{"version":3,"sources":["webpack://initLayoutContainer/webpack/universalModuleDefinition","webpack://initLayoutContainer/webpack/bootstrap","webpack://initLayoutContainer/./src/getLayout.js","webpack://initLayoutContainer/./src/index.js","webpack://initLayoutContainer/./src/layout.js"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","getBestDimensions","minRatio","maxRatio","Width","Height","count","maxWidth","maxHeight","maxArea","targetCols","targetRows","targetHeight","targetWidth","tWidth","tHeight","tRatio","cols","rows","Math","ceil","floor","area","min","undefined","ratio","getLayout","opts","elements","fixedRatio","containerWidth","containerHeight","offsetLeft","offsetTop","alignItems","Infinity","scaleLastRow","ratios","map","element","height","width","length","dimensions","x","y","row","boxes","push","totalRowHeight","remainingShortRows","remainingHeightDiff","extraHeight","rowMarginLeft","j","left","top","bigPercentage","minBigPercentage","bigFixedRatio","bigMaxRatio","bigMinRatio","bigFirst","bigAlignItems","smallAlignItems","smallMaxWidth","smallMaxHeight","bigMaxWidth","bigMaxHeight","bigScaleLastRow","availableRatio","bigOffsetTop","bigOffsetLeft","bigIndices","bigOnes","filter","idx","big","smallOnes","bigBoxes","smallBoxes","areas","bigWidth","bigHeight","showBigFirst","bigDimensions","max","smallDimensions","small","bigBoxesIdx","smallBoxesIdx","forEach","indexOf","require","layout","container","win","window","document","querySelector","HTMLElement","css","el","propertyName","style","NaN","keys","currentValue","getComputedStyle","getPropertyValue","getCSSNumber","elem","prop","cssStr","parseInt","animate","bigClass","ignoreClass","heightStr","id","getAttribute","random","toFixed","setAttribute","offsetHeight","widthStr","offsetWidth","getWidth","children","Array","querySelectorAll","res","child","videoHeight","videoWidth","video","getChildDims","classList","contains","box","actualWidth","actualHeight","w","h","onLayout","targetPosition","fixAspectRatio","sub","oldWidth","$","stop","duration","easing","complete","add","positionElement"],"mappings":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AU,WAC9EC,EAAiB,CACrB1F,KAASX,EAAT,KACAY,IAAQX,EAAR,KACAJ,MAAUqG,EAAV,KACAtG,OAAWuG,EAAX,MAGIG,EAAiB,WACrB,IAAMC,EAAMpC,EAAKZ,cAAc,YAC/B,GAAIgD,EAAK,CAIP,IAAMC,EAAWD,EAAI3C,MAAM/D,MAC3B0G,EAAI3C,MAAM/D,MAAWqG,EAArB,KAEAK,EAAI3C,MAAM/D,MAAQ2G,GAAY,KAI9BjC,GAAwB,oBAANkC,GACpBA,EAAEtC,GAAMuC,OACRD,EAAEtC,GAAMI,QAAQ8B,EAAgB9B,EAAQoC,UAAY,IAAKpC,EAAQqC,QAAU,SACzE,WACEN,IACI/B,EAAQsC,UAAUtC,EAAQsC,SAASrL,KAAK,GACxC4K,GACFA,EAASjC,EAAM,CACbxD,KAAMX,EACNY,IAAKX,EACLJ,MAAOqG,EACPtG,OAAQuG,SAKhB1C,EAAIU,EAAMkC,GACLlC,EAAK0B,UAAUC,SAAS,cAC3B3B,EAAK0B,UAAUiB,IAAI,aAEjBV,GACFA,EAASjC,EAAM,CACbxD,KAAMX,EACNY,IAAKX,EACLJ,MAAOqG,EACPtG,OAAQuG,KAIdG,IAqGAS,CAAgB5C,EAAM4B,EAAIpF,KAAMoF,EAAInF,IAAKoF,EAAaC,EACpD1B,EAASxF,EAAKqH","file":"opentok-layout.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"initLayoutContainer\"] = factory();\n\telse\n\t\troot[\"initLayoutContainer\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","const getBestDimensions = (minRatio, maxRatio, Width, Height, count, maxWidth, maxHeight) => {\n let maxArea;\n let targetCols;\n let targetRows;\n let targetHeight;\n let targetWidth;\n let tWidth;\n let tHeight;\n let tRatio;\n\n // Iterate through every possible combination of rows and columns\n // and see which one has the least amount of whitespace\n for (let i = 1; i <= count; i += 1) {\n const cols = i;\n const rows = Math.ceil(count / cols);\n\n // Try taking up the whole height and width\n tHeight = Math.floor(Height / rows);\n tWidth = Math.floor(Width / cols);\n\n tRatio = tHeight / tWidth;\n if (tRatio > maxRatio) {\n // We went over decrease the height\n tRatio = maxRatio;\n tHeight = tWidth * tRatio;\n } else if (tRatio < minRatio) {\n // We went under decrease the width\n tRatio = minRatio;\n tWidth = tHeight / tRatio;\n }\n\n tWidth = Math.min(maxWidth, tWidth);\n tHeight = Math.min(maxHeight, tHeight);\n\n const area = (tWidth * tHeight) * count;\n\n // If this width and height takes up the most space then we're going with that\n if (maxArea === undefined || (area >= maxArea)) {\n if (!(area === maxArea && (count % (cols * rows)) > (count % (targetRows * targetCols)))) {\n // Favour even numbers of participants in each row, eg. 2 on each row\n // instead of 3 in one row and then 1 on the next\n maxArea = area;\n targetHeight = tHeight;\n targetWidth = tWidth;\n targetCols = cols;\n targetRows = rows;\n }\n }\n }\n return {\n maxArea,\n targetCols,\n targetRows,\n targetHeight,\n targetWidth,\n ratio: targetHeight / targetWidth,\n };\n};\n\nconst getLayout = (opts, elements) => {\n const {\n maxRatio,\n minRatio,\n fixedRatio,\n containerWidth,\n containerHeight,\n offsetLeft = 0,\n offsetTop = 0,\n alignItems = 'center',\n maxWidth = Infinity,\n maxHeight = Infinity,\n scaleLastRow = true,\n } = opts;\n const ratios = elements.map(element => element.height / element.width);\n const count = ratios.length;\n\n\n let dimensions;\n\n if (!fixedRatio) {\n dimensions = getBestDimensions(minRatio, maxRatio, containerWidth, containerHeight, count,\n maxWidth, maxHeight);\n } else {\n // Use the ratio of the first video element we find to approximate\n const ratio = ratios.length > 0 ? ratios[0] : null;\n dimensions = getBestDimensions(ratio, ratio, containerWidth, containerHeight, count,\n maxWidth, maxHeight);\n }\n\n // Loop through each stream in the container and place it inside\n let x = 0;\n let y = 0;\n const rows = [];\n let row;\n const boxes = [];\n // Iterate through the children and create an array with a new item for each row\n // and calculate the width of each row so that we know if we go over the size and need\n // to adjust\n for (let i = 0; i < ratios.length; i += 1) {\n if (i % dimensions.targetCols === 0) {\n // This is a new row\n row = {\n ratios: [],\n width: 0,\n height: 0,\n };\n rows.push(row);\n }\n const ratio = ratios[i];\n row.ratios.push(ratio);\n let targetWidth = dimensions.targetWidth;\n const targetHeight = dimensions.targetHeight;\n // If we're using a fixedRatio then we need to set the correct ratio for this element\n if (fixedRatio) {\n targetWidth = targetHeight / ratio;\n }\n row.width += targetWidth;\n row.height = targetHeight;\n }\n // Calculate total row height adjusting if we go too wide\n let totalRowHeight = 0;\n let remainingShortRows = 0;\n for (let i = 0; i < rows.length; i += 1) {\n row = rows[i];\n if (row.width > containerWidth) {\n // Went over on the width, need to adjust the height proportionally\n row.height = Math.floor(row.height * (containerWidth / row.width));\n row.width = containerWidth;\n } else if (row.width < containerWidth && row.height < maxHeight) {\n remainingShortRows += 1;\n }\n totalRowHeight += row.height;\n }\n if (scaleLastRow && totalRowHeight < containerHeight && remainingShortRows > 0) {\n // We can grow some of the rows, we're not taking up the whole height\n let remainingHeightDiff = containerHeight - totalRowHeight;\n totalRowHeight = 0;\n for (let i = 0; i < rows.length; i += 1) {\n row = rows[i];\n if (row.width < containerWidth) {\n // Evenly distribute the extra height between the short rows\n let extraHeight = remainingHeightDiff / remainingShortRows;\n if ((extraHeight / row.height) > ((containerWidth - row.width) / row.width)) {\n // We can't go that big or we'll go too wide\n extraHeight = Math.floor(((containerWidth - row.width) / row.width) * row.height);\n }\n row.width += Math.floor((extraHeight / row.height) * row.width);\n row.height += extraHeight;\n remainingHeightDiff -= extraHeight;\n remainingShortRows -= 1;\n }\n totalRowHeight += row.height;\n }\n }\n switch (alignItems) {\n case 'start':\n y = 0;\n break;\n case 'end':\n y = containerHeight - totalRowHeight;\n break;\n case 'center':\n default:\n y = ((containerHeight - (totalRowHeight)) / 2);\n break;\n }\n // Iterate through each row and place each child\n for (let i = 0; i < rows.length; i += 1) {\n row = rows[i];\n let rowMarginLeft;\n switch (alignItems) {\n case 'start':\n rowMarginLeft = 0;\n break;\n case 'end':\n rowMarginLeft = containerWidth - row.width;\n break;\n case 'center':\n default:\n rowMarginLeft = ((containerWidth - row.width) / 2);\n break;\n }\n x = rowMarginLeft;\n let targetHeight;\n for (let j = 0; j < row.ratios.length; j += 1) {\n const ratio = row.ratios[j];\n\n let targetWidth = dimensions.targetWidth;\n targetHeight = row.height;\n // If we're using a fixedRatio then we need to set the correct ratio for this element\n if (fixedRatio) {\n targetWidth = Math.floor(targetHeight / ratio);\n } else if ((targetHeight / targetWidth)\n !== (dimensions.targetHeight / dimensions.targetWidth)) {\n // We grew this row, we need to adjust the width to account for the increase in height\n targetWidth = Math.floor((dimensions.targetWidth / dimensions.targetHeight) * targetHeight);\n }\n\n boxes.push({\n left: x + offsetLeft,\n top: y + offsetTop,\n width: targetWidth,\n height: targetHeight,\n });\n x += targetWidth;\n }\n y += targetHeight;\n }\n return boxes;\n};\n\nconst getVideoRatio = element => element.height / element.width;\n\nmodule.exports = (opts, elements) => {\n const {\n maxRatio = 3 / 2,\n minRatio = 9 / 16,\n fixedRatio = false,\n bigPercentage = 0.8,\n minBigPercentage = 0,\n bigFixedRatio = false,\n bigMaxRatio = 3 / 2,\n bigMinRatio = 9 / 16,\n bigFirst = true,\n containerWidth = 640,\n containerHeight = 480,\n alignItems = 'center',\n bigAlignItems = 'center',\n smallAlignItems = 'center',\n maxWidth = Infinity,\n maxHeight = Infinity,\n smallMaxWidth = Infinity,\n smallMaxHeight = Infinity,\n bigMaxWidth = Infinity,\n bigMaxHeight = Infinity,\n scaleLastRow = true,\n bigScaleLastRow = true,\n } = opts;\n\n const availableRatio = containerHeight / containerWidth;\n let offsetLeft = 0;\n let offsetTop = 0;\n let bigOffsetTop = 0;\n let bigOffsetLeft = 0;\n const bigIndices = [];\n const bigOnes = elements.filter((element, idx) => {\n if (element.big) {\n bigIndices.push(idx);\n return true;\n }\n return false;\n });\n const smallOnes = elements.filter(element => !element.big);\n let bigBoxes = [];\n let smallBoxes = [];\n const areas = {};\n if (bigOnes.length > 0 && smallOnes.length > 0) {\n let bigWidth;\n let bigHeight;\n let showBigFirst = bigFirst === true;\n\n if (availableRatio > getVideoRatio(bigOnes[0])) {\n // We are tall, going to take up the whole width and arrange small\n // guys at the bottom\n bigWidth = containerWidth;\n bigHeight = Math.floor(containerHeight * bigPercentage);\n if (minBigPercentage > 0) {\n // Find the best size for the big area\n let bigDimensions;\n if (!bigFixedRatio) {\n bigDimensions = getBestDimensions(bigMinRatio, bigMaxRatio, bigWidth,\n bigHeight, bigOnes.length, bigMaxWidth, bigMaxHeight);\n } else {\n // Use the ratio of the first video element we find to approximate\n const ratio = bigOnes[0].height / bigOnes[0].width;\n bigDimensions = getBestDimensions(ratio, ratio, bigWidth, bigHeight,\n bigOnes.length, bigMaxWidth, bigMaxHeight);\n }\n bigHeight = Math.max(containerHeight * minBigPercentage,\n Math.min(bigHeight, bigDimensions.targetHeight * bigDimensions.targetRows));\n // Don't awkwardly scale the small area bigger than we need to and end up with floating\n // videos in the middle\n const smallDimensions = getBestDimensions(minRatio, maxRatio, containerWidth,\n containerHeight - bigHeight, smallOnes.length, smallMaxWidth, smallMaxHeight);\n bigHeight = Math.max(bigHeight, containerHeight\n - (smallDimensions.targetRows * smallDimensions.targetHeight));\n }\n offsetTop = bigHeight;\n bigOffsetTop = containerHeight - offsetTop;\n if (bigFirst === 'column') {\n showBigFirst = false;\n } else if (bigFirst === 'row') {\n showBigFirst = true;\n }\n } else {\n // We are wide, going to take up the whole height and arrange the small\n // guys on the right\n bigHeight = containerHeight;\n bigWidth = Math.floor(containerWidth * bigPercentage);\n if (minBigPercentage > 0) {\n // Find the best size for the big area\n let bigDimensions;\n if (!bigFixedRatio) {\n bigDimensions = getBestDimensions(bigMinRatio, bigMaxRatio, bigWidth,\n bigHeight, bigOnes.length, bigMaxWidth, bigMaxHeight);\n } else {\n // Use the ratio of the first video element we find to approximate\n const ratio = bigOnes[0].height / bigOnes[0].width;\n bigDimensions = getBestDimensions(ratio, ratio, bigWidth, bigHeight,\n bigOnes.length, bigMaxWidth, bigMaxHeight);\n }\n bigWidth = Math.max(containerWidth * minBigPercentage,\n Math.min(bigWidth, bigDimensions.targetWidth * bigDimensions.targetCols));\n // Don't awkwardly scale the small area bigger than we need to and end up with floating\n // videos in the middle\n const smallDimensions = getBestDimensions(minRatio, maxRatio, containerWidth - bigWidth,\n containerHeight, smallOnes.length, smallMaxWidth, smallMaxHeight);\n bigWidth = Math.max(bigWidth, containerWidth\n - (smallDimensions.targetCols * smallDimensions.targetWidth));\n }\n offsetLeft = bigWidth;\n bigOffsetLeft = containerWidth - offsetLeft;\n if (bigFirst === 'column') {\n showBigFirst = true;\n } else if (bigFirst === 'row') {\n showBigFirst = false;\n }\n }\n if (showBigFirst) {\n areas.big = {\n top: 0,\n left: 0,\n width: bigWidth,\n height: bigHeight,\n };\n areas.small = {\n top: offsetTop,\n left: offsetLeft,\n width: containerWidth - offsetLeft,\n height: containerHeight - offsetTop,\n };\n } else {\n areas.big = {\n left: bigOffsetLeft,\n top: bigOffsetTop,\n width: bigWidth,\n height: bigHeight,\n };\n areas.small = {\n top: 0,\n left: 0,\n width: containerWidth - offsetLeft,\n height: containerHeight - offsetTop,\n };\n }\n } else if (bigOnes.length > 0 && smallOnes.length === 0) {\n // We only have one bigOne just center it\n areas.big = {\n top: 0,\n left: 0,\n width: containerWidth,\n height: containerHeight,\n };\n } else {\n areas.small = {\n top: offsetTop,\n left: offsetLeft,\n width: containerWidth - offsetLeft,\n height: containerHeight - offsetTop,\n };\n }\n\n if (areas.big) {\n bigBoxes = getLayout({\n containerWidth: areas.big.width,\n containerHeight: areas.big.height,\n offsetLeft: areas.big.left,\n offsetTop: areas.big.top,\n fixedRatio: bigFixedRatio,\n minRatio: bigMinRatio,\n maxRatio: bigMaxRatio,\n alignItems: bigAlignItems,\n maxWidth: bigMaxWidth,\n maxHeight: bigMaxHeight,\n scaleLastRow: bigScaleLastRow,\n }, bigOnes);\n }\n if (areas.small) {\n smallBoxes = getLayout({\n containerWidth: areas.small.width,\n containerHeight: areas.small.height,\n offsetLeft: areas.small.left,\n offsetTop: areas.small.top,\n fixedRatio,\n minRatio,\n maxRatio,\n alignItems: areas.big ? smallAlignItems : alignItems,\n maxWidth: areas.big ? smallMaxWidth : maxWidth,\n maxHeight: areas.big ? smallMaxHeight : maxHeight,\n scaleLastRow,\n }, smallOnes);\n }\n\n const boxes = [];\n let bigBoxesIdx = 0;\n let smallBoxesIdx = 0;\n // Rebuild the array in the right order based on where the bigIndices should be\n elements.forEach((element, idx) => {\n if (bigIndices.indexOf(idx) > -1) {\n boxes[idx] = bigBoxes[bigBoxesIdx];\n bigBoxesIdx += 1;\n } else {\n boxes[idx] = smallBoxes[smallBoxesIdx];\n smallBoxesIdx += 1;\n }\n });\n return { boxes, areas };\n};\n","/*!\n * opentok-layout-js (http://github.com/aullman/opentok-layout-js)\n *\n * Automatic layout of video elements (publisher and subscriber) minimising\n * white-space for the OpenTok on WebRTC API.\n *\n * @Author: Adam Ullman (http://github.com/aullman)\n * @Copyright (c) 2014 Adam Ullman\n * @License: Released under the MIT license (http://opensource.org/licenses/MIT)\n * */\n\n// in CommonJS context, this should be a `require()`d dependency.\n// in browser globals context, ...? (when using bower, there are dependencies that it has handled\n// for you, so these might be safe to assume)\n\nconst getLayout = require('./getLayout');\nconst layout = require('./layout');\n\nmodule.exports = function initLayoutContainer(container, opts) {\n const win = (opts && opts.window) || (typeof window === 'undefined' ? undefined : window);\n container = typeof container === 'string' ? win.document.querySelector(container) : container;\n if (!(typeof (win && win.HTMLElement) === 'undefined' || container instanceof win.HTMLElement) && !opts) {\n // container is actually the options\n opts = container;\n } else if (!opts) {\n opts = {};\n }\n\n return {\n layout: layout.bind(this, container, opts),\n getLayout: getLayout.bind(this, opts),\n };\n};\n","const getLayout = require('./getLayout');\n\nmodule.exports = (container, opts) => {\n function css(el, propertyName, value) {\n if (value) {\n // We are setting one css property\n el.style[propertyName] = value;\n return NaN;\n }\n if (typeof propertyName === 'object') {\n // We are setting several CSS properties at once\n Object.keys(propertyName).forEach((key) => {\n css(el, key, propertyName[key]);\n });\n return NaN;\n }\n // We are getting the css property\n const computedStyle = ((opts && opts.window) || window).getComputedStyle(el);\n let currentValue = computedStyle.getPropertyValue(propertyName);\n\n if (currentValue === '') {\n currentValue = el.style[propertyName];\n }\n\n return currentValue;\n }\n\n const filterDisplayNone = element => css(element, 'display') !== 'none';\n\n function height(el) {\n if (el.offsetHeight > 0) {\n return `${el.offsetHeight}px`;\n }\n return css(el, 'height');\n }\n\n function width(el) {\n if (el.offsetWidth > 0) {\n return `${el.offsetWidth}px`;\n }\n return css(el, 'width');\n }\n\n const positionElement = function positionElement(elem, x, y, w, h, animate, onLayout) {\n const targetPosition = {\n left: `${x}px`,\n top: `${y}px`,\n width: `${w}px`,\n height: `${h}px`,\n };\n\n const fixAspectRatio = function fixAspectRatio() {\n const sub = elem.querySelector('.OT_root');\n if (sub) {\n // If this is the parent of a subscriber or publisher then we need\n // to force the mutation observer on the publisher or subscriber to\n // trigger to get it to fix it's layout\n const oldWidth = sub.style.width;\n sub.style.width = `${w}px`;\n // sub.style.height = height + 'px';\n sub.style.width = oldWidth || '';\n }\n };\n\n if (animate && typeof $ !== 'undefined') {\n $(elem).stop();\n $(elem).animate(targetPosition, animate.duration || 200, animate.easing || 'swing',\n () => {\n fixAspectRatio();\n if (animate.complete) animate.complete.call(this);\n if (onLayout) {\n onLayout(elem, {\n left: x,\n top: y,\n width: w,\n height: h,\n });\n }\n });\n } else {\n css(elem, targetPosition);\n if (!elem.classList.contains('ot-layout')) {\n elem.classList.add('ot-layout');\n }\n if (onLayout) {\n onLayout(elem, {\n left: x,\n top: y,\n width: w,\n height: h,\n });\n }\n }\n fixAspectRatio();\n };\n\n const getChildDims = function getChildDims(child) {\n if (child) {\n if (child.videoHeight && child.videoWidth) {\n return {\n height: child.videoHeight,\n width: child.videoWidth,\n };\n }\n const video = child.querySelector('video');\n if (video && video.videoHeight && video.videoWidth) {\n return {\n height: video.videoHeight,\n width: video.videoWidth,\n };\n }\n }\n return {\n height: 480,\n width: 640,\n };\n };\n\n const getCSSNumber = function getCSSNumber(elem, prop) {\n const cssStr = css(elem, prop);\n return cssStr ? parseInt(cssStr, 10) : 0;\n };\n\n // Really cheap UUID function\n const cheapUUID = function cheapUUID() {\n return (Math.random() * 100000000).toFixed(0);\n };\n\n const getHeight = function getHeight(elem) {\n const heightStr = height(elem);\n return heightStr ? parseInt(heightStr, 10) : 0;\n };\n\n const getWidth = function getWidth(elem) {\n const widthStr = width(elem);\n return widthStr ? parseInt(widthStr, 10) : 0;\n };\n\n const {\n animate = false,\n bigClass = 'OT_big',\n ignoreClass = 'OT_ignore',\n } = opts;\n\n if (css(container, 'display') === 'none') {\n return;\n }\n let id = container.getAttribute('id');\n if (!id) {\n id = `OT_${cheapUUID()}`;\n container.setAttribute('id', id);\n }\n\n opts.containerHeight = getHeight(container)\n - getCSSNumber(container, 'border-top')\n - getCSSNumber(container, 'border-bottom');\n opts.containerWidth = getWidth(container)\n - getCSSNumber(container, 'border-left')\n - getCSSNumber(container, 'border-right');\n\n const children = Array.prototype.filter.call(\n container.querySelectorAll(`#${id}>*:not(.${ignoreClass})`),\n filterDisplayNone\n );\n const elements = children.map((element) => {\n const res = getChildDims(element);\n res.big = element.classList.contains(bigClass);\n return res;\n });\n\n const layout = getLayout(opts, elements);\n layout.boxes.forEach((box, idx) => {\n const elem = children[idx];\n css(elem, 'position', 'absolute');\n const actualWidth = box.width\n - getCSSNumber(elem, 'margin-left')\n - getCSSNumber(elem, 'margin-right')\n - (css(elem, 'box-sizing') !== 'border-box'\n ? (getCSSNumber(elem, 'padding-left')\n + getCSSNumber(elem, 'padding-right')\n + getCSSNumber(elem, 'border-left')\n + getCSSNumber(elem, 'border-right'))\n : 0);\n\n const actualHeight = box.height\n - getCSSNumber(elem, 'margin-top')\n - getCSSNumber(elem, 'margin-bottom')\n - (css(elem, 'box-sizing') !== 'border-box'\n ? (getCSSNumber(elem, 'padding-top')\n + getCSSNumber(elem, 'padding-bottom')\n + getCSSNumber(elem, 'border-top')\n + getCSSNumber(elem, 'border-bottom'))\n : 0);\n\n positionElement(elem, box.left, box.top, actualWidth, actualHeight,\n animate, opts.onLayout);\n });\n};\n"],"sourceRoot":""}