{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/istext.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/indexof.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/isnode.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/position.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/global.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/insertat.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/iswindow.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/rect.js","webpack:///./node_modules/@ckeditor/ckeditor5-utils/src/dom/isrange.js"],"names":["isText","obj","Object","prototype","toString","call","indexOf","node","index","previousSibling","__webpack_require__","d","__webpack_exports__","isNode","defaultView","Document","ownerDocument","Node","getOptimalPosition","_ref","element","target","positions","limiter","fitInViewport","isFunction","bestPositionRect","bestPositionName","positionedElementAncestor","getPositionedAncestor","elementRect","Rect","targetRect","limiterRect","getVisible","viewportRect","global","window","bestPosition","getBestPositionNameAndRect","_ref2","getPositionNameAndRect","_ref3","D_Projects_UA_repo_Source_Client_UA_User_Web_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__","_getPositionNameAndRe","_getPositionNameAndRe2","absoluteRectCoordinates","getAbsoluteRectCoordinates","shiftRectCoordinatesDueToPositionedAncestor","left","top","name","position","positionData","clone","moveTo","options","elementRectArea","getArea","processedPositions","processPositionsToAreas","processedPositionsInViewport","filter","_ref4","viewportIntersectArea","bestPositionData","getBestOfProcessedPositions","_ref5","_step","_iterator","_createForOfIteratorHelper","s","n","done","value","_positionData","positionName","positionRect","limiterIntersectArea","limiterViewportIntersectRect","getIntersection","getIntersectionArea","processedPosition","push","err","e","f","_step2","maxFitFactor","_iterator2","_step2$value","fitFactor","Math","pow","_ref6","ancestorPosition","ancestorBorderWidths","getBorderWidths","scrollLeft","scrollTop","_ref7","_global$window","scrollX","scrollY","document","insertAt","parentElement","nodeToInsert","insertBefore","childNodes","isWindow","stringifiedObject","apply","rectProperties","source","D_Projects_UA_repo_Source_Client_UA_User_Web_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_7__","this","isSourceRange","isRange","defineProperty","_source","writable","enumerable","isElement","rangeRects","getDomRangeRects","copyRectProperties","getBoundingRect","getBoundingClientRect","innerWidth","innerHeight","right","bottom","width","height","x","y","anotherRect","rect","max","min","visibleRect","isBody","parent","parentNode","commonAncestorContainer","parentRect","intersectionRect","prop","intersectRect","isEqual","scrollBarWidth","scrollBarHeight","direction","documentElement","clientWidth","clientHeight","getComputedStyle","borderWidths","offsetWidth","offsetHeight","range","rects","clientRects","Array","from","getClientRects","length","startContainer","_step3","boundingRectData","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","rectangleCount","_iterator3","_step4","_iterator4","p","elementOrRange","body"],"mappings":";;;;;AAee,SAASA,EAAQC,GAC/B,MAAgD,iBAAzCC,OAAOC,UAAUC,SAASC,KAAMJ;;;;;ACDzB,SAASK,EAASC,GAChC,IAAIC,EAAQ,EAEZ,MAAQD,EAAKE,gBACZF,EAAOA,EAAKE,gBACZD,IAGD,OAAOA,EAvBRE,EAAAC,EAAAC,EAAA,sBAAAN;;;;;ACee,SAASO,EAAQZ,GAC/B,GAAKA,EAAM,CACV,GAAKA,EAAIa,YACR,OAAOb,aAAeA,EAAIa,YAAYC,SAChC,GAAKd,EAAIe,eAAiBf,EAAIe,cAAcF,YAClD,OAAOb,aAAeA,EAAIe,cAAcF,YAAYG,KAItD,OAAO,EAxBRP,EAAAC,EAAAC,EAAA,sBAAAC;;;;GC+EO,SAASK,EAATC,GAAsF,IAAvDC,EAAuDD,EAAvDC,QAASC,EAA8CF,EAA9CE,OAAQC,EAAsCH,EAAtCG,UAAWC,EAA2BJ,EAA3BI,QAASC,EAAkBL,EAAlBK,cAGrEC,eAAYJ,KAChBA,EAASA,KAKLI,eAAYF,KA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E,kBACdzC,OAAQuC,OAAOE,mBAEZC,EAAiB,EAPUC,EAAAzG,EASX4F,GATW,IAS/B,IAAAa,EAAAxG,MAAAkG,EAAAM,EAAAvG,KAAAC,MAA4B,KAAhBiE,EAAgB+B,EAAA/F,MAC3BoG,IAEAJ,EAAiBzH,KAAO2C,KAAKgD,IAAK8B,EAAiBzH,KAAMyF,EAAKzF,MAC9DyH,EAAiBxH,IAAM0C,KAAKgD,IAAK8B,EAAiBxH,IAAKwF,EAAKxF,KAC5DwH,EAAiBvC,MAAQvC,KAAK+C,IAAK+B,EAAiBvC,MAAOO,EAAKP,OAChEuC,EAAiBtC,OAASxC,KAAK+C,IAAK+B,EAAiBtC,OAAQM,EAAKN,SAfpC,MAAAhD,GAAA2F,EAAA1F,EAAAD,GAAA,QAAA2F,EAAAzF,IAkB/B,OAAuB,GAAlBwF,EACG,MAGRJ,EAAiBrC,MAAQqC,EAAiBvC,MAAQuC,EAAiBzH,KACnEyH,EAAiBpC,OAASoC,EAAiBtC,OAASsC,EAAiBxH,IAE9D,IAAInB,EAAM2I,aASnB,SAAS5C,EAAoBY,EAAMxB,GAAS,IAAA8D,EAAAC,EAAA3G,EAC1B2C,GAD0B,IAC3C,IAAAgE,EAAA1G,MAAAyG,EAAAC,EAAAzG,KAAAC,MAAkC,KAAtByG,EAAsBF,EAAAtG,MACjCgE,EAAMwC,GAAMhE,EAAQgE,IAFsB,MAAA9F,GAAA6F,EAAA5F,EAAAD,GAAA,QAAA6F,EAAA3F,KAW5C,SAASwD,EAAQqC,GAChB,QAAMxD,eAAWwD,IAIVA,IAAmBA,EAAenK,cAAcoK;;;;;AC1azC,SAAS9D,EAASrH,GAChC,MAAiD,kBAA1CC,OAAOC,UAAUC,SAAS4G,MAAO/G","file":"js/chunk-688e3c58.dbe4ff56.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module utils/dom/istext\n */\n\n/**\n * Checks if the object is a native DOM Text node.\n *\n * @param {*} obj\n * @returns {Boolean}\n */\nexport default function isText( obj ) {\n\treturn Object.prototype.toString.call( obj ) == '[object Text]';\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module utils/dom/indexof\n */\n\n/**\n * Returns index of the node in the parent element.\n *\n * @param {Node} node Node which index is tested.\n * @returns {Number} Index of the node in the parent element. Returns 0 if node has no parent.\n */\nexport default function indexOf( node ) {\n\tlet index = 0;\n\n\twhile ( node.previousSibling ) {\n\t\tnode = node.previousSibling;\n\t\tindex++;\n\t}\n\n\treturn index;\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module utils/dom/isnode\n */\n\n/**\n * Checks if the object is a native DOM Node.\n *\n * @param {*} obj\n * @returns {Boolean}\n */\nexport default function isNode( obj ) {\n\tif ( obj ) {\n\t\tif ( obj.defaultView ) {\n\t\t\treturn obj instanceof obj.defaultView.Document;\n\t\t} else if ( obj.ownerDocument && obj.ownerDocument.defaultView ) {\n\t\t\treturn obj instanceof obj.ownerDocument.defaultView.Node;\n\t\t}\n\t}\n\n\treturn false;\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module utils/dom/position\n */\n\nimport global from './global';\nimport Rect from './rect';\nimport getPositionedAncestor from './getpositionedancestor';\nimport getBorderWidths from './getborderwidths';\nimport { isFunction } from 'lodash-es';\n\n/**\n * Calculates the `position: absolute` coordinates of a given element so it can be positioned with respect to the\n * target in the visually most efficient way, taking various restrictions like viewport or limiter geometry\n * into consideration.\n *\n *\t\t// The element which is to be positioned.\n *\t\tconst element = document.body.querySelector( '#toolbar' );\n *\n *\t\t// A target to which the element is positioned relatively.\n *\t\tconst target = document.body.querySelector( '#container' );\n *\n *\t\t// Finding the optimal coordinates for the positioning.\n *\t\tconst { left, top, name } = getOptimalPosition( {\n *\t\t\telement: element,\n *\t\t\ttarget: target,\n *\n * \t\t\t// The algorithm will chose among these positions to meet the requirements such\n * \t\t\t// as \"limiter\" element or \"fitInViewport\", set below. The positions are considered\n * \t\t\t// in the order of the array.\n *\t\t\tpositions: [\n *\t\t\t\t//\n *\t\t\t \t//\t[ Target ]\n *\t\t\t\t//\t+-----------------+\n *\t\t\t\t//\t| Element |\n *\t\t\t\t//\t+-----------------+\n *\t\t\t\t//\n *\t\t\t\ttargetRect => ( {\n *\t\t\t\t\ttop: targetRect.bottom,\n *\t\t\t\t\tleft: targetRect.left,\n *\t\t\t\t\tname: 'mySouthEastPosition'\n *\t\t\t\t} ),\n *\n *\t\t\t\t//\n *\t\t\t\t//\t+-----------------+\n *\t\t\t\t//\t| Element |\n *\t\t\t\t//\t+-----------------+\n *\t\t\t\t//\t[ Target ]\n *\t\t\t\t//\n *\t\t\t\t( targetRect, elementRect ) => ( {\n *\t\t\t\t\ttop: targetRect.top - elementRect.height,\n *\t\t\t\t\tleft: targetRect.left,\n *\t\t\t\t\tname: 'myNorthEastPosition'\n *\t\t\t\t} )\n *\t\t\t],\n *\n *\t\t\t// Find a position such guarantees the element remains within visible boundaries of
.\n *\t\t\tlimiter: document.body,\n *\n *\t\t\t// Find a position such guarantees the element remains within visible boundaries of the browser viewport.\n *\t\t\tfitInViewport: true\n *\t\t} );\n *\n *\t\t// The best position which fits into document.body and the viewport. May be useful\n *\t\t// to set proper class on the `element`.\n *\t\tconsole.log( name ); // -> \"myNorthEastPosition\"\n *\n *\t\t// Using the absolute coordinates which has been found to position the element\n *\t\t// as in the diagram depicting the \"myNorthEastPosition\" position.\n *\t\telement.style.top = top;\n *\t\telement.style.left = left;\n *\n * @param {module:utils/dom/position~Options} options Positioning options object.\n * @returns {module:utils/dom/position~Position}\n */\nexport function getOptimalPosition( { element, target, positions, limiter, fitInViewport } ) {\n\t// If the {@link module:utils/dom/position~Options#target} is a function, use what it returns.\n\t// https://github.com/ckeditor/ckeditor5-utils/issues/157\n\tif ( isFunction( target ) ) {\n\t\ttarget = target();\n\t}\n\n\t// If the {@link module:utils/dom/position~Options#limiter} is a function, use what it returns.\n\t// https://github.com/ckeditor/ckeditor5-ui/issues/260\n\tif ( isFunction( limiter ) ) {\n\t\tlimiter = limiter();\n\t}\n\n\tconst positionedElementAncestor = getPositionedAncestor( element );\n\tconst elementRect = new Rect( element );\n\tconst targetRect = new Rect( target );\n\n\tlet bestPositionRect;\n\tlet bestPositionName;\n\n\t// If there are no limits, just grab the very first position and be done with that drama.\n\tif ( !limiter && !fitInViewport ) {\n\t\t[ bestPositionName, bestPositionRect ] = getPositionNameAndRect( positions[ 0 ], targetRect, elementRect );\n\t} else {\n\t\tconst limiterRect = limiter && new Rect( limiter ).getVisible();\n\t\tconst viewportRect = fitInViewport && new Rect( global.window );\n\t\tconst bestPosition = getBestPositionNameAndRect( positions, { targetRect, elementRect, limiterRect, viewportRect } );\n\n\t\t// If there's no best position found, i.e. when all intersections have no area because\n\t\t// rects have no width or height, then just use the first available position.\n\t\t[ bestPositionName, bestPositionRect ] = bestPosition || getPositionNameAndRect( positions[ 0 ], targetRect, elementRect );\n\t}\n\n\tlet absoluteRectCoordinates = getAbsoluteRectCoordinates( bestPositionRect );\n\n\tif ( positionedElementAncestor ) {\n\t\tabsoluteRectCoordinates = shiftRectCoordinatesDueToPositionedAncestor( absoluteRectCoordinates, positionedElementAncestor );\n\t}\n\n\treturn {\n\t\tleft: absoluteRectCoordinates.left,\n\t\ttop: absoluteRectCoordinates.top,\n\t\tname: bestPositionName\n\t};\n}\n\n// For given position function, returns a corresponding `Rect` instance.\n//\n// @private\n// @param {Function} position A function returning {@link module:utils/dom/position~Position}.\n// @param {utils/dom/rect~Rect} targetRect A rect of the target.\n// @param {utils/dom/rect~Rect} elementRect A rect of positioned element.\n// @returns {Array|null} An array containing position name and its Rect (or null if position should be ignored).\nfunction getPositionNameAndRect( position, targetRect, elementRect ) {\n\tconst positionData = position( targetRect, elementRect );\n\n\tif ( !positionData ) {\n\t\treturn null;\n\t}\n\n\tconst { left, top, name } = positionData;\n\n\treturn [ name, elementRect.clone().moveTo( left, top ) ];\n}\n\n// For a given array of positioning functions, returns such that provides the best\n// fit of the `elementRect` into the `limiterRect` and `viewportRect`.\n//\n// @private\n//\n// @param {Object} options\n// @param {module:utils/dom/position~Options#positions} positions Functions returning {@link module:utils/dom/position~Position}\n// to be checked, in the order of preference.\n// @param {Object} options\n// @param {utils/dom/rect~Rect} options.targetRect A rect of the {@link module:utils/dom/position~Options#target}.\n// @param {utils/dom/rect~Rect} options.elementRect A rect of positioned {@link module:utils/dom/position~Options#element}.\n// @param {utils/dom/rect~Rect} options.limiterRect A rect of the {@link module:utils/dom/position~Options#limiter}.\n// @param {utils/dom/rect~Rect} options.viewportRect A rect of the viewport.\n//\n// @returns {Array} An array containing the name of the position and it's rect.\nfunction getBestPositionNameAndRect( positions, options ) {\n\tconst { elementRect, viewportRect } = options;\n\n\t// This is when element is fully visible.\n\tconst elementRectArea = elementRect.getArea();\n\n\t// Let's calculate intersection areas for positions. It will end early if best match is found.\n\tconst processedPositions = processPositionsToAreas( positions, options );\n\n\t// First let's check all positions that fully fit in the viewport.\n\tif ( viewportRect ) {\n\t\tconst processedPositionsInViewport = processedPositions.filter( ( { viewportIntersectArea } ) => {\n\t\t\treturn viewportIntersectArea === elementRectArea;\n\t\t} );\n\n\t\t// Try to find best position from those which fit completely in viewport.\n\t\tconst bestPositionData = getBestOfProcessedPositions( processedPositionsInViewport, elementRectArea );\n\n\t\tif ( bestPositionData ) {\n\t\t\treturn bestPositionData;\n\t\t}\n\t}\n\n\t// Either there is no viewportRect or there is no position that fits completely in the viewport.\n\treturn getBestOfProcessedPositions( processedPositions, elementRectArea );\n}\n\n// For a given array of positioning functions, calculates intersection areas for them.\n//\n// Note: If some position fully fits into the `limiterRect`, it will be returned early, without further consideration\n// of other positions.\n//\n// @private\n//\n// @param {module:utils/dom/position~Options#positions} positions Functions returning {@link module:utils/dom/position~Position}\n// to be checked, in the order of preference.\n// @param {Object} options\n// @param {utils/dom/rect~Rect} options.targetRect A rect of the {@link module:utils/dom/position~Options#target}.\n// @param {utils/dom/rect~Rect} options.elementRect A rect of positioned {@link module:utils/dom/position~Options#element}.\n// @param {utils/dom/rect~Rect} options.limiterRect A rect of the {@link module:utils/dom/position~Options#limiter}.\n// @param {utils/dom/rect~Rect} options.viewportRect A rect of the viewport.\n//\n// @returns {Array.