element.\n *\t\tconst pattern = element => {\n *\t\t\tif ( element.name == 'div' && element.childCount > 0 ) {\n *\t\t\t\t// Return which part of the element was matched.\n *\t\t\t\treturn { name: true };\n *\t\t\t}\n *\n *\t\t\treturn null;\n *\t\t};\n *\n *\t\t// Match a
element with big font (\"heading-like\" element).\n *\t\tconst pattern = element => {\n *\t\t\tif ( element.name == 'p' ) {\n *\t\t\t\tconst fontSize = element.getStyle( 'font-size' );\n *\t\t\t\tconst size = fontSize.match( /(\\d+)/px );\n *\n *\t\t\t\tif ( size && Number( size[ 1 ] ) > 26 ) {\n *\t\t\t\t\treturn { name: true, attribute: [ 'font-size' ] };\n *\t\t\t\t}\n *\t\t\t}\n *\n *\t\t\treturn null;\n *\t\t};\n *\n * `MatcherPattern` is defined in a way that it is a superset of {@link module:engine/view/elementdefinition~ElementDefinition},\n * that is, every `ElementDefinition` also can be used as a `MatcherPattern`.\n *\n * @typedef {String|RegExp|Object|Function} module:engine/view/matcher~MatcherPattern\n *\n * @property {String|RegExp} [name] View element name to match.\n * @property {String|RegExp|Array.} [classes] View element's class name(s) to match.\n * @property {Object} [styles] Object with key-value pairs representing styles to match.\n * Each object key represents style name. Value can be given as `String` or `RegExp`.\n * @property {Object} [attributes] Object with key-value pairs representing attributes to match.\n * Each object key represents attribute name. Value can be given as `String` or `RegExp`.\n */","import \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.array.sort\";\nimport \"core-js/modules/es6.regexp.match\";\nimport _construct from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/construct\";\nimport _slicedToArray from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/slicedToArray\";\nimport _toConsumableArray from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/toConsumableArray\";\nimport \"regenerator-runtime/runtime\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.map\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.set\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/element\n */\nimport Node from \"./node\";\nimport Text from \"./text\";\nimport TextProxy from \"./textproxy\";\nimport objectToMap from '@ckeditor/ckeditor5-utils/src/objecttomap';\nimport isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';\nimport Matcher from \"./matcher\";\nimport { isPlainObject } from 'lodash-es';\n/**\n * View element.\n *\n * The editing engine does not define a fixed semantics of its elements (it is \"DTD-free\").\n * This is why the type of the {@link module:engine/view/element~Element} need to\n * be defined by the feature developer. When creating an element you should use one of the following methods:\n *\n * * {@link module:engine/view/downcastwriter~DowncastWriter#createContainerElement `downcastWriter#createContainerElement()`}\n * in order to create a {@link module:engine/view/containerelement~ContainerElement},\n * * {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement `downcastWriter#createAttributeElement()`}\n * in order to create a {@link module:engine/view/attributeelement~AttributeElement},\n * * {@link module:engine/view/downcastwriter~DowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`}\n * in order to create a {@link module:engine/view/emptyelement~EmptyElement}.\n * * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`}\n * in order to create a {@link module:engine/view/uielement~UIElement}.\n * * {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`}\n * in order to create a {@link module:engine/view/editableelement~EditableElement}.\n *\n * Note that for view elements which are not created from the model, like elements from mutations, paste or\n * {@link module:engine/controller/datacontroller~DataController#set data.set} it is not possible to define the type of the element.\n * In such cases the {@link module:engine/view/upcastwriter~UpcastWriter#createElement `UpcastWriter#createElement()`} method\n * should be used to create generic view elements.\n *\n * @extends module:engine/view/node~Node\n */\n\nvar Element =\n/*#__PURE__*/\nfunction (_Node) {\n _inherits(Element, _Node);\n\n /**\n * Creates a view element.\n *\n * Attributes can be passed in various formats:\n *\n *\t\tnew Element( 'div', { class: 'editor', contentEditable: 'true' } ); // object\n *\t\tnew Element( 'div', [ [ 'class', 'editor' ], [ 'contentEditable', 'true' ] ] ); // map-like iterator\n *\t\tnew Element( 'div', mapOfAttributes ); // map\n *\n * @protected\n * @param {String} name Node name.\n * @param {Object|Iterable} [attrs] Collection of attributes.\n * @param {module:engine/view/node~Node|Iterable.} [children]\n * A list of nodes to be inserted into created element.\n */\n function Element(name, attrs, children) {\n var _this;\n\n _classCallCheck(this, Element);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Element).call(this));\n /**\n * Name of the element.\n *\n * @readonly\n * @member {String}\n */\n\n _this.name = name;\n /**\n * Map of attributes, where attributes names are keys and attributes values are values.\n *\n * @protected\n * @member {Map} #_attrs\n */\n\n _this._attrs = parseAttributes(attrs);\n /**\n * Array of child nodes.\n *\n * @protected\n * @member {Array.}\n */\n\n _this._children = [];\n\n if (children) {\n _this._insertChild(0, children);\n }\n /**\n * Set of classes associated with element instance.\n *\n * @protected\n * @member {Set}\n */\n\n\n _this._classes = new Set();\n\n if (_this._attrs.has('class')) {\n // Remove class attribute and handle it by class set.\n var classString = _this._attrs.get('class');\n\n parseClasses(_this._classes, classString);\n\n _this._attrs.delete('class');\n }\n /**\n * Map of styles.\n *\n * @protected\n * @member {Map} module:engine/view/element~Element#_styles\n */\n\n\n _this._styles = new Map();\n\n if (_this._attrs.has('style')) {\n // Remove style attribute and handle it by styles map.\n parseInlineStyles(_this._styles, _this._attrs.get('style'));\n\n _this._attrs.delete('style');\n }\n /**\n * Map of custom properties.\n * Custom properties can be added to element instance, will be cloned but not rendered into DOM.\n *\n * @protected\n * @member {Map}\n */\n\n\n _this._customProperties = new Map();\n return _this;\n }\n /**\n * Number of element's children.\n *\n * @readonly\n * @type {Number}\n */\n\n\n _createClass(Element, [{\n key: \"is\",\n\n /**\n * Checks whether this object is of the given.\n *\n *\t\telement.is( 'element' ); // -> true\n *\t\telement.is( 'node' ); // -> true\n *\t\telement.is( 'view:element' ); // -> true\n *\t\telement.is( 'view:node' ); // -> true\n *\n *\t\telement.is( 'model:element' ); // -> false\n *\t\telement.is( 'documentSelection' ); // -> false\n *\n * Assuming that the object being checked is an element, you can also check its\n * {@link module:engine/view/element~Element#name name}:\n *\n *\t\telement.is( 'img' ); // -> true if this is an element\n *\t\telement.is( 'element', 'img' ); // -> same as above\n *\t\ttext.is( 'img' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'element' || cutType == this.name || _get(_getPrototypeOf(Element.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'element' && name == this.name;\n }\n }\n /**\n * Gets child at the given index.\n *\n * @param {Number} index Index of child.\n * @returns {module:engine/view/node~Node} Child node.\n */\n\n }, {\n key: \"getChild\",\n value: function getChild(index) {\n return this._children[index];\n }\n /**\n * Gets index of the given child node. Returns `-1` if child node is not found.\n *\n * @param {module:engine/view/node~Node} node Child node.\n * @returns {Number} Index of the child node.\n */\n\n }, {\n key: \"getChildIndex\",\n value: function getChildIndex(node) {\n return this._children.indexOf(node);\n }\n /**\n * Gets child nodes iterator.\n *\n * @returns {Iterable.} Child nodes iterator.\n */\n\n }, {\n key: \"getChildren\",\n value: function getChildren() {\n return this._children[Symbol.iterator]();\n }\n /**\n * Returns an iterator that contains the keys for attributes. Order of inserting attributes is not preserved.\n *\n * @returns {Iterable.} Keys for attributes.\n */\n\n }, {\n key: \"getAttributeKeys\",\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getAttributeKeys() {\n return regeneratorRuntime.wrap(function getAttributeKeys$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(this._classes.size > 0)) {\n _context.next = 3;\n break;\n }\n\n _context.next = 3;\n return 'class';\n\n case 3:\n if (!(this._styles.size > 0)) {\n _context.next = 6;\n break;\n }\n\n _context.next = 6;\n return 'style';\n\n case 6:\n return _context.delegateYield(this._attrs.keys(), \"t0\", 7);\n\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, getAttributeKeys, this);\n })\n /**\n * Returns iterator that iterates over this element's attributes.\n *\n * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.\n * This format is accepted by native `Map` object and also can be passed in `Node` constructor.\n *\n * @returns {Iterable.<*>}\n */\n\n }, {\n key: \"getAttributes\",\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getAttributes() {\n return regeneratorRuntime.wrap(function getAttributes$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.delegateYield(this._attrs.entries(), \"t0\", 1);\n\n case 1:\n if (!(this._classes.size > 0)) {\n _context2.next = 4;\n break;\n }\n\n _context2.next = 4;\n return ['class', this.getAttribute('class')];\n\n case 4:\n if (!(this._styles.size > 0)) {\n _context2.next = 7;\n break;\n }\n\n _context2.next = 7;\n return ['style', this.getAttribute('style')];\n\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, getAttributes, this);\n })\n /**\n * Gets attribute by key. If attribute is not present - returns undefined.\n *\n * @param {String} key Attribute key.\n * @returns {String|undefined} Attribute value.\n */\n\n }, {\n key: \"getAttribute\",\n value: function getAttribute(key) {\n if (key == 'class') {\n if (this._classes.size > 0) {\n return _toConsumableArray(this._classes).join(' ');\n }\n\n return undefined;\n }\n\n if (key == 'style') {\n if (this._styles.size > 0) {\n var styleString = '';\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this._styles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _step$value = _slicedToArray(_step.value, 2),\n property = _step$value[0],\n value = _step$value[1];\n\n styleString += \"\".concat(property, \":\").concat(value, \";\");\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return styleString;\n }\n\n return undefined;\n }\n\n return this._attrs.get(key);\n }\n /**\n * Returns a boolean indicating whether an attribute with the specified key exists in the element.\n *\n * @param {String} key Attribute key.\n * @returns {Boolean} `true` if attribute with the specified key exists in the element, false otherwise.\n */\n\n }, {\n key: \"hasAttribute\",\n value: function hasAttribute(key) {\n if (key == 'class') {\n return this._classes.size > 0;\n }\n\n if (key == 'style') {\n return this._styles.size > 0;\n }\n\n return this._attrs.has(key);\n }\n /**\n * Checks if this element is similar to other element.\n * Both elements should have the same name and attributes to be considered as similar. Two similar elements\n * can contain different set of children nodes.\n *\n * @param {module:engine/view/element~Element} otherElement\n * @returns {Boolean}\n */\n\n }, {\n key: \"isSimilar\",\n value: function isSimilar(otherElement) {\n if (!(otherElement instanceof Element)) {\n return false;\n } // If exactly the same Element is provided - return true immediately.\n\n\n if (this === otherElement) {\n return true;\n } // Check element name.\n\n\n if (this.name != otherElement.name) {\n return false;\n } // Check number of attributes, classes and styles.\n\n\n if (this._attrs.size !== otherElement._attrs.size || this._classes.size !== otherElement._classes.size || this._styles.size !== otherElement._styles.size) {\n return false;\n } // Check if attributes are the same.\n\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = this._attrs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var _step2$value = _slicedToArray(_step2.value, 2),\n key = _step2$value[0],\n value = _step2$value[1];\n\n if (!otherElement._attrs.has(key) || otherElement._attrs.get(key) !== value) {\n return false;\n }\n } // Check if classes are the same.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = this._classes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var className = _step3.value;\n\n if (!otherElement._classes.has(className)) {\n return false;\n }\n } // Check if styles are the same.\n\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = this._styles[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _step4$value = _slicedToArray(_step4.value, 2),\n property = _step4$value[0],\n _value = _step4$value[1];\n\n if (!otherElement._styles.has(property) || otherElement._styles.get(property) !== _value) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n\n return true;\n }\n /**\n * Returns true if class is present.\n * If more then one class is provided - returns true only when all classes are present.\n *\n *\t\telement.hasClass( 'foo' ); // Returns true if 'foo' class is present.\n *\t\telement.hasClass( 'foo', 'bar' ); // Returns true if 'foo' and 'bar' classes are both present.\n *\n * @param {...String} className\n */\n\n }, {\n key: \"hasClass\",\n value: function hasClass() {\n for (var _len = arguments.length, className = new Array(_len), _key = 0; _key < _len; _key++) {\n className[_key] = arguments[_key];\n }\n\n for (var _i = 0, _className = className; _i < _className.length; _i++) {\n var name = _className[_i];\n\n if (!this._classes.has(name)) {\n return false;\n }\n }\n\n return true;\n }\n /**\n * Returns iterator that contains all class names.\n *\n * @returns {Iterable.}\n */\n\n }, {\n key: \"getClassNames\",\n value: function getClassNames() {\n return this._classes.keys();\n }\n /**\n * Returns style value for given property.\n * Undefined is returned if style does not exist.\n *\n * @param {String} property\n * @returns {String|undefined}\n */\n\n }, {\n key: \"getStyle\",\n value: function getStyle(property) {\n return this._styles.get(property);\n }\n /**\n * Returns iterator that contains all style names.\n *\n * @returns {Iterable.}\n */\n\n }, {\n key: \"getStyleNames\",\n value: function getStyleNames() {\n return this._styles.keys();\n }\n /**\n * Returns true if style keys are present.\n * If more then one style property is provided - returns true only when all properties are present.\n *\n *\t\telement.hasStyle( 'color' ); // Returns true if 'border-top' style is present.\n *\t\telement.hasStyle( 'color', 'border-top' ); // Returns true if 'color' and 'border-top' styles are both present.\n *\n * @param {...String} property\n */\n\n }, {\n key: \"hasStyle\",\n value: function hasStyle() {\n for (var _len2 = arguments.length, property = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n property[_key2] = arguments[_key2];\n }\n\n for (var _i2 = 0, _property = property; _i2 < _property.length; _i2++) {\n var name = _property[_i2];\n\n if (!this._styles.has(name)) {\n return false;\n }\n }\n\n return true;\n }\n /**\n * Returns ancestor element that match specified pattern.\n * Provided patterns should be compatible with {@link module:engine/view/matcher~Matcher Matcher} as it is used internally.\n *\n * @see module:engine/view/matcher~Matcher\n * @param {Object|String|RegExp|Function} patterns Patterns used to match correct ancestor.\n * See {@link module:engine/view/matcher~Matcher}.\n * @returns {module:engine/view/element~Element|null} Found element or `null` if no matching ancestor was found.\n */\n\n }, {\n key: \"findAncestor\",\n value: function findAncestor() {\n for (var _len3 = arguments.length, patterns = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n patterns[_key3] = arguments[_key3];\n }\n\n var matcher = _construct(Matcher, patterns);\n\n var parent = this.parent;\n\n while (parent) {\n if (matcher.match(parent)) {\n return parent;\n }\n\n parent = parent.parent;\n }\n\n return null;\n }\n /**\n * Returns the custom property value for the given key.\n *\n * @param {String|Symbol} key\n * @returns {*}\n */\n\n }, {\n key: \"getCustomProperty\",\n value: function getCustomProperty(key) {\n return this._customProperties.get(key);\n }\n /**\n * Returns an iterator which iterates over this element's custom properties.\n * Iterator provides `[ key, value ]` pairs for each stored property.\n *\n * @returns {Iterable.<*>}\n */\n\n }, {\n key: \"getCustomProperties\",\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getCustomProperties() {\n return regeneratorRuntime.wrap(function getCustomProperties$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n return _context3.delegateYield(this._customProperties.entries(), \"t0\", 1);\n\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }\n }, getCustomProperties, this);\n })\n /**\n * Returns identity string based on element's name, styles, classes and other attributes.\n * Two elements that {@link #isSimilar are similar} will have same identity string.\n * It has the following format:\n *\n *\t\t'name class=\"class1,class2\" style=\"style1:value1;style2:value2\" attr1=\"val1\" attr2=\"val2\"'\n \t *\n * For example:\n *\n *\t\tconst element = writer.createContainerElement( 'foo', {\n *\t\t\tbanana: '10',\n *\t\t\tapple: '20',\n *\t\t\tstyle: 'color: red; border-color: white;',\n *\t\t\tclass: 'baz'\n *\t\t} );\n *\n *\t\t// returns 'foo class=\"baz\" style=\"border-color:white;color:red\" apple=\"20\" banana=\"10\"'\n *\t\telement.getIdentity();\n *\n * NOTE: Classes, styles and other attributes are sorted alphabetically.\n *\n * @returns {String}\n */\n\n }, {\n key: \"getIdentity\",\n value: function getIdentity() {\n var classes = Array.from(this._classes).sort().join(',');\n var styles = Array.from(this._styles).map(function (i) {\n return \"\".concat(i[0], \":\").concat(i[1]);\n }).sort().join(';');\n var attributes = Array.from(this._attrs).map(function (i) {\n return \"\".concat(i[0], \"=\\\"\").concat(i[1], \"\\\"\");\n }).sort().join(' ');\n return this.name + (classes == '' ? '' : \" class=\\\"\".concat(classes, \"\\\"\")) + (styles == '' ? '' : \" style=\\\"\".concat(styles, \"\\\"\")) + (attributes == '' ? '' : \" \".concat(attributes));\n }\n /**\n * Clones provided element.\n *\n * @protected\n * @param {Boolean} [deep=false] If set to `true` clones element and all its children recursively. When set to `false`,\n * element will be cloned without any children.\n * @returns {module:engine/view/element~Element} Clone of this element.\n */\n\n }, {\n key: \"_clone\",\n value: function _clone() {\n var deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var childrenClone = [];\n\n if (deep) {\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = this.getChildren()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var child = _step5.value;\n childrenClone.push(child._clone(deep));\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n } // ContainerElement and AttributeElement should be also cloned properly.\n\n\n var cloned = new this.constructor(this.name, this._attrs, childrenClone); // Classes and styles are cloned separately - this solution is faster than adding them back to attributes and\n // parse once again in constructor.\n\n cloned._classes = new Set(this._classes);\n cloned._styles = new Map(this._styles); // Clone custom properties.\n\n cloned._customProperties = new Map(this._customProperties); // Clone filler offset method.\n // We can't define this method in a prototype because it's behavior which\n // is changed by e.g. toWidget() function from ckeditor5-widget. Perhaps this should be one of custom props.\n\n cloned.getFillerOffset = this.getFillerOffset;\n return cloned;\n }\n /**\n * {@link module:engine/view/element~Element#_insertChild Insert} a child node or a list of child nodes at the end of this node\n * and sets the parent of these nodes to this element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#insert\n * @protected\n * @param {module:engine/view/item~Item|Iterable.} items Items to be inserted.\n * @fires module:engine/view/node~Node#change\n * @returns {Number} Number of appended nodes.\n */\n\n }, {\n key: \"_appendChild\",\n value: function _appendChild(items) {\n return this._insertChild(this.childCount, items);\n }\n /**\n * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to\n * this element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#insert\n * @protected\n * @param {Number} index Position where nodes should be inserted.\n * @param {module:engine/view/item~Item|Iterable.} items Items to be inserted.\n * @fires module:engine/view/node~Node#change\n * @returns {Number} Number of inserted nodes.\n */\n\n }, {\n key: \"_insertChild\",\n value: function _insertChild(index, items) {\n this._fireChange('children', this);\n\n var count = 0;\n var nodes = normalize(items);\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = nodes[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var node = _step6.value;\n\n // If node that is being added to this element is already inside another element, first remove it from the old parent.\n if (node.parent !== null) {\n node._remove();\n }\n\n node.parent = this;\n\n this._children.splice(index, 0, node);\n\n index++;\n count++;\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n\n return count;\n }\n /**\n * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#remove\n * @protected\n * @param {Number} index Number of the first node to remove.\n * @param {Number} [howMany=1] Number of nodes to remove.\n * @fires module:engine/view/node~Node#change\n * @returns {Array.} The array of removed nodes.\n */\n\n }, {\n key: \"_removeChildren\",\n value: function _removeChildren(index) {\n var howMany = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n this._fireChange('children', this);\n\n for (var i = index; i < index + howMany; i++) {\n this._children[i].parent = null;\n }\n\n return this._children.splice(index, howMany);\n }\n /**\n * Adds or overwrite attribute with a specified key and value.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#setAttribute\n * @protected\n * @param {String} key Attribute key.\n * @param {String} value Attribute value.\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_setAttribute\",\n value: function _setAttribute(key, value) {\n value = String(value);\n\n this._fireChange('attributes', this);\n\n if (key == 'class') {\n parseClasses(this._classes, value);\n } else if (key == 'style') {\n parseInlineStyles(this._styles, value);\n } else {\n this._attrs.set(key, value);\n }\n }\n /**\n * Removes attribute from the element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#removeAttribute\n * @protected\n * @param {String} key Attribute key.\n * @returns {Boolean} Returns true if an attribute existed and has been removed.\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_removeAttribute\",\n value: function _removeAttribute(key) {\n this._fireChange('attributes', this); // Remove class attribute.\n\n\n if (key == 'class') {\n if (this._classes.size > 0) {\n this._classes.clear();\n\n return true;\n }\n\n return false;\n } // Remove style attribute.\n\n\n if (key == 'style') {\n if (this._styles.size > 0) {\n this._styles.clear();\n\n return true;\n }\n\n return false;\n } // Remove other attributes.\n\n\n return this._attrs.delete(key);\n }\n /**\n * Adds specified class.\n *\n *\t\telement._addClass( 'foo' ); // Adds 'foo' class.\n *\t\telement._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#addClass\n * @protected\n * @param {Array.|String} className\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_addClass\",\n value: function _addClass(className) {\n var _this2 = this;\n\n this._fireChange('attributes', this);\n\n className = Array.isArray(className) ? className : [className];\n className.forEach(function (name) {\n return _this2._classes.add(name);\n });\n }\n /**\n * Removes specified class.\n *\n *\t\telement._removeClass( 'foo' ); // Removes 'foo' class.\n *\t\telement._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#removeClass\n * @protected\n * @param {Array.|String} className\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_removeClass\",\n value: function _removeClass(className) {\n var _this3 = this;\n\n this._fireChange('attributes', this);\n\n className = Array.isArray(className) ? className : [className];\n className.forEach(function (name) {\n return _this3._classes.delete(name);\n });\n }\n /**\n * Adds style to the element.\n *\n *\t\telement._setStyle( 'color', 'red' );\n *\t\telement._setStyle( {\n *\t\t\tcolor: 'red',\n *\t\t\tposition: 'fixed'\n *\t\t} );\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#setStyle\n * @protected\n * @param {String|Object} property Property name or object with key - value pairs.\n * @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_setStyle\",\n value: function _setStyle(property, value) {\n this._fireChange('attributes', this);\n\n if (isPlainObject(property)) {\n var keys = Object.keys(property);\n\n for (var _i3 = 0, _keys = keys; _i3 < _keys.length; _i3++) {\n var key = _keys[_i3];\n\n this._styles.set(key, property[key]);\n }\n } else {\n this._styles.set(property, value);\n }\n }\n /**\n * Removes specified style.\n *\n *\t\telement._removeStyle( 'color' ); // Removes 'color' style.\n *\t\telement._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#removeStyle\n * @protected\n * @param {Array.|String} property\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_removeStyle\",\n value: function _removeStyle(property) {\n var _this4 = this;\n\n this._fireChange('attributes', this);\n\n property = Array.isArray(property) ? property : [property];\n property.forEach(function (name) {\n return _this4._styles.delete(name);\n });\n }\n /**\n * Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,\n * so they can be used to add special data to elements.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#setCustomProperty\n * @protected\n * @param {String|Symbol} key\n * @param {*} value\n */\n\n }, {\n key: \"_setCustomProperty\",\n value: function _setCustomProperty(key, value) {\n this._customProperties.set(key, value);\n }\n /**\n * Removes the custom property stored under the given key.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#removeCustomProperty\n * @protected\n * @param {String|Symbol} key\n * @returns {Boolean} Returns true if property was removed.\n */\n\n }, {\n key: \"_removeCustomProperty\",\n value: function _removeCustomProperty(key) {\n return this._customProperties.delete(key);\n }\n /**\n * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.\n *\n * @abstract\n * @method module:engine/view/element~Element#getFillerOffset\n */\n\n }, {\n key: \"childCount\",\n get: function get() {\n return this._children.length;\n }\n /**\n * Is `true` if there are no nodes inside this element, `false` otherwise.\n *\n * @readonly\n * @type {Boolean}\n */\n\n }, {\n key: \"isEmpty\",\n get: function get() {\n return this._children.length === 0;\n }\n }]);\n\n return Element;\n}(Node); // Parses attributes provided to the element constructor before they are applied to an element. If attributes are passed\n// as an object (instead of `Map`), the object is transformed to the map. Attributes with `null` value are removed.\n// Attributes with non-`String` value are converted to `String`.\n//\n// @param {Object|Map} attrs Attributes to parse.\n// @returns {Map} Parsed attributes.\n\n\nexport { Element as default };\n\nfunction parseAttributes(attrs) {\n if (isPlainObject(attrs)) {\n attrs = objectToMap(attrs);\n } else {\n attrs = new Map(attrs);\n }\n\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = attrs[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var _step7$value = _slicedToArray(_step7.value, 2),\n key = _step7$value[0],\n value = _step7$value[1];\n\n if (value === null) {\n attrs.delete(key);\n } else if (typeof value != 'string') {\n attrs.set(key, String(value));\n }\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n return attrs;\n} // Parses inline styles and puts property - value pairs into styles map.\n// Styles map is cleared before insertion.\n//\n// @param {Map.} stylesMap Map to insert parsed properties and values.\n// @param {String} stylesString Styles to parse.\n\n\nfunction parseInlineStyles(stylesMap, stylesString) {\n // `null` if no quote was found in input string or last found quote was a closing quote. See below.\n var quoteType = null;\n var propertyNameStart = 0;\n var propertyValueStart = 0;\n var propertyName = null;\n stylesMap.clear(); // Do not set anything if input string is empty.\n\n if (stylesString === '') {\n return;\n } // Fix inline styles that do not end with `;` so they are compatible with algorithm below.\n\n\n if (stylesString.charAt(stylesString.length - 1) != ';') {\n stylesString = stylesString + ';';\n } // Seek the whole string for \"special characters\".\n\n\n for (var i = 0; i < stylesString.length; i++) {\n var char = stylesString.charAt(i);\n\n if (quoteType === null) {\n // No quote found yet or last found quote was a closing quote.\n switch (char) {\n case ':':\n // Most of time colon means that property name just ended.\n // Sometimes however `:` is found inside property value (for example in background image url).\n if (!propertyName) {\n // Treat this as end of property only if property name is not already saved.\n // Save property name.\n propertyName = stylesString.substr(propertyNameStart, i - propertyNameStart); // Save this point as the start of property value.\n\n propertyValueStart = i + 1;\n }\n\n break;\n\n case '\"':\n case '\\'':\n // Opening quote found (this is an opening quote, because `quoteType` is `null`).\n quoteType = char;\n break;\n\n case ';':\n {\n // Property value just ended.\n // Use previously stored property value start to obtain property value.\n var propertyValue = stylesString.substr(propertyValueStart, i - propertyValueStart);\n\n if (propertyName) {\n // Save parsed part.\n stylesMap.set(propertyName.trim(), propertyValue.trim());\n }\n\n propertyName = null; // Save this point as property name start. Property name starts immediately after previous property value ends.\n\n propertyNameStart = i + 1;\n break;\n }\n }\n } else if (char === quoteType) {\n // If a quote char is found and it is a closing quote, mark this fact by `null`-ing `quoteType`.\n quoteType = null;\n }\n }\n} // Parses class attribute and puts all classes into classes set.\n// Classes set s cleared before insertion.\n//\n// @param {Set.} classesSet Set to insert parsed classes.\n// @param {String} classesString String with classes to parse.\n\n\nfunction parseClasses(classesSet, classesString) {\n var classArray = classesString.split(/\\s+/);\n classesSet.clear();\n classArray.forEach(function (name) {\n return classesSet.add(name);\n });\n} // Converts strings to Text and non-iterables to arrays.\n//\n// @param {String|module:engine/view/item~Item|Iterable.}\n// @returns {Iterable.}\n\n\nfunction normalize(nodes) {\n // Separate condition because string is iterable.\n if (typeof nodes == 'string') {\n return [new Text(nodes)];\n }\n\n if (!isIterable(nodes)) {\n nodes = [nodes];\n } // Array.from to enable .map() on non-arrays.\n\n\n return Array.from(nodes).map(function (node) {\n if (typeof node == 'string') {\n return new Text(node);\n }\n\n if (node instanceof TextProxy) {\n return new Text(node.data);\n }\n\n return node;\n });\n}","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _toConsumableArray from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/containerelement\n */\nimport Element from \"./element\";\n/**\n * Containers are elements which define document structure. They define boundaries for\n * {@link module:engine/view/attributeelement~AttributeElement attributes}. They are mostly used for block elements like `` or `
`.\n *\n * Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various\n * types (container element, {@link module:engine/view/attributeelement~AttributeElement attribute element},\n * {@link module:engine/view/emptyelement~EmptyElement empty element}, etc) when developing a feature.\n *\n * The container element should be your default choice when writing a converter, unless:\n *\n * * this element represents a model text attribute (then use {@link module:engine/view/attributeelement~AttributeElement}),\n * * this is an empty element like `
` (then use {@link module:engine/view/emptyelement~EmptyElement}),\n * * this is a root element,\n * * this is a nested editable element (then use {@link module:engine/view/editableelement~EditableElement}).\n *\n * To create a new container element instance use the\n * {@link module:engine/view/downcastwriter~DowncastWriter#createContainerElement `DowncastWriter#createContainerElement()`}\n * method.\n *\n * @extends module:engine/view/element~Element\n */\n\nvar ContainerElement =\n/*#__PURE__*/\nfunction (_Element) {\n _inherits(ContainerElement, _Element);\n\n /**\n * Creates a container element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#createContainerElement\n * @see module:engine/view/element~Element\n * @protected\n */\n function ContainerElement(name, attrs, children) {\n var _this;\n\n _classCallCheck(this, ContainerElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(ContainerElement).call(this, name, attrs, children));\n /**\n * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.\n *\n * @method #getFillerOffset\n * @returns {Number|null} Block filler offset or `null` if block filler is not needed.\n */\n\n _this.getFillerOffset = getFillerOffset;\n return _this;\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\tcontainerElement.is( 'containerElement' ); // -> true\n *\t\tcontainerElement.is( 'element' ); // -> true\n *\t\tcontainerElement.is( 'node' ); // -> true\n *\t\tcontainerElement.is( 'view:containerElement' ); // -> true\n *\t\tcontainerElement.is( 'view:element' ); // -> true\n *\t\tcontainerElement.is( 'view:node' ); // -> true\n *\n *\t\tcontainerElement.is( 'model:element' ); // -> false\n *\t\tcontainerElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is a container element, you can also check its\n * {@link module:engine/view/containerelement~ContainerElement#name name}:\n *\n *\t\tcontainerElement.is( 'div' ); // -> true if this is a div container element\n *\t\tcontainerElement.is( 'contaienrElement', 'div' ); // -> same as above\n *\t\ttext.is( 'div' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n\n _createClass(ContainerElement, [{\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type && type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'containerElement' || _get(_getPrototypeOf(ContainerElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'containerElement' && name == this.name || _get(_getPrototypeOf(ContainerElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n }]);\n\n return ContainerElement;\n}(Element);\n/**\n * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.\n *\n * @returns {Number|null} Block filler offset or `null` if block filler is not needed.\n */\n\n\nexport { ContainerElement as default };\nexport function getFillerOffset() {\n var children = _toConsumableArray(this.getChildren());\n\n var lastChild = children[this.childCount - 1]; // Block filler is required after a `
` if it's the last element in its container. See #1422.\n\n if (lastChild && lastChild.is('element', 'br')) {\n return this.childCount;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var child = _step.value;\n\n // If there's any non-UI element – don't render the bogus.\n if (!child.is('uiElement')) {\n return null;\n }\n } // If there are only UI elements – render the bogus at the end of the element.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return this.childCount;\n}","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nexport default identity;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nexport default apply;\n","import apply from './_apply.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nexport default overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nexport default constant;\n","import constant from './constant.js';\nimport defineProperty from './_defineProperty.js';\nimport identity from './identity.js';\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nexport default baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nexport default shortOut;\n","import baseSetToString from './_baseSetToString.js';\nimport shortOut from './_shortOut.js';\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nexport default setToString;\n","import identity from './identity.js';\nimport overRest from './_overRest.js';\nimport setToString from './_setToString.js';\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nexport default baseRest;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nexport default createAssigner;\n","import copyObject from './_copyObject.js';\nimport createAssigner from './_createAssigner.js';\nimport keysIn from './keysIn.js';\n\n/**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\nvar assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n});\n\nexport default assignIn;\n","import _typeof from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/typeof\";\nimport _toConsumableArray from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.map\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.set\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\n\n/**\n * @license Copyright (c) 2003-2019, 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/observablemixin\n */\nimport EmitterMixin from \"./emittermixin\";\nimport CKEditorError from \"./ckeditorerror\";\nimport { extend, isObject } from 'lodash-es';\nvar observablePropertiesSymbol = Symbol('observableProperties');\nvar boundObservablesSymbol = Symbol('boundObservables');\nvar boundPropertiesSymbol = Symbol('boundProperties');\n/**\n * Mixin that injects the \"observable properties\" and data binding functionality described in the\n * {@link ~Observable} interface.\n *\n * Read more about the concept of observables in the:\n * * {@glink framework/guides/architecture/core-editor-architecture#event-system-and-observables \"Event system and observables\"}\n * section of the {@glink framework/guides/architecture/core-editor-architecture \"Core editor architecture\"} guide,\n * * {@glink framework/guides/deep-dive/observables \"Observables\" deep dive} guide.\n *\n * @mixin ObservableMixin\n * @mixes module:utils/emittermixin~EmitterMixin\n * @implements module:utils/observablemixin~Observable\n */\n\nvar ObservableMixin = {\n /**\n * @inheritDoc\n */\n set: function set(name, value) {\n var _this = this;\n\n // If the first parameter is an Object, iterate over its properties.\n if (isObject(name)) {\n Object.keys(name).forEach(function (property) {\n _this.set(property, name[property]);\n }, this);\n return;\n }\n\n initObservable(this);\n var properties = this[observablePropertiesSymbol];\n\n if (name in this && !properties.has(name)) {\n /**\n * Cannot override an existing property.\n *\n * This error is thrown when trying to {@link ~Observable#set set} an property with\n * a name of an already existing property. For example:\n *\n *\t\tlet observable = new Model();\n *\t\tobservable.property = 1;\n *\t\tobservable.set( 'property', 2 );\t\t\t// throws\n *\n *\t\tobservable.set( 'property', 1 );\n *\t\tobservable.set( 'property', 2 );\t\t\t// ok, because this is an existing property.\n *\n * @error observable-set-cannot-override\n */\n throw new CKEditorError('observable-set-cannot-override: Cannot override an existing property.', this);\n }\n\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n get: function get() {\n return properties.get(name);\n },\n set: function set(value) {\n var oldValue = properties.get(name); // Fire `set` event before the new value will be set to make it possible\n // to override observable property without affecting `change` event.\n // See https://github.com/ckeditor/ckeditor5-utils/issues/171.\n\n var newValue = this.fire('set:' + name, name, value, oldValue);\n\n if (newValue === undefined) {\n newValue = value;\n } // Allow undefined as an initial value like A.define( 'x', undefined ) (#132).\n // Note: When properties map has no such own property, then its value is undefined.\n\n\n if (oldValue !== newValue || !properties.has(name)) {\n properties.set(name, newValue);\n this.fire('change:' + name, name, newValue, oldValue);\n }\n }\n });\n this[name] = value;\n },\n\n /**\n * @inheritDoc\n */\n bind: function bind() {\n var _this2 = this;\n\n for (var _len = arguments.length, bindProperties = new Array(_len), _key = 0; _key < _len; _key++) {\n bindProperties[_key] = arguments[_key];\n }\n\n if (!bindProperties.length || !isStringArray(bindProperties)) {\n /**\n * All properties must be strings.\n *\n * @error observable-bind-wrong-properties\n */\n throw new CKEditorError('observable-bind-wrong-properties: All properties must be strings.', this);\n }\n\n if (new Set(bindProperties).size !== bindProperties.length) {\n /**\n * Properties must be unique.\n *\n * @error observable-bind-duplicate-properties\n */\n throw new CKEditorError('observable-bind-duplicate-properties: Properties must be unique.', this);\n }\n\n initObservable(this);\n var boundProperties = this[boundPropertiesSymbol];\n bindProperties.forEach(function (propertyName) {\n if (boundProperties.has(propertyName)) {\n /**\n * Cannot bind the same property more that once.\n *\n * @error observable-bind-rebind\n */\n throw new CKEditorError('observable-bind-rebind: Cannot bind the same property more that once.', _this2);\n }\n });\n var bindings = new Map(); // @typedef {Object} Binding\n // @property {Array} property Property which is bound.\n // @property {Array} to Array of observable–property components of the binding (`{ observable: ..., property: .. }`).\n // @property {Array} callback A function which processes `to` components.\n\n bindProperties.forEach(function (a) {\n var binding = {\n property: a,\n to: []\n };\n boundProperties.set(a, binding);\n bindings.set(a, binding);\n }); // @typedef {Object} BindChain\n // @property {Function} to See {@link ~ObservableMixin#_bindTo}.\n // @property {Function} toMany See {@link ~ObservableMixin#_bindToMany}.\n // @property {module:utils/observablemixin~Observable} _observable The observable which initializes the binding.\n // @property {Array} _bindProperties Array of `_observable` properties to be bound.\n // @property {Array} _to Array of `to()` observable–properties (`{ observable: toObservable, properties: ...toProperties }`).\n // @property {Map} _bindings Stores bindings to be kept in\n // {@link ~ObservableMixin#_boundProperties}/{@link ~ObservableMixin#_boundObservables}\n // initiated in this binding chain.\n\n return {\n to: bindTo,\n toMany: bindToMany,\n _observable: this,\n _bindProperties: bindProperties,\n _to: [],\n _bindings: bindings\n };\n },\n\n /**\n * @inheritDoc\n */\n unbind: function unbind() {\n var _this3 = this;\n\n // Nothing to do here if not inited yet.\n if (!(observablePropertiesSymbol in this)) {\n return;\n }\n\n var boundProperties = this[boundPropertiesSymbol];\n var boundObservables = this[boundObservablesSymbol];\n\n for (var _len2 = arguments.length, unbindProperties = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n unbindProperties[_key2] = arguments[_key2];\n }\n\n if (unbindProperties.length) {\n if (!isStringArray(unbindProperties)) {\n /**\n * Properties must be strings.\n *\n * @error observable-unbind-wrong-properties\n */\n throw new CKEditorError('observable-unbind-wrong-properties: Properties must be strings.', this);\n }\n\n unbindProperties.forEach(function (propertyName) {\n var binding = boundProperties.get(propertyName); // Nothing to do if the binding is not defined\n\n if (!binding) {\n return;\n }\n\n var toObservable, toProperty, toProperties, toPropertyBindings;\n binding.to.forEach(function (to) {\n // TODO: ES6 destructuring.\n toObservable = to[0];\n toProperty = to[1];\n toProperties = boundObservables.get(toObservable);\n toPropertyBindings = toProperties[toProperty];\n toPropertyBindings.delete(binding);\n\n if (!toPropertyBindings.size) {\n delete toProperties[toProperty];\n }\n\n if (!Object.keys(toProperties).length) {\n boundObservables.delete(toObservable);\n\n _this3.stopListening(toObservable, 'change');\n }\n });\n boundProperties.delete(propertyName);\n });\n } else {\n boundObservables.forEach(function (bindings, boundObservable) {\n _this3.stopListening(boundObservable, 'change');\n });\n boundObservables.clear();\n boundProperties.clear();\n }\n },\n\n /**\n * @inheritDoc\n */\n decorate: function decorate(methodName) {\n var _this4 = this;\n\n var originalMethod = this[methodName];\n\n if (!originalMethod) {\n /**\n * Cannot decorate an undefined method.\n *\n * @error observablemixin-cannot-decorate-undefined\n * @param {Object} object The object which method should be decorated.\n * @param {String} methodName Name of the method which does not exist.\n */\n throw new CKEditorError('observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.', this, {\n object: this,\n methodName: methodName\n });\n }\n\n this.on(methodName, function (evt, args) {\n evt.return = originalMethod.apply(_this4, args);\n });\n\n this[methodName] = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return this.fire(methodName, args);\n };\n }\n};\nextend(ObservableMixin, EmitterMixin);\nexport default ObservableMixin; // Init symbol properties needed to for the observable mechanism to work.\n//\n// @private\n// @param {module:utils/observablemixin~ObservableMixin} observable\n\nfunction initObservable(observable) {\n // Do nothing if already inited.\n if (observablePropertiesSymbol in observable) {\n return;\n } // The internal hash containing the observable's state.\n //\n // @private\n // @type {Map}\n\n\n Object.defineProperty(observable, observablePropertiesSymbol, {\n value: new Map()\n }); // Map containing bindings to external observables. It shares the binding objects\n // (`{ observable: A, property: 'a', to: ... }`) with {@link module:utils/observablemixin~ObservableMixin#_boundProperties} and\n // it is used to observe external observables to update own properties accordingly.\n // See {@link module:utils/observablemixin~ObservableMixin#bind}.\n //\n //\t\tA.bind( 'a', 'b', 'c' ).to( B, 'x', 'y', 'x' );\n //\t\tconsole.log( A._boundObservables );\n //\n //\t\t\tMap( {\n //\t\t\t\tB: {\n //\t\t\t\t\tx: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n //\t\t\t\t\t\t{ observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n //\t\t\t\t\t] ),\n //\t\t\t\t\ty: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n //\t\t\t\t\t] )\n //\t\t\t\t}\n //\t\t\t} )\n //\n //\t\tA.bind( 'd' ).to( B, 'z' ).to( C, 'w' ).as( callback );\n //\t\tconsole.log( A._boundObservables );\n //\n //\t\t\tMap( {\n //\t\t\t\tB: {\n //\t\t\t\t\tx: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n //\t\t\t\t\t\t{ observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n //\t\t\t\t\t] ),\n //\t\t\t\t\ty: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n //\t\t\t\t\t] ),\n //\t\t\t\t\tz: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n //\t\t\t\t\t] )\n //\t\t\t\t},\n //\t\t\t\tC: {\n //\t\t\t\t\tw: Set( [\n //\t\t\t\t\t\t{ observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n //\t\t\t\t\t] )\n //\t\t\t\t}\n //\t\t\t} )\n //\n // @private\n // @type {Map}\n\n Object.defineProperty(observable, boundObservablesSymbol, {\n value: new Map()\n }); // Object that stores which properties of this observable are bound and how. It shares\n // the binding objects (`{ observable: A, property: 'a', to: ... }`) with\n // {@link module:utils/observablemixin~ObservableMixin#_boundObservables}. This data structure is\n // a reverse of {@link module:utils/observablemixin~ObservableMixin#_boundObservables} and it is helpful for\n // {@link module:utils/observablemixin~ObservableMixin#unbind}.\n //\n // See {@link module:utils/observablemixin~ObservableMixin#bind}.\n //\n //\t\tA.bind( 'a', 'b', 'c' ).to( B, 'x', 'y', 'x' );\n //\t\tconsole.log( A._boundProperties );\n //\n //\t\t\tMap( {\n //\t\t\t\ta: { observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n //\t\t\t\tb: { observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n //\t\t\t\tc: { observable: A, property: 'c', to: [ [ B, 'x' ] ] }\n //\t\t\t} )\n //\n //\t\tA.bind( 'd' ).to( B, 'z' ).to( C, 'w' ).as( callback );\n //\t\tconsole.log( A._boundProperties );\n //\n //\t\t\tMap( {\n //\t\t\t\ta: { observable: A, property: 'a', to: [ [ B, 'x' ] ] },\n //\t\t\t\tb: { observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n //\t\t\t\tc: { observable: A, property: 'c', to: [ [ B, 'x' ] ] },\n //\t\t\t\td: { observable: A, property: 'd', to: [ [ B, 'z' ], [ C, 'w' ] ], callback: callback }\n //\t\t\t} )\n //\n // @private\n // @type {Map}\n\n Object.defineProperty(observable, boundPropertiesSymbol, {\n value: new Map()\n });\n} // A chaining for {@link module:utils/observablemixin~ObservableMixin#bind} providing `.to()` interface.\n//\n// @private\n// @param {...[Observable|String|Function]} args Arguments of the `.to( args )` binding.\n\n\nfunction bindTo() {\n var _this5 = this;\n\n var parsedArgs = parseBindToArgs.apply(void 0, arguments);\n var bindingsKeys = Array.from(this._bindings.keys());\n var numberOfBindings = bindingsKeys.length; // Eliminate A.bind( 'x' ).to( B, C )\n\n if (!parsedArgs.callback && parsedArgs.to.length > 1) {\n /**\n * Binding multiple observables only possible with callback.\n *\n * @error observable-bind-no-callback\n */\n throw new CKEditorError('observable-bind-to-no-callback: Binding multiple observables only possible with callback.', this);\n } // Eliminate A.bind( 'x', 'y' ).to( B, callback )\n\n\n if (numberOfBindings > 1 && parsedArgs.callback) {\n /**\n * Cannot bind multiple properties and use a callback in one binding.\n *\n * @error observable-bind-to-extra-callback\n */\n throw new CKEditorError('observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.', this);\n }\n\n parsedArgs.to.forEach(function (to) {\n // Eliminate A.bind( 'x', 'y' ).to( B, 'a' )\n if (to.properties.length && to.properties.length !== numberOfBindings) {\n /**\n * The number of properties must match.\n *\n * @error observable-bind-to-properties-length\n */\n throw new CKEditorError('observable-bind-to-properties-length: The number of properties must match.', _this5);\n } // When no to.properties specified, observing source properties instead i.e.\n // A.bind( 'x', 'y' ).to( B ) -> Observe B.x and B.y\n\n\n if (!to.properties.length) {\n to.properties = _this5._bindProperties;\n }\n });\n this._to = parsedArgs.to; // Fill {@link BindChain#_bindings} with callback. When the callback is set there's only one binding.\n\n if (parsedArgs.callback) {\n this._bindings.get(bindingsKeys[0]).callback = parsedArgs.callback;\n }\n\n attachBindToListeners(this._observable, this._to); // Update observable._boundProperties and observable._boundObservables.\n\n updateBindToBound(this); // Set initial values of bound properties.\n\n this._bindProperties.forEach(function (propertyName) {\n updateBoundObservableProperty(_this5._observable, propertyName);\n });\n} // Binds to an attribute in a set of iterable observables.\n//\n// @private\n// @param {Array.
} observables\n// @param {String} attribute\n// @param {Function} callback\n\n\nfunction bindToMany(observables, attribute, callback) {\n if (this._bindings.size > 1) {\n /**\n * Binding one attribute to many observables only possible with one attribute.\n *\n * @error observable-bind-to-many-not-one-binding\n */\n throw new CKEditorError('observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().', this);\n }\n\n this.to.apply(this, _toConsumableArray(getBindingTargets(observables, attribute)).concat([// ...using given callback to parse attribute values.\n callback]));\n} // Returns an array of binding components for\n// {@link Observable#bind} from a set of iterable observables.\n//\n// @param {Array.} observables\n// @param {String} attribute\n// @returns {Array.}\n\n\nfunction getBindingTargets(observables, attribute) {\n var observableAndAttributePairs = observables.map(function (observable) {\n return [observable, attribute];\n }); // Merge pairs to one-dimension array of observables and attributes.\n\n return Array.prototype.concat.apply([], observableAndAttributePairs);\n} // Check if all entries of the array are of `String` type.\n//\n// @private\n// @param {Array} arr An array to be checked.\n// @returns {Boolean}\n\n\nfunction isStringArray(arr) {\n return arr.every(function (a) {\n return typeof a == 'string';\n });\n} // Parses and validates {@link Observable#bind}`.to( args )` arguments and returns\n// an object with a parsed structure. For example\n//\n//\t\tA.bind( 'x' ).to( B, 'a', C, 'b', call );\n//\n// becomes\n//\n//\t\t{\n//\t\t\tto: [\n//\t\t\t\t{ observable: B, properties: [ 'a' ] },\n//\t\t\t\t{ observable: C, properties: [ 'b' ] },\n//\t\t\t],\n//\t\t\tcallback: call\n// \t\t}\n//\n// @private\n// @param {...*} args Arguments of {@link Observable#bind}`.to( args )`.\n// @returns {Object}\n\n\nfunction parseBindToArgs() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n // Eliminate A.bind( 'x' ).to()\n if (!args.length) {\n /**\n * Invalid argument syntax in `to()`.\n *\n * @error observable-bind-to-parse-error\n */\n throw new CKEditorError('observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null);\n }\n\n var parsed = {\n to: []\n };\n var lastObservable;\n\n if (typeof args[args.length - 1] == 'function') {\n parsed.callback = args.pop();\n }\n\n args.forEach(function (a) {\n if (typeof a == 'string') {\n lastObservable.properties.push(a);\n } else if (_typeof(a) == 'object') {\n lastObservable = {\n observable: a,\n properties: []\n };\n parsed.to.push(lastObservable);\n } else {\n throw new CKEditorError('observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null);\n }\n });\n return parsed;\n} // Synchronizes {@link module:utils/observablemixin#_boundObservables} with {@link Binding}.\n//\n// @private\n// @param {Binding} binding A binding to store in {@link Observable#_boundObservables}.\n// @param {Observable} toObservable A observable, which is a new component of `binding`.\n// @param {String} toPropertyName A name of `toObservable`'s property, a new component of the `binding`.\n\n\nfunction updateBoundObservables(observable, binding, toObservable, toPropertyName) {\n var boundObservables = observable[boundObservablesSymbol];\n var bindingsToObservable = boundObservables.get(toObservable);\n var bindings = bindingsToObservable || {};\n\n if (!bindings[toPropertyName]) {\n bindings[toPropertyName] = new Set();\n } // Pass the binding to a corresponding Set in `observable._boundObservables`.\n\n\n bindings[toPropertyName].add(binding);\n\n if (!bindingsToObservable) {\n boundObservables.set(toObservable, bindings);\n }\n} // Synchronizes {@link Observable#_boundProperties} and {@link Observable#_boundObservables}\n// with {@link BindChain}.\n//\n// Assuming the following binding being created\n//\n// \t\tA.bind( 'a', 'b' ).to( B, 'x', 'y' );\n//\n// the following bindings were initialized by {@link Observable#bind} in {@link BindChain#_bindings}:\n//\n// \t\t{\n// \t\t\ta: { observable: A, property: 'a', to: [] },\n// \t\t\tb: { observable: A, property: 'b', to: [] },\n// \t\t}\n//\n// Iterate over all bindings in this chain and fill their `to` properties with\n// corresponding to( ... ) arguments (components of the binding), so\n//\n// \t\t{\n// \t\t\ta: { observable: A, property: 'a', to: [ B, 'x' ] },\n// \t\t\tb: { observable: A, property: 'b', to: [ B, 'y' ] },\n// \t\t}\n//\n// Then update the structure of {@link Observable#_boundObservables} with updated\n// binding, so it becomes:\n//\n// \t\tMap( {\n// \t\t\tB: {\n// \t\t\t\tx: Set( [\n// \t\t\t\t\t{ observable: A, property: 'a', to: [ [ B, 'x' ] ] }\n// \t\t\t\t] ),\n// \t\t\t\ty: Set( [\n// \t\t\t\t\t{ observable: A, property: 'b', to: [ [ B, 'y' ] ] },\n// \t\t\t\t] )\n//\t\t\t}\n// \t\t} )\n//\n// @private\n// @param {BindChain} chain The binding initialized by {@link Observable#bind}.\n\n\nfunction updateBindToBound(chain) {\n var toProperty;\n\n chain._bindings.forEach(function (binding, propertyName) {\n // Note: For a binding without a callback, this will run only once\n // like in A.bind( 'x', 'y' ).to( B, 'a', 'b' )\n // TODO: ES6 destructuring.\n chain._to.forEach(function (to) {\n toProperty = to.properties[binding.callback ? 0 : chain._bindProperties.indexOf(propertyName)];\n binding.to.push([to.observable, toProperty]);\n updateBoundObservables(chain._observable, binding, to.observable, toProperty);\n });\n });\n} // Updates an property of a {@link Observable} with a value\n// determined by an entry in {@link Observable#_boundProperties}.\n//\n// @private\n// @param {Observable} observable A observable which property is to be updated.\n// @param {String} propertyName An property to be updated.\n\n\nfunction updateBoundObservableProperty(observable, propertyName) {\n var boundProperties = observable[boundPropertiesSymbol];\n var binding = boundProperties.get(propertyName);\n var propertyValue; // When a binding with callback is created like\n //\n // \t\tA.bind( 'a' ).to( B, 'b', C, 'c', callback );\n //\n // collect B.b and C.c, then pass them to callback to set A.a.\n\n if (binding.callback) {\n propertyValue = binding.callback.apply(observable, binding.to.map(function (to) {\n return to[0][to[1]];\n }));\n } else {\n propertyValue = binding.to[0];\n propertyValue = propertyValue[0][propertyValue[1]];\n }\n\n if (observable.hasOwnProperty(propertyName)) {\n observable[propertyName] = propertyValue;\n } else {\n observable.set(propertyName, propertyValue);\n }\n} // Starts listening to changes in {@link BindChain._to} observables to update\n// {@link BindChain._observable} {@link BindChain._bindProperties}. Also sets the\n// initial state of {@link BindChain._observable}.\n//\n// @private\n// @param {BindChain} chain The chain initialized by {@link Observable#bind}.\n\n\nfunction attachBindToListeners(observable, toBindings) {\n toBindings.forEach(function (to) {\n var boundObservables = observable[boundObservablesSymbol];\n var bindings; // If there's already a chain between the observables (`observable` listens to\n // `to.observable`), there's no need to create another `change` event listener.\n\n if (!boundObservables.get(to.observable)) {\n observable.listenTo(to.observable, 'change', function (evt, propertyName) {\n bindings = boundObservables.get(to.observable)[propertyName]; // Note: to.observable will fire for any property change, react\n // to changes of properties which are bound only.\n\n if (bindings) {\n bindings.forEach(function (binding) {\n updateBoundObservableProperty(observable, binding.property);\n });\n }\n });\n }\n });\n}\n/**\n * Interface which adds \"observable properties\" and data binding functionality.\n *\n * Can be easily implemented by a class by mixing the {@link module:utils/observablemixin~ObservableMixin} mixin.\n *\n * Read more about the usage of this interface in the:\n * * {@glink framework/guides/architecture/core-editor-architecture#event-system-and-observables \"Event system and observables\"}\n * section of the {@glink framework/guides/architecture/core-editor-architecture \"Core editor architecture\"} guide,\n * * {@glink framework/guides/deep-dive/observables \"Observables\" deep dive} guide.\n *\n * @interface Observable\n * @extends module:utils/emittermixin~Emitter\n */\n\n/**\n * Fired when a property changed value.\n *\n *\t\tobservable.set( 'prop', 1 );\n *\n *\t\tobservable.on( 'change:prop', ( evt, propertyName, newValue, oldValue ) => {\n *\t\t\tconsole.log( `${ propertyName } has changed from ${ oldValue } to ${ newValue }` );\n *\t\t} );\n *\n *\t\tobservable.prop = 2; // -> 'prop has changed from 1 to 2'\n *\n * @event change:{property}\n * @param {String} name The property name.\n * @param {*} value The new property value.\n * @param {*} oldValue The previous property value.\n */\n\n/**\n * Fired when a property value is going to be set but is not set yet (before the `change` event is fired).\n *\n * You can control the final value of the property by using\n * the {@link module:utils/eventinfo~EventInfo#return event's `return` property}.\n *\n *\t\tobservable.set( 'prop', 1 );\n *\n *\t\tobservable.on( 'set:prop', ( evt, propertyName, newValue, oldValue ) => {\n *\t\t\tconsole.log( `Value is going to be changed from ${ oldValue } to ${ newValue }` );\n *\t\t\tconsole.log( `Current property value is ${ observable[ propertyName ] }` );\n *\n *\t\t\t// Let's override the value.\n *\t\t\tevt.return = 3;\n *\t\t} );\n *\n *\t\tobservable.on( 'change:prop', ( evt, propertyName, newValue, oldValue ) => {\n *\t\t\tconsole.log( `Value has changed from ${ oldValue } to ${ newValue }` );\n *\t\t} );\n *\n *\t\tobservable.prop = 2; // -> 'Value is going to be changed from 1 to 2'\n *\t\t // -> 'Current property value is 1'\n *\t\t // -> 'Value has changed from 1 to 3'\n *\n * **Note:** Event is fired even when the new value is the same as the old value.\n *\n * @event set:{property}\n * @param {String} name The property name.\n * @param {*} value The new property value.\n * @param {*} oldValue The previous property value.\n */\n\n/**\n * Creates and sets the value of an observable property of this object. Such an property becomes a part\n * of the state and is be observable.\n *\n * It accepts also a single object literal containing key/value pairs with properties to be set.\n *\n * This method throws the `observable-set-cannot-override` error if the observable instance already\n * have a property with the given property name. This prevents from mistakenly overriding existing\n * properties and methods, but means that `foo.set( 'bar', 1 )` may be slightly slower than `foo.bar = 1`.\n *\n * @method #set\n * @param {String|Object} name The property's name or object with `name=>value` pairs.\n * @param {*} [value] The property's value (if `name` was passed in the first parameter).\n */\n\n/**\n * Binds {@link #set observable properties} to other objects implementing the\n * {@link module:utils/observablemixin~Observable} interface.\n *\n * Read more in the {@glink framework/guides/deep-dive/observables#property-bindings dedicated guide}\n * covering the topic of property bindings with some additional examples.\n *\n * Consider two objects: a `button` and an associated `command` (both `Observable`).\n *\n * A simple property binding could be as follows:\n *\n *\t\tbutton.bind( 'isEnabled' ).to( command, 'isEnabled' );\n *\n * or even shorter:\n *\n *\t\tbutton.bind( 'isEnabled' ).to( command );\n *\n * which works in the following way:\n *\n * * `button.isEnabled` **instantly equals** `command.isEnabled`,\n * * whenever `command.isEnabled` changes, `button.isEnabled` will immediately reflect its value.\n *\n * **Note**: To release the binding, use {@link module:utils/observablemixin~Observable#unbind}.\n *\n * You can also \"rename\" the property in the binding by specifying the new name in the `to()` chain:\n *\n *\t\tbutton.bind( 'isEnabled' ).to( command, 'isWorking' );\n *\n * It is possible to bind more than one property at a time to shorten the code:\n *\n *\t\tbutton.bind( 'isEnabled', 'value' ).to( command );\n *\n * which corresponds to:\n *\n *\t\tbutton.bind( 'isEnabled' ).to( command );\n *\t\tbutton.bind( 'value' ).to( command );\n *\n * The binding can include more than one observable, combining multiple data sources in a custom callback:\n *\n *\t\tbutton.bind( 'isEnabled' ).to( command, 'isEnabled', ui, 'isVisible',\n *\t\t\t( isCommandEnabled, isUIVisible ) => isCommandEnabled && isUIVisible );\n *\n * It is also possible to bind to the same property in an array of observables.\n * To bind a `button` to multiple commands (also `Observables`) so that each and every one of them\n * must be enabled for the button to become enabled, use the following code:\n *\n *\t\tbutton.bind( 'isEnabled' ).toMany( [ commandA, commandB, commandC ], 'isEnabled',\n *\t\t\t( isAEnabled, isBEnabled, isCEnabled ) => isAEnabled && isBEnabled && isCEnabled );\n *\n * @method #bind\n * @param {...String} bindProperties Observable properties that will be bound to other observable(s).\n * @returns {Object} The bind chain with the `to()` and `toMany()` methods.\n */\n\n/**\n * Removes the binding created with {@link #bind}.\n *\n *\t\t// Removes the binding for the 'a' property.\n *\t\tA.unbind( 'a' );\n *\n *\t\t// Removes bindings for all properties.\n *\t\tA.unbind();\n *\n * @method #unbind\n * @param {...String} [unbindProperties] Observable properties to be unbound. All the bindings will\n * be released if no properties are provided.\n */\n\n/**\n * Turns the given methods of this object into event-based ones. This means that the new method will fire an event\n * (named after the method) and the original action will be plugged as a listener to that event.\n *\n * Read more in the {@glink framework/guides/deep-dive/observables#decorating-object-methods dedicated guide}\n * covering the topic of decorating methods with some additional examples.\n *\n * Decorating the method does not change its behavior (it only adds an event),\n * but it allows to modify it later on by listening to the method's event.\n *\n * For example, to cancel the method execution the event can be {@link module:utils/eventinfo~EventInfo#stop stopped}:\n *\n *\t\tclass Foo {\n *\t\t\tconstructor() {\n *\t\t\t\tthis.decorate( 'method' );\n *\t\t\t}\n *\n *\t\t\tmethod() {\n *\t\t\t\tconsole.log( 'called!' );\n *\t\t\t}\n *\t\t}\n *\n *\t\tconst foo = new Foo();\n *\t\tfoo.on( 'method', ( evt ) => {\n *\t\t\tevt.stop();\n *\t\t}, { priority: 'high' } );\n *\n *\t\tfoo.method(); // Nothing is logged.\n *\n *\n * **Note**: The high {@link module:utils/priorities~PriorityString priority} listener\n * has been used to execute this particular callback before the one which calls the original method\n * (which uses the \"normal\" priority).\n *\n * It is also possible to change the returned value:\n *\n *\t\tfoo.on( 'method', ( evt ) => {\n *\t\t\tevt.return = 'Foo!';\n *\t\t} );\n *\n *\t\tfoo.method(); // -> 'Foo'\n *\n * Finally, it is possible to access and modify the arguments the method is called with:\n *\n *\t\tmethod( a, b ) {\n *\t\t\tconsole.log( `${ a }, ${ b }` );\n *\t\t}\n *\n *\t\t// ...\n *\n *\t\tfoo.on( 'method', ( evt, args ) => {\n *\t\t\targs[ 0 ] = 3;\n *\n *\t\t\tconsole.log( args[ 1 ] ); // -> 2\n *\t\t}, { priority: 'high' } );\n *\n *\t\tfoo.method( 1, 2 ); // -> '3, 2'\n *\n * @method #decorate\n * @param {String} methodName Name of the method to decorate.\n */","import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/editableelement\n */\nimport ContainerElement from \"./containerelement\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport mix from '@ckeditor/ckeditor5-utils/src/mix';\nimport ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';\nvar documentSymbol = Symbol('document');\n/**\n * Editable element which can be a {@link module:engine/view/rooteditableelement~RootEditableElement root}\n * or nested editable area in the editor.\n *\n * Editable is automatically read-only when its {@link module:engine/view/document~Document Document} is read-only.\n *\n * The constructor of this class shouldn't be used directly. To create new `EditableElement` use the\n * {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.\n *\n * @extends module:engine/view/containerelement~ContainerElement\n * @mixes module:utils/observablemixin~ObservableMixin\n */\n\nvar EditableElement =\n/*#__PURE__*/\nfunction (_ContainerElement) {\n _inherits(EditableElement, _ContainerElement);\n\n /**\n * Creates an editable element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#createEditableElement\n * @protected\n */\n function EditableElement(name, attrs, children) {\n var _this;\n\n _classCallCheck(this, EditableElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(EditableElement).call(this, name, attrs, children));\n /**\n * Whether the editable is in read-write or read-only mode.\n *\n * @observable\n * @member {Boolean} module:engine/view/editableelement~EditableElement#isReadOnly\n */\n\n _this.set('isReadOnly', false);\n /**\n * Whether the editable is focused.\n *\n * This property updates when {@link module:engine/view/document~Document#isFocused document.isFocused} or view\n * selection is changed.\n *\n * @readonly\n * @observable\n * @member {Boolean} module:engine/view/editableelement~EditableElement#isFocused\n */\n\n\n _this.set('isFocused', false);\n /**\n * The {@link module:engine/view/document~Document} which is an owner of this root.\n * Can only by set once.\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-editableelement-document-already-set`\n * when document is already set.\n *\n * @member {module:engine/view/document~Document} #document\n */\n\n\n return _this;\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\teditableElement.is( 'editableElement' ); // -> true\n *\t\teditableElement.is( 'element' ); // -> true\n *\t\teditableElement.is( 'node' ); // -> true\n *\t\teditableElement.is( 'view:editableElement' ); // -> true\n *\t\teditableElement.is( 'view:element' ); // -> true\n *\t\teditableElement.is( 'view:node' ); // -> true\n *\n *\t\teditableElement.is( 'model:element' ); // -> false\n *\t\teditableElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is an editbale element, you can also check its\n * {@link module:engine/view/editableelement~EditableElement#name name}:\n *\n *\t\teditableElement.is( 'div' ); // -> true if this is a div element\n *\t\teditableElement.is( 'editableElement', 'div' ); // -> same as above\n *\t\ttext.is( 'div' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n\n _createClass(EditableElement, [{\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type && type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'editableElement' || _get(_getPrototypeOf(EditableElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'editableElement' && name == this.name || _get(_getPrototypeOf(EditableElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopListening();\n }\n /**\n * Returns document associated with the editable.\n *\n * @readonly\n * @returns {module:engine/view/document~Document}\n */\n\n }, {\n key: \"document\",\n get: function get() {\n return this.getCustomProperty(documentSymbol);\n }\n /**\n * Sets document of this editable element.\n *\n * @protected\n * @param {module:engine/view/document~Document} document\n */\n\n }, {\n key: \"_document\",\n set: function set(document) {\n var _this2 = this;\n\n if (this.getCustomProperty(documentSymbol)) {\n /**\n * View document is already set. It can only be set once.\n *\n * @error view-editableelement-document-already-set\n */\n throw new CKEditorError('view-editableelement-document-already-set: View document is already set.', this);\n }\n\n this._setCustomProperty(documentSymbol, document);\n\n this.bind('isReadOnly').to(document);\n this.bind('isFocused').to(document, 'isFocused', function (isFocused) {\n return isFocused && document.selection.editableElement == _this2;\n }); // Update focus state based on selection changes.\n\n this.listenTo(document.selection, 'change', function () {\n _this2.isFocused = document.isFocused && document.selection.editableElement == _this2;\n });\n }\n }]);\n\n return EditableElement;\n}(ContainerElement);\n\nexport { EditableElement as default };\nmix(EditableElement, ObservableMixin);","import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/rooteditableelement\n */\nimport EditableElement from \"./editableelement\";\nvar rootNameSymbol = Symbol('rootName');\n/**\n * Class representing a single root in the data view. A root can be either {@link ~RootEditableElement#isReadOnly editable or read-only},\n * but in both cases it is called \"an editable\". Roots can contain other {@link module:engine/view/editableelement~EditableElement\n * editable elements} making them \"nested editables\".\n *\n * @extends module:engine/view/editableelement~EditableElement\n */\n\nvar RootEditableElement =\n/*#__PURE__*/\nfunction (_EditableElement) {\n _inherits(RootEditableElement, _EditableElement);\n\n /**\n * Creates root editable element.\n *\n * @param {String} name Node name.\n */\n function RootEditableElement(name) {\n var _this;\n\n _classCallCheck(this, RootEditableElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(RootEditableElement).call(this, name));\n /**\n * Name of this root inside {@link module:engine/view/document~Document} that is an owner of this root. If no\n * other name is set, `main` name is used.\n *\n * @readonly\n * @member {String}\n */\n\n _this.rootName = 'main';\n return _this;\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\trootEditableElement.is( 'rootEditableElement' ); // -> true\n *\t\trootEditableElement.is( 'editableElement' ); // -> true\n *\t\trootEditableElement.is( 'element' ); // -> true\n *\t\trootEditableElement.is( 'node' ); // -> true\n *\t\trootEditableElement.is( 'view:rootEditableElement' ); // -> true\n *\t\trootEditableElement.is( 'view:editableElement' ); // -> true\n *\t\trootEditableElement.is( 'view:element' ); // -> true\n *\t\trootEditableElement.is( 'view:node' ); // -> true\n *\n *\t\trootEditableElement.is( 'model:element' ); // -> false\n *\t\trootEditableElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is a root editbale element, you can also check its\n * {@link module:engine/view/rooteditableelement~RootEditableElement#name name}:\n *\n *\t\trootEditableElement.is( 'div' ); // -> true if this is a div root editable element\n *\t\trootEditableElement.is( 'rootEditableElement', 'div' ); // -> same as above\n *\t\ttext.is( 'div' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n\n _createClass(RootEditableElement, [{\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'rootElement' || _get(_getPrototypeOf(RootEditableElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'rootElement' && name == this.name || _get(_getPrototypeOf(RootEditableElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n }, {\n key: \"rootName\",\n get: function get() {\n return this.getCustomProperty(rootNameSymbol);\n },\n set: function set(rootName) {\n this._setCustomProperty(rootNameSymbol, rootName);\n }\n /**\n * Overrides old element name and sets new one.\n * This is needed because view roots are created before they are attached to the DOM.\n * The name of the root element is temporary at this stage. It has to be changed when the\n * view root element is attached to the DOM element.\n *\n * @protected\n * @param {String} name The new name of element.\n */\n\n }, {\n key: \"_name\",\n set: function set(name) {\n this.name = name;\n }\n }]);\n\n return RootEditableElement;\n}(EditableElement);\n\nexport { RootEditableElement as default };","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/treewalker\n */\nimport Element from \"./element\";\nimport Text from \"./text\";\nimport TextProxy from \"./textproxy\";\nimport Position from \"./position\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\n/**\n * Position iterator class. It allows to iterate forward and backward over the document.\n */\n\nvar TreeWalker =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates a range iterator. All parameters are optional, but you have to specify either `boundaries` or `startPosition`.\n *\n * @constructor\n * @param {Object} options Object with configuration.\n * @param {module:engine/view/range~Range} [options.boundaries=null] Range to define boundaries of the iterator.\n * @param {module:engine/view/position~Position} [options.startPosition] Starting position.\n * @param {'forward'|'backward'} [options.direction='forward'] Walking direction.\n * @param {Boolean} [options.singleCharacters=false] Flag indicating whether all characters from\n * {@link module:engine/view/text~Text} should be returned as one {@link module:engine/view/text~Text} (`false`) ore one by one as\n * {@link module:engine/view/textproxy~TextProxy} (`true`).\n * @param {Boolean} [options.shallow=false] Flag indicating whether iterator should enter elements or not. If the\n * iterator is shallow child nodes of any iterated node will not be returned along with `elementEnd` tag.\n * @param {Boolean} [options.ignoreElementEnd=false] Flag indicating whether iterator should ignore `elementEnd`\n * tags. If the option is true walker will not return a parent node of start position. If this option is `true`\n * each {@link module:engine/view/element~Element} will be returned once, while if the option is `false` they might be returned\n * twice: for `'elementStart'` and `'elementEnd'`.\n */\n function TreeWalker() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, TreeWalker);\n\n if (!options.boundaries && !options.startPosition) {\n /**\n * Neither boundaries nor starting position have been defined.\n *\n * @error view-tree-walker-no-start-position\n */\n throw new CKEditorError('view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.', null);\n }\n\n if (options.direction && options.direction != 'forward' && options.direction != 'backward') {\n throw new CKEditorError('view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.', options.startPosition, {\n direction: options.direction\n });\n }\n /**\n * Iterator boundaries.\n *\n * When the iterator is walking `'forward'` on the end of boundary or is walking `'backward'`\n * on the start of boundary, then `{ done: true }` is returned.\n *\n * If boundaries are not defined they are set before first and after last child of the root node.\n *\n * @readonly\n * @member {module:engine/view/range~Range} module:engine/view/treewalker~TreeWalker#boundaries\n */\n\n\n this.boundaries = options.boundaries || null;\n /**\n * Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is\n * `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.\n *\n * @readonly\n * @member {module:engine/view/position~Position} module:engine/view/treewalker~TreeWalker#position\n */\n\n if (options.startPosition) {\n this.position = Position._createAt(options.startPosition);\n } else {\n this.position = Position._createAt(options.boundaries[options.direction == 'backward' ? 'end' : 'start']);\n }\n /**\n * Walking direction. Defaults `'forward'`.\n *\n * @readonly\n * @member {'backward'|'forward'} module:engine/view/treewalker~TreeWalker#direction\n */\n\n\n this.direction = options.direction || 'forward';\n /**\n * Flag indicating whether all characters from {@link module:engine/view/text~Text} should be returned as one\n * {@link module:engine/view/text~Text} or one by one as {@link module:engine/view/textproxy~TextProxy}.\n *\n * @readonly\n * @member {Boolean} module:engine/view/treewalker~TreeWalker#singleCharacters\n */\n\n this.singleCharacters = !!options.singleCharacters;\n /**\n * Flag indicating whether iterator should enter elements or not. If the iterator is shallow child nodes of any\n * iterated node will not be returned along with `elementEnd` tag.\n *\n * @readonly\n * @member {Boolean} module:engine/view/treewalker~TreeWalker#shallow\n */\n\n this.shallow = !!options.shallow;\n /**\n * Flag indicating whether iterator should ignore `elementEnd` tags. If set to `true`, walker will not\n * return a parent node of the start position. Each {@link module:engine/view/element~Element} will be returned once.\n * When set to `false` each element might be returned twice: for `'elementStart'` and `'elementEnd'`.\n *\n * @readonly\n * @member {Boolean} module:engine/view/treewalker~TreeWalker#ignoreElementEnd\n */\n\n this.ignoreElementEnd = !!options.ignoreElementEnd;\n /**\n * Start boundary parent.\n *\n * @private\n * @member {module:engine/view/node~Node} module:engine/view/treewalker~TreeWalker#_boundaryStartParent\n */\n\n this._boundaryStartParent = this.boundaries ? this.boundaries.start.parent : null;\n /**\n * End boundary parent.\n *\n * @private\n * @member {module:engine/view/node~Node} module:engine/view/treewalker~TreeWalker#_boundaryEndParent\n */\n\n this._boundaryEndParent = this.boundaries ? this.boundaries.end.parent : null;\n }\n /**\n * Iterable interface.\n *\n * @returns {Iterable.}\n */\n\n\n _createClass(TreeWalker, [{\n key: Symbol.iterator,\n value: function value() {\n return this;\n }\n /**\n * Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.\n *\n * For example:\n *\n * \t\twalker.skip( value => value.type == 'text' ); // {}foo
-> foo[]
\n * \t\twalker.skip( value => true ); // Move the position to the end: {}foo
-> foo
[]\n * \t\twalker.skip( value => false ); // Do not move the position.\n *\n * @param {Function} skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should\n * return `true` if the value should be skipped or `false` if not.\n */\n\n }, {\n key: \"skip\",\n value: function skip(_skip) {\n var done, value, prevPosition;\n\n do {\n prevPosition = this.position;\n\n var _this$next = this.next();\n\n done = _this$next.done;\n value = _this$next.value;\n } while (!done && _skip(value));\n\n if (!done) {\n this.position = prevPosition;\n }\n }\n /**\n * Gets the next tree walker's value.\n *\n * @returns {module:engine/view/treewalker~TreeWalkerValue} Object implementing iterator interface, returning\n * information about taken step.\n */\n\n }, {\n key: \"next\",\n value: function next() {\n if (this.direction == 'forward') {\n return this._next();\n } else {\n return this._previous();\n }\n }\n /**\n * Makes a step forward in view. Moves the {@link #position} to the next position and returns the encountered value.\n *\n * @private\n * @returns {Object}\n * @returns {Boolean} return.done `true` if iterator is done, `false` otherwise.\n * @returns {module:engine/view/treewalker~TreeWalkerValue} return.value Information about taken step.\n */\n\n }, {\n key: \"_next\",\n value: function _next() {\n var position = this.position.clone();\n var previousPosition = this.position;\n var parent = position.parent; // We are at the end of the root.\n\n if (parent.parent === null && position.offset === parent.childCount) {\n return {\n done: true\n };\n } // We reached the walker boundary.\n\n\n if (parent === this._boundaryEndParent && position.offset == this.boundaries.end.offset) {\n return {\n done: true\n };\n } // Get node just after current position.\n\n\n var node; // Text is a specific parent because it contains string instead of child nodes.\n\n if (parent instanceof Text) {\n if (position.isAtEnd) {\n // Prevent returning \"elementEnd\" for Text node. Skip that value and return the next walker step.\n this.position = Position._createAfter(parent);\n return this._next();\n }\n\n node = parent.data[position.offset];\n } else {\n node = parent.getChild(position.offset);\n }\n\n if (node instanceof Element) {\n if (!this.shallow) {\n position = new Position(node, 0);\n } else {\n position.offset++;\n }\n\n this.position = position;\n return this._formatReturnValue('elementStart', node, previousPosition, position, 1);\n } else if (node instanceof Text) {\n if (this.singleCharacters) {\n position = new Position(node, 0);\n this.position = position;\n return this._next();\n } else {\n var charactersCount = node.data.length;\n var item; // If text stick out of walker range, we need to cut it and wrap in TextProxy.\n\n if (node == this._boundaryEndParent) {\n charactersCount = this.boundaries.end.offset;\n item = new TextProxy(node, 0, charactersCount);\n position = Position._createAfter(item);\n } else {\n item = new TextProxy(node, 0, node.data.length); // If not just keep moving forward.\n\n position.offset++;\n }\n\n this.position = position;\n return this._formatReturnValue('text', item, previousPosition, position, charactersCount);\n }\n } else if (typeof node == 'string') {\n var textLength;\n\n if (this.singleCharacters) {\n textLength = 1;\n } else {\n // Check if text stick out of walker range.\n var endOffset = parent === this._boundaryEndParent ? this.boundaries.end.offset : parent.data.length;\n textLength = endOffset - position.offset;\n }\n\n var textProxy = new TextProxy(parent, position.offset, textLength);\n position.offset += textLength;\n this.position = position;\n return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);\n } else {\n // `node` is not set, we reached the end of current `parent`.\n position = Position._createAfter(parent);\n this.position = position;\n\n if (this.ignoreElementEnd) {\n return this._next();\n } else {\n return this._formatReturnValue('elementEnd', parent, previousPosition, position);\n }\n }\n }\n /**\n * Makes a step backward in view. Moves the {@link #position} to the previous position and returns the encountered value.\n *\n * @private\n * @returns {Object}\n * @returns {Boolean} return.done True if iterator is done.\n * @returns {module:engine/view/treewalker~TreeWalkerValue} return.value Information about taken step.\n */\n\n }, {\n key: \"_previous\",\n value: function _previous() {\n var position = this.position.clone();\n var previousPosition = this.position;\n var parent = position.parent; // We are at the beginning of the root.\n\n if (parent.parent === null && position.offset === 0) {\n return {\n done: true\n };\n } // We reached the walker boundary.\n\n\n if (parent == this._boundaryStartParent && position.offset == this.boundaries.start.offset) {\n return {\n done: true\n };\n } // Get node just before current position.\n\n\n var node; // Text {@link module:engine/view/text~Text} element is a specific parent because contains string instead of child nodes.\n\n if (parent instanceof Text) {\n if (position.isAtStart) {\n // Prevent returning \"elementStart\" for Text node. Skip that value and return the next walker step.\n this.position = Position._createBefore(parent);\n return this._previous();\n }\n\n node = parent.data[position.offset - 1];\n } else {\n node = parent.getChild(position.offset - 1);\n }\n\n if (node instanceof Element) {\n if (!this.shallow) {\n position = new Position(node, node.childCount);\n this.position = position;\n\n if (this.ignoreElementEnd) {\n return this._previous();\n } else {\n return this._formatReturnValue('elementEnd', node, previousPosition, position);\n }\n } else {\n position.offset--;\n this.position = position;\n return this._formatReturnValue('elementStart', node, previousPosition, position, 1);\n }\n } else if (node instanceof Text) {\n if (this.singleCharacters) {\n position = new Position(node, node.data.length);\n this.position = position;\n return this._previous();\n } else {\n var charactersCount = node.data.length;\n var item; // If text stick out of walker range, we need to cut it and wrap in TextProxy.\n\n if (node == this._boundaryStartParent) {\n var offset = this.boundaries.start.offset;\n item = new TextProxy(node, offset, node.data.length - offset);\n charactersCount = item.data.length;\n position = Position._createBefore(item);\n } else {\n item = new TextProxy(node, 0, node.data.length); // If not just keep moving backward.\n\n position.offset--;\n }\n\n this.position = position;\n return this._formatReturnValue('text', item, previousPosition, position, charactersCount);\n }\n } else if (typeof node == 'string') {\n var textLength;\n\n if (!this.singleCharacters) {\n // Check if text stick out of walker range.\n var startOffset = parent === this._boundaryStartParent ? this.boundaries.start.offset : 0;\n textLength = position.offset - startOffset;\n } else {\n textLength = 1;\n }\n\n position.offset -= textLength;\n var textProxy = new TextProxy(parent, position.offset, textLength);\n this.position = position;\n return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);\n } else {\n // `node` is not set, we reached the beginning of current `parent`.\n position = Position._createBefore(parent);\n this.position = position;\n return this._formatReturnValue('elementStart', parent, previousPosition, position, 1);\n }\n }\n /**\n * Format returned data and adjust `previousPosition` and `nextPosition` if reach the bound of the {@link module:engine/view/text~Text}.\n *\n * @private\n * @param {module:engine/view/treewalker~TreeWalkerValueType} type Type of step.\n * @param {module:engine/view/item~Item} item Item between old and new position.\n * @param {module:engine/view/position~Position} previousPosition Previous position of iterator.\n * @param {module:engine/view/position~Position} nextPosition Next position of iterator.\n * @param {Number} [length] Length of the item.\n * @returns {module:engine/view/treewalker~TreeWalkerValue}\n */\n\n }, {\n key: \"_formatReturnValue\",\n value: function _formatReturnValue(type, item, previousPosition, nextPosition, length) {\n // Text is a specific parent, because contains string instead of children.\n // Walker doesn't enter to the Text except situations when walker is iterating over every single character,\n // or the bound starts/ends inside the Text. So when the position is at the beginning or at the end of the Text\n // we move it just before or just after Text.\n if (item instanceof TextProxy) {\n // Position is at the end of Text.\n if (item.offsetInText + item.data.length == item.textNode.data.length) {\n if (this.direction == 'forward' && !(this.boundaries && this.boundaries.end.isEqual(this.position))) {\n nextPosition = Position._createAfter(item.textNode); // When we change nextPosition of returned value we need also update walker current position.\n\n this.position = nextPosition;\n } else {\n previousPosition = Position._createAfter(item.textNode);\n }\n } // Position is at the begining ot the text.\n\n\n if (item.offsetInText === 0) {\n if (this.direction == 'backward' && !(this.boundaries && this.boundaries.start.isEqual(this.position))) {\n nextPosition = Position._createBefore(item.textNode); // When we change nextPosition of returned value we need also update walker current position.\n\n this.position = nextPosition;\n } else {\n previousPosition = Position._createBefore(item.textNode);\n }\n }\n }\n\n return {\n done: false,\n value: {\n type: type,\n item: item,\n previousPosition: previousPosition,\n nextPosition: nextPosition,\n length: length\n }\n };\n }\n }]);\n\n return TreeWalker;\n}();\n/**\n * Type of the step made by {@link module:engine/view/treewalker~TreeWalker}.\n * Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end\n * of node, or `'text'` if walker traversed over single and multiple characters.\n * For {@link module:engine/view/text~Text} `elementStart` and `elementEnd` is not returned.\n *\n * @typedef {String} module:engine/view/treewalker~TreeWalkerValueType\n */\n\n/**\n * Object returned by {@link module:engine/view/treewalker~TreeWalker} when traversing tree view.\n *\n * @typedef {Object} module:engine/view/treewalker~TreeWalkerValue\n * @property {module:engine/view/treewalker~TreeWalkerValueType} type\n * @property {module:engine/view/item~Item} item Item between the old and the new positions\n * of the tree walker.\n * @property {module:engine/view/position~Position} previousPosition Previous position of the iterator.\n * * Forward iteration: For `'elementEnd'` it is the last position inside the element. For all other types it is the\n * position before the item.\n * * Backward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is\n * the position after item.\n * * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the\n * inside of the text to its parent just before or just after that text.\n * @property {module:engine/view/position~Position} nextPosition Next position of the iterator.\n * * Forward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is\n * the position after the item.\n * * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position\n * before the item.\n * * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the\n * inside of the text to its parent just before or just after that text.\n * @property {Number} [length] Length of the item. For `'elementStart'` it is `1`. For `'text'` it is\n * the length of that text. For `'elementEnd'` it is `undefined`.\n */\n\n/**\n * Tree walking directions.\n *\n * @typedef {'forward'|'backward'} module:engine/view/treewalker~TreeWalkerDirection\n */\n\n\nexport { TreeWalker as default };","import _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/position\n */\nimport TreeWalker from \"./treewalker\";\nimport compareArrays from '@ckeditor/ckeditor5-utils/src/comparearrays';\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport EditableElement from \"./editableelement\"; // To check if component is loaded more than once.\n\nimport '@ckeditor/ckeditor5-utils/src/version';\n/**\n * Position in the view tree. Position is represented by its parent node and an offset in this parent.\n *\n * In order to create a new position instance use the `createPosition*()` factory methods available in:\n *\n * * {@link module:engine/view/view~View}\n * * {@link module:engine/view/downcastwriter~DowncastWriter}\n * * {@link module:engine/view/upcastwriter~UpcastWriter}\n */\n\nvar Position =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates a position.\n *\n * @param {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment} parent Position parent.\n * @param {Number} offset Position offset.\n */\n function Position(parent, offset) {\n _classCallCheck(this, Position);\n\n /**\n * Position parent.\n *\n * @readonly\n * @member {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment}\n * module:engine/view/position~Position#parent\n */\n this.parent = parent;\n /**\n * Position offset.\n *\n * @readonly\n * @member {Number} module:engine/view/position~Position#offset\n */\n\n this.offset = offset;\n }\n /**\n * Node directly after the position. Equals `null` when there is no node after position or position is located\n * inside text node.\n *\n * @readonly\n * @type {module:engine/view/node~Node|null}\n */\n\n\n _createClass(Position, [{\n key: \"getShiftedBy\",\n\n /**\n * Returns a new instance of Position with offset incremented by `shift` value.\n *\n * @param {Number} shift How position offset should get changed. Accepts negative values.\n * @returns {module:engine/view/position~Position} Shifted position.\n */\n value: function getShiftedBy(shift) {\n var shifted = Position._createAt(this);\n\n var offset = shifted.offset + shift;\n shifted.offset = offset < 0 ? 0 : offset;\n return shifted;\n }\n /**\n * Gets the farthest position which matches the callback using\n * {@link module:engine/view/treewalker~TreeWalker TreeWalker}.\n *\n * For example:\n *\n * \t\tgetLastMatchingPosition( value => value.type == 'text' ); // {}foo
-> foo[]
\n * \t\tgetLastMatchingPosition( value => value.type == 'text', { direction: 'backward' } ); // foo[]
-> {}foo
\n * \t\tgetLastMatchingPosition( value => false ); // Do not move the position.\n *\n * @param {Function} skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should\n * return `true` if the value should be skipped or `false` if not.\n * @param {Object} options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.\n *\n * @returns {module:engine/view/position~Position} The position after the last item which matches the `skip` callback test.\n */\n\n }, {\n key: \"getLastMatchingPosition\",\n value: function getLastMatchingPosition(skip) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n options.startPosition = this;\n var treeWalker = new TreeWalker(options);\n treeWalker.skip(skip);\n return treeWalker.position;\n }\n /**\n * Returns ancestors array of this position, that is this position's parent and it's ancestors.\n *\n * @returns {Array} Array with ancestors.\n */\n\n }, {\n key: \"getAncestors\",\n value: function getAncestors() {\n if (this.parent.is('documentFragment')) {\n return [this.parent];\n } else {\n return this.parent.getAncestors({\n includeSelf: true\n });\n }\n }\n /**\n * Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}\n * which is a common ancestor of both positions.\n *\n * @param {module:engine/view/position~Position} position\n * @returns {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment|null}\n */\n\n }, {\n key: \"getCommonAncestor\",\n value: function getCommonAncestor(position) {\n var ancestorsA = this.getAncestors();\n var ancestorsB = position.getAncestors();\n var i = 0;\n\n while (ancestorsA[i] == ancestorsB[i] && ancestorsA[i]) {\n i++;\n }\n\n return i === 0 ? null : ancestorsA[i - 1];\n }\n /**\n * Checks whether this object is of the given type.\n *\n *\t\tposition.is( 'position' ); // -> true\n *\t\tposition.is( 'view:position' ); // -> true\n *\n *\t\tposition.is( 'model:position' ); // -> false\n *\t\tposition.is( 'element' ); // -> false\n *\t\tposition.is( 'range' ); // -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type\n * @returns {Boolean}\n */\n\n }, {\n key: \"is\",\n value: function is(type) {\n return type == 'position' || type == 'view:position';\n }\n /**\n * Checks whether this position equals given position.\n *\n * @param {module:engine/view/position~Position} otherPosition Position to compare with.\n * @returns {Boolean} True if positions are same.\n */\n\n }, {\n key: \"isEqual\",\n value: function isEqual(otherPosition) {\n return this.parent == otherPosition.parent && this.offset == otherPosition.offset;\n }\n /**\n * Checks whether this position is located before given position. When method returns `false` it does not mean that\n * this position is after give one. Two positions may be located inside separate roots and in that situation this\n * method will still return `false`.\n *\n * @see module:engine/view/position~Position#isAfter\n * @see module:engine/view/position~Position#compareWith\n * @param {module:engine/view/position~Position} otherPosition Position to compare with.\n * @returns {Boolean} Returns `true` if this position is before given position.\n */\n\n }, {\n key: \"isBefore\",\n value: function isBefore(otherPosition) {\n return this.compareWith(otherPosition) == 'before';\n }\n /**\n * Checks whether this position is located after given position. When method returns `false` it does not mean that\n * this position is before give one. Two positions may be located inside separate roots and in that situation this\n * method will still return `false`.\n *\n * @see module:engine/view/position~Position#isBefore\n * @see module:engine/view/position~Position#compareWith\n * @param {module:engine/view/position~Position} otherPosition Position to compare with.\n * @returns {Boolean} Returns `true` if this position is after given position.\n */\n\n }, {\n key: \"isAfter\",\n value: function isAfter(otherPosition) {\n return this.compareWith(otherPosition) == 'after';\n }\n /**\n * Checks whether this position is before, after or in same position that other position. Two positions may be also\n * different when they are located in separate roots.\n *\n * @param {module:engine/view/position~Position} otherPosition Position to compare with.\n * @returns {module:engine/view/position~PositionRelation}\n */\n\n }, {\n key: \"compareWith\",\n value: function compareWith(otherPosition) {\n if (this.root !== otherPosition.root) {\n return 'different';\n }\n\n if (this.isEqual(otherPosition)) {\n return 'same';\n } // Get path from root to position's parent element.\n\n\n var thisPath = this.parent.is('node') ? this.parent.getPath() : [];\n var otherPath = otherPosition.parent.is('node') ? otherPosition.parent.getPath() : []; // Add the positions' offsets to the parents offsets.\n\n thisPath.push(this.offset);\n otherPath.push(otherPosition.offset); // Compare both path arrays to find common ancestor.\n\n var result = compareArrays(thisPath, otherPath);\n\n switch (result) {\n case 'prefix':\n return 'before';\n\n case 'extension':\n return 'after';\n\n default:\n return thisPath[result] < otherPath[result] ? 'before' : 'after';\n }\n }\n /**\n * Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this positions as a start position.\n *\n * @param {Object} options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}\n * @param {module:engine/view/range~Range} [options.boundaries=null] Range to define boundaries of the iterator.\n * @param {Boolean} [options.singleCharacters=false]\n * @param {Boolean} [options.shallow=false]\n * @param {Boolean} [options.ignoreElementEnd=false]\n */\n\n }, {\n key: \"getWalker\",\n value: function getWalker() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n options.startPosition = this;\n return new TreeWalker(options);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new Position(this.parent, this.offset);\n }\n /**\n * Creates position at the given location. The location can be specified as:\n *\n * * a {@link module:engine/view/position~Position position},\n * * parent element and offset (offset defaults to `0`),\n * * parent element and `'end'` (sets position at the end of that element),\n * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).\n *\n * This method is a shortcut to other constructors such as:\n *\n * * {@link module:engine/view/position~Position._createBefore},\n * * {@link module:engine/view/position~Position._createAfter}.\n *\n * @protected\n * @param {module:engine/view/item~Item|module:engine/view/position~Position} itemOrPosition\n * @param {Number|'end'|'before'|'after'} [offset] Offset or one of the flags. Used only when\n * first parameter is a {@link module:engine/view/item~Item view item}.\n */\n\n }, {\n key: \"nodeAfter\",\n get: function get() {\n if (this.parent.is('text')) {\n return null;\n }\n\n return this.parent.getChild(this.offset) || null;\n }\n /**\n * Node directly before the position. Equals `null` when there is no node before position or position is located\n * inside text node.\n *\n * @readonly\n * @type {module:engine/view/node~Node|null}\n */\n\n }, {\n key: \"nodeBefore\",\n get: function get() {\n if (this.parent.is('text')) {\n return null;\n }\n\n return this.parent.getChild(this.offset - 1) || null;\n }\n /**\n * Is `true` if position is at the beginning of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.\n *\n * @readonly\n * @type {Boolean}\n */\n\n }, {\n key: \"isAtStart\",\n get: function get() {\n return this.offset === 0;\n }\n /**\n * Is `true` if position is at the end of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.\n *\n * @readonly\n * @type {Boolean}\n */\n\n }, {\n key: \"isAtEnd\",\n get: function get() {\n var endOffset = this.parent.is('text') ? this.parent.data.length : this.parent.childCount;\n return this.offset === endOffset;\n }\n /**\n * Position's root, that is the root of the position's parent element.\n *\n * @readonly\n * @type {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment}\n */\n\n }, {\n key: \"root\",\n get: function get() {\n return this.parent.root;\n }\n /**\n * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this position, or `null` if\n * position is not inside an editable element.\n *\n * @type {module:engine/view/editableelement~EditableElement|null}\n */\n\n }, {\n key: \"editableElement\",\n get: function get() {\n var editable = this.parent;\n\n while (!(editable instanceof EditableElement)) {\n if (editable.parent) {\n editable = editable.parent;\n } else {\n return null;\n }\n }\n\n return editable;\n }\n }], [{\n key: \"_createAt\",\n value: function _createAt(itemOrPosition, offset) {\n if (itemOrPosition instanceof Position) {\n return new this(itemOrPosition.parent, itemOrPosition.offset);\n } else {\n var node = itemOrPosition;\n\n if (offset == 'end') {\n offset = node.is('text') ? node.data.length : node.childCount;\n } else if (offset == 'before') {\n return this._createBefore(node);\n } else if (offset == 'after') {\n return this._createAfter(node);\n } else if (offset !== 0 && !offset) {\n /**\n * {@link module:engine/view/view~View#createPositionAt `View#createPositionAt()`}\n * requires the offset to be specified when the first parameter is a view item.\n *\n * @error view-createPositionAt-offset-required\n */\n throw new CKEditorError('view-createPositionAt-offset-required: ' + 'View#createPositionAt() requires the offset when the first parameter is a view item.', node);\n }\n\n return new Position(node, offset);\n }\n }\n /**\n * Creates a new position after given view item.\n *\n * @protected\n * @param {module:engine/view/item~Item} item View item after which the position should be located.\n * @returns {module:engine/view/position~Position}\n */\n\n }, {\n key: \"_createAfter\",\n value: function _createAfter(item) {\n // TextProxy is not a instance of Node so we need do handle it in specific way.\n if (item.is('textProxy')) {\n return new Position(item.textNode, item.offsetInText + item.data.length);\n }\n\n if (!item.parent) {\n /**\n * You can not make a position after a root.\n *\n * @error view-position-after-root\n * @param {module:engine/view/node~Node} root\n */\n throw new CKEditorError('view-position-after-root: You can not make position after root.', item, {\n root: item\n });\n }\n\n return new Position(item.parent, item.index + 1);\n }\n /**\n * Creates a new position before given view item.\n *\n * @protected\n * @param {module:engine/view/item~Item} item View item before which the position should be located.\n * @returns {module:engine/view/position~Position}\n */\n\n }, {\n key: \"_createBefore\",\n value: function _createBefore(item) {\n // TextProxy is not a instance of Node so we need do handle it in specific way.\n if (item.is('textProxy')) {\n return new Position(item.textNode, item.offsetInText);\n }\n\n if (!item.parent) {\n /**\n * You cannot make a position before a root.\n *\n * @error view-position-before-root\n * @param {module:engine/view/node~Node} root\n */\n throw new CKEditorError('view-position-before-root: You can not make position before root.', item, {\n root: item\n });\n }\n\n return new Position(item.parent, item.index);\n }\n }]);\n\n return Position;\n}();\n/**\n * A flag indicating whether this position is `'before'` or `'after'` or `'same'` as given position.\n * If positions are in different roots `'different'` flag is returned.\n *\n * @typedef {String} module:engine/view/position~PositionRelation\n */\n\n\nexport { Position as default };","import \"core-js/modules/web.dom.iterable\";\nimport \"regenerator-runtime/runtime\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/range\n */\nimport Position from \"./position\";\nimport TreeWalker from \"./treewalker\";\n/**\n * Range in the view tree. A range is represented by its start and end {@link module:engine/view/position~Position positions}.\n *\n * In order to create a new position instance use the `createPosition*()` factory methods available in:\n *\n * * {@link module:engine/view/view~View}\n * * {@link module:engine/view/downcastwriter~DowncastWriter}\n * * {@link module:engine/view/upcastwriter~UpcastWriter}\n */\n\nvar Range =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates a range spanning from `start` position to `end` position.\n *\n * **Note:** Constructor creates it's own {@link module:engine/view/position~Position} instances basing on passed values.\n *\n * @param {module:engine/view/position~Position} start Start position.\n * @param {module:engine/view/position~Position} [end] End position. If not set, range will be collapsed at the `start` position.\n */\n function Range(start) {\n var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _classCallCheck(this, Range);\n\n /**\n * Start position.\n *\n * @readonly\n * @member {module:engine/view/position~Position}\n */\n this.start = start.clone();\n /**\n * End position.\n *\n * @readonly\n * @member {module:engine/view/position~Position}\n */\n\n this.end = end ? end.clone() : start.clone();\n }\n /**\n * Iterable interface.\n *\n * Iterates over all {@link module:engine/view/item~Item view items} that are in this range and returns\n * them together with additional information like length or {@link module:engine/view/position~Position positions},\n * grouped as {@link module:engine/view/treewalker~TreeWalkerValue}.\n *\n * This iterator uses {@link module:engine/view/treewalker~TreeWalker TreeWalker} with `boundaries` set to this range and\n * `ignoreElementEnd` option\n * set to `true`.\n *\n * @returns {Iterable.}\n */\n\n\n _createClass(Range, [{\n key: Symbol.iterator,\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function value() {\n return regeneratorRuntime.wrap(function value$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.delegateYield(new TreeWalker({\n boundaries: this,\n ignoreElementEnd: true\n }), \"t0\", 1);\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, value, this);\n })\n /**\n * Returns whether the range is collapsed, that is it start and end positions are equal.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"getEnlarged\",\n\n /**\n * Creates a maximal range that has the same content as this range but is expanded in both ways (at the beginning\n * and at the end).\n *\n * For example:\n *\n *\t\tFoo
{Bar}
-> Foo
[Bar]
\n *\t\tfoo{bar}
-> foo[bar]
\n *\n * Note that in the sample above:\n *\n * - `` have type of {@link module:engine/view/containerelement~ContainerElement},\n * - `` have type of {@link module:engine/view/attributeelement~AttributeElement},\n * - `` have type of {@link module:engine/view/uielement~UIElement}.\n *\n * @returns {module:engine/view/range~Range} Enlarged range.\n */\n value: function getEnlarged() {\n var start = this.start.getLastMatchingPosition(enlargeTrimSkip, {\n direction: 'backward'\n });\n var end = this.end.getLastMatchingPosition(enlargeTrimSkip); // Fix positions, in case if they are in Text node.\n\n if (start.parent.is('text') && start.isAtStart) {\n start = Position._createBefore(start.parent);\n }\n\n if (end.parent.is('text') && end.isAtEnd) {\n end = Position._createAfter(end.parent);\n }\n\n return new Range(start, end);\n }\n /**\n * Creates a minimum range that has the same content as this range but is trimmed in both ways (at the beginning\n * and at the end).\n *\n * For example:\n *\n *\t\tFoo
[Bar]
-> Foo
{Bar}
\n *\t\tfoo[bar]
-> foo{bar}
\n *\n * Note that in the sample above:\n *\n * - `` have type of {@link module:engine/view/containerelement~ContainerElement},\n * - `` have type of {@link module:engine/view/attributeelement~AttributeElement},\n * - `` have type of {@link module:engine/view/uielement~UIElement}.\n *\n * @returns {module:engine/view/range~Range} Shrink range.\n */\n\n }, {\n key: \"getTrimmed\",\n value: function getTrimmed() {\n var start = this.start.getLastMatchingPosition(enlargeTrimSkip);\n\n if (start.isAfter(this.end) || start.isEqual(this.end)) {\n return new Range(start, start);\n }\n\n var end = this.end.getLastMatchingPosition(enlargeTrimSkip, {\n direction: 'backward'\n });\n var nodeAfterStart = start.nodeAfter;\n var nodeBeforeEnd = end.nodeBefore; // Because TreeWalker prefers positions next to text node, we need to move them manually into these text nodes.\n\n if (nodeAfterStart && nodeAfterStart.is('text')) {\n start = new Position(nodeAfterStart, 0);\n }\n\n if (nodeBeforeEnd && nodeBeforeEnd.is('text')) {\n end = new Position(nodeBeforeEnd, nodeBeforeEnd.data.length);\n }\n\n return new Range(start, end);\n }\n /**\n * Two ranges are equal if their start and end positions are equal.\n *\n * @param {module:engine/view/range~Range} otherRange Range to compare with.\n * @returns {Boolean} `true` if ranges are equal, `false` otherwise\n */\n\n }, {\n key: \"isEqual\",\n value: function isEqual(otherRange) {\n return this == otherRange || this.start.isEqual(otherRange.start) && this.end.isEqual(otherRange.end);\n }\n /**\n * Checks whether this range contains given {@link module:engine/view/position~Position position}.\n *\n * @param {module:engine/view/position~Position} position Position to check.\n * @returns {Boolean} `true` if given {@link module:engine/view/position~Position position} is contained in this range,\n * `false` otherwise.\n */\n\n }, {\n key: \"containsPosition\",\n value: function containsPosition(position) {\n return position.isAfter(this.start) && position.isBefore(this.end);\n }\n /**\n * Checks whether this range contains given {@link module:engine/view/range~Range range}.\n *\n * @param {module:engine/view/range~Range} otherRange Range to check.\n * @param {Boolean} [loose=false] Whether the check is loose or strict. If the check is strict (`false`), compared range cannot\n * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or\n * even be equal to this range. Note that collapsed ranges are always compared in strict mode.\n * @returns {Boolean} `true` if given {@link module:engine/view/range~Range range} boundaries are contained by this range, `false`\n * otherwise.\n */\n\n }, {\n key: \"containsRange\",\n value: function containsRange(otherRange) {\n var loose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (otherRange.isCollapsed) {\n loose = false;\n }\n\n var containsStart = this.containsPosition(otherRange.start) || loose && this.start.isEqual(otherRange.start);\n var containsEnd = this.containsPosition(otherRange.end) || loose && this.end.isEqual(otherRange.end);\n return containsStart && containsEnd;\n }\n /**\n * Computes which part(s) of this {@link module:engine/view/range~Range range} is not a part of given\n * {@link module:engine/view/range~Range range}.\n * Returned array contains zero, one or two {@link module:engine/view/range~Range ranges}.\n *\n * Examples:\n *\n *\t\tlet foo = downcastWriter.createText( 'foo' );\n *\t\tlet img = downcastWriter.createContainerElement( 'img' );\n *\t\tlet bar = downcastWriter.createText( 'bar' );\n *\t\tlet p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );\n *\n *\t\tlet range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // \"o\", img, \"b\" are in range.\n *\t\tlet otherRange = view.createRange( // \"oo\", img, \"ba\" are in range.\n *\t\t\tview.createPositionAt( foo, 1 ),\n *\t\t\tview.createPositionAt( bar, 2 )\n *\t\t);\n *\t\tlet transformed = range.getDifference( otherRange );\n *\t\t// transformed array has no ranges because `otherRange` contains `range`\n *\n *\t\totherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // \"oo\", img are in range.\n *\t\ttransformed = range.getDifference( otherRange );\n *\t\t// transformed array has one range: from ( p, 2 ) to ( bar, 1 )\n *\n *\t\totherRange = view.createRange( view.createPositionAt( p, 1 ), view.createPositionAt( p, 2 ) ); // img is in range.\n *\t\ttransformed = range.getDifference( otherRange );\n *\t\t// transformed array has two ranges: from ( foo, 1 ) to ( p, 1 ) and from ( p, 2 ) to ( bar, 1 )\n *\n * @param {module:engine/view/range~Range} otherRange Range to differentiate against.\n * @returns {Array.} The difference between ranges.\n */\n\n }, {\n key: \"getDifference\",\n value: function getDifference(otherRange) {\n var ranges = [];\n\n if (this.isIntersecting(otherRange)) {\n // Ranges intersect.\n if (this.containsPosition(otherRange.start)) {\n // Given range start is inside this range. This means that we have to\n // add shrunken range - from the start to the middle of this range.\n ranges.push(new Range(this.start, otherRange.start));\n }\n\n if (this.containsPosition(otherRange.end)) {\n // Given range end is inside this range. This means that we have to\n // add shrunken range - from the middle of this range to the end.\n ranges.push(new Range(otherRange.end, this.end));\n }\n } else {\n // Ranges do not intersect, return the original range.\n ranges.push(this.clone());\n }\n\n return ranges;\n }\n /**\n * Returns an intersection of this {@link module:engine/view/range~Range range} and given {@link module:engine/view/range~Range range}.\n * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.\n *\n * Examples:\n *\n *\t\tlet foo = downcastWriter.createText( 'foo' );\n *\t\tlet img = downcastWriter.createContainerElement( 'img' );\n *\t\tlet bar = downcastWriter.createText( 'bar' );\n *\t\tlet p = downcastWriter.createContainerElement( 'p', null, [ foo, img, bar ] );\n *\n *\t\tlet range = view.createRange( view.createPositionAt( foo, 2 ), view.createPositionAt( bar, 1 ); // \"o\", img, \"b\" are in range.\n *\t\tlet otherRange = view.createRange( view.createPositionAt( foo, 1 ), view.createPositionAt( p, 2 ); // \"oo\", img are in range.\n *\t\tlet transformed = range.getIntersection( otherRange ); // range from ( foo, 1 ) to ( p, 2 ).\n *\n *\t\totherRange = view.createRange( view.createPositionAt( bar, 1 ), view.createPositionAt( bar, 3 ); \"ar\" is in range.\n *\t\ttransformed = range.getIntersection( otherRange ); // null - no common part.\n *\n * @param {module:engine/view/range~Range} otherRange Range to check for intersection.\n * @returns {module:engine/view/range~Range|null} A common part of given ranges or `null` if ranges have no common part.\n */\n\n }, {\n key: \"getIntersection\",\n value: function getIntersection(otherRange) {\n if (this.isIntersecting(otherRange)) {\n // Ranges intersect, so a common range will be returned.\n // At most, it will be same as this range.\n var commonRangeStart = this.start;\n var commonRangeEnd = this.end;\n\n if (this.containsPosition(otherRange.start)) {\n // Given range start is inside this range. This means thaNt we have to\n // shrink common range to the given range start.\n commonRangeStart = otherRange.start;\n }\n\n if (this.containsPosition(otherRange.end)) {\n // Given range end is inside this range. This means that we have to\n // shrink common range to the given range end.\n commonRangeEnd = otherRange.end;\n }\n\n return new Range(commonRangeStart, commonRangeEnd);\n } // Ranges do not intersect, so they do not have common part.\n\n\n return null;\n }\n /**\n * Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this range as a boundary.\n *\n * @param {Object} options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.\n * @param {module:engine/view/position~Position} [options.startPosition]\n * @param {Boolean} [options.singleCharacters=false]\n * @param {Boolean} [options.shallow=false]\n * @param {Boolean} [options.ignoreElementEnd=false]\n * @returns {module:engine/view/treewalker~TreeWalker}\n */\n\n }, {\n key: \"getWalker\",\n value: function getWalker() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n options.boundaries = this;\n return new TreeWalker(options);\n }\n /**\n * Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}\n * which is a common ancestor of range's both ends (in which the entire range is contained).\n *\n * @returns {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment|null}\n */\n\n }, {\n key: \"getCommonAncestor\",\n value: function getCommonAncestor() {\n return this.start.getCommonAncestor(this.end);\n }\n /**\n * Clones this range.\n *\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"clone\",\n value: function clone() {\n return new Range(this.start, this.end);\n }\n /**\n * Returns an iterator that iterates over all {@link module:engine/view/item~Item view items} that are in this range and returns\n * them.\n *\n * This method uses {@link module:engine/view/treewalker~TreeWalker} with `boundaries` set to this range and `ignoreElementEnd` option\n * set to `true`. However it returns only {@link module:engine/view/item~Item items},\n * not {@link module:engine/view/treewalker~TreeWalkerValue}.\n *\n * You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~TreeWalker} for\n * a full list of available options.\n *\n * @param {Object} options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.\n * @returns {Iterable.}\n */\n\n }, {\n key: \"getItems\",\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getItems() {\n var options,\n treeWalker,\n _iteratorNormalCompletion,\n _didIteratorError,\n _iteratorError,\n _iterator,\n _step,\n _value,\n _args2 = arguments;\n\n return regeneratorRuntime.wrap(function getItems$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};\n options.boundaries = this;\n options.ignoreElementEnd = true;\n treeWalker = new TreeWalker(options);\n _iteratorNormalCompletion = true;\n _didIteratorError = false;\n _iteratorError = undefined;\n _context2.prev = 7;\n _iterator = treeWalker[Symbol.iterator]();\n\n case 9:\n if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {\n _context2.next = 16;\n break;\n }\n\n _value = _step.value;\n _context2.next = 13;\n return _value.item;\n\n case 13:\n _iteratorNormalCompletion = true;\n _context2.next = 9;\n break;\n\n case 16:\n _context2.next = 22;\n break;\n\n case 18:\n _context2.prev = 18;\n _context2.t0 = _context2[\"catch\"](7);\n _didIteratorError = true;\n _iteratorError = _context2.t0;\n\n case 22:\n _context2.prev = 22;\n _context2.prev = 23;\n\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n\n case 25:\n _context2.prev = 25;\n\n if (!_didIteratorError) {\n _context2.next = 28;\n break;\n }\n\n throw _iteratorError;\n\n case 28:\n return _context2.finish(25);\n\n case 29:\n return _context2.finish(22);\n\n case 30:\n case \"end\":\n return _context2.stop();\n }\n }\n }, getItems, this, [[7, 18, 22, 30], [23,, 25, 29]]);\n })\n /**\n * Returns an iterator that iterates over all {@link module:engine/view/position~Position positions} that are boundaries or\n * contained in this range.\n *\n * This method uses {@link module:engine/view/treewalker~TreeWalker} with `boundaries` set to this range. However it returns only\n * {@link module:engine/view/position~Position positions}, not {@link module:engine/view/treewalker~TreeWalkerValue}.\n *\n * You may specify additional options for the tree walker. See {@link module:engine/view/treewalker~TreeWalker} for\n * a full list of available options.\n *\n * @param {Object} options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.\n * @returns {Iterable.}\n */\n\n }, {\n key: \"getPositions\",\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getPositions() {\n var options,\n treeWalker,\n _iteratorNormalCompletion2,\n _didIteratorError2,\n _iteratorError2,\n _iterator2,\n _step2,\n _value2,\n _args3 = arguments;\n\n return regeneratorRuntime.wrap(function getPositions$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};\n options.boundaries = this;\n treeWalker = new TreeWalker(options);\n _context3.next = 5;\n return treeWalker.position;\n\n case 5:\n _iteratorNormalCompletion2 = true;\n _didIteratorError2 = false;\n _iteratorError2 = undefined;\n _context3.prev = 8;\n _iterator2 = treeWalker[Symbol.iterator]();\n\n case 10:\n if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {\n _context3.next = 17;\n break;\n }\n\n _value2 = _step2.value;\n _context3.next = 14;\n return _value2.nextPosition;\n\n case 14:\n _iteratorNormalCompletion2 = true;\n _context3.next = 10;\n break;\n\n case 17:\n _context3.next = 23;\n break;\n\n case 19:\n _context3.prev = 19;\n _context3.t0 = _context3[\"catch\"](8);\n _didIteratorError2 = true;\n _iteratorError2 = _context3.t0;\n\n case 23:\n _context3.prev = 23;\n _context3.prev = 24;\n\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n\n case 26:\n _context3.prev = 26;\n\n if (!_didIteratorError2) {\n _context3.next = 29;\n break;\n }\n\n throw _iteratorError2;\n\n case 29:\n return _context3.finish(26);\n\n case 30:\n return _context3.finish(23);\n\n case 31:\n case \"end\":\n return _context3.stop();\n }\n }\n }, getPositions, this, [[8, 19, 23, 31], [24,, 26, 30]]);\n })\n /**\n * Checks whether this object is of the given type.\n *\n *\t\trange.is( 'range' ); // -> true\n *\t\trange.is( 'view:range' ); // -> true\n *\n *\t\trange.is( 'model:range' ); // -> false\n *\t\trange.is( 'element' ); // -> false\n *\t\trange.is( 'selection' ); // -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type\n * @returns {Boolean}\n */\n\n }, {\n key: \"is\",\n value: function is(type) {\n return type == 'range' || type == 'view:range';\n }\n /**\n * Checks and returns whether this range intersects with the given range.\n *\n * @param {module:engine/view/range~Range} otherRange Range to compare with.\n * @returns {Boolean} True if ranges intersect.\n */\n\n }, {\n key: \"isIntersecting\",\n value: function isIntersecting(otherRange) {\n return this.start.isBefore(otherRange.end) && this.end.isAfter(otherRange.start);\n }\n /**\n * Creates a range from the given parents and offsets.\n *\n * @protected\n * @param {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment} startElement Start position\n * parent element.\n * @param {Number} startOffset Start position offset.\n * @param {module:engine/view/node~Node|module:engine/view/documentfragment~DocumentFragment} endElement End position\n * parent element.\n * @param {Number} endOffset End position offset.\n * @returns {module:engine/view/range~Range} Created range.\n */\n\n }, {\n key: \"isCollapsed\",\n get: function get() {\n return this.start.isEqual(this.end);\n }\n /**\n * Returns whether this range is flat, that is if {@link module:engine/view/range~Range#start start} position and\n * {@link module:engine/view/range~Range#end end} position are in the same {@link module:engine/view/position~Position#parent parent}.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"isFlat\",\n get: function get() {\n return this.start.parent === this.end.parent;\n }\n /**\n * Range root element.\n *\n * @type {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment}\n */\n\n }, {\n key: \"root\",\n get: function get() {\n return this.start.root;\n }\n }], [{\n key: \"_createFromParentsAndOffsets\",\n value: function _createFromParentsAndOffsets(startElement, startOffset, endElement, endOffset) {\n return new this(new Position(startElement, startOffset), new Position(endElement, endOffset));\n }\n /**\n * Creates a new range, spreading from specified {@link module:engine/view/position~Position position} to a position moved by\n * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.\n *\n * @protected\n * @param {module:engine/view/position~Position} position Beginning of the range.\n * @param {Number} shift How long the range should be.\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"_createFromPositionAndShift\",\n value: function _createFromPositionAndShift(position, shift) {\n var start = position;\n var end = position.getShiftedBy(shift);\n return shift > 0 ? new this(start, end) : new this(end, start);\n }\n /**\n * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of\n * that element and ends after the last child of that element.\n *\n * @protected\n * @param {module:engine/view/element~Element} element Element which is a parent for the range.\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"_createIn\",\n value: function _createIn(element) {\n return this._createFromParentsAndOffsets(element, 0, element, element.childCount);\n }\n /**\n * Creates a range that starts before given {@link module:engine/view/item~Item view item} and ends after it.\n *\n * @protected\n * @param {module:engine/view/item~Item} item\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"_createOn\",\n value: function _createOn(item) {\n var size = item.is('textProxy') ? item.offsetSize : 1;\n return this._createFromPositionAndShift(Position._createBefore(item), size);\n }\n }]);\n\n return Range;\n}(); // Function used by getEnlarged and getTrimmed methods.\n\n\nexport { Range as default };\n\nfunction enlargeTrimSkip(value) {\n if (value.item.is('attributeElement') || value.item.is('uiElement')) {\n return true;\n }\n\n return false;\n}","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\n\n/**\n * @license Copyright (c) 2003-2019, 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/count\n */\n\n/**\n * Returns the number of items return by the iterator.\n *\n *\t\tcount( [ 1, 2, 3, 4, 5 ] ); // 5;\n *\n * @param {Iterable.<*>} iterator Any iterator.\n * @returns {Number} Number of items returned by that iterator.\n */\nexport default function count(iterator) {\n var count = 0;\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = iterator[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ = _step.value;\n // eslint-disable-line no-unused-vars\n count++;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return count;\n}","import \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.string.anchor\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"regenerator-runtime/runtime\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/selection\n */\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport Range from \"./range\";\nimport Position from \"./position\";\nimport mix from '@ckeditor/ckeditor5-utils/src/mix';\nimport EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';\nimport Node from \"./node\";\nimport Element from \"./element\";\nimport count from '@ckeditor/ckeditor5-utils/src/count';\nimport isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';\nimport DocumentSelection from \"./documentselection\";\n/**\n * Class representing an arbirtary selection in the view.\n * See also {@link module:engine/view/documentselection~DocumentSelection}.\n *\n * New selection instances can be created via the constructor or one these methods:\n *\n * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},\n * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.\n *\n * A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using\n * the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.\n */\n\nvar Selection =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates new selection instance.\n *\n * **Note**: The selection constructor is available as a factory method:\n *\n * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},\n * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.\n *\n * \t\t// Creates empty selection without ranges.\n *\t\tconst selection = writer.createSelection();\n *\n *\t\t// Creates selection at the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\tconst selection = writer.createSelection( range );\n *\n *\t\t// Creates selection at the given ranges\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n *\t\tconst selection = writer.createSelection( ranges );\n *\n *\t\t// Creates selection from the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\tconst selection = writer.createSelection( otherSelection );\n *\n *\t\t// Creates selection from the document selection.\n *\t\tconst selection = writer.createSelection( editor.editing.view.document.selection );\n *\n * \t\t// Creates selection at the given position.\n *\t\tconst position = writer.createPositionFromPath( root, path );\n *\t\tconst selection = writer.createSelection( position );\n *\n *\t\t// Creates collapsed selection at the position of given item and offset.\n *\t\tconst paragraph = writer.createContainerElement( 'paragraph' );\n *\t\tconst selection = writer.createSelection( paragraph, offset );\n *\n *\t\t// Creates a range inside an {@link module:engine/view/element~Element element} which starts before the\n *\t\t// first child of that element and ends after the last child of that element.\n *\t\tconst selection = writer.createSelection( paragraph, 'in' );\n *\n *\t\t// Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends\n *\t\t// just after the item.\n *\t\tconst selection = writer.createSelection( paragraph, 'on' );\n *\n * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Creates backward selection.\n *\t\tconst selection = writer.createSelection( range, { backward: true } );\n *\n * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n * (and be properly handled by screen readers).\n *\n *\t\t// Creates fake selection with label.\n *\t\tconst selection = writer.createSelection( range, { fake: true, label: 'foo' } );\n *\n * @param {module:engine/view/selection~Selectable} [selectable=null]\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Offset or place when selectable is an `Item`.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n */\n function Selection() {\n var selectable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var placeOrOffset = arguments.length > 1 ? arguments[1] : undefined;\n var options = arguments.length > 2 ? arguments[2] : undefined;\n\n _classCallCheck(this, Selection);\n\n /**\n * Stores all ranges that are selected.\n *\n * @protected\n * @member {Array.}\n */\n this._ranges = [];\n /**\n * Specifies whether the last added range was added as a backward or forward range.\n *\n * @protected\n * @member {Boolean}\n */\n\n this._lastRangeBackward = false;\n /**\n * Specifies whether selection instance is fake.\n *\n * @private\n * @member {Boolean}\n */\n\n this._isFake = false;\n /**\n * Fake selection's label.\n *\n * @private\n * @member {String}\n */\n\n this._fakeSelectionLabel = '';\n this.setTo(selectable, placeOrOffset, options);\n }\n /**\n * Returns true if selection instance is marked as `fake`.\n *\n * @see #setTo\n * @returns {Boolean}\n */\n\n\n _createClass(Selection, [{\n key: \"getRanges\",\n\n /**\n * Returns an iterable that contains copies of all ranges added to the selection.\n *\n * @returns {Iterable.}\n */\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getRanges() {\n var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, range;\n\n return regeneratorRuntime.wrap(function getRanges$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _iteratorNormalCompletion = true;\n _didIteratorError = false;\n _iteratorError = undefined;\n _context.prev = 3;\n _iterator = this._ranges[Symbol.iterator]();\n\n case 5:\n if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {\n _context.next = 12;\n break;\n }\n\n range = _step.value;\n _context.next = 9;\n return range.clone();\n\n case 9:\n _iteratorNormalCompletion = true;\n _context.next = 5;\n break;\n\n case 12:\n _context.next = 18;\n break;\n\n case 14:\n _context.prev = 14;\n _context.t0 = _context[\"catch\"](3);\n _didIteratorError = true;\n _iteratorError = _context.t0;\n\n case 18:\n _context.prev = 18;\n _context.prev = 19;\n\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n\n case 21:\n _context.prev = 21;\n\n if (!_didIteratorError) {\n _context.next = 24;\n break;\n }\n\n throw _iteratorError;\n\n case 24:\n return _context.finish(21);\n\n case 25:\n return _context.finish(18);\n\n case 26:\n case \"end\":\n return _context.stop();\n }\n }\n }, getRanges, this, [[3, 14, 18, 26], [19,, 21, 25]]);\n })\n /**\n * Returns copy of the first range in the selection. First range is the one which\n * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start\n * position of all other ranges (not to confuse with the first range added to the selection).\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/range~Range|null}\n */\n\n }, {\n key: \"getFirstRange\",\n value: function getFirstRange() {\n var first = null;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = this._ranges[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var range = _step2.value;\n\n if (!first || range.start.isBefore(first.start)) {\n first = range;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n return first ? first.clone() : null;\n }\n /**\n * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}\n * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse\n * with the last range added to the selection). Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/range~Range|null}\n */\n\n }, {\n key: \"getLastRange\",\n value: function getLastRange() {\n var last = null;\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = this._ranges[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var range = _step3.value;\n\n if (!last || range.end.isAfter(last.end)) {\n last = range;\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return last ? last.clone() : null;\n }\n /**\n * Returns copy of the first position in the selection. First position is the position that\n * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/position~Position|null}\n */\n\n }, {\n key: \"getFirstPosition\",\n value: function getFirstPosition() {\n var firstRange = this.getFirstRange();\n return firstRange ? firstRange.start.clone() : null;\n }\n /**\n * Returns copy of the last position in the selection. Last position is the position that\n * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/position~Position|null}\n */\n\n }, {\n key: \"getLastPosition\",\n value: function getLastPosition() {\n var lastRange = this.getLastRange();\n return lastRange ? lastRange.end.clone() : null;\n }\n /**\n * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,\n * same number of ranges and all ranges from one selection equal to a range from other selection.\n *\n * @param {module:engine/view/selection~Selection|module:engine/view/documentselection~DocumentSelection} otherSelection\n * Selection to compare with.\n * @returns {Boolean} `true` if selections are equal, `false` otherwise.\n */\n\n }, {\n key: \"isEqual\",\n value: function isEqual(otherSelection) {\n if (this.isFake != otherSelection.isFake) {\n return false;\n }\n\n if (this.isFake && this.fakeSelectionLabel != otherSelection.fakeSelectionLabel) {\n return false;\n }\n\n if (this.rangeCount != otherSelection.rangeCount) {\n return false;\n } else if (this.rangeCount === 0) {\n return true;\n }\n\n if (!this.anchor.isEqual(otherSelection.anchor) || !this.focus.isEqual(otherSelection.focus)) {\n return false;\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = this._ranges[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var thisRange = _step4.value;\n var found = false;\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = otherSelection._ranges[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var otherRange = _step5.value;\n\n if (thisRange.isEqual(otherRange)) {\n found = true;\n break;\n }\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n if (!found) {\n return false;\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n\n return true;\n }\n /**\n * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same\n * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are\n * equal to any trimmed range from other selection.\n *\n * @param {module:engine/view/selection~Selection|module:engine/view/documentselection~DocumentSelection} otherSelection\n * Selection to compare with.\n * @returns {Boolean} `true` if selections are similar, `false` otherwise.\n */\n\n }, {\n key: \"isSimilar\",\n value: function isSimilar(otherSelection) {\n if (this.isBackward != otherSelection.isBackward) {\n return false;\n }\n\n var numOfRangesA = count(this.getRanges());\n var numOfRangesB = count(otherSelection.getRanges()); // If selections have different number of ranges, they cannot be similar.\n\n if (numOfRangesA != numOfRangesB) {\n return false;\n } // If both selections have no ranges, they are similar.\n\n\n if (numOfRangesA == 0) {\n return true;\n } // Check if each range in one selection has a similar range in other selection.\n\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = this.getRanges()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var rangeA = _step6.value;\n rangeA = rangeA.getTrimmed();\n var found = false;\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = otherSelection.getRanges()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var rangeB = _step7.value;\n rangeB = rangeB.getTrimmed();\n\n if (rangeA.start.isEqual(rangeB.start) && rangeA.end.isEqual(rangeB.end)) {\n found = true;\n break;\n }\n } // For `rangeA`, neither range in `otherSelection` was similar. So selections are not similar.\n\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n if (!found) {\n return false;\n }\n } // There were no ranges that weren't matched. Selections are similar.\n\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n\n return true;\n }\n /**\n * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only\n * one range in the selection, and that range contains exactly one element.\n * Returns `null` if there is no selected element.\n *\n * @returns {module:engine/view/element~Element|null}\n */\n\n }, {\n key: \"getSelectedElement\",\n value: function getSelectedElement() {\n if (this.rangeCount !== 1) {\n return null;\n }\n\n var range = this.getFirstRange();\n var nodeAfterStart = range.start.nodeAfter;\n var nodeBeforeEnd = range.end.nodeBefore; // Handle the situation when selection position is at the beginning / at the end of a text node.\n // In such situation `.nodeAfter` and `.nodeBefore` are `null` but the selection still might be spanning\n // over one element.\n //\n // Foo{}bar
vs Foo[]bar
\n //\n // These are basically the same selections, only the difference is if the selection position is at\n // at the end/at the beginning of a text node or just before/just after the text node.\n //\n\n if (range.start.parent.is('text') && range.start.isAtEnd && range.start.parent.nextSibling) {\n nodeAfterStart = range.start.parent.nextSibling;\n }\n\n if (range.end.parent.is('text') && range.end.isAtStart && range.end.parent.previousSibling) {\n nodeBeforeEnd = range.end.parent.previousSibling;\n }\n\n return nodeAfterStart instanceof Element && nodeAfterStart == nodeBeforeEnd ? nodeAfterStart : null;\n }\n /**\n * Sets this selection's ranges and direction to the specified location based on the given\n * {@link module:engine/view/selection~Selectable selectable}.\n *\n *\t\t// Sets selection to the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\tselection.setTo( range );\n *\n *\t\t// Sets selection to given ranges.\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n *\t\tselection.setTo( range );\n *\n *\t\t// Sets selection to the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\tselection.setTo( otherSelection );\n *\n *\t \t// Sets selection to contents of DocumentSelection.\n *\t\tselection.setTo( editor.editing.view.document.selection );\n *\n * \t\t// Sets collapsed selection at the given position.\n *\t\tconst position = writer.createPositionAt( root, path );\n *\t\tselection.setTo( position );\n *\n * \t\t// Sets collapsed selection at the position of given item and offset.\n *\t\tselection.setTo( paragraph, offset );\n *\n * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of\n * that element and ends after the last child of that element.\n *\n *\t\tselection.setTo( paragraph, 'in' );\n *\n * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.\n *\n *\t\tselection.setTo( paragraph, 'on' );\n *\n * \t\t// Clears selection. Removes all ranges.\n *\t\tselection.setTo( null );\n *\n * `Selection#setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Sets selection as backward.\n *\t\tselection.setTo( range, { backward: true } );\n *\n * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n * (and be properly handled by screen readers).\n *\n *\t\t// Creates fake selection with label.\n *\t\tselection.setTo( range, { fake: true, label: 'foo' } );\n *\n * @fires change\n * @param {module:engine/view/selection~Selectable} selectable\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Sets place or offset of the selection.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n */\n\n }, {\n key: \"setTo\",\n value: function setTo(selectable, placeOrOffset, options) {\n if (selectable === null) {\n this._setRanges([]);\n\n this._setFakeOptions(placeOrOffset);\n } else if (selectable instanceof Selection || selectable instanceof DocumentSelection) {\n this._setRanges(selectable.getRanges(), selectable.isBackward);\n\n this._setFakeOptions({\n fake: selectable.isFake,\n label: selectable.fakeSelectionLabel\n });\n } else if (selectable instanceof Range) {\n this._setRanges([selectable], placeOrOffset && placeOrOffset.backward);\n\n this._setFakeOptions(placeOrOffset);\n } else if (selectable instanceof Position) {\n this._setRanges([new Range(selectable)]);\n\n this._setFakeOptions(placeOrOffset);\n } else if (selectable instanceof Node) {\n var backward = !!options && !!options.backward;\n var range;\n\n if (placeOrOffset === undefined) {\n /**\n * selection.setTo requires the second parameter when the first parameter is a node.\n *\n * @error view-selection-setTo-required-second-parameter\n */\n throw new CKEditorError('view-selection-setTo-required-second-parameter: ' + 'selection.setTo requires the second parameter when the first parameter is a node.', this);\n } else if (placeOrOffset == 'in') {\n range = Range._createIn(selectable);\n } else if (placeOrOffset == 'on') {\n range = Range._createOn(selectable);\n } else {\n range = new Range(Position._createAt(selectable, placeOrOffset));\n }\n\n this._setRanges([range], backward);\n\n this._setFakeOptions(options);\n } else if (isIterable(selectable)) {\n // We assume that the selectable is an iterable of ranges.\n // Array.from() is used to prevent setting ranges to the old iterable\n this._setRanges(selectable, placeOrOffset && placeOrOffset.backward);\n\n this._setFakeOptions(placeOrOffset);\n } else {\n /**\n * Cannot set selection to given place.\n *\n * @error view-selection-setTo-not-selectable\n */\n throw new CKEditorError('view-selection-setTo-not-selectable: Cannot set selection to given place.', this);\n }\n\n this.fire('change');\n }\n /**\n * Moves {@link #focus} to the specified location.\n *\n * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}\n * parameters.\n *\n * @fires change\n * @param {module:engine/view/item~Item|module:engine/view/position~Position} itemOrPosition\n * @param {Number|'end'|'before'|'after'} [offset] Offset or one of the flags. Used only when\n * first parameter is a {@link module:engine/view/item~Item view item}.\n */\n\n }, {\n key: \"setFocus\",\n value: function setFocus(itemOrPosition, offset) {\n if (this.anchor === null) {\n /**\n * Cannot set selection focus if there are no ranges in selection.\n *\n * @error view-selection-setFocus-no-ranges\n */\n throw new CKEditorError('view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.', this);\n }\n\n var newFocus = Position._createAt(itemOrPosition, offset);\n\n if (newFocus.compareWith(this.focus) == 'same') {\n return;\n }\n\n var anchor = this.anchor;\n\n this._ranges.pop();\n\n if (newFocus.compareWith(anchor) == 'before') {\n this._addRange(new Range(newFocus, anchor), true);\n } else {\n this._addRange(new Range(anchor, newFocus));\n }\n\n this.fire('change');\n }\n /**\n * Checks whether this object is of the given type.\n *\n *\t\tselection.is( 'selection' ); // -> true\n *\t\tselection.is( 'view:selection' ); // -> true\n *\n *\t\tselection.is( 'model:selection' ); // -> false\n *\t\tselection.is( 'element' ); // -> false\n *\t\tselection.is( 'range' ); // -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type\n * @returns {Boolean}\n */\n\n }, {\n key: \"is\",\n value: function is(type) {\n return type == 'selection' || type == 'view:selection';\n }\n /**\n * Replaces all ranges that were added to the selection with given array of ranges. Last range of the array\n * is treated like the last added range and is used to set {@link #anchor anchor} and {@link #focus focus}.\n * Accepts a flag describing in which way the selection is made.\n *\n * @private\n * @param {Iterable.} newRanges Iterable object of ranges to set.\n * @param {Boolean} [isLastBackward=false] Flag describing if last added range was selected forward - from start to end\n * (`false`) or backward - from end to start (`true`). Defaults to `false`.\n */\n\n }, {\n key: \"_setRanges\",\n value: function _setRanges(newRanges) {\n var isLastBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n // New ranges should be copied to prevent removing them by setting them to `[]` first.\n // Only applies to situations when selection is set to the same selection or same selection's ranges.\n newRanges = Array.from(newRanges);\n this._ranges = [];\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = newRanges[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var range = _step8.value;\n\n this._addRange(range);\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n\n this._lastRangeBackward = !!isLastBackward;\n }\n /**\n * Sets this selection instance to be marked as `fake`. A fake selection does not render as browser native selection\n * over selected elements and is hidden to the user. This way, no native selection UI artifacts are displayed to\n * the user and selection over elements can be represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM (and be\n * properly handled by screen readers).\n *\n * @private\n * @param {Object} [options] Options.\n * @param {Boolean} [options.fake] If set to true selection will be marked as `fake`.\n * @param {String} [options.label=''] Fake selection label.\n */\n\n }, {\n key: \"_setFakeOptions\",\n value: function _setFakeOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._isFake = !!options.fake;\n this._fakeSelectionLabel = options.fake ? options.label || '' : '';\n }\n /**\n * Adds a range to the selection. Added range is copied. This means that passed range is not saved in the\n * selection instance and you can safely operate on it.\n *\n * Accepts a flag describing in which way the selection is made - passed range might be selected from\n * {@link module:engine/view/range~Range#start start} to {@link module:engine/view/range~Range#end end}\n * or from {@link module:engine/view/range~Range#end end} to {@link module:engine/view/range~Range#start start}.\n * The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects\n * with ranges already stored in Selection instance.\n *\n * @private\n * @fires change\n * @param {module:engine/view/range~Range} range\n * @param {Boolean} [isBackward]\n */\n\n }, {\n key: \"_addRange\",\n value: function _addRange(range) {\n var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!(range instanceof Range)) {\n /**\n * Selection range set to an object that is not an instance of {@link module:engine/view/range~Range}.\n *\n * @error view-selection-add-range-not-range\n */\n throw new CKEditorError('view-selection-add-range-not-range: ' + 'Selection range set to an object that is not an instance of view.Range', this);\n }\n\n this._pushRange(range);\n\n this._lastRangeBackward = !!isBackward;\n }\n /**\n * Adds range to selection - creates copy of given range so it can be safely used and modified.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects\n * with ranges already stored in selection instance.\n *\n * @private\n * @param {module:engine/view/range~Range} range\n */\n\n }, {\n key: \"_pushRange\",\n value: function _pushRange(range) {\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = this._ranges[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var storedRange = _step9.value;\n\n if (range.isIntersecting(storedRange)) {\n /**\n * Trying to add a range that intersects with another range from selection.\n *\n * @error view-selection-range-intersects\n * @param {module:engine/view/range~Range} addedRange Range that was added to the selection.\n * @param {module:engine/view/range~Range} intersectingRange Range from selection that intersects with `addedRange`.\n */\n throw new CKEditorError('view-selection-range-intersects: Trying to add a range that intersects with another range from selection.', this, {\n addedRange: range,\n intersectingRange: storedRange\n });\n }\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n this._ranges.push(new Range(range.start, range.end));\n }\n /**\n * Fired whenever selection ranges are changed through {@link ~Selection Selection API}.\n *\n * @event change\n */\n\n }, {\n key: \"isFake\",\n get: function get() {\n return this._isFake;\n }\n /**\n * Returns fake selection label.\n *\n * @see #setTo\n * @returns {String}\n */\n\n }, {\n key: \"fakeSelectionLabel\",\n get: function get() {\n return this._fakeSelectionLabel;\n }\n /**\n * Selection anchor. Anchor may be described as a position where the selection starts. Together with\n * {@link #focus focus} they define the direction of selection, which is important\n * when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.\n * It may be a bit unintuitive when there are multiple ranges in selection.\n *\n * @see #focus\n * @type {module:engine/view/position~Position}\n */\n\n }, {\n key: \"anchor\",\n get: function get() {\n if (!this._ranges.length) {\n return null;\n }\n\n var range = this._ranges[this._ranges.length - 1];\n var anchor = this._lastRangeBackward ? range.end : range.start;\n return anchor.clone();\n }\n /**\n * Selection focus. Focus is a position where the selection ends.\n *\n * @see #anchor\n * @type {module:engine/view/position~Position}\n */\n\n }, {\n key: \"focus\",\n get: function get() {\n if (!this._ranges.length) {\n return null;\n }\n\n var range = this._ranges[this._ranges.length - 1];\n var focus = this._lastRangeBackward ? range.start : range.end;\n return focus.clone();\n }\n /**\n * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is\n * collapsed.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"isCollapsed\",\n get: function get() {\n return this.rangeCount === 1 && this._ranges[0].isCollapsed;\n }\n /**\n * Returns number of ranges in selection.\n *\n * @type {Number}\n */\n\n }, {\n key: \"rangeCount\",\n get: function get() {\n return this._ranges.length;\n }\n /**\n * Specifies whether the {@link #focus} precedes {@link #anchor}.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"isBackward\",\n get: function get() {\n return !this.isCollapsed && this._lastRangeBackward;\n }\n /**\n * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`\n * if the selection is not inside an editable element.\n *\n * @type {module:engine/view/editableelement~EditableElement|null}\n */\n\n }, {\n key: \"editableElement\",\n get: function get() {\n if (this.anchor) {\n return this.anchor.editableElement;\n }\n\n return null;\n }\n }]);\n\n return Selection;\n}();\n\nexport { Selection as default };\nmix(Selection, EmitterMixin);\n/**\n * An entity that is used to set selection.\n *\n * See also {@link module:engine/view/selection~Selection#setTo}\n *\n * @typedef {\n * module:engine/view/selection~Selection|\n * module:engine/view/documentselection~DocumentSelection|\n * module:engine/view/position~Position|\n * Iterable.|\n * module:engine/view/range~Range|\n * module:engine/view/item~Item|\n * null\n * } module:engine/view/selection~Selectable\n */","import \"core-js/modules/es6.string.anchor\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"regenerator-runtime/runtime\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/documentselection\n */\nimport Selection from \"./selection\";\nimport mix from '@ckeditor/ckeditor5-utils/src/mix';\nimport EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';\n/**\n * Class representing the document selection in the view.\n *\n * Its instance is available in {@link module:engine/view/document~Document#selection `Document#selection`}.\n *\n * It is similar to {@link module:engine/view/selection~Selection} but\n * it has a read-only API and can be modified only by the writer available in\n * the {@link module:engine/view/view~View#change `View#change()`} block\n * (so via {@link module:engine/view/downcastwriter~DowncastWriter#setSelection `DowncastWriter#setSelection()`}).\n */\n\nvar DocumentSelection =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates new DocumentSelection instance.\n *\n * \t\t// Creates empty selection without ranges.\n *\t\tconst selection = new DocumentSelection();\n *\n *\t\t// Creates selection at the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\tconst selection = new DocumentSelection( range );\n *\n *\t\t// Creates selection at the given ranges\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( start2, end2 ) ];\n *\t\tconst selection = new DocumentSelection( ranges );\n *\n *\t\t// Creates selection from the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\tconst selection = new DocumentSelection( otherSelection );\n *\n * \t\t// Creates selection at the given position.\n *\t\tconst position = writer.createPositionAt( root, offset );\n *\t\tconst selection = new DocumentSelection( position );\n *\n *\t\t// Creates collapsed selection at the position of given item and offset.\n *\t\tconst paragraph = writer.createContainerElement( 'paragraph' );\n *\t\tconst selection = new DocumentSelection( paragraph, offset );\n *\n *\t\t// Creates a range inside an {@link module:engine/view/element~Element element} which starts before the\n *\t\t// first child of that element and ends after the last child of that element.\n *\t\tconst selection = new DocumentSelection( paragraph, 'in' );\n *\n *\t\t// Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends\n *\t\t// just after the item.\n *\t\tconst selection = new DocumentSelection( paragraph, 'on' );\n *\n * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Creates backward selection.\n *\t\tconst selection = new DocumentSelection( range, { backward: true } );\n *\n * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n * (and be properly handled by screen readers).\n *\n *\t\t// Creates fake selection with label.\n *\t\tconst selection = new DocumentSelection( range, { fake: true, label: 'foo' } );\n *\n * @param {module:engine/view/selection~Selectable} [selectable=null]\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Offset or place when selectable is an `Item`.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n */\n function DocumentSelection() {\n var selectable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var placeOrOffset = arguments.length > 1 ? arguments[1] : undefined;\n var options = arguments.length > 2 ? arguments[2] : undefined;\n\n _classCallCheck(this, DocumentSelection);\n\n /**\n * Selection is used internally (`DocumentSelection` is a proxy to that selection).\n *\n * @private\n * @member {module:engine/view/selection~Selection}\n */\n this._selection = new Selection(); // Delegate change event to be fired on DocumentSelection instance.\n\n this._selection.delegate('change').to(this); // Set selection data.\n\n\n this._selection.setTo(selectable, placeOrOffset, options);\n }\n /**\n * Returns true if selection instance is marked as `fake`.\n *\n * @see #_setTo\n * @returns {Boolean}\n */\n\n\n _createClass(DocumentSelection, [{\n key: \"getRanges\",\n\n /**\n * Returns an iterable that contains copies of all ranges added to the selection.\n *\n * @returns {Iterable.}\n */\n value:\n /*#__PURE__*/\n regeneratorRuntime.mark(function getRanges() {\n return regeneratorRuntime.wrap(function getRanges$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.delegateYield(this._selection.getRanges(), \"t0\", 1);\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, getRanges, this);\n })\n /**\n * Returns copy of the first range in the selection. First range is the one which\n * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start\n * position of all other ranges (not to confuse with the first range added to the selection).\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/range~Range|null}\n */\n\n }, {\n key: \"getFirstRange\",\n value: function getFirstRange() {\n return this._selection.getFirstRange();\n }\n /**\n * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}\n * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse\n * with the last range added to the selection). Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/range~Range|null}\n */\n\n }, {\n key: \"getLastRange\",\n value: function getLastRange() {\n return this._selection.getLastRange();\n }\n /**\n * Returns copy of the first position in the selection. First position is the position that\n * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/position~Position|null}\n */\n\n }, {\n key: \"getFirstPosition\",\n value: function getFirstPosition() {\n return this._selection.getFirstPosition();\n }\n /**\n * Returns copy of the last position in the selection. Last position is the position that\n * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.\n * Returns `null` if no ranges are added to selection.\n *\n * @returns {module:engine/view/position~Position|null}\n */\n\n }, {\n key: \"getLastPosition\",\n value: function getLastPosition() {\n return this._selection.getLastPosition();\n }\n /**\n * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only\n * one range in the selection, and that range contains exactly one element.\n * Returns `null` if there is no selected element.\n *\n * @returns {module:engine/view/element~Element|null}\n */\n\n }, {\n key: \"getSelectedElement\",\n value: function getSelectedElement() {\n return this._selection.getSelectedElement();\n }\n /**\n * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,\n * same number of ranges and all ranges from one selection equal to a range from other selection.\n *\n * @param {module:engine/view/selection~Selection|module:engine/view/documentselection~DocumentSelection} otherSelection\n * Selection to compare with.\n * @returns {Boolean} `true` if selections are equal, `false` otherwise.\n */\n\n }, {\n key: \"isEqual\",\n value: function isEqual(otherSelection) {\n return this._selection.isEqual(otherSelection);\n }\n /**\n * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same\n * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are\n * equal to any trimmed range from other selection.\n *\n * @param {module:engine/view/selection~Selection|module:engine/view/documentselection~DocumentSelection} otherSelection\n * Selection to compare with.\n * @returns {Boolean} `true` if selections are similar, `false` otherwise.\n */\n\n }, {\n key: \"isSimilar\",\n value: function isSimilar(otherSelection) {\n return this._selection.isSimilar(otherSelection);\n }\n /**\n * Checks whether this object is of the given type.\n *\n *\t\tdocSelection.is( 'selection' ); // -> true\n *\t\tdocSelection.is( 'documentSelection' ); // -> true\n *\t\tdocSelection.is( 'view:selection' ); // -> true\n *\t\tdocSelection.is( 'view:documentSelection' ); // -> true\n *\n *\t\tdocSelection.is( 'model:documentSelection' ); // -> false\n *\t\tdocSelection.is( 'element' ); // -> false\n *\t\tdocSelection.is( 'node' ); // -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type\n * @returns {Boolean}\n */\n\n }, {\n key: \"is\",\n value: function is(type) {\n return type == 'selection' || type == 'documentSelection' || type == 'view:selection' || type == 'view:documentSelection';\n }\n /**\n * Sets this selection's ranges and direction to the specified location based on the given\n * {@link module:engine/view/selection~Selectable selectable}.\n *\n *\t\t// Sets selection to the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\tdocumentSelection._setTo( range );\n *\n *\t\t// Sets selection to given ranges.\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( start2, end2 ) ];\n *\t\tdocumentSelection._setTo( range );\n *\n *\t\t// Sets selection to the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\tdocumentSelection._setTo( otherSelection );\n *\n * \t\t// Sets collapsed selection at the given position.\n *\t\tconst position = writer.createPositionAt( root, offset );\n *\t\tdocumentSelection._setTo( position );\n *\n * \t\t// Sets collapsed selection at the position of given item and offset.\n *\t\tdocumentSelection._setTo( paragraph, offset );\n *\n * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of\n * that element and ends after the last child of that element.\n *\n *\t\tdocumentSelection._setTo( paragraph, 'in' );\n *\n * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.\n *\n *\t\tdocumentSelection._setTo( paragraph, 'on' );\n *\n * \t\t// Clears selection. Removes all ranges.\n *\t\tdocumentSelection._setTo( null );\n *\n * `Selection#_setTo()` method allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Sets selection as backward.\n *\t\tdocumentSelection._setTo( range, { backward: true } );\n *\n * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to des cribe fake selection in DOM\n * (and be properly handled by screen readers).\n *\n *\t\t// Creates fake selection with label.\n *\t\tdocumentSelection._setTo( range, { fake: true, label: 'foo' } );\n *\n * @protected\n * @fires change\n * @param {module:engine/view/selection~Selectable} selectable\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Sets place or offset of the selection.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n */\n\n }, {\n key: \"_setTo\",\n value: function _setTo(selectable, placeOrOffset, options) {\n this._selection.setTo(selectable, placeOrOffset, options);\n }\n /**\n * Moves {@link #focus} to the specified location.\n *\n * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}\n * parameters.\n *\n * @protected\n * @fires change\n * @param {module:engine/view/item~Item|module:engine/view/position~Position} itemOrPosition\n * @param {Number|'end'|'before'|'after'} [offset] Offset or one of the flags. Used only when\n * first parameter is a {@link module:engine/view/item~Item view item}.\n */\n\n }, {\n key: \"_setFocus\",\n value: function _setFocus(itemOrPosition, offset) {\n this._selection.setFocus(itemOrPosition, offset);\n }\n /**\n * Fired whenever selection ranges are changed through {@link ~DocumentSelection Selection API}.\n *\n * @event change\n */\n\n }, {\n key: \"isFake\",\n get: function get() {\n return this._selection.isFake;\n }\n /**\n * Returns fake selection label.\n *\n * @see #_setTo\n * @returns {String}\n */\n\n }, {\n key: \"fakeSelectionLabel\",\n get: function get() {\n return this._selection.fakeSelectionLabel;\n }\n /**\n * Selection anchor. Anchor may be described as a position where the selection starts. Together with\n * {@link #focus focus} they define the direction of selection, which is important\n * when expanding/shrinking selection. Anchor is always the start or end of the most recent added range.\n * It may be a bit unintuitive when there are multiple ranges in selection.\n *\n * @see #focus\n * @type {module:engine/view/position~Position}\n */\n\n }, {\n key: \"anchor\",\n get: function get() {\n return this._selection.anchor;\n }\n /**\n * Selection focus. Focus is a position where the selection ends.\n *\n * @see #anchor\n * @type {module:engine/view/position~Position}\n */\n\n }, {\n key: \"focus\",\n get: function get() {\n return this._selection.focus;\n }\n /**\n * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is\n * collapsed.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"isCollapsed\",\n get: function get() {\n return this._selection.isCollapsed;\n }\n /**\n * Returns number of ranges in selection.\n *\n * @type {Number}\n */\n\n }, {\n key: \"rangeCount\",\n get: function get() {\n return this._selection.rangeCount;\n }\n /**\n * Specifies whether the {@link #focus} precedes {@link #anchor}.\n *\n * @type {Boolean}\n */\n\n }, {\n key: \"isBackward\",\n get: function get() {\n return this._selection.isBackward;\n }\n /**\n * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`\n * if the selection is not inside an editable element.\n *\n * @type {module:engine/view/editableelement~EditableElement|null}\n */\n\n }, {\n key: \"editableElement\",\n get: function get() {\n return this._selection.editableElement;\n }\n /**\n * Used for the compatibility with the {@link module:engine/view/selection~Selection#isEqual} method.\n *\n * @protected\n */\n\n }, {\n key: \"_ranges\",\n get: function get() {\n return this._selection._ranges;\n }\n }]);\n\n return DocumentSelection;\n}();\n\nexport { DocumentSelection as default };\nmix(DocumentSelection, EmitterMixin);","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/es6.array.find\";\nimport \"core-js/modules/es6.weak-map\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.map\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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/collection\n */\nimport EmitterMixin from \"./emittermixin\";\nimport CKEditorError from \"./ckeditorerror\";\nimport uid from \"./uid\";\nimport mix from \"./mix\";\n/**\n * Collections are ordered sets of objects. Items in the collection can be retrieved by their indexes\n * in the collection (like in an array) or by their ids.\n *\n * If an object without an `id` property is being added to the collection, the `id` property will be generated\n * automatically. Note that the automatically generated id is unique only within this single collection instance.\n *\n * By default an item in the collection is identified by its `id` property. The name of the identifier can be\n * configured through the constructor of the collection.\n *\n * @mixes module:utils/emittermixin~EmitterMixin\n */\n\nvar Collection =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates a new Collection instance.\n *\n * @param {Object} [options={}] The options object.\n * @param {String} [options.idProperty='id'] The name of the property which is considered to identify an item.\n */\n function Collection() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Collection);\n\n /**\n * The internal list of items in the collection.\n *\n * @private\n * @member {Object[]}\n */\n this._items = [];\n /**\n * The internal map of items in the collection.\n *\n * @private\n * @member {Map}\n */\n\n this._itemMap = new Map();\n /**\n * The name of the property which is considered to identify an item.\n *\n * @private\n * @member {String}\n */\n\n this._idProperty = options.idProperty || 'id';\n /**\n * A helper mapping external items of a bound collection ({@link #bindTo})\n * and actual items of this collection. It provides information\n * necessary to properly remove items bound to another collection.\n *\n * See {@link #_bindToInternalToExternalMap}.\n *\n * @protected\n * @member {WeakMap}\n */\n\n this._bindToExternalToInternalMap = new WeakMap();\n /**\n * A helper mapping items of this collection to external items of a bound collection\n * ({@link #bindTo}). It provides information necessary to manage the bindings, e.g.\n * to avoid loops in two–way bindings.\n *\n * See {@link #_bindToExternalToInternalMap}.\n *\n * @protected\n * @member {WeakMap}\n */\n\n this._bindToInternalToExternalMap = new WeakMap();\n /**\n * Stores indexes of skipped items from bound external collection.\n *\n * @private\n * @member {Array}\n */\n\n this._skippedIndexesFromExternal = [];\n /**\n * A collection instance this collection is bound to as a result\n * of calling {@link #bindTo} method.\n *\n * @protected\n * @member {module:utils/collection~Collection} #_bindToCollection\n */\n }\n /**\n * The number of items available in the collection.\n *\n * @member {Number} #length\n */\n\n\n _createClass(Collection, [{\n key: \"add\",\n\n /**\n * Adds an item into the collection.\n *\n * If the item does not have an id, then it will be automatically generated and set on the item.\n *\n * @chainable\n * @param {Object} item\n * @param {Number} [index] The position of the item in the collection. The item\n * is pushed to the collection when `index` not specified.\n * @fires add\n */\n value: function add(item, index) {\n var itemId;\n var idProperty = this._idProperty;\n\n if (idProperty in item) {\n itemId = item[idProperty];\n\n if (typeof itemId != 'string') {\n /**\n * This item's id should be a string.\n *\n * @error collection-add-invalid-id\n */\n throw new CKEditorError('collection-add-invalid-id', this);\n }\n\n if (this.get(itemId)) {\n /**\n * This item already exists in the collection.\n *\n * @error collection-add-item-already-exists\n */\n throw new CKEditorError('collection-add-item-already-exists', this);\n }\n } else {\n item[idProperty] = itemId = uid();\n } // TODO: Use ES6 default function argument.\n\n\n if (index === undefined) {\n index = this._items.length;\n } else if (index > this._items.length || index < 0) {\n /**\n * The index number has invalid value.\n *\n * @error collection-add-item-bad-index\n */\n throw new CKEditorError('collection-add-item-invalid-index', this);\n }\n\n this._items.splice(index, 0, item);\n\n this._itemMap.set(itemId, item);\n\n this.fire('add', item, index);\n return this;\n }\n /**\n * Gets item by its id or index.\n *\n * @param {String|Number} idOrIndex The item id or index in the collection.\n * @returns {Object|null} The requested item or `null` if such item does not exist.\n */\n\n }, {\n key: \"get\",\n value: function get(idOrIndex) {\n var item;\n\n if (typeof idOrIndex == 'string') {\n item = this._itemMap.get(idOrIndex);\n } else if (typeof idOrIndex == 'number') {\n item = this._items[idOrIndex];\n } else {\n /**\n * Index or id must be given.\n *\n * @error collection-get-invalid-arg\n */\n throw new CKEditorError('collection-get-invalid-arg: Index or id must be given.', this);\n }\n\n return item || null;\n }\n /**\n * Returns a boolean indicating whether the collection contains an item.\n *\n * @param {Object|String} itemOrId The item or its id in the collection.\n * @returns {Boolean} `true` if the collection contains the item, `false` otherwise.\n */\n\n }, {\n key: \"has\",\n value: function has(itemOrId) {\n if (typeof itemOrId == 'string') {\n return this._itemMap.has(itemOrId);\n } else {\n // Object\n var idProperty = this._idProperty;\n var id = itemOrId[idProperty];\n return this._itemMap.has(id);\n }\n }\n /**\n * Gets index of item in the collection.\n * When item is not defined in the collection then index will be equal -1.\n *\n * @param {Object|String} itemOrId The item or its id in the collection.\n * @returns {Number} Index of given item.\n */\n\n }, {\n key: \"getIndex\",\n value: function getIndex(itemOrId) {\n var item;\n\n if (typeof itemOrId == 'string') {\n item = this._itemMap.get(itemOrId);\n } else {\n item = itemOrId;\n }\n\n return this._items.indexOf(item);\n }\n /**\n * Removes an item from the collection.\n *\n * @param {Object|Number|String} subject The item to remove, its id or index in the collection.\n * @returns {Object} The removed item.\n * @fires remove\n */\n\n }, {\n key: \"remove\",\n value: function remove(subject) {\n var index, id, item;\n var itemDoesNotExist = false;\n var idProperty = this._idProperty;\n\n if (typeof subject == 'string') {\n id = subject;\n item = this._itemMap.get(id);\n itemDoesNotExist = !item;\n\n if (item) {\n index = this._items.indexOf(item);\n }\n } else if (typeof subject == 'number') {\n index = subject;\n item = this._items[index];\n itemDoesNotExist = !item;\n\n if (item) {\n id = item[idProperty];\n }\n } else {\n item = subject;\n id = item[idProperty];\n index = this._items.indexOf(item);\n itemDoesNotExist = index == -1 || !this._itemMap.get(id);\n }\n\n if (itemDoesNotExist) {\n /**\n * Item not found.\n *\n * @error collection-remove-404\n */\n throw new CKEditorError('collection-remove-404: Item not found.', this);\n }\n\n this._items.splice(index, 1);\n\n this._itemMap.delete(id);\n\n var externalItem = this._bindToInternalToExternalMap.get(item);\n\n this._bindToInternalToExternalMap.delete(item);\n\n this._bindToExternalToInternalMap.delete(externalItem);\n\n this.fire('remove', item, index);\n return item;\n }\n /**\n * Executes the callback for each item in the collection and composes an array or values returned by this callback.\n *\n * @param {Function} callback\n * @param {Object} callback.item\n * @param {Number} callback.index\n * @param {Object} ctx Context in which the `callback` will be called.\n * @returns {Array} The result of mapping.\n */\n\n }, {\n key: \"map\",\n value: function map(callback, ctx) {\n return this._items.map(callback, ctx);\n }\n /**\n * Finds the first item in the collection for which the `callback` returns a true value.\n *\n * @param {Function} callback\n * @param {Object} callback.item\n * @param {Number} callback.index\n * @param {Object} ctx Context in which the `callback` will be called.\n * @returns {Object} The item for which `callback` returned a true value.\n */\n\n }, {\n key: \"find\",\n value: function find(callback, ctx) {\n return this._items.find(callback, ctx);\n }\n /**\n * Returns an array with items for which the `callback` returned a true value.\n *\n * @param {Function} callback\n * @param {Object} callback.item\n * @param {Number} callback.index\n * @param {Object} ctx Context in which the `callback` will be called.\n * @returns {Object[]} The array with matching items.\n */\n\n }, {\n key: \"filter\",\n value: function filter(callback, ctx) {\n return this._items.filter(callback, ctx);\n }\n /**\n * Removes all items from the collection and destroys the binding created using\n * {@link #bindTo}.\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n if (this._bindToCollection) {\n this.stopListening(this._bindToCollection);\n this._bindToCollection = null;\n }\n\n while (this.length) {\n this.remove(0);\n }\n }\n /**\n * Binds and synchronizes the collection with another one.\n *\n * The binding can be a simple factory:\n *\n *\t\tclass FactoryClass {\n *\t\t\tconstructor( data ) {\n *\t\t\t\tthis.label = data.label;\n *\t\t\t}\n *\t\t}\n *\n *\t\tconst source = new Collection( { idProperty: 'label' } );\n *\t\tconst target = new Collection();\n *\n *\t\ttarget.bindTo( source ).as( FactoryClass );\n *\n *\t\tsource.add( { label: 'foo' } );\n *\t\tsource.add( { label: 'bar' } );\n *\n *\t\tconsole.log( target.length ); // 2\n *\t\tconsole.log( target.get( 1 ).label ); // 'bar'\n *\n *\t\tsource.remove( 0 );\n *\t\tconsole.log( target.length ); // 1\n *\t\tconsole.log( target.get( 0 ).label ); // 'bar'\n *\n * or the factory driven by a custom callback:\n *\n *\t\tclass FooClass {\n *\t\t\tconstructor( data ) {\n *\t\t\t\tthis.label = data.label;\n *\t\t\t}\n *\t\t}\n *\n *\t\tclass BarClass {\n *\t\t\tconstructor( data ) {\n *\t\t\t\tthis.label = data.label;\n *\t\t\t}\n *\t\t}\n *\n *\t\tconst source = new Collection( { idProperty: 'label' } );\n *\t\tconst target = new Collection();\n *\n *\t\ttarget.bindTo( source ).using( ( item ) => {\n *\t\t\tif ( item.label == 'foo' ) {\n *\t\t\t\treturn new FooClass( item );\n *\t\t\t} else {\n *\t\t\t\treturn new BarClass( item );\n *\t\t\t}\n *\t\t} );\n *\n *\t\tsource.add( { label: 'foo' } );\n *\t\tsource.add( { label: 'bar' } );\n *\n *\t\tconsole.log( target.length ); // 2\n *\t\tconsole.log( target.get( 0 ) instanceof FooClass ); // true\n *\t\tconsole.log( target.get( 1 ) instanceof BarClass ); // true\n *\n * or the factory out of property name:\n *\n *\t\tconst source = new Collection( { idProperty: 'label' } );\n *\t\tconst target = new Collection();\n *\n *\t\ttarget.bindTo( source ).using( 'label' );\n *\n *\t\tsource.add( { label: { value: 'foo' } } );\n *\t\tsource.add( { label: { value: 'bar' } } );\n *\n *\t\tconsole.log( target.length ); // 2\n *\t\tconsole.log( target.get( 0 ).value ); // 'foo'\n *\t\tconsole.log( target.get( 1 ).value ); // 'bar'\n *\n * It's possible to skip specified items by returning falsy value:\n *\n *\t\tconst source = new Collection();\n *\t\tconst target = new Collection();\n *\n *\t\ttarget.bindTo( source ).using( item => {\n *\t\t\tif ( item.hidden ) {\n *\t\t\t\treturn null;\n *\t\t\t}\n *\n *\t\t\treturn item;\n *\t\t} );\n *\n *\t\tsource.add( { hidden: true } );\n *\t\tsource.add( { hidden: false } );\n *\n *\t\tconsole.log( source.length ); // 2\n *\t\tconsole.log( target.length ); // 1\n *\n * **Note**: {@link #clear} can be used to break the binding.\n *\n * @param {module:utils/collection~Collection} externalCollection A collection to be bound.\n * @returns {Object}\n * @returns {module:utils/collection~CollectionBindToChain} The binding chain object.\n */\n\n }, {\n key: \"bindTo\",\n value: function bindTo(externalCollection) {\n var _this = this;\n\n if (this._bindToCollection) {\n /**\n * The collection cannot be bound more than once.\n *\n * @error collection-bind-to-rebind\n */\n throw new CKEditorError('collection-bind-to-rebind: The collection cannot be bound more than once.', this);\n }\n\n this._bindToCollection = externalCollection;\n return {\n as: function as(Class) {\n _this._setUpBindToBinding(function (item) {\n return new Class(item);\n });\n },\n using: function using(callbackOrProperty) {\n if (typeof callbackOrProperty == 'function') {\n _this._setUpBindToBinding(function (item) {\n return callbackOrProperty(item);\n });\n } else {\n _this._setUpBindToBinding(function (item) {\n return item[callbackOrProperty];\n });\n }\n }\n };\n }\n /**\n * Finalizes and activates a binding initiated by {#bindTo}.\n *\n * @protected\n * @param {Function} factory A function which produces collection items.\n */\n\n }, {\n key: \"_setUpBindToBinding\",\n value: function _setUpBindToBinding(factory) {\n var _this2 = this;\n\n var externalCollection = this._bindToCollection; // Adds the item to the collection once a change has been done to the external collection.\n //\n // @private\n\n var addItem = function addItem(evt, externalItem, index) {\n var isExternalBoundToThis = externalCollection._bindToCollection == _this2;\n\n var externalItemBound = externalCollection._bindToInternalToExternalMap.get(externalItem); // If an external collection is bound to this collection, which makes it a 2–way binding,\n // and the particular external collection item is already bound, don't add it here.\n // The external item has been created **out of this collection's item** and (re)adding it will\n // cause a loop.\n\n\n if (isExternalBoundToThis && externalItemBound) {\n _this2._bindToExternalToInternalMap.set(externalItem, externalItemBound);\n\n _this2._bindToInternalToExternalMap.set(externalItemBound, externalItem);\n } else {\n var item = factory(externalItem); // When there is no item we need to remember skipped index first and then we can skip this item.\n\n if (!item) {\n _this2._skippedIndexesFromExternal.push(index);\n\n return;\n } // Lets try to put item at the same index as index in external collection\n // but when there are a skipped items in one or both collections we need to recalculate this index.\n\n\n var finalIndex = index; // When we try to insert item after some skipped items from external collection we need\n // to include this skipped items and decrease index.\n //\n // For the following example:\n // external -> [ 'A', 'B - skipped for internal', 'C - skipped for internal' ]\n // internal -> [ A ]\n //\n // Another item is been added at the end of external collection:\n // external.add( 'D' )\n // external -> [ 'A', 'B - skipped for internal', 'C - skipped for internal', 'D' ]\n //\n // We can't just add 'D' to internal at the same index as index in external because\n // this will produce empty indexes what is invalid:\n // internal -> [ 'A', empty, empty, 'D' ]\n //\n // So we need to include skipped items and decrease index\n // internal -> [ 'A', 'D' ]\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = _this2._skippedIndexesFromExternal[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var skipped = _step.value;\n\n if (index > skipped) {\n finalIndex--;\n }\n } // We need to take into consideration that external collection could skip some items from\n // internal collection.\n //\n // For the following example:\n // internal -> [ 'A', 'B - skipped for external', 'C - skipped for external' ]\n // external -> [ A ]\n //\n // Another item is been added at the end of external collection:\n // external.add( 'D' )\n // external -> [ 'A', 'D' ]\n //\n // We need to include skipped items and place new item after them:\n // internal -> [ 'A', 'B - skipped for external', 'C - skipped for external', 'D' ]\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = externalCollection._skippedIndexesFromExternal[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var _skipped = _step2.value;\n\n if (finalIndex >= _skipped) {\n finalIndex++;\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n _this2._bindToExternalToInternalMap.set(externalItem, item);\n\n _this2._bindToInternalToExternalMap.set(item, externalItem);\n\n _this2.add(item, finalIndex); // After adding new element to internal collection we need update indexes\n // of skipped items in external collection.\n\n\n for (var i = 0; i < externalCollection._skippedIndexesFromExternal.length; i++) {\n if (finalIndex <= externalCollection._skippedIndexesFromExternal[i]) {\n externalCollection._skippedIndexesFromExternal[i]++;\n }\n }\n }\n }; // Load the initial content of the collection.\n\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = externalCollection[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var externalItem = _step3.value;\n addItem(null, externalItem, externalCollection.getIndex(externalItem));\n } // Synchronize the with collection as new items are added.\n\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n this.listenTo(externalCollection, 'add', addItem); // Synchronize the with collection as new items are removed.\n\n this.listenTo(externalCollection, 'remove', function (evt, externalItem, index) {\n var item = _this2._bindToExternalToInternalMap.get(externalItem);\n\n if (item) {\n _this2.remove(item);\n } // After removing element from external collection we need update/remove indexes\n // of skipped items in internal collection.\n\n\n _this2._skippedIndexesFromExternal = _this2._skippedIndexesFromExternal.reduce(function (result, skipped) {\n if (index < skipped) {\n result.push(skipped - 1);\n }\n\n if (index > skipped) {\n result.push(skipped);\n }\n\n return result;\n }, []);\n });\n }\n /**\n * Iterable interface.\n *\n * @returns {Iterable.<*>}\n */\n\n }, {\n key: Symbol.iterator,\n value: function value() {\n return this._items[Symbol.iterator]();\n }\n /**\n * Fired when an item is added to the collection.\n *\n * @event add\n * @param {Object} item The added item.\n */\n\n /**\n * Fired when an item is removed from the collection.\n *\n * @event remove\n * @param {Object} item The removed item.\n * @param {Number} index Index from which item was removed.\n */\n\n }, {\n key: \"length\",\n get: function get() {\n return this._items.length;\n }\n /**\n * Returns the first item from the collection or null when collection is empty.\n *\n * @returns {Object|null} The first item or `null` if collection is empty.\n */\n\n }, {\n key: \"first\",\n get: function get() {\n return this._items[0] || null;\n }\n /**\n * Returns the last item from the collection or null when collection is empty.\n *\n * @returns {Object|null} The last item or `null` if collection is empty.\n */\n\n }, {\n key: \"last\",\n get: function get() {\n return this._items[this.length - 1] || null;\n }\n }]);\n\n return Collection;\n}();\n\nexport { Collection as default };\nmix(Collection, EmitterMixin);\n/**\n * An object returned by the {@link module:utils/collection~Collection#bindTo `bindTo()`} method\n * providing functions that specify the type of the binding.\n *\n * See the {@link module:utils/collection~Collection#bindTo `bindTo()`} documentation for examples.\n *\n * @interface module:utils/collection~CollectionBindToChain\n */\n\n/**\n * Creates a callback or a property binding.\n *\n * @method #using\n * @param {Function|String} callbackOrProperty When the function is passed, it should return\n * the collection items. When the string is provided, the property value is used to create the bound collection items.\n */\n\n/**\n * Creates the class factory binding in which items of the source collection are passed to\n * the constructor of the specified class.\n *\n * @method #as\n * @param {Function} Class The class constructor used to create instances in the factory.\n */","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.set\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/document\n */\nimport DocumentSelection from \"./documentselection\";\nimport Collection from '@ckeditor/ckeditor5-utils/src/collection';\nimport mix from '@ckeditor/ckeditor5-utils/src/mix';\nimport ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';\n/**\n * Document class creates an abstract layer over the content editable area, contains a tree of view elements and\n * {@link module:engine/view/documentselection~DocumentSelection view selection} associated with this document.\n *\n * @mixes module:utils/observablemixin~ObservableMixin\n */\n\nvar Document =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates a Document instance.\n */\n function Document() {\n _classCallCheck(this, Document);\n\n /**\n * Selection done on this document.\n *\n * @readonly\n * @member {module:engine/view/documentselection~DocumentSelection} module:engine/view/document~Document#selection\n */\n this.selection = new DocumentSelection();\n /**\n * Roots of the view tree. Collection of the {@link module:engine/view/element~Element view elements}.\n *\n * View roots are created as a result of binding between {@link module:engine/view/document~Document#roots} and\n * {@link module:engine/model/document~Document#roots} and this is handled by\n * {@link module:engine/controller/editingcontroller~EditingController}, so to create view root we need to create\n * model root using {@link module:engine/model/document~Document#createRoot}.\n *\n * @readonly\n * @member {module:utils/collection~Collection} module:engine/view/document~Document#roots\n */\n\n this.roots = new Collection({\n idProperty: 'rootName'\n });\n /**\n * Defines whether document is in read-only mode.\n *\n * When document is read-ony then all roots are read-only as well and caret placed inside this root is hidden.\n *\n * @observable\n * @member {Boolean} #isReadOnly\n */\n\n this.set('isReadOnly', false);\n /**\n * True if document is focused.\n *\n * This property is updated by the {@link module:engine/view/observer/focusobserver~FocusObserver}.\n * If the {@link module:engine/view/observer/focusobserver~FocusObserver} is disabled this property will not change.\n *\n * @readonly\n * @observable\n * @member {Boolean} module:engine/view/document~Document#isFocused\n */\n\n this.set('isFocused', false);\n /**\n * True if composition is in progress inside the document.\n *\n * This property is updated by the {@link module:engine/view/observer/compositionobserver~CompositionObserver}.\n * If the {@link module:engine/view/observer/compositionobserver~CompositionObserver} is disabled this property will not change.\n *\n * @readonly\n * @observable\n * @member {Boolean} module:engine/view/document~Document#isComposing\n */\n\n this.set('isComposing', false);\n /**\n * Post-fixer callbacks registered to the view document.\n *\n * @private\n * @member {Set}\n */\n\n this._postFixers = new Set();\n }\n /**\n * Gets a {@link module:engine/view/document~Document#roots view root element} with the specified name. If the name is not\n * specific \"main\" root is returned.\n *\n * @param {String} [name='main'] Name of the root.\n * @returns {module:engine/view/rooteditableelement~RootEditableElement|null} The view root element with the specified name\n * or null when there is no root of given name.\n */\n\n\n _createClass(Document, [{\n key: \"getRoot\",\n value: function getRoot() {\n var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'main';\n return this.roots.get(name);\n }\n /**\n * Allows registering post-fixer callbacks. A post-fixers mechanism allows to update the view tree just before it is rendered\n * to the DOM.\n *\n * Post-fixers are executed right after all changes from the outermost change block were applied but\n * before the {@link module:engine/view/view~View#event:render render event} is fired. If a post-fixer callback made\n * a change, it should return `true`. When this happens, all post-fixers are fired again to check if something else should\n * not be fixed in the new document tree state.\n *\n * View post-fixers are useful when you want to apply some fixes whenever the view structure changes. Keep in mind that\n * changes executed in a view post-fixer should not break model-view mapping.\n *\n * The types of changes which should be safe:\n *\n * * adding or removing attribute from elements,\n * * changes inside of {@link module:engine/view/uielement~UIElement UI elements},\n * * {@link module:engine/model/differ~Differ#refreshItem marking some of the model elements to be re-converted}.\n *\n * Try to avoid changes which touch view structure:\n *\n * * you should not add or remove nor wrap or unwrap any view elements,\n * * you should not change the editor data model in a view post-fixer.\n *\n * As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~DowncastWriter downcast writer}.\n *\n * Typically, a post-fixer will look like this:\n *\n *\t\teditor.editing.view.document.registerPostFixer( writer => {\n *\t\t\tif ( checkSomeCondition() ) {\n *\t\t\t\twriter.doSomething();\n *\n *\t\t\t\t// Let other post-fixers know that something changed.\n *\t\t\t\treturn true;\n *\t\t\t}\n *\t\t} );\n *\n * Note that nothing happens right after you register a post-fixer (e.g. execute such a code in the console).\n * That is because adding a post-fixer does not execute it.\n * The post-fixer will be executed as soon as any change in the document needs to cause its rendering.\n * If you want to re-render the editor's view after registering the post-fixer then you should do it manually by calling\n * {@link module:engine/view/view~View#forceRender `view.forceRender()`}.\n *\n * If you need to register a callback which is executed when DOM elements are already updated,\n * use {@link module:engine/view/view~View#event:render render event}.\n *\n * @param {Function} postFixer\n */\n\n }, {\n key: \"registerPostFixer\",\n value: function registerPostFixer(postFixer) {\n this._postFixers.add(postFixer);\n }\n /**\n * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.roots.map(function (root) {\n return root.destroy();\n });\n this.stopListening();\n }\n /**\n * Performs post-fixer loops. Executes post-fixer callbacks as long as none of them has done any changes to the model.\n *\n * @protected\n * @param {module:engine/view/downcastwriter~DowncastWriter} writer\n */\n\n }, {\n key: \"_callPostFixers\",\n value: function _callPostFixers(writer) {\n var wasFixed = false;\n\n do {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this._postFixers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var callback = _step.value;\n wasFixed = callback(writer);\n\n if (wasFixed) {\n break;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n } while (wasFixed);\n }\n /**\n * Event fired whenever document content layout changes. It is fired whenever content is\n * {@link module:engine/view/view~View#event:render rendered}, but should be also fired by observers in case of\n * other actions which may change layout, for instance when image loads.\n *\n * @event layoutChanged\n */\n\n }]);\n\n return Document;\n}();\n\nexport { Document as default };\nmix(Document, ObservableMixin);\n/**\n * Enum representing type of the change.\n *\n * Possible values:\n *\n * * `children` - for child list changes,\n * * `attributes` - for element attributes changes,\n * * `text` - for text nodes changes.\n *\n * @typedef {String} module:engine/view/document~ChangeType\n */","import \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.set\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/attributeelement\n */\nimport Element from \"./element\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; // Default attribute priority.\n\nvar DEFAULT_PRIORITY = 10;\n/**\n * Attribute elements are used to represent formatting elements in the view (think – ``, ``, etc.).\n * Most often they are created when downcasting model text attributes.\n *\n * Editing engine does not define a fixed HTML DTD. This is why a feature developer needs to choose between various\n * types (container element, {@link module:engine/view/attributeelement~AttributeElement attribute element},\n * {@link module:engine/view/emptyelement~EmptyElement empty element}, etc) when developing a feature.\n *\n * To create a new attribute element instance use the\n * {@link module:engine/view/downcastwriter~DowncastWriter#createAttributeElement `DowncastWriter#createAttributeElement()`} method.\n *\n * @extends module:engine/view/element~Element\n */\n\nvar AttributeElement =\n/*#__PURE__*/\nfunction (_Element) {\n _inherits(AttributeElement, _Element);\n\n /**\n * Creates an attribute element.\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#createAttributeElement\n * @see module:engine/view/element~Element\n * @protected\n */\n function AttributeElement(name, attrs, children) {\n var _this;\n\n _classCallCheck(this, AttributeElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(AttributeElement).call(this, name, attrs, children));\n /**\n * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.\n *\n * @method #getFillerOffset\n * @returns {Number|null} Block filler offset or `null` if block filler is not needed.\n */\n\n _this.getFillerOffset = getFillerOffset;\n /**\n * Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~DowncastWriter}.\n *\n * @protected\n * @member {Number}\n */\n\n _this._priority = DEFAULT_PRIORITY;\n /**\n * Element identifier. If set, it is used by {@link module:engine/view/element~Element#isSimilar},\n * and then two elements are considered similar if, and only if they have the same `_id`.\n *\n * @protected\n * @member {String|Number}\n */\n\n _this._id = null;\n /**\n * Keeps all the attribute elements that have the same {@link module:engine/view/attributeelement~AttributeElement#id ids}\n * and still exist in the view tree.\n *\n * This property is managed by {@link module:engine/view/downcastwriter~DowncastWriter}.\n *\n * @protected\n * @member {Set.|null}\n */\n\n _this._clonesGroup = null;\n return _this;\n }\n /**\n * Element priority. Decides in what order elements are wrapped by {@link module:engine/view/downcastwriter~DowncastWriter}.\n *\n * @readonly\n * @type {Number}\n */\n\n\n _createClass(AttributeElement, [{\n key: \"getElementsWithSameId\",\n\n /**\n * Returns all {@link module:engine/view/attributeelement~AttributeElement attribute elements} that has the\n * same {@link module:engine/view/attributeelement~AttributeElement#id id} and are in the view tree (were not removed).\n *\n * Note: If this element has been removed from the tree, returned set will not include it.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError attribute-element-get-elements-with-same-id-no-id}\n * if this element has no `id`.\n *\n * @returns {Set.} Set containing all the attribute elements\n * with the same `id` that were added and not removed from the view tree.\n */\n value: function getElementsWithSameId() {\n if (this.id === null) {\n /**\n * Cannot get elements with the same id for an attribute element without id.\n *\n * @error attribute-element-get-elements-with-same-id-no-id\n */\n throw new CKEditorError('attribute-element-get-elements-with-same-id-no-id: ' + 'Cannot get elements with the same id for an attribute element without id.', this);\n }\n\n return new Set(this._clonesGroup);\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\tattributeElement.is( 'attributeElement' ); // -> true\n *\t\tattributeElement.is( 'element' ); // -> true\n *\t\tattributeElement.is( 'node' ); // -> true\n *\t\tattributeElement.is( 'view:attributeElement' ); // -> true\n *\t\tattributeElement.is( 'view:element' ); // -> true\n *\t\tattributeElement.is( 'view:node' ); // -> true\n *\n *\t\tattributeElement.is( 'model:element' ); // -> false\n *\t\tattributeElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is an attribute element, you can also check its\n * {@link module:engine/view/attributeelement~AttributeElement#name name}:\n *\n *\t\tattributeElement.is( 'b' ); // -> true if this is a bold element\n *\t\tattributeElement.is( 'attributeElement', 'b' ); // -> same as above\n *\t\ttext.is( 'b' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n }, {\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type && type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'attributeElement' || _get(_getPrototypeOf(AttributeElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'attributeElement' && name == this.name || _get(_getPrototypeOf(AttributeElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n /**\n * Checks if this element is similar to other element.\n *\n * If none of elements has set {@link module:engine/view/attributeelement~AttributeElement#id}, then both elements\n * should have the same name, attributes and priority to be considered as similar. Two similar elements can contain\n * different set of children nodes.\n *\n * If at least one element has {@link module:engine/view/attributeelement~AttributeElement#id} set, then both\n * elements have to have the same {@link module:engine/view/attributeelement~AttributeElement#id} value to be\n * considered similar.\n *\n * Similarity is important for {@link module:engine/view/downcastwriter~DowncastWriter}. For example:\n *\n * * two following similar elements can be merged together into one, longer element,\n * * {@link module:engine/view/downcastwriter~DowncastWriter#unwrap} checks similarity of passed element and processed element to\n * decide whether processed element should be unwrapped,\n * * etc.\n *\n * @param {module:engine/view/element~Element} otherElement\n * @returns {Boolean}\n */\n\n }, {\n key: \"isSimilar\",\n value: function isSimilar(otherElement) {\n // If any element has an `id` set, just compare the ids.\n if (this.id !== null || otherElement.id !== null) {\n return this.id === otherElement.id;\n }\n\n return _get(_getPrototypeOf(AttributeElement.prototype), \"isSimilar\", this).call(this, otherElement) && this.priority == otherElement.priority;\n }\n /**\n * Clones provided element with priority.\n *\n * @protected\n * @param {Boolean} deep If set to `true` clones element and all its children recursively. When set to `false`,\n * element will be cloned without any children.\n * @returns {module:engine/view/attributeelement~AttributeElement} Clone of this element.\n */\n\n }, {\n key: \"_clone\",\n value: function _clone(deep) {\n var cloned = _get(_getPrototypeOf(AttributeElement.prototype), \"_clone\", this).call(this, deep); // Clone priority too.\n\n\n cloned._priority = this._priority; // And id too.\n\n cloned._id = this._id;\n return cloned;\n }\n }, {\n key: \"priority\",\n get: function get() {\n return this._priority;\n }\n /**\n * Element identifier. If set, it is used by {@link module:engine/view/element~Element#isSimilar},\n * and then two elements are considered similar if, and only if they have the same `id`.\n *\n * @readonly\n * @type {String|Number}\n */\n\n }, {\n key: \"id\",\n get: function get() {\n return this._id;\n }\n }]);\n\n return AttributeElement;\n}(Element);\n/**\n * Default attribute priority.\n *\n * @member {Number} module:engine/view/attributeelement~AttributeElement.DEFAULT_PRIORITY\n */\n\n\nexport { AttributeElement as default };\nAttributeElement.DEFAULT_PRIORITY = DEFAULT_PRIORITY; // Returns block {@link module:engine/view/filler~Filler filler} offset or `null` if block filler is not needed.\n//\n// @returns {Number|null} Block filler offset or `null` if block filler is not needed.\n\nfunction getFillerOffset() {\n // foo does not need filler.\n if (nonUiChildrenCount(this)) {\n return null;\n }\n\n var element = this.parent; //
needs filler ->
\n\n while (element && element.is('attributeElement')) {\n if (nonUiChildrenCount(element) > 1) {\n return null;\n }\n\n element = element.parent;\n }\n\n if (!element || nonUiChildrenCount(element) > 1) {\n return null;\n } // Render block filler at the end of element (after all ui elements).\n\n\n return this.childCount;\n} // Returns total count of children that are not {@link module:engine/view/uielement~UIElement UIElements}.\n//\n// @param {module:engine/view/element~Element} element\n// @returns {Number}\n\n\nfunction nonUiChildrenCount(element) {\n return Array.from(element.getChildren()).filter(function (element) {\n return !element.is('uiElement');\n }).length;\n}","import \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/emptyelement\n */\nimport Element from \"./element\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport Node from \"./node\";\n/**\n * Empty element class. It is used to represent elements that cannot contain any child nodes (for example `` elements).\n *\n * To create a new empty element use the\n * {@link module:engine/view/downcastwriter~DowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`} method.\n *\n * @extends module:engine/view/element~Element\n */\n\nvar EmptyElement =\n/*#__PURE__*/\nfunction (_Element) {\n _inherits(EmptyElement, _Element);\n\n /**\n * Creates new instance of EmptyElement.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,\n * to inform that usage of EmptyElement is incorrect (adding child nodes to EmptyElement is forbidden).\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#createEmptyElement\n * @protected\n * @param {String} name Node name.\n * @param {Object|Iterable} [attributes] Collection of attributes.\n */\n function EmptyElement(name, attributes, children) {\n var _this;\n\n _classCallCheck(this, EmptyElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(EmptyElement).call(this, name, attributes, children));\n /**\n * Returns `null` because filler is not needed for EmptyElements.\n *\n * @method #getFillerOffset\n * @returns {null} Always returns null.\n */\n\n _this.getFillerOffset = getFillerOffset;\n return _this;\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\temptyElement.is( 'emptyElement' ); // -> true\n *\t\temptyElement.is( 'element' ); // -> true\n *\t\temptyElement.is( 'node' ); // -> true\n *\t\temptyElement.is( 'view:emptyElement' ); // -> true\n *\t\temptyElement.is( 'view:element' ); // -> true\n *\t\temptyElement.is( 'view:node' ); // -> true\n *\n *\t\temptyElement.is( 'model:element' ); // -> false\n *\t\temptyElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is an empty element, you can also check its\n * {@link module:engine/view/emptyelement~EmptyElement#name name}:\n *\n *\t\temptyElement.is( 'img' ); // -> true if this is a img element\n *\t\temptyElement.is( 'emptyElement', 'img' ); // -> same as above\n *\t\ttext.is( 'img' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n\n _createClass(EmptyElement, [{\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'emptyElement' || _get(_getPrototypeOf(EmptyElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'emptyElement' && name == this.name || _get(_getPrototypeOf(EmptyElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n /**\n * Overrides {@link module:engine/view/element~Element#_insertChild} method.\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent\n * adding any child nodes to EmptyElement.\n *\n * @protected\n */\n\n }, {\n key: \"_insertChild\",\n value: function _insertChild(index, nodes) {\n if (nodes && (nodes instanceof Node || Array.from(nodes).length > 0)) {\n /**\n * Cannot add children to {@link module:engine/view/emptyelement~EmptyElement}.\n *\n * @error view-emptyelement-cannot-add\n */\n throw new CKEditorError('view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.', [this, nodes]);\n }\n }\n }]);\n\n return EmptyElement;\n}(Element); // Returns `null` because block filler is not needed for EmptyElements.\n//\n// @returns {null}\n\n\nexport { EmptyElement as default };\n\nfunction getFillerOffset() {\n return null;\n}","import \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.regexp.search\";\nimport \"core-js/modules/es6.regexp.match\";\n\n/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* globals navigator:false */\n\n/**\n * @module utils/env\n */\nvar userAgent = navigator.userAgent.toLowerCase();\n/**\n * A namespace containing environment and browser information.\n *\n * @namespace\n */\n\nvar env = {\n /**\n * Indicates that the application is running on Macintosh.\n *\n * @static\n * @type {Boolean}\n */\n isMac: isMac(userAgent),\n\n /**\n * Indicates that the application is running in Microsoft Edge.\n *\n * @static\n * @type {Boolean}\n */\n isEdge: isEdge(userAgent),\n\n /**\n * Indicates that the application is running in Firefox (Gecko).\n *\n * @static\n * @type {Boolean}\n */\n isGecko: isGecko(userAgent),\n\n /**\n * Indicates that the application is running in Safari.\n *\n * @static\n * @type {Boolean}\n */\n isSafari: isSafari(userAgent),\n\n /**\n * Indicates that the application is running on Android mobile device.\n *\n * @static\n * @type {Boolean}\n */\n isAndroid: isAndroid(userAgent),\n\n /**\n * Environment features information.\n *\n * @memberOf module:utils/env~env\n * @namespace\n */\n features: {\n /**\n * Indicates that the environment supports ES2018 Unicode property escapes — like `\\p{P}` or `\\p{L}`.\n * More information about unicode properties might be found\n * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).\n *\n * @type {Boolean}\n */\n isRegExpUnicodePropertySupported: isRegExpUnicodePropertySupported()\n }\n};\nexport default env;\n/**\n * Checks if User Agent represented by the string is running on Macintosh.\n *\n * @param {String} userAgent **Lowercase** `navigator.userAgent` string.\n * @returns {Boolean} Whether User Agent is running on Macintosh or not.\n */\n\nexport function isMac(userAgent) {\n return userAgent.indexOf('macintosh') > -1;\n}\n/**\n * Checks if User Agent represented by the string is Microsoft Edge.\n *\n * @param {String} userAgent **Lowercase** `navigator.userAgent` string.\n * @returns {Boolean} Whether User Agent is Edge or not.\n */\n\nexport function isEdge(userAgent) {\n return !!userAgent.match(/edge\\/(\\d+.?\\d*)/);\n}\n/**\n * Checks if User Agent represented by the string is Firefox (Gecko).\n *\n * @param {String} userAgent **Lowercase** `navigator.userAgent` string.\n * @returns {Boolean} Whether User Agent is Firefox or not.\n */\n\nexport function isGecko(userAgent) {\n return !!userAgent.match(/gecko\\/\\d+/);\n}\n/**\n * Checks if User Agent represented by the string is Safari.\n *\n * @param {String} userAgent **Lowercase** `navigator.userAgent` string.\n * @returns {Boolean} Whether User Agent is Safari or not.\n */\n\nexport function isSafari(userAgent) {\n return userAgent.indexOf(' applewebkit/') > -1 && userAgent.indexOf('chrome') === -1;\n}\n/**\n * Checks if User Agent represented by the string is Android mobile device.\n *\n * @param {String} userAgent **Lowercase** `navigator.userAgent` string.\n * @returns {Boolean} Whether User Agent is Safari or not.\n */\n\nexport function isAndroid(userAgent) {\n return userAgent.indexOf('android') > -1;\n}\n/**\n * Checks if the current environment supports ES2018 Unicode properties like `\\p{P}` or `\\p{L}`.\n * More information about unicode properties might be found\n * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).\n *\n * @returns {Boolean}\n */\n\nexport function isRegExpUnicodePropertySupported() {\n var isSupported = false; // Feature detection for Unicode properties. Added in ES2018. Currently Firefox and Edge do not support it.\n // See https://github.com/ckeditor/ckeditor5-mention/issues/44#issuecomment-487002174.\n\n try {\n // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n isSupported = 'ć'.search(new RegExp('[\\\\p{L}]', 'u')) === 0;\n } catch (error) {// Firefox throws a SyntaxError when the group is unsupported.\n }\n\n return isSupported;\n}","import \"core-js/modules/es6.regexp.split\";\n\n/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * Set of utils related to keyboard support.\n *\n * @module utils/keyboard\n */\nimport CKEditorError from \"./ckeditorerror\";\nimport env from \"./env\";\nvar macGlyphsToModifiers = {\n '⌘': 'ctrl',\n '⇧': 'shift',\n '⌥': 'alt'\n};\nvar modifiersToMacGlyphs = {\n 'ctrl': '⌘',\n 'shift': '⇧',\n 'alt': '⌥'\n};\n/**\n * Object with `keyName => keyCode` pairs for a set of known keys.\n *\n * Contains:\n *\n * * `a-z`,\n * * `0-9`,\n * * `f1-f12`,\n * * `arrow(left|up|right|bottom)`,\n * * `backspace`, `delete`, `enter`, `esc`, `tab`,\n * * `ctrl`, `cmd`, `shift`, `alt`.\n */\n\nexport var keyCodes = generateKnownKeyCodes();\n/**\n * Converts a key name or a {@link module:utils/keyboard~KeystrokeInfo keystroke info} into a key code.\n *\n * Note: Key names are matched with {@link module:utils/keyboard~keyCodes} in a case-insensitive way.\n *\n * @param {String|module:utils/keyboard~KeystrokeInfo} Key name (see {@link module:utils/keyboard~keyCodes})\n * or a keystroke data object.\n * @returns {Number} Key or keystroke code.\n */\n\nexport function getCode(key) {\n var keyCode;\n\n if (typeof key == 'string') {\n keyCode = keyCodes[key.toLowerCase()];\n\n if (!keyCode) {\n /**\n * Unknown key name. Only key names contained by the {@link module:utils/keyboard~keyCodes} can be used.\n *\n * @errror keyboard-unknown-key\n * @param {String} key\n */\n throw new CKEditorError('keyboard-unknown-key: Unknown key name.', null, {\n key: key\n });\n }\n } else {\n keyCode = key.keyCode + (key.altKey ? keyCodes.alt : 0) + (key.ctrlKey ? keyCodes.ctrl : 0) + (key.shiftKey ? keyCodes.shift : 0);\n }\n\n return keyCode;\n}\n/**\n * Parses keystroke and returns a keystroke code that will match the code returned by\n * link {@link module:utils/keyboard.getCode} for a corresponding {@link module:utils/keyboard~KeystrokeInfo keystroke info}.\n *\n * The keystroke can be passed in two formats:\n *\n * * as a single string – e.g. `ctrl + A`,\n * * as an array of {@link module:utils/keyboard~keyCodes known key names} and key codes – e.g.:\n * * `[ 'ctrl', 32 ]` (ctrl + space),\n * * `[ 'ctrl', 'a' ]` (ctrl + A).\n *\n * Note: Key names are matched with {@link module:utils/keyboard~keyCodes} in a case-insensitive way.\n *\n * Note: Only keystrokes with a single non-modifier key are supported (e.g. `ctrl+A` is OK, but `ctrl+A+B` is not).\n *\n * @param {String|Array.} keystroke Keystroke definition.\n * @returns {Number} Keystroke code.\n */\n\nexport function parseKeystroke(keystroke) {\n if (typeof keystroke == 'string') {\n keystroke = splitKeystrokeText(keystroke);\n }\n\n return keystroke.map(function (key) {\n return typeof key == 'string' ? getCode(key) : key;\n }).reduce(function (key, sum) {\n return sum + key;\n }, 0);\n}\n/**\n * It translates any keystroke string text like `\"CTRL+A\"` to an\n * environment–specific keystroke, i.e. `\"⌘A\"` on Mac OSX.\n *\n * @param {String} keystroke Keystroke text.\n * @returns {String} Keystroke text specific for the environment.\n */\n\nexport function getEnvKeystrokeText(keystroke) {\n if (!env.isMac) {\n return keystroke;\n }\n\n return splitKeystrokeText(keystroke) // Replace modifiers (e.g. \"ctrl\") with Mac glyphs (e.g. \"⌘\") first.\n .map(function (key) {\n return modifiersToMacGlyphs[key.toLowerCase()] || key;\n }) // Decide whether to put \"+\" between keys in the keystroke or not.\n .reduce(function (value, key) {\n if (value.slice(-1) in macGlyphsToModifiers) {\n return value + key;\n } else {\n return value + '+' + key;\n }\n });\n}\n\nfunction generateKnownKeyCodes() {\n var keyCodes = {\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n backspace: 8,\n delete: 46,\n enter: 13,\n space: 32,\n esc: 27,\n tab: 9,\n // The idea about these numbers is that they do not collide with any real key codes, so we can use them\n // like bit masks.\n ctrl: 0x110000,\n // Has the same code as ctrl, because their behaviour should be unified across the editor.\n // See http://ckeditor.github.io/editor-recommendations/general-policies#ctrl-vs-cmd\n cmd: 0x110000,\n shift: 0x220000,\n alt: 0x440000\n }; // a-z\n\n for (var code = 65; code <= 90; code++) {\n var letter = String.fromCharCode(code);\n keyCodes[letter.toLowerCase()] = code;\n } // 0-9\n\n\n for (var _code = 48; _code <= 57; _code++) {\n keyCodes[_code - 48] = _code;\n } // F1-F12\n\n\n for (var _code2 = 112; _code2 <= 123; _code2++) {\n keyCodes['f' + (_code2 - 111)] = _code2;\n }\n\n return keyCodes;\n}\n\nfunction splitKeystrokeText(keystroke) {\n return keystroke.split(/\\s*\\+\\s*/);\n}\n/**\n * Information about a keystroke.\n *\n * @interface module:utils/keyboard~KeystrokeInfo\n */\n\n/**\n * The [key code](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode).\n *\n * @member {Number} module:utils/keyboard~KeystrokeInfo#keyCode\n */\n\n/**\n * Whether the Alt modifier was pressed.\n *\n * @member {Bolean} module:utils/keyboard~KeystrokeInfo#altKey\n */\n\n/**\n * Whether the Ctrl or Cmd modifier was pressed.\n *\n * @member {Bolean} module:utils/keyboard~KeystrokeInfo#ctrlKey\n */\n\n/**\n * Whether the Shift modifier was pressed.\n *\n * @member {Bolean} module:utils/keyboard~KeystrokeInfo#shiftKey\n */","import \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/getPrototypeOf\";\nimport _get from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/get\";\nimport _inherits from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/inherits\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/uielement\n */\nimport Element from \"./element\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport Node from \"./node\";\nimport { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';\n/**\n * UI element class. It should be used to represent editing UI which needs to be injected into the editing view\n * If possible, you should keep your UI outside the editing view. However, if that is not possible,\n * UI elements can be used.\n *\n * How a UI element is rendered is in your control (you pass a callback to\n * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`}).\n * The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when\n * the user modifies the selection by using arrow keys and the editor does not listen to any mutations which\n * happen inside your UI elements.\n *\n * The limitation is that you cannot convert a model element to a UI element. UI elements need to be\n * created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements\n * inside normal {@link module:engine/view/containerelement~ContainerElement container elements}.\n *\n * To create a new UI element use the\n * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.\n *\n * @extends module:engine/view/element~Element\n */\n\nvar UIElement =\n/*#__PURE__*/\nfunction (_Element) {\n _inherits(UIElement, _Element);\n\n /**\n * Creates new instance of UIElement.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,\n * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).\n *\n * @see module:engine/view/downcastwriter~DowncastWriter#createUIElement\n * @protected\n * @param {String} name Node name.\n * @param {Object|Iterable} [attributes] Collection of attributes.\n */\n function UIElement(name, attributes, children) {\n var _this;\n\n _classCallCheck(this, UIElement);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(UIElement).call(this, name, attributes, children));\n /**\n * Returns `null` because filler is not needed for UIElements.\n *\n * @method #getFillerOffset\n * @returns {null} Always returns null.\n */\n\n _this.getFillerOffset = getFillerOffset;\n return _this;\n }\n /**\n * Checks whether this object is of the given.\n *\n *\t\tuiElement.is( 'uiElement' ); // -> true\n *\t\tuiElement.is( 'element' ); // -> true\n *\t\tuiElement.is( 'node' ); // -> true\n *\t\tuiElement.is( 'view:uiElement' ); // -> true\n *\t\tuiElement.is( 'view:element' ); // -> true\n *\t\tuiElement.is( 'view:node' ); // -> true\n *\n *\t\tuiElement.is( 'model:element' ); // -> false\n *\t\tuiElement.is( 'documentFragment' ); // -> false\n *\n * Assuming that the object being checked is an ui element, you can also check its\n * {@link module:engine/view/uielement~UIElement#name name}:\n *\n *\t\tuiElement.is( 'span' ); // -> true if this is a span ui element\n *\t\tuiElement.is( 'uiElement', 'span' ); // -> same as above\n *\t\ttext.is( 'span' ); -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type Type to check when `name` parameter is present.\n * Otherwise, it acts like the `name` parameter.\n * @param {String} [name] Element name.\n * @returns {Boolean}\n */\n\n\n _createClass(UIElement, [{\n key: \"is\",\n value: function is(type) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var cutType = type.replace(/^view:/, '');\n\n if (!name) {\n return cutType == 'uiElement' || _get(_getPrototypeOf(UIElement.prototype), \"is\", this).call(this, type);\n } else {\n return cutType == 'uiElement' && name == this.name || _get(_getPrototypeOf(UIElement.prototype), \"is\", this).call(this, type, name);\n }\n }\n /**\n * Overrides {@link module:engine/view/element~Element#_insertChild} method.\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes\n * to UIElement.\n *\n * @protected\n */\n\n }, {\n key: \"_insertChild\",\n value: function _insertChild(index, nodes) {\n if (nodes && (nodes instanceof Node || Array.from(nodes).length > 0)) {\n /**\n * Cannot add children to {@link module:engine/view/uielement~UIElement}.\n *\n * @error view-uielement-cannot-add\n */\n throw new CKEditorError('view-uielement-cannot-add: Cannot add child nodes to UIElement instance.', this);\n }\n }\n /**\n * Renders this {@link module:engine/view/uielement~UIElement} to DOM. This method is called by\n * {@link module:engine/view/domconverter~DomConverter}.\n * Do not use inheritance to create custom rendering method, replace `render()` method instead:\n *\n *\t\tconst myUIElement = downcastWriter.createUIElement( 'span' );\n *\t\tmyUIElement.render = function( domDocument ) {\n *\t\t\tconst domElement = this.toDomElement( domDocument );\n *\t\t\tdomElement.innerHTML = 'this is ui element';\n *\n *\t\t\treturn domElement;\n *\t\t};\n *\n * @param {Document} domDocument\n * @returns {HTMLElement}\n */\n\n }, {\n key: \"render\",\n value: function render(domDocument) {\n return this.toDomElement(domDocument);\n }\n /**\n * Creates DOM element based on this view UIElement.\n * Note that each time this method is called new DOM element is created.\n *\n * @param {Document} domDocument\n * @returns {HTMLElement}\n */\n\n }, {\n key: \"toDomElement\",\n value: function toDomElement(domDocument) {\n var domElement = domDocument.createElement(this.name);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = this.getAttributeKeys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key = _step.value;\n domElement.setAttribute(key, this.getAttribute(key));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return domElement;\n }\n }]);\n\n return UIElement;\n}(Element);\n/**\n * This function injects UI element handling to the given {@link module:engine/view/document~Document document}.\n *\n * A callback is added to {@link module:engine/view/document~Document#event:keydown document keydown event}.\n * The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.\n * Without this handler, it would be impossible to \"jump over\" UI element using right arrow key.\n *\n * @param {module:engine/view/view~View} view View controller to which the quirks handling will be injected.\n */\n\n\nexport { UIElement as default };\nexport function injectUiElementHandling(view) {\n view.document.on('keydown', function (evt, data) {\n return jumpOverUiElement(evt, data, view.domConverter);\n });\n} // Returns `null` because block filler is not needed for UIElements.\n//\n// @returns {null}\n\nfunction getFillerOffset() {\n return null;\n} // Selection cannot be placed in a `UIElement`. Whenever it is placed there, it is moved before it. This\n// causes a situation when it is impossible to jump over `UIElement` using right arrow key, because the selection\n// ends up in ui element (in DOM) and is moved back to the left. This handler fixes this situation.\n\n\nfunction jumpOverUiElement(evt, data, domConverter) {\n if (data.keyCode == keyCodes.arrowright) {\n var domSelection = data.domTarget.ownerDocument.defaultView.getSelection();\n var domSelectionCollapsed = domSelection.rangeCount == 1 && domSelection.getRangeAt(0).collapsed; // Jump over UI element if selection is collapsed or shift key is pressed. These are the cases when selection would extend.\n\n if (domSelectionCollapsed || data.shiftKey) {\n var domParent = domSelection.focusNode;\n var domOffset = domSelection.focusOffset;\n var viewPosition = domConverter.domPositionToView(domParent, domOffset); // In case if dom element is not converted to view or is not mapped or something. Happens for example in some tests.\n\n if (viewPosition === null) {\n return;\n } // Skip all following ui elements.\n\n\n var jumpedOverAnyUiElement = false;\n var nextViewPosition = viewPosition.getLastMatchingPosition(function (value) {\n if (value.item.is('uiElement')) {\n // Remember that there was at least one ui element.\n jumpedOverAnyUiElement = true;\n } // Jump over ui elements, jump over empty attribute elements, move up from inside of attribute element.\n\n\n if (value.item.is('uiElement') || value.item.is('attributeElement')) {\n return true;\n } // Don't jump over text or don't get out of container element.\n\n\n return false;\n }); // If anything has been skipped, fix position.\n // This `if` could be possibly omitted but maybe it is better not to mess with DOM selection if not needed.\n\n if (jumpedOverAnyUiElement) {\n var newDomPosition = domConverter.viewPositionToDom(nextViewPosition);\n\n if (domSelectionCollapsed) {\n // Selection was collapsed, so collapse it at further position.\n domSelection.collapse(newDomPosition.parent, newDomPosition.offset);\n } else {\n // Selection was not collapse, so extend it instead of collapsing.\n domSelection.extend(newDomPosition.parent, newDomPosition.offset);\n }\n }\n }\n }\n}","import \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 engine/view/documentfragment\n */\nimport Text from \"./text\";\nimport TextProxy from \"./textproxy\";\nimport mix from '@ckeditor/ckeditor5-utils/src/mix';\nimport isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';\nimport EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';\n/**\n * Document fragment.\n *\n * To create a new document fragment instance use the\n * {@link module:engine/view/upcastwriter~UpcastWriter#createDocumentFragment `UpcastWriter#createDocumentFragment()`}\n * method.\n */\n\nvar DocumentFragment =\n/*#__PURE__*/\nfunction () {\n /**\n * Creates new DocumentFragment instance.\n *\n * @protected\n * @param {module:engine/view/node~Node|Iterable.} [children]\n * A list of nodes to be inserted into the created document fragment.\n */\n function DocumentFragment(children) {\n _classCallCheck(this, DocumentFragment);\n\n /**\n * Array of child nodes.\n *\n * @protected\n * @member {Array.} module:engine/view/documentfragment~DocumentFragment#_children\n */\n this._children = [];\n\n if (children) {\n this._insertChild(0, children);\n }\n }\n /**\n * Iterable interface.\n *\n * Iterates over nodes added to this document fragment.\n *\n * @returns {Iterable.}\n */\n\n\n _createClass(DocumentFragment, [{\n key: Symbol.iterator,\n value: function value() {\n return this._children[Symbol.iterator]();\n }\n /**\n * Number of child nodes in this document fragment.\n *\n * @readonly\n * @type {Number}\n */\n\n }, {\n key: \"is\",\n\n /**\n * Checks whether this object is of the given type.\n *\n *\t\tdocFrag.is( 'documentFragment' ); // -> true\n *\t\tdocFrag.is( 'view:documentFragment' ); // -> true\n *\n *\t\tdocFrag.is( 'model:documentFragment' ); // -> false\n *\t\tdocFrag.is( 'element' ); // -> false\n *\t\tdocFrag.is( 'node' ); // -> false\n *\n * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.\n *\n * @param {String} type\n * @returns {Boolean}\n */\n value: function is(type) {\n return type == 'documentFragment' || type == 'view:documentFragment';\n }\n /**\n * {@link module:engine/view/documentfragment~DocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end\n * and sets the parent of these nodes to this fragment.\n *\n * @param {module:engine/view/item~Item|Iterable.} items Items to be inserted.\n * @returns {Number} Number of appended nodes.\n */\n\n }, {\n key: \"_appendChild\",\n value: function _appendChild(items) {\n return this._insertChild(this.childCount, items);\n }\n /**\n * Gets child at the given index.\n *\n * @param {Number} index Index of child.\n * @returns {module:engine/view/node~Node} Child node.\n */\n\n }, {\n key: \"getChild\",\n value: function getChild(index) {\n return this._children[index];\n }\n /**\n * Gets index of the given child node. Returns `-1` if child node is not found.\n *\n * @param {module:engine/view/node~Node} node Child node.\n * @returns {Number} Index of the child node.\n */\n\n }, {\n key: \"getChildIndex\",\n value: function getChildIndex(node) {\n return this._children.indexOf(node);\n }\n /**\n * Gets child nodes iterator.\n *\n * @returns {Iterable.} Child nodes iterator.\n */\n\n }, {\n key: \"getChildren\",\n value: function getChildren() {\n return this._children[Symbol.iterator]();\n }\n /**\n * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to\n * this fragment.\n *\n * @param {Number} index Position where nodes should be inserted.\n * @param {module:engine/view/item~Item|Iterable.} items Items to be inserted.\n * @returns {Number} Number of inserted nodes.\n */\n\n }, {\n key: \"_insertChild\",\n value: function _insertChild(index, items) {\n this._fireChange('children', this);\n\n var count = 0;\n var nodes = normalize(items);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n\n // If node that is being added to this element is already inside another element, first remove it from the old parent.\n if (node.parent !== null) {\n node._remove();\n }\n\n node.parent = this;\n\n this._children.splice(index, 0, node);\n\n index++;\n count++;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return count;\n }\n /**\n * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.\n *\n * @param {Number} index Number of the first node to remove.\n * @param {Number} [howMany=1] Number of nodes to remove.\n * @returns {Array.} The array of removed nodes.\n */\n\n }, {\n key: \"_removeChildren\",\n value: function _removeChildren(index) {\n var howMany = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n this._fireChange('children', this);\n\n for (var i = index; i < index + howMany; i++) {\n this._children[i].parent = null;\n }\n\n return this._children.splice(index, howMany);\n }\n /**\n * Fires `change` event with given type of the change.\n *\n * @private\n * @param {module:engine/view/document~ChangeType} type Type of the change.\n * @param {module:engine/view/node~Node} node Changed node.\n * @fires module:engine/view/node~Node#change\n */\n\n }, {\n key: \"_fireChange\",\n value: function _fireChange(type, node) {\n this.fire('change:' + type, node);\n }\n }, {\n key: \"childCount\",\n get: function get() {\n return this._children.length;\n }\n /**\n * Is `true` if there are no nodes inside this document fragment, `false` otherwise.\n *\n * @readonly\n * @type {Boolean}\n */\n\n }, {\n key: \"isEmpty\",\n get: function get() {\n return this.childCount === 0;\n }\n /**\n * Artificial root of `DocumentFragment`. Returns itself. Added for compatibility reasons.\n *\n * @readonly\n * @type {module:engine/model/documentfragment~DocumentFragment}\n */\n\n }, {\n key: \"root\",\n get: function get() {\n return this;\n }\n /**\n * Artificial parent of `DocumentFragment`. Returns `null`. Added for compatibility reasons.\n *\n * @readonly\n * @type {null}\n */\n\n }, {\n key: \"parent\",\n get: function get() {\n return null;\n }\n }]);\n\n return DocumentFragment;\n}();\n\nexport { DocumentFragment as default };\nmix(DocumentFragment, EmitterMixin); // Converts strings to Text and non-iterables to arrays.\n//\n// @param {String|module:engine/view/item~Item|Iterable.}\n// @returns {Iterable.}\n\nfunction normalize(nodes) {\n // Separate condition because string is iterable.\n if (typeof nodes == 'string') {\n return [new Text(nodes)];\n }\n\n if (!isIterable(nodes)) {\n nodes = [nodes];\n } // Array.from to enable .map() on non-arrays.\n\n\n return Array.from(nodes).map(function (node) {\n if (typeof node == 'string') {\n return new Text(node);\n }\n\n if (node instanceof TextProxy) {\n return new Text(node.data);\n }\n\n return node;\n });\n}","import \"core-js/modules/es6.set\";\nimport \"core-js/modules/es6.array.from\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.number.constructor\";\nimport \"core-js/modules/es6.array.find\";\nimport \"core-js/modules/es7.symbol.async-iterator\";\nimport \"core-js/modules/es6.symbol\";\nimport _toConsumableArray from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.map\";\nimport _classCallCheck from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/classCallCheck\";\nimport _createClass from \"D:\\\\LimeSurvey\\\\assets\\\\packages\\\\questioneditor\\\\node_modules\\\\@babel\\\\runtime-corejs2/helpers/esm/createClass\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 module:engine/view/downcastwriter\n */\nimport Position from \"./position\";\nimport Range from \"./range\";\nimport Selection from \"./selection\";\nimport ContainerElement from \"./containerelement\";\nimport AttributeElement from \"./attributeelement\";\nimport EmptyElement from \"./emptyelement\";\nimport UIElement from \"./uielement\";\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\nimport DocumentFragment from \"./documentfragment\";\nimport isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';\nimport Text from \"./text\";\nimport EditableElement from \"./editableelement\";\nimport { isPlainObject } from 'lodash-es';\n/**\n * View downcast writer.\n *\n * It provides a set of methods used to manipulate view nodes.\n *\n * Do not create an instance of this writer manually. To modify a view structure, use\n * the {@link module:engine/view/view~View#change `View#change()`} block.\n *\n * The `DowncastWriter` is designed to work with semantic views which are the views that were/are being downcasted from the model.\n * To work with ordinary views (e.g. parsed from a pasted content) use the\n * {@link module:engine/view/upcastwriter~UpcastWriter upcast writer}.\n *\n * Read more about changing the view in the {@glink framework/guides/architecture/editing-engine#changing-the-view Changing the view}\n * section of the {@glink framework/guides/architecture/editing-engine Editing engine architecture} guide.\n */\n\nvar DowncastWriter =\n/*#__PURE__*/\nfunction () {\n function DowncastWriter(document) {\n _classCallCheck(this, DowncastWriter);\n\n /**\n * @readonly\n * @type {module:engine/view/document~Document}\n */\n this.document = document;\n /**\n * Holds references to the attribute groups that share the same {@link module:engine/view/attributeelement~AttributeElement#id id}.\n * The keys are `id`s, the values are `Set`s holding {@link module:engine/view/attributeelement~AttributeElement}s.\n *\n * @private\n * @type {Map.}\n */\n\n this._cloneGroups = new Map();\n }\n /**\n * Sets {@link module:engine/view/documentselection~DocumentSelection selection's} ranges and direction to the\n * specified location based on the given {@link module:engine/view/selection~Selectable selectable}.\n *\n * Usage:\n *\n *\t\t// Sets selection to the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\twriter.setSelection( range );\n *\n *\t\t// Sets backward selection to the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\twriter.setSelection( range );\n *\n *\t\t// Sets selection to given ranges.\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( start2, end2 ) ];\n *\t\twriter.setSelection( range );\n *\n *\t\t// Sets selection to the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\twriter.setSelection( otherSelection );\n *\n * \t\t// Sets collapsed selection at the given position.\n *\t\tconst position = writer.createPositionFromPath( root, path );\n *\t\twriter.setSelection( position );\n *\n * \t\t// Sets collapsed selection at the position of given item and offset.\n *\t\tconst paragraph = writer.createContainerElement( 'p' );\n *\t\twriter.setSelection( paragraph, offset );\n *\n * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of\n \t * that element and ends after the last child of that element.\n *\n * \t\twriter.setSelection( paragraph, 'in' );\n *\n * Creates a range on the {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.\n *\n *\t\twriter.setSelection( paragraph, 'on' );\n *\n * \t\t// Removes all ranges.\n *\t\twriter.setSelection( null );\n *\n * `DowncastWriter#setSelection()` allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Sets selection as backward.\n *\t\twriter.setSelection( range, { backward: true } );\n *\n *\t\t// Sets selection as fake.\n *\t\t// Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * \t\t// This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * \t\t// represented in other way, for example by applying proper CSS class.\n *\t\twriter.setSelection( range, { fake: true } );\n *\n * \t\t// Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n * \t\t// (and be properly handled by screen readers).\n *\t\twriter.setSelection( range, { fake: true, label: 'foo' } );\n *\n * @param {module:engine/view/selection~Selectable} selectable\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Sets place or offset of the selection.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n */\n\n\n _createClass(DowncastWriter, [{\n key: \"setSelection\",\n value: function setSelection(selectable, placeOrOffset, options) {\n this.document.selection._setTo(selectable, placeOrOffset, options);\n }\n /**\n * Moves {@link module:engine/view/documentselection~DocumentSelection#focus selection's focus} to the specified location.\n *\n * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}\n * parameters.\n *\n * @param {module:engine/view/item~Item|module:engine/view/position~Position} itemOrPosition\n * @param {Number|'end'|'before'|'after'} [offset] Offset or one of the flags. Used only when\n * first parameter is a {@link module:engine/view/item~Item view item}.\n */\n\n }, {\n key: \"setSelectionFocus\",\n value: function setSelectionFocus(itemOrPosition, offset) {\n this.document.selection._setFocus(itemOrPosition, offset);\n }\n /**\n * Creates a new {@link module:engine/view/text~Text text node}.\n *\n *\t\twriter.createText( 'foo' );\n *\n * @param {String} data The text's data.\n * @returns {module:engine/view/text~Text} The created text node.\n */\n\n }, {\n key: \"createText\",\n value: function createText(data) {\n return new Text(data);\n }\n /**\n * Creates new {@link module:engine/view/attributeelement~AttributeElement}.\n *\n *\t\twriter.createAttributeElement( 'strong' );\n *\t\twriter.createAttributeElement( 'a', { href: 'foo.bar' } );\n *\n *\t\t// Make `` element contain other attributes element so the `` element is not broken.\n *\t\twriter.createAttributeElement( 'a', { href: 'foo.bar' }, { priority: 5 } );\n *\n *\t\t// Set `id` of a marker element so it is not joined or merged with \"normal\" elements.\n *\t\twriter.createAttributeElement( 'span', { class: 'my-marker' }, { id: 'marker:my' } );\n *\n * @param {String} name Name of the element.\n * @param {Object} [attributes] Element's attributes.\n * @param {Object} [options] Element's options.\n * @param {Number} [options.priority] Element's {@link module:engine/view/attributeelement~AttributeElement#priority priority}.\n * @param {Number|String} [options.id] Element's {@link module:engine/view/attributeelement~AttributeElement#id id}.\n * @returns {module:engine/view/attributeelement~AttributeElement} Created element.\n */\n\n }, {\n key: \"createAttributeElement\",\n value: function createAttributeElement(name, attributes) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var attributeElement = new AttributeElement(name, attributes);\n\n if (options.priority) {\n attributeElement._priority = options.priority;\n }\n\n if (options.id) {\n attributeElement._id = options.id;\n }\n\n return attributeElement;\n }\n /**\n * Creates new {@link module:engine/view/containerelement~ContainerElement}.\n *\n *\t\twriter.createContainerElement( 'p' );\n *\n *\t\t// Create element with custom attributes.\n *\t\twriter.createContainerElement( 'div', { id: 'foo-bar', 'data-baz': '123' } );\n *\n *\t\t// Create element with custom styles.\n *\t\twriter.createContainerElement( 'p', { style: 'font-weight: bold; padding-bottom: 10px' } );\n *\n *\t\t// Create element with custom classes.\n *\t\twriter.createContainerElement( 'p', { class: 'foo bar baz' } );\n *\n * @param {String} name Name of the element.\n * @param {Object} [attributes] Elements attributes.\n * @returns {module:engine/view/containerelement~ContainerElement} Created element.\n */\n\n }, {\n key: \"createContainerElement\",\n value: function createContainerElement(name, attributes) {\n return new ContainerElement(name, attributes);\n }\n /**\n * Creates new {@link module:engine/view/editableelement~EditableElement}.\n *\n *\t\twriter.createEditableElement( 'div' );\n *\t\twriter.createEditableElement( 'div', { id: 'foo-1234' } );\n *\n * @param {String} name Name of the element.\n * @param {Object} [attributes] Elements attributes.\n * @returns {module:engine/view/editableelement~EditableElement} Created element.\n */\n\n }, {\n key: \"createEditableElement\",\n value: function createEditableElement(name, attributes) {\n var editableElement = new EditableElement(name, attributes);\n editableElement._document = this.document;\n return editableElement;\n }\n /**\n * Creates new {@link module:engine/view/emptyelement~EmptyElement}.\n *\n *\t\twriter.createEmptyElement( 'img' );\n *\t\twriter.createEmptyElement( 'img', { id: 'foo-1234' } );\n *\n * @param {String} name Name of the element.\n * @param {Object} [attributes] Elements attributes.\n * @returns {module:engine/view/emptyelement~EmptyElement} Created element.\n */\n\n }, {\n key: \"createEmptyElement\",\n value: function createEmptyElement(name, attributes) {\n return new EmptyElement(name, attributes);\n }\n /**\n * Creates new {@link module:engine/view/uielement~UIElement}.\n *\n *\t\twriter.createUIElement( 'span' );\n *\t\twriter.createUIElement( 'span', { id: 'foo-1234' } );\n *\n * Custom render function can be provided as third parameter:\n *\n *\t\twriter.createUIElement( 'span', null, function( domDocument ) {\n *\t\t\tconst domElement = this.toDomElement( domDocument );\n *\t\t\tdomElement.innerHTML = 'this is ui element';\n *\n *\t\t\treturn domElement;\n *\t\t} );\n *\n * @param {String} name Name of the element.\n * @param {Object} [attributes] Elements attributes.\n * @param {Function} [renderFunction] Custom render function.\n * @returns {module:engine/view/uielement~UIElement} Created element.\n */\n\n }, {\n key: \"createUIElement\",\n value: function createUIElement(name, attributes, renderFunction) {\n var uiElement = new UIElement(name, attributes);\n\n if (renderFunction) {\n uiElement.render = renderFunction;\n }\n\n return uiElement;\n }\n /**\n * Adds or overwrite element's attribute with a specified key and value.\n *\n *\t\twriter.setAttribute( 'href', 'http://ckeditor.com', linkElement );\n *\n * @param {String} key Attribute key.\n * @param {String} value Attribute value.\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"setAttribute\",\n value: function setAttribute(key, value, element) {\n element._setAttribute(key, value);\n }\n /**\n * Removes attribute from the element.\n *\n *\t\twriter.removeAttribute( 'href', linkElement );\n *\n * @param {String} key Attribute key.\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"removeAttribute\",\n value: function removeAttribute(key, element) {\n element._removeAttribute(key);\n }\n /**\n * Adds specified class to the element.\n *\n *\t\twriter.addClass( 'foo', linkElement );\n *\t\twriter.addClass( [ 'foo', 'bar' ], linkElement );\n *\n * @param {Array.|String} className\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"addClass\",\n value: function addClass(className, element) {\n element._addClass(className);\n }\n /**\n * Removes specified class from the element.\n *\n *\t\twriter.removeClass( 'foo', linkElement );\n *\t\twriter.removeClass( [ 'foo', 'bar' ], linkElement );\n *\n * @param {Array.|String} className\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"removeClass\",\n value: function removeClass(className, element) {\n element._removeClass(className);\n }\n /**\n * Adds style to the element.\n *\n *\t\twriter.setStyle( 'color', 'red', element );\n *\t\twriter.setStyle( {\n *\t\t\tcolor: 'red',\n *\t\t\tposition: 'fixed'\n *\t\t}, element );\n *\n * @param {String|Object} property Property name or object with key - value pairs.\n * @param {String} [value] Value to set. This parameter is ignored if object is provided as the first parameter.\n * @param {module:engine/view/element~Element} element Element to set styles on.\n */\n\n }, {\n key: \"setStyle\",\n value: function setStyle(property, value, element) {\n if (isPlainObject(property) && element === undefined) {\n element = value;\n }\n\n element._setStyle(property, value);\n }\n /**\n * Removes specified style from the element.\n *\n *\t\twriter.removeStyle( 'color', element ); // Removes 'color' style.\n *\t\twriter.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.\n *\n * @param {Array.|String} property\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"removeStyle\",\n value: function removeStyle(property, element) {\n element._removeStyle(property);\n }\n /**\n * Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,\n * so they can be used to add special data to elements.\n *\n * @param {String|Symbol} key\n * @param {*} value\n * @param {module:engine/view/element~Element} element\n */\n\n }, {\n key: \"setCustomProperty\",\n value: function setCustomProperty(key, value, element) {\n element._setCustomProperty(key, value);\n }\n /**\n * Removes a custom property stored under the given key.\n *\n * @param {String|Symbol} key\n * @param {module:engine/view/element~Element} element\n * @returns {Boolean} Returns true if property was removed.\n */\n\n }, {\n key: \"removeCustomProperty\",\n value: function removeCustomProperty(key, element) {\n return element._removeCustomProperty(key);\n }\n /**\n * Breaks attribute nodes at provided position or at boundaries of provided range. It breaks attribute elements inside\n * up to a container element.\n *\n * In following examples `` is a container, `` and `` are attribute nodes:\n *\n *\t\t
foobar{}
-> foobar[]
\n *\t\tfoo{}bar
-> foo{}bar
\n *\t\tfoob{}ar
-> foob[]ar
\n *\t\tfo{oba}r
-> foobar
\n *\n * **Note:** {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment} is treated like a container.\n *\n * **Note:** Difference between {@link module:engine/view/downcastwriter~DowncastWriter#breakAttributes breakAttributes} and\n * {@link module:engine/view/downcastwriter~DowncastWriter#breakContainer breakContainer} is that `breakAttributes` breaks all\n * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,\n * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.\n * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container`\n * when {@link module:engine/view/range~Range#start start}\n * and {@link module:engine/view/range~Range#end end} positions of a passed range are not placed inside same parent container.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-empty-element`\n * when trying to break attributes\n * inside {@link module:engine/view/emptyelement~EmptyElement EmptyElement}.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-ui-element`\n * when trying to break attributes\n * inside {@link module:engine/view/uielement~UIElement UIElement}.\n *\n * @see module:engine/view/attributeelement~AttributeElement\n * @see module:engine/view/containerelement~ContainerElement\n * @see module:engine/view/downcastwriter~DowncastWriter#breakContainer\n * @param {module:engine/view/position~Position|module:engine/view/range~Range} positionOrRange Position where\n * to break attribute elements.\n * @returns {module:engine/view/position~Position|module:engine/view/range~Range} New position or range, after breaking the attribute\n * elements.\n */\n\n }, {\n key: \"breakAttributes\",\n value: function breakAttributes(positionOrRange) {\n if (positionOrRange instanceof Position) {\n return this._breakAttributes(positionOrRange);\n } else {\n return this._breakAttributesRange(positionOrRange);\n }\n }\n /**\n * Breaks {@link module:engine/view/containerelement~ContainerElement container view element} into two, at the given position. Position\n * has to be directly inside container element and cannot be in root. Does not break if position is at the beginning\n * or at the end of it's parent element.\n *\n *\t\tfoo^bar
-> foo
bar
\n *\t\t -> \n *\t\t^foobar
-> ^foobar
\n *\t\tfoobar^
-> foobar
^\n *\n * **Note:** Difference between {@link module:engine/view/downcastwriter~DowncastWriter#breakAttributes breakAttributes} and\n * {@link module:engine/view/downcastwriter~DowncastWriter#breakContainer breakContainer} is that `breakAttributes` breaks all\n * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,\n * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.\n * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.\n *\n * @see module:engine/view/attributeelement~AttributeElement\n * @see module:engine/view/containerelement~ContainerElement\n * @see module:engine/view/downcastwriter~DowncastWriter#breakAttributes\n * @param {module:engine/view/position~Position} position Position where to break element.\n * @returns {module:engine/view/position~Position} Position between broken elements. If element has not been broken,\n * the returned position is placed either before it or after it.\n */\n\n }, {\n key: \"breakContainer\",\n value: function breakContainer(position) {\n var element = position.parent;\n\n if (!element.is('containerElement')) {\n /**\n * Trying to break an element which is not a container element.\n *\n * @error view-writer-break-non-container-element\n */\n throw new CKEditorError('view-writer-break-non-container-element: Trying to break an element which is not a container element.', this.document);\n }\n\n if (!element.parent) {\n /**\n * Trying to break root element.\n *\n * @error view-writer-break-root\n */\n throw new CKEditorError('view-writer-break-root: Trying to break root element.', this.document);\n }\n\n if (position.isAtStart) {\n return Position._createBefore(element);\n } else if (!position.isAtEnd) {\n var newElement = element._clone(false);\n\n this.insert(Position._createAfter(element), newElement);\n var sourceRange = new Range(position, Position._createAt(element, 'end'));\n var targetPosition = new Position(newElement, 0);\n this.move(sourceRange, targetPosition);\n }\n\n return Position._createAfter(element);\n }\n /**\n * Merges {@link module:engine/view/attributeelement~AttributeElement attribute elements}. It also merges text nodes if needed.\n * Only {@link module:engine/view/attributeelement~AttributeElement#isSimilar similar} attribute elements can be merged.\n *\n * In following examples `` is a container and `` is an attribute element:\n *\n *\t\t
foo[]bar
-> foo{}bar
\n *\t\tfoo[]bar
-> foo{}bar
\n *\t\ta[]b
-> a[]b
\n *\n * It will also take care about empty attributes when merging:\n *\n *\t\t[]
-> []
\n *\t\tfoo[]bar
-> foo{}bar
\n *\n * **Note:** Difference between {@link module:engine/view/downcastwriter~DowncastWriter#mergeAttributes mergeAttributes} and\n * {@link module:engine/view/downcastwriter~DowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two\n * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}\n * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.\n *\n * @see module:engine/view/attributeelement~AttributeElement\n * @see module:engine/view/containerelement~ContainerElement\n * @see module:engine/view/downcastwriter~DowncastWriter#mergeContainers\n * @param {module:engine/view/position~Position} position Merge position.\n * @returns {module:engine/view/position~Position} Position after merge.\n */\n\n }, {\n key: \"mergeAttributes\",\n value: function mergeAttributes(position) {\n var positionOffset = position.offset;\n var positionParent = position.parent; // When inside text node - nothing to merge.\n\n if (positionParent.is('text')) {\n return position;\n } // When inside empty attribute - remove it.\n\n\n if (positionParent.is('attributeElement') && positionParent.childCount === 0) {\n var parent = positionParent.parent;\n var offset = positionParent.index;\n\n positionParent._remove();\n\n this._removeFromClonedElementsGroup(positionParent);\n\n return this.mergeAttributes(new Position(parent, offset));\n }\n\n var nodeBefore = positionParent.getChild(positionOffset - 1);\n var nodeAfter = positionParent.getChild(positionOffset); // Position should be placed between two nodes.\n\n if (!nodeBefore || !nodeAfter) {\n return position;\n } // When position is between two text nodes.\n\n\n if (nodeBefore.is('text') && nodeAfter.is('text')) {\n return mergeTextNodes(nodeBefore, nodeAfter);\n } // When position is between two same attribute elements.\n else if (nodeBefore.is('attributeElement') && nodeAfter.is('attributeElement') && nodeBefore.isSimilar(nodeAfter)) {\n // Move all children nodes from node placed after selection and remove that node.\n var count = nodeBefore.childCount;\n\n nodeBefore._appendChild(nodeAfter.getChildren());\n\n nodeAfter._remove();\n\n this._removeFromClonedElementsGroup(nodeAfter); // New position is located inside the first node, before new nodes.\n // Call this method recursively to merge again if needed.\n\n\n return this.mergeAttributes(new Position(nodeBefore, count));\n }\n\n return position;\n }\n /**\n * Merges two {@link module:engine/view/containerelement~ContainerElement container elements} that are before and after given position.\n * Precisely, the element after the position is removed and it's contents are moved to element before the position.\n *\n *\t\tfoo
^bar
-> foo^bar
\n *\t\tfoo
^bar
-> foo^bar
\n *\n * **Note:** Difference between {@link module:engine/view/downcastwriter~DowncastWriter#mergeAttributes mergeAttributes} and\n * {@link module:engine/view/downcastwriter~DowncastWriter#mergeContainers mergeContainers} is that `mergeAttributes` merges two\n * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}\n * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.\n *\n * @see module:engine/view/attributeelement~AttributeElement\n * @see module:engine/view/containerelement~ContainerElement\n * @see module:engine/view/downcastwriter~DowncastWriter#mergeAttributes\n * @param {module:engine/view/position~Position} position Merge position.\n * @returns {module:engine/view/position~Position} Position after merge.\n */\n\n }, {\n key: \"mergeContainers\",\n value: function mergeContainers(position) {\n var prev = position.nodeBefore;\n var next = position.nodeAfter;\n\n if (!prev || !next || !prev.is('containerElement') || !next.is('containerElement')) {\n /**\n * Element before and after given position cannot be merged.\n *\n * @error view-writer-merge-containers-invalid-position\n */\n throw new CKEditorError('view-writer-merge-containers-invalid-position: ' + 'Element before and after given position cannot be merged.', this.document);\n }\n\n var lastChild = prev.getChild(prev.childCount - 1);\n var newPosition = lastChild instanceof Text ? Position._createAt(lastChild, 'end') : Position._createAt(prev, 'end');\n this.move(Range._createIn(next), Position._createAt(prev, 'end'));\n this.remove(Range._createOn(next));\n return newPosition;\n }\n /**\n * Insert node or nodes at specified position. Takes care about breaking attributes before insertion\n * and merging them afterwards.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-insert-invalid-node` when nodes to insert\n * contains instances that are not {@link module:engine/view/text~Text Texts},\n * {@link module:engine/view/attributeelement~AttributeElement AttributeElements},\n * {@link module:engine/view/containerelement~ContainerElement ContainerElements},\n * {@link module:engine/view/emptyelement~EmptyElement EmptyElements} or\n * {@link module:engine/view/uielement~UIElement UIElements}.\n *\n * @param {module:engine/view/position~Position} position Insertion position.\n * @param {module:engine/view/text~Text|module:engine/view/attributeelement~AttributeElement|\n * module:engine/view/containerelement~ContainerElement|module:engine/view/emptyelement~EmptyElement|\n * module:engine/view/uielement~UIElement|Iterable.} nodes Node or nodes to insert.\n * @returns {module:engine/view/range~Range} Range around inserted nodes.\n */\n\n }, {\n key: \"insert\",\n value: function insert(position, nodes) {\n nodes = isIterable(nodes) ? _toConsumableArray(nodes) : [nodes]; // Check if nodes to insert are instances of AttributeElements, ContainerElements, EmptyElements, UIElements or Text.\n\n validateNodesToInsert(nodes, this.document);\n var container = getParentContainer(position);\n\n if (!container) {\n /**\n * Position's parent container cannot be found.\n *\n * @error view-writer-invalid-position-container\n */\n throw new CKEditorError('view-writer-invalid-position-container', this.document);\n }\n\n var insertionPosition = this._breakAttributes(position, true);\n\n var length = container._insertChild(insertionPosition.offset, nodes);\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n\n this._addToClonedElementsGroup(node);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var endPosition = insertionPosition.getShiftedBy(length);\n var start = this.mergeAttributes(insertionPosition); // When no nodes were inserted - return collapsed range.\n\n if (length === 0) {\n return new Range(start, start);\n } else {\n // If start position was merged - move end position.\n if (!start.isEqual(insertionPosition)) {\n endPosition.offset--;\n }\n\n var end = this.mergeAttributes(endPosition);\n return new Range(start, end);\n }\n }\n /**\n * Removes provided range from the container.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside\n * same parent container.\n *\n * @param {module:engine/view/range~Range|module:engine/view/item~Item} rangeOrItem Range to remove from container\n * or an {@link module:engine/view/item~Item item} to remove. If range is provided, after removing, it will be updated\n * to a collapsed range showing the new position.\n * @returns {module:engine/view/documentfragment~DocumentFragment} Document fragment containing removed nodes.\n */\n\n }, {\n key: \"remove\",\n value: function remove(rangeOrItem) {\n var range = rangeOrItem instanceof Range ? rangeOrItem : Range._createOn(rangeOrItem);\n validateRangeContainer(range, this.document); // If range is collapsed - nothing to remove.\n\n if (range.isCollapsed) {\n return new DocumentFragment();\n } // Break attributes at range start and end.\n\n\n var _this$_breakAttribute = this._breakAttributesRange(range, true),\n breakStart = _this$_breakAttribute.start,\n breakEnd = _this$_breakAttribute.end;\n\n var parentContainer = breakStart.parent;\n var count = breakEnd.offset - breakStart.offset; // Remove nodes in range.\n\n var removed = parentContainer._removeChildren(breakStart.offset, count);\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = removed[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var node = _step2.value;\n\n this._removeFromClonedElementsGroup(node);\n } // Merge after removing.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var mergePosition = this.mergeAttributes(breakStart);\n range.start = mergePosition;\n range.end = mergePosition.clone(); // Return removed nodes.\n\n return new DocumentFragment(removed);\n }\n /**\n * Removes matching elements from given range.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside\n * same parent container.\n *\n * @param {module:engine/view/range~Range} range Range to clear.\n * @param {module:engine/view/element~Element} element Element to remove.\n */\n\n }, {\n key: \"clear\",\n value: function clear(range, element) {\n validateRangeContainer(range, this.document); // Create walker on given range.\n // We walk backward because when we remove element during walk it modifies range end position.\n\n var walker = range.getWalker({\n direction: 'backward',\n ignoreElementEnd: true\n }); // Let's walk.\n\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = walker[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var current = _step3.value;\n var item = current.item;\n var rangeToRemove = void 0; // When current item matches to the given element.\n\n if (item.is('element') && element.isSimilar(item)) {\n // Create range on this element.\n rangeToRemove = Range._createOn(item); // When range starts inside Text or TextProxy element.\n } else if (!current.nextPosition.isAfter(range.start) && item.is('textProxy')) {\n // We need to check if parent of this text matches to given element.\n var parentElement = item.getAncestors().find(function (ancestor) {\n return ancestor.is('element') && element.isSimilar(ancestor);\n }); // If it is then create range inside this element.\n\n if (parentElement) {\n rangeToRemove = Range._createIn(parentElement);\n }\n } // If we have found element to remove.\n\n\n if (rangeToRemove) {\n // We need to check if element range stick out of the given range and truncate if it is.\n if (rangeToRemove.end.isAfter(range.end)) {\n rangeToRemove.end = range.end;\n }\n\n if (rangeToRemove.start.isBefore(range.start)) {\n rangeToRemove.start = range.start;\n } // At the end we remove range with found element.\n\n\n this.remove(rangeToRemove);\n }\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n }\n /**\n * Moves nodes from provided range to target position.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside\n * same parent container.\n *\n * @param {module:engine/view/range~Range} sourceRange Range containing nodes to move.\n * @param {module:engine/view/position~Position} targetPosition Position to insert.\n * @returns {module:engine/view/range~Range} Range in target container. Inserted nodes are placed between\n * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions.\n */\n\n }, {\n key: \"move\",\n value: function move(sourceRange, targetPosition) {\n var nodes;\n\n if (targetPosition.isAfter(sourceRange.end)) {\n targetPosition = this._breakAttributes(targetPosition, true);\n var parent = targetPosition.parent;\n var countBefore = parent.childCount;\n sourceRange = this._breakAttributesRange(sourceRange, true);\n nodes = this.remove(sourceRange);\n targetPosition.offset += parent.childCount - countBefore;\n } else {\n nodes = this.remove(sourceRange);\n }\n\n return this.insert(targetPosition, nodes);\n }\n /**\n * Wraps elements within range with provided {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.\n * If a collapsed range is provided, it will be wrapped only if it is equal to view selection.\n *\n * If a collapsed range was passed and is same as selection, the selection\n * will be moved to the inside of the wrapped attribute element.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-invalid-range-container`\n * when {@link module:engine/view/range~Range#start}\n * and {@link module:engine/view/range~Range#end} positions are not placed inside same parent container.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-nonselection-collapsed-range` when passed range\n * is collapsed and different than view selection.\n *\n * @param {module:engine/view/range~Range} range Range to wrap.\n * @param {module:engine/view/attributeelement~AttributeElement} attribute Attribute element to use as wrapper.\n * @returns {module:engine/view/range~Range} range Range after wrapping, spanning over wrapping attribute element.\n */\n\n }, {\n key: \"wrap\",\n value: function wrap(range, attribute) {\n if (!(attribute instanceof AttributeElement)) {\n throw new CKEditorError('view-writer-wrap-invalid-attribute', this.document);\n }\n\n validateRangeContainer(range, this.document);\n\n if (!range.isCollapsed) {\n // Non-collapsed range. Wrap it with the attribute element.\n return this._wrapRange(range, attribute);\n } else {\n // Collapsed range. Wrap position.\n var position = range.start;\n\n if (position.parent.is('element') && !_hasNonUiChildren(position.parent)) {\n position = position.getLastMatchingPosition(function (value) {\n return value.item.is('uiElement');\n });\n }\n\n position = this._wrapPosition(position, attribute);\n var viewSelection = this.document.selection; // If wrapping position is equal to view selection, move view selection inside wrapping attribute element.\n\n if (viewSelection.isCollapsed && viewSelection.getFirstPosition().isEqual(range.start)) {\n this.setSelection(position);\n }\n\n return new Range(position);\n }\n }\n /**\n * Unwraps nodes within provided range from attribute element.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when\n * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside\n * same parent container.\n *\n * @param {module:engine/view/range~Range} range\n * @param {module:engine/view/attributeelement~AttributeElement} attribute\n */\n\n }, {\n key: \"unwrap\",\n value: function unwrap(range, attribute) {\n if (!(attribute instanceof AttributeElement)) {\n /**\n * Attribute element need to be instance of attribute element.\n *\n * @error view-writer-unwrap-invalid-attribute\n */\n throw new CKEditorError('view-writer-unwrap-invalid-attribute', this.document);\n }\n\n validateRangeContainer(range, this.document); // If range is collapsed - nothing to unwrap.\n\n if (range.isCollapsed) {\n return range;\n } // Break attributes at range start and end.\n\n\n var _this$_breakAttribute2 = this._breakAttributesRange(range, true),\n breakStart = _this$_breakAttribute2.start,\n breakEnd = _this$_breakAttribute2.end;\n\n var parentContainer = breakStart.parent; // Unwrap children located between break points.\n\n var newRange = this._unwrapChildren(parentContainer, breakStart.offset, breakEnd.offset, attribute); // Merge attributes at the both ends and return a new range.\n\n\n var start = this.mergeAttributes(newRange.start); // If start position was merged - move end position back.\n\n if (!start.isEqual(newRange.start)) {\n newRange.end.offset--;\n }\n\n var end = this.mergeAttributes(newRange.end);\n return new Range(start, end);\n }\n /**\n * Renames element by creating a copy of renamed element but with changed name and then moving contents of the\n * old element to the new one. Keep in mind that this will invalidate all {@link module:engine/view/position~Position positions} which\n * has renamed element as {@link module:engine/view/position~Position#parent a parent}.\n *\n * New element has to be created because `Element#tagName` property in DOM is readonly.\n *\n * Since this function creates a new element and removes the given one, the new element is returned to keep reference.\n *\n * @param {String} newName New name for element.\n * @param {module:engine/view/containerelement~ContainerElement} viewElement Element to be renamed.\n */\n\n }, {\n key: \"rename\",\n value: function rename(newName, viewElement) {\n var newElement = new ContainerElement(newName, viewElement.getAttributes());\n this.insert(Position._createAfter(viewElement), newElement);\n this.move(Range._createIn(viewElement), Position._createAt(newElement, 0));\n this.remove(Range._createOn(viewElement));\n return newElement;\n }\n /**\n * Cleans up memory by removing obsolete cloned elements group from the writer.\n *\n * Should be used whenever all {@link module:engine/view/attributeelement~AttributeElement attribute elements}\n * with the same {@link module:engine/view/attributeelement~AttributeElement#id id} are going to be removed from the view and\n * the group will no longer be needed.\n *\n * Cloned elements group are not removed automatically in case if the group is still needed after all its elements\n * were removed from the view.\n *\n * Keep in mind that group names are equal to the `id` property of the attribute element.\n *\n * @param {String} groupName Name of the group to clear.\n */\n\n }, {\n key: \"clearClonedElementsGroup\",\n value: function clearClonedElementsGroup(groupName) {\n this._cloneGroups.delete(groupName);\n }\n /**\n * Creates position at the given location. The location can be specified as:\n *\n * * a {@link module:engine/view/position~Position position},\n * * parent element and offset (offset defaults to `0`),\n * * parent element and `'end'` (sets position at the end of that element),\n * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).\n *\n * This method is a shortcut to other constructors such as:\n *\n * * {@link #createPositionBefore},\n * * {@link #createPositionAfter},\n *\n * @param {module:engine/view/item~Item|module:engine/model/position~Position} itemOrPosition\n * @param {Number|'end'|'before'|'after'} [offset] Offset or one of the flags. Used only when\n * first parameter is a {@link module:engine/view/item~Item view item}.\n */\n\n }, {\n key: \"createPositionAt\",\n value: function createPositionAt(itemOrPosition, offset) {\n return Position._createAt(itemOrPosition, offset);\n }\n /**\n * Creates a new position after given view item.\n *\n * @param {module:engine/view/item~Item} item View item after which the position should be located.\n * @returns {module:engine/view/position~Position}\n */\n\n }, {\n key: \"createPositionAfter\",\n value: function createPositionAfter(item) {\n return Position._createAfter(item);\n }\n /**\n * Creates a new position before given view item.\n *\n * @param {module:engine/view/item~Item} item View item before which the position should be located.\n * @returns {module:engine/view/position~Position}\n */\n\n }, {\n key: \"createPositionBefore\",\n value: function createPositionBefore(item) {\n return Position._createBefore(item);\n }\n /**\n * Creates a range spanning from `start` position to `end` position.\n *\n * **Note:** This factory method creates it's own {@link module:engine/view/position~Position} instances basing on passed values.\n *\n * @param {module:engine/view/position~Position} start Start position.\n * @param {module:engine/view/position~Position} [end] End position. If not set, range will be collapsed at `start` position.\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"createRange\",\n value: function createRange(start, end) {\n return new Range(start, end);\n }\n /**\n * Creates a range that starts before given {@link module:engine/view/item~Item view item} and ends after it.\n *\n * @param {module:engine/view/item~Item} item\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"createRangeOn\",\n value: function createRangeOn(item) {\n return Range._createOn(item);\n }\n /**\n * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of\n * that element and ends after the last child of that element.\n *\n * @param {module:engine/view/element~Element} element Element which is a parent for the range.\n * @returns {module:engine/view/range~Range}\n */\n\n }, {\n key: \"createRangeIn\",\n value: function createRangeIn(element) {\n return Range._createIn(element);\n }\n /**\n Creates new {@link module:engine/view/selection~Selection} instance.\n *\n * \t\t// Creates empty selection without ranges.\n *\t\tconst selection = writer.createSelection();\n *\n *\t\t// Creates selection at the given range.\n *\t\tconst range = writer.createRange( start, end );\n *\t\tconst selection = writer.createSelection( range );\n *\n *\t\t// Creates selection at the given ranges\n * \t\tconst ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];\n *\t\tconst selection = writer.createSelection( ranges );\n *\n *\t\t// Creates selection from the other selection.\n *\t\tconst otherSelection = writer.createSelection();\n *\t\tconst selection = writer.createSelection( otherSelection );\n *\n *\t\t// Creates selection from the document selection.\n *\t\tconst selection = writer.createSelection( editor.editing.view.document.selection );\n *\n * \t\t// Creates selection at the given position.\n *\t\tconst position = writer.createPositionFromPath( root, path );\n *\t\tconst selection = writer.createSelection( position );\n *\n *\t\t// Creates collapsed selection at the position of given item and offset.\n *\t\tconst paragraph = writer.createContainerElement( 'p' );\n *\t\tconst selection = writer.createSelection( paragraph, offset );\n *\n *\t\t// Creates a range inside an {@link module:engine/view/element~Element element} which starts before the\n *\t\t// first child of that element and ends after the last child of that element.\n *\t\tconst selection = writer.createSelection( paragraph, 'in' );\n *\n *\t\t// Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends\n *\t\t// just after the item.\n *\t\tconst selection = writer.createSelection( paragraph, 'on' );\n *\n * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.\n *\n *\t\t// Creates backward selection.\n *\t\tconst selection = writer.createSelection( range, { backward: true } );\n *\n * Fake selection does not render as browser native selection over selected elements and is hidden to the user.\n * This way, no native selection UI artifacts are displayed to the user and selection over elements can be\n * represented in other way, for example by applying proper CSS class.\n *\n * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM\n * (and be properly handled by screen readers).\n *\n *\t\t// Creates fake selection with label.\n *\t\tconst selection = writer.createSelection( range, { fake: true, label: 'foo' } );\n *\n * @param {module:engine/view/selection~Selectable} [selectable=null]\n * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Offset or place when selectable is an `Item`.\n * @param {Object} [options]\n * @param {Boolean} [options.backward] Sets this selection instance to be backward.\n * @param {Boolean} [options.fake] Sets this selection instance to be marked as `fake`.\n * @param {String} [options.label] Label for the fake selection.\n * @returns {module:engine/view/selection~Selection}\n */\n\n }, {\n key: \"createSelection\",\n value: function createSelection(selectable, placeOrOffset, options) {\n return new Selection(selectable, placeOrOffset, options);\n }\n /**\n * Wraps children with provided `wrapElement`. Only children contained in `parent` element between\n * `startOffset` and `endOffset` will be wrapped.\n *\n * @private\n * @param {module:engine/view/element~Element} parent\n * @param {Number} startOffset\n * @param {Number} endOffset\n * @param {module:engine/view/element~Element} wrapElement\n */\n\n }, {\n key: \"_wrapChildren\",\n value: function _wrapChildren(parent, startOffset, endOffset, wrapElement) {\n var i = startOffset;\n var wrapPositions = [];\n\n while (i < endOffset) {\n var child = parent.getChild(i);\n var isText = child.is('text');\n var isAttribute = child.is('attributeElement');\n var isEmpty = child.is('emptyElement');\n var isUI = child.is('uiElement'); //\n // (In all examples, assume that `wrapElement` is `` element.)\n //\n // Check if `wrapElement` can be joined with the wrapped element. One of requirements is having same name.\n // If possible, join elements.\n //\n // abc
--> abc
\n //\n\n if (isAttribute && this._wrapAttributeElement(wrapElement, child)) {\n wrapPositions.push(new Position(parent, i));\n } //\n // Wrap the child if it is not an attribute element or if it is an attribute element that should be inside\n // `wrapElement` (due to priority).\n //\n // abc
--> abc
\n // abc
--> abc
\n //\n else if (isText || isEmpty || isUI || isAttribute && shouldABeOutsideB(wrapElement, child)) {\n // Clone attribute.\n var newAttribute = wrapElement._clone(); // Wrap current node with new attribute.\n\n\n child._remove();\n\n newAttribute._appendChild(child);\n\n parent._insertChild(i, newAttribute);\n\n this._addToClonedElementsGroup(newAttribute);\n\n wrapPositions.push(new Position(parent, i));\n } //\n // If other nested attribute is found and it wasn't wrapped (see above), continue wrapping inside it.\n //\n // abc
--> abc
\n //\n else if (isAttribute) {\n this._wrapChildren(child, 0, child.childCount, wrapElement);\n }\n\n i++;\n } // Merge at each wrap.\n\n\n var offsetChange = 0;\n\n for (var _i = 0, _wrapPositions = wrapPositions; _i < _wrapPositions.length; _i++) {\n var position = _wrapPositions[_i];\n position.offset -= offsetChange; // Do not merge with elements outside selected children.\n\n if (position.offset == startOffset) {\n continue;\n }\n\n var newPosition = this.mergeAttributes(position); // If nodes were merged - other merge offsets will change.\n\n if (!newPosition.isEqual(position)) {\n offsetChange++;\n endOffset--;\n }\n }\n\n return Range._createFromParentsAndOffsets(parent, startOffset, parent, endOffset);\n }\n /**\n * Unwraps children from provided `unwrapElement`. Only children contained in `parent` element between\n * `startOffset` and `endOffset` will be unwrapped.\n *\n * @private\n * @param {module:engine/view/element~Element} parent\n * @param {Number} startOffset\n * @param {Number} endOffset\n * @param {module:engine/view/element~Element} unwrapElement\n */\n\n }, {\n key: \"_unwrapChildren\",\n value: function _unwrapChildren(parent, startOffset, endOffset, unwrapElement) {\n var i = startOffset;\n var unwrapPositions = []; // Iterate over each element between provided offsets inside parent.\n // We don't use tree walker or range iterator because we will be removing and merging potentially multiple nodes,\n // so it could get messy. It is safer to it manually in this case.\n\n while (i < endOffset) {\n var child = parent.getChild(i); // Skip all text nodes. There should be no container element's here either.\n\n if (!child.is('attributeElement')) {\n i++;\n continue;\n } //\n // (In all examples, assume that `unwrapElement` is `` element.)\n //\n // If the child is similar to the given attribute element, unwrap it - it will be completely removed.\n //\n // abcxyz
--> abcxyz
\n //\n\n\n if (child.isSimilar(unwrapElement)) {\n var unwrapped = child.getChildren();\n var count = child.childCount; // Replace wrapper element with its children\n\n child._remove();\n\n parent._insertChild(i, unwrapped);\n\n this._removeFromClonedElementsGroup(child); // Save start and end position of moved items.\n\n\n unwrapPositions.push(new Position(parent, i), new Position(parent, i + count)); // Skip elements that were unwrapped. Assuming there won't be another element to unwrap in child elements.\n\n i += count;\n endOffset += count - 1;\n continue;\n } //\n // If the child is not similar but is an attribute element, try partial unwrapping - remove the same attributes/styles/classes.\n // Partial unwrapping will happen only if the elements have the same name.\n //\n // abcxyz
--> abcxyz
\n // abcxyz
--> abcxyz
\n //\n\n\n if (this._unwrapAttributeElement(unwrapElement, child)) {\n unwrapPositions.push(new Position(parent, i), new Position(parent, i + 1));\n i++;\n continue;\n } //\n // If other nested attribute is found, look through it's children for elements to unwrap.\n //\n // abc
-->
abc
\n //\n\n\n this._unwrapChildren(child, 0, child.childCount, unwrapElement);\n\n i++;\n } // Merge at each unwrap.\n\n\n var offsetChange = 0;\n\n for (var _i2 = 0, _unwrapPositions = unwrapPositions; _i2 < _unwrapPositions.length; _i2++) {\n var position = _unwrapPositions[_i2];\n position.offset -= offsetChange; // Do not merge with elements outside selected children.\n\n if (position.offset == startOffset || position.offset == endOffset) {\n continue;\n }\n\n var newPosition = this.mergeAttributes(position); // If nodes were merged - other merge offsets will change.\n\n if (!newPosition.isEqual(position)) {\n offsetChange++;\n endOffset--;\n }\n }\n\n return Range._createFromParentsAndOffsets(parent, startOffset, parent, endOffset);\n }\n /**\n * Helper function for `view.writer.wrap`. Wraps range with provided attribute element.\n * This method will also merge newly added attribute element with its siblings whenever possible.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.\n *\n * @private\n * @param {module:engine/view/range~Range} range\n * @param {module:engine/view/attributeelement~AttributeElement} attribute\n * @returns {module:engine/view/range~Range} New range after wrapping, spanning over wrapping attribute element.\n */\n\n }, {\n key: \"_wrapRange\",\n value: function _wrapRange(range, attribute) {\n // Break attributes at range start and end.\n var _this$_breakAttribute3 = this._breakAttributesRange(range, true),\n breakStart = _this$_breakAttribute3.start,\n breakEnd = _this$_breakAttribute3.end;\n\n var parentContainer = breakStart.parent; // Wrap all children with attribute.\n\n var newRange = this._wrapChildren(parentContainer, breakStart.offset, breakEnd.offset, attribute); // Merge attributes at the both ends and return a new range.\n\n\n var start = this.mergeAttributes(newRange.start); // If start position was merged - move end position back.\n\n if (!start.isEqual(newRange.start)) {\n newRange.end.offset--;\n }\n\n var end = this.mergeAttributes(newRange.end);\n return new Range(start, end);\n }\n /**\n * Helper function for {@link #wrap}. Wraps position with provided attribute element.\n * This method will also merge newly added attribute element with its siblings whenever possible.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not\n * an instance of {@link module:engine/view/attributeelement~AttributeElement AttributeElement}.\n *\n * @private\n * @param {module:engine/view/position~Position} position\n * @param {module:engine/view/attributeelement~AttributeElement} attribute\n * @returns {module:engine/view/position~Position} New position after wrapping.\n */\n\n }, {\n key: \"_wrapPosition\",\n value: function _wrapPosition(position, attribute) {\n // Return same position when trying to wrap with attribute similar to position parent.\n if (attribute.isSimilar(position.parent)) {\n return movePositionToTextNode(position.clone());\n } // When position is inside text node - break it and place new position between two text nodes.\n\n\n if (position.parent.is('text')) {\n position = breakTextNode(position);\n } // Create fake element that will represent position, and will not be merged with other attributes.\n\n\n var fakePosition = this.createAttributeElement();\n fakePosition._priority = Number.POSITIVE_INFINITY;\n\n fakePosition.isSimilar = function () {\n return false;\n }; // Insert fake element in position location.\n\n\n position.parent._insertChild(position.offset, fakePosition); // Range around inserted fake attribute element.\n\n\n var wrapRange = new Range(position, position.getShiftedBy(1)); // Wrap fake element with attribute (it will also merge if possible).\n\n this.wrap(wrapRange, attribute); // Remove fake element and place new position there.\n\n var newPosition = new Position(fakePosition.parent, fakePosition.index);\n\n fakePosition._remove(); // If position is placed between text nodes - merge them and return position inside.\n\n\n var nodeBefore = newPosition.nodeBefore;\n var nodeAfter = newPosition.nodeAfter;\n\n if (nodeBefore instanceof Text && nodeAfter instanceof Text) {\n return mergeTextNodes(nodeBefore, nodeAfter);\n } // If position is next to text node - move position inside.\n\n\n return movePositionToTextNode(newPosition);\n }\n /**\n * \tWraps one {@link module:engine/view/attributeelement~AttributeElement AttributeElement} into another by\n * \tmerging them if possible. When merging is possible - all attributes, styles and classes are moved from wrapper\n * \telement to element being wrapped.\n *\n * \t@private\n * \t@param {module:engine/view/attributeelement~AttributeElement} wrapper Wrapper AttributeElement.\n * \t@param {module:engine/view/attributeelement~AttributeElement} toWrap AttributeElement to wrap using wrapper element.\n * \t@returns {Boolean} Returns `true` if elements are merged.\n */\n\n }, {\n key: \"_wrapAttributeElement\",\n value: function _wrapAttributeElement(wrapper, toWrap) {\n if (!canBeJoined(wrapper, toWrap)) {\n return false;\n } // Can't merge if name or priority differs.\n\n\n if (wrapper.name !== toWrap.name || wrapper.priority !== toWrap.priority) {\n return false;\n } // Check if attributes can be merged.\n\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = wrapper.getAttributeKeys()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var key = _step4.value;\n\n // Classes and styles should be checked separately.\n if (key === 'class' || key === 'style') {\n continue;\n } // If some attributes are different we cannot wrap.\n\n\n if (toWrap.hasAttribute(key) && toWrap.getAttribute(key) !== wrapper.getAttribute(key)) {\n return false;\n }\n } // Check if styles can be merged.\n\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = wrapper.getStyleNames()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var _key = _step5.value;\n\n if (toWrap.hasStyle(_key) && toWrap.getStyle(_key) !== wrapper.getStyle(_key)) {\n return false;\n }\n } // Move all attributes/classes/styles from wrapper to wrapped AttributeElement.\n\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = wrapper.getAttributeKeys()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _key2 = _step6.value;\n\n // Classes and styles should be checked separately.\n if (_key2 === 'class' || _key2 === 'style') {\n continue;\n } // Move only these attributes that are not present - other are similar.\n\n\n if (!toWrap.hasAttribute(_key2)) {\n this.setAttribute(_key2, wrapper.getAttribute(_key2), toWrap);\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = wrapper.getStyleNames()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var _key3 = _step7.value;\n\n if (!toWrap.hasStyle(_key3)) {\n this.setStyle(_key3, wrapper.getStyle(_key3), toWrap);\n }\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = wrapper.getClassNames()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _key4 = _step8.value;\n\n if (!toWrap.hasClass(_key4)) {\n this.addClass(_key4, toWrap);\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n\n return true;\n }\n /**\n * Unwraps {@link module:engine/view/attributeelement~AttributeElement AttributeElement} from another by removing\n * corresponding attributes, classes and styles. All attributes, classes and styles from wrapper should be present\n * inside element being unwrapped.\n *\n * @private\n * @param {module:engine/view/attributeelement~AttributeElement} wrapper Wrapper AttributeElement.\n * @param {module:engine/view/attributeelement~AttributeElement} toUnwrap AttributeElement to unwrap using wrapper element.\n * @returns {Boolean} Returns `true` if elements are unwrapped.\n **/\n\n }, {\n key: \"_unwrapAttributeElement\",\n value: function _unwrapAttributeElement(wrapper, toUnwrap) {\n if (!canBeJoined(wrapper, toUnwrap)) {\n return false;\n } // Can't unwrap if name or priority differs.\n\n\n if (wrapper.name !== toUnwrap.name || wrapper.priority !== toUnwrap.priority) {\n return false;\n } // Check if AttributeElement has all wrapper attributes.\n\n\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = wrapper.getAttributeKeys()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var key = _step9.value;\n\n // Classes and styles should be checked separately.\n if (key === 'class' || key === 'style') {\n continue;\n } // If some attributes are missing or different we cannot unwrap.\n\n\n if (!toUnwrap.hasAttribute(key) || toUnwrap.getAttribute(key) !== wrapper.getAttribute(key)) {\n return false;\n }\n } // Check if AttributeElement has all wrapper classes.\n\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n if (!toUnwrap.hasClass.apply(toUnwrap, _toConsumableArray(wrapper.getClassNames()))) {\n return false;\n } // Check if AttributeElement has all wrapper styles.\n\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = wrapper.getStyleNames()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _key5 = _step10.value;\n\n // If some styles are missing or different we cannot unwrap.\n if (!toUnwrap.hasStyle(_key5) || toUnwrap.getStyle(_key5) !== wrapper.getStyle(_key5)) {\n return false;\n }\n } // Remove all wrapper's attributes from unwrapped element.\n\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n\n var _iteratorNormalCompletion11 = true;\n var _didIteratorError11 = false;\n var _iteratorError11 = undefined;\n\n try {\n for (var _iterator11 = wrapper.getAttributeKeys()[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {\n var _key6 = _step11.value;\n\n // Classes and styles should be checked separately.\n if (_key6 === 'class' || _key6 === 'style') {\n continue;\n }\n\n this.removeAttribute(_key6, toUnwrap);\n } // Remove all wrapper's classes from unwrapped element.\n\n } catch (err) {\n _didIteratorError11 = true;\n _iteratorError11 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion11 && _iterator11.return != null) {\n _iterator11.return();\n }\n } finally {\n if (_didIteratorError11) {\n throw _iteratorError11;\n }\n }\n }\n\n this.removeClass(Array.from(wrapper.getClassNames()), toUnwrap); // Remove all wrapper's styles from unwrapped element.\n\n this.removeStyle(Array.from(wrapper.getStyleNames()), toUnwrap);\n return true;\n }\n /**\n * Helper function used by other `DowncastWriter` methods. Breaks attribute elements at the boundaries of given range.\n *\n * @private\n * @param {module:engine/view/range~Range} range Range which `start` and `end` positions will be used to break attributes.\n * @param {Boolean} [forceSplitText=false] If set to `true`, will break text nodes even if they are directly in container element.\n * This behavior will result in incorrect view state, but is needed by other view writing methods which then fixes view state.\n * @returns {module:engine/view/range~Range} New range with located at break positions.\n */\n\n }, {\n key: \"_breakAttributesRange\",\n value: function _breakAttributesRange(range) {\n var forceSplitText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var rangeStart = range.start;\n var rangeEnd = range.end;\n validateRangeContainer(range, this.document); // Break at the collapsed position. Return new collapsed range.\n\n if (range.isCollapsed) {\n var position = this._breakAttributes(range.start, forceSplitText);\n\n return new Range(position, position);\n }\n\n var breakEnd = this._breakAttributes(rangeEnd, forceSplitText);\n\n var count = breakEnd.parent.childCount;\n\n var breakStart = this._breakAttributes(rangeStart, forceSplitText); // Calculate new break end offset.\n\n\n breakEnd.offset += breakEnd.parent.childCount - count;\n return new Range(breakStart, breakEnd);\n }\n /**\n * Helper function used by other `DowncastWriter` methods. Breaks attribute elements at given position.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-empty-element` when break position\n * is placed inside {@link module:engine/view/emptyelement~EmptyElement EmptyElement}.\n *\n * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-cannot-break-ui-element` when break position\n * is placed inside {@link module:engine/view/uielement~UIElement UIElement}.\n *\n * @private\n * @param {module:engine/view/position~Position} position Position where to break attributes.\n * @param {Boolean} [forceSplitText=false] If set to `true`, will break text nodes even if they are directly in container element.\n * This behavior will result in incorrect view state, but is needed by other view writing methods which then fixes view state.\n * @returns {module:engine/view/position~Position} New position after breaking the attributes.\n */\n\n }, {\n key: \"_breakAttributes\",\n value: function _breakAttributes(position) {\n var forceSplitText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var positionOffset = position.offset;\n var positionParent = position.parent; // If position is placed inside EmptyElement - throw an exception as we cannot break inside.\n\n if (position.parent.is('emptyElement')) {\n /**\n * Cannot break inside EmptyElement instance.\n *\n * @error view-writer-cannot-break-empty-element\n */\n throw new CKEditorError('view-writer-cannot-break-empty-element', this.document);\n } // If position is placed inside UIElement - throw an exception as we cannot break inside.\n\n\n if (position.parent.is('uiElement')) {\n /**\n * Cannot break inside UIElement instance.\n *\n * @error view-writer-cannot-break-ui-element\n */\n throw new CKEditorError('view-writer-cannot-break-ui-element', this.document);\n } // There are no attributes to break and text nodes breaking is not forced.\n\n\n if (!forceSplitText && positionParent.is('text') && isContainerOrFragment(positionParent.parent)) {\n return position.clone();\n } // Position's parent is container, so no attributes to break.\n\n\n if (isContainerOrFragment(positionParent)) {\n return position.clone();\n } // Break text and start again in new position.\n\n\n if (positionParent.is('text')) {\n return this._breakAttributes(breakTextNode(position), forceSplitText);\n }\n\n var length = positionParent.childCount; //
foobar{}
\n // foobar[]
\n // foobar[]
\n\n if (positionOffset == length) {\n var newPosition = new Position(positionParent.parent, positionParent.index + 1);\n return this._breakAttributes(newPosition, forceSplitText);\n } else {\n // foo{}bar
\n // foo[]bar
\n // foo{}bar
\n if (positionOffset === 0) {\n var _newPosition = new Position(positionParent.parent, positionParent.index);\n\n return this._breakAttributes(_newPosition, forceSplitText);\n } // foob{}ar
\n // foob[]ar
\n // foob[]ar
\n // foob[]ar
\n else {\n var offsetAfter = positionParent.index + 1; // Break element.\n\n var clonedNode = positionParent._clone(); // Insert cloned node to position's parent node.\n\n\n positionParent.parent._insertChild(offsetAfter, clonedNode);\n\n this._addToClonedElementsGroup(clonedNode); // Get nodes to move.\n\n\n var count = positionParent.childCount - positionOffset;\n\n var nodesToMove = positionParent._removeChildren(positionOffset, count); // Move nodes to cloned node.\n\n\n clonedNode._appendChild(nodesToMove); // Create new position to work on.\n\n\n var _newPosition2 = new Position(positionParent.parent, offsetAfter);\n\n return this._breakAttributes(_newPosition2, forceSplitText);\n }\n }\n }\n /**\n * Stores the information that an {@link module:engine/view/attributeelement~AttributeElement attribute element} was\n * added to the tree. Saves the reference to the group in the given element and updates the group, so other elements\n * from the group now keep a reference to the given attribute element.\n *\n * The clones group can be obtained using {@link module:engine/view/attributeelement~AttributeElement#getElementsWithSameId}.\n *\n * Does nothing if added element has no {@link module:engine/view/attributeelement~AttributeElement#id id}.\n *\n * @private\n * @param {module:engine/view/attributeelement~AttributeElement} element Attribute element to save.\n */\n\n }, {\n key: \"_addToClonedElementsGroup\",\n value: function _addToClonedElementsGroup(element) {\n // Add only if the element is in document tree.\n if (!element.root.is('rootElement')) {\n return;\n } // Traverse the element's children recursively to find other attribute elements that also might got inserted.\n // The loop is at the beginning so we can make fast returns later in the code.\n\n\n if (element.is('element')) {\n var _iteratorNormalCompletion12 = true;\n var _didIteratorError12 = false;\n var _iteratorError12 = undefined;\n\n try {\n for (var _iterator12 = element.getChildren()[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {\n var child = _step12.value;\n\n this._addToClonedElementsGroup(child);\n }\n } catch (err) {\n _didIteratorError12 = true;\n _iteratorError12 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion12 && _iterator12.return != null) {\n _iterator12.return();\n }\n } finally {\n if (_didIteratorError12) {\n throw _iteratorError12;\n }\n }\n }\n }\n\n var id = element.id;\n\n if (!id) {\n return;\n }\n\n var group = this._cloneGroups.get(id);\n\n if (!group) {\n group = new Set();\n\n this._cloneGroups.set(id, group);\n }\n\n group.add(element);\n element._clonesGroup = group;\n }\n /**\n * Removes all the information about the given {@link module:engine/view/attributeelement~AttributeElement attribute element}\n * from its clones group.\n *\n * Keep in mind, that the element will still keep a reference to the group (but the group will not keep a reference to it).\n * This allows to reference the whole group even if the element was already removed from the tree.\n *\n * Does nothing if the element has no {@link module:engine/view/attributeelement~AttributeElement#id id}.\n *\n * @private\n * @param {module:engine/view/attributeelement~AttributeElement} element Attribute element to remove.\n */\n\n }, {\n key: \"_removeFromClonedElementsGroup\",\n value: function _removeFromClonedElementsGroup(element) {\n // Traverse the element's children recursively to find other attribute elements that also got removed.\n // The loop is at the beginning so we can make fast returns later in the code.\n if (element.is('element')) {\n var _iteratorNormalCompletion13 = true;\n var _didIteratorError13 = false;\n var _iteratorError13 = undefined;\n\n try {\n for (var _iterator13 = element.getChildren()[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {\n var child = _step13.value;\n\n this._removeFromClonedElementsGroup(child);\n }\n } catch (err) {\n _didIteratorError13 = true;\n _iteratorError13 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion13 && _iterator13.return != null) {\n _iterator13.return();\n }\n } finally {\n if (_didIteratorError13) {\n throw _iteratorError13;\n }\n }\n }\n }\n\n var id = element.id;\n\n if (!id) {\n return;\n }\n\n var group = this._cloneGroups.get(id);\n\n if (!group) {\n return;\n }\n\n group.delete(element); // Not removing group from element on purpose!\n // If other parts of code have reference to this element, they will be able to get references to other elements from the group.\n }\n }]);\n\n return DowncastWriter;\n}(); // Helper function for `view.writer.wrap`. Checks if given element has any children that are not ui elements.\n\n\nexport { DowncastWriter as default };\n\nfunction _hasNonUiChildren(parent) {\n return Array.from(parent.getChildren()).some(function (child) {\n return !child.is('uiElement');\n });\n}\n/**\n * Attribute element need to be instance of attribute element.\n *\n * @error view-writer-wrap-invalid-attribute\n */\n// Returns first parent container of specified {@link module:engine/view/position~Position Position}.\n// Position's parent node is checked as first, then next parents are checked.\n// Note that {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment} is treated like a container.\n//\n// @param {module:engine/view/position~Position} position Position used as a start point to locate parent container.\n// @returns {module:engine/view/containerelement~ContainerElement|module:engine/view/documentfragment~DocumentFragment|undefined}\n// Parent container element or `undefined` if container is not found.\n\n\nfunction getParentContainer(position) {\n var parent = position.parent;\n\n while (!isContainerOrFragment(parent)) {\n if (!parent) {\n return undefined;\n }\n\n parent = parent.parent;\n }\n\n return parent;\n} // Checks if first {@link module:engine/view/attributeelement~AttributeElement AttributeElement} provided to the function\n// can be wrapped otuside second element. It is done by comparing elements'\n// {@link module:engine/view/attributeelement~AttributeElement#priority priorities}, if both have same priority\n// {@link module:engine/view/element~Element#getIdentity identities} are compared.\n//\n// @param {module:engine/view/attributeelement~AttributeElement} a\n// @param {module:engine/view/attributeelement~AttributeElement} b\n// @returns {Boolean}\n\n\nfunction shouldABeOutsideB(a, b) {\n if (a.priority < b.priority) {\n return true;\n } else if (a.priority > b.priority) {\n return false;\n } // When priorities are equal and names are different - use identities.\n\n\n return a.getIdentity() < b.getIdentity();\n} // Returns new position that is moved to near text node. Returns same position if there is no text node before of after\n// specified position.\n//\n//\t\tfoo[]
-> foo{}
\n//\t\t[]foo
-> {}foo
\n//\n// @param {module:engine/view/position~Position} position\n// @returns {module:engine/view/position~Position} Position located inside text node or same position if there is no text nodes\n// before or after position location.\n\n\nfunction movePositionToTextNode(position) {\n var nodeBefore = position.nodeBefore;\n\n if (nodeBefore && nodeBefore.is('text')) {\n return new Position(nodeBefore, nodeBefore.data.length);\n }\n\n var nodeAfter = position.nodeAfter;\n\n if (nodeAfter && nodeAfter.is('text')) {\n return new Position(nodeAfter, 0);\n }\n\n return position;\n} // Breaks text node into two text nodes when possible.\n//\n//\t\tfoo{}bar
-> foo[]bar
\n//\t\t{}foobar
-> []foobar
\n//\t\tfoobar{}
-> foobar[]
\n//\n// @param {module:engine/view/position~Position} position Position that need to be placed inside text node.\n// @returns {module:engine/view/position~Position} New position after breaking text node.\n\n\nfunction breakTextNode(position) {\n if (position.offset == position.parent.data.length) {\n return new Position(position.parent.parent, position.parent.index + 1);\n }\n\n if (position.offset === 0) {\n return new Position(position.parent.parent, position.parent.index);\n } // Get part of the text that need to be moved.\n\n\n var textToMove = position.parent.data.slice(position.offset); // Leave rest of the text in position's parent.\n\n position.parent._data = position.parent.data.slice(0, position.offset); // Insert new text node after position's parent text node.\n\n position.parent.parent._insertChild(position.parent.index + 1, new Text(textToMove)); // Return new position between two newly created text nodes.\n\n\n return new Position(position.parent.parent, position.parent.index + 1);\n} // Merges two text nodes into first node. Removes second node and returns merge position.\n//\n// @param {module:engine/view/text~Text} t1 First text node to merge. Data from second text node will be moved at the end of\n// this text node.\n// @param {module:engine/view/text~Text} t2 Second text node to merge. This node will be removed after merging.\n// @returns {module:engine/view/position~Position} Position after merging text nodes.\n\n\nfunction mergeTextNodes(t1, t2) {\n // Merge text data into first text node and remove second one.\n var nodeBeforeLength = t1.data.length;\n t1._data += t2.data;\n\n t2._remove();\n\n return new Position(t1, nodeBeforeLength);\n} // Checks if provided nodes are valid to insert. Checks if each node is an instance of\n// {@link module:engine/view/text~Text Text} or {@link module:engine/view/attributeelement~AttributeElement AttributeElement},\n// {@link module:engine/view/containerelement~ContainerElement ContainerElement},\n// {@link module:engine/view/emptyelement~EmptyElement EmptyElement} or\n// {@link module:engine/view/uielement~UIElement UIElement}.\n//\n// Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-insert-invalid-node` when nodes to insert\n// contains instances that are not {@link module:engine/view/text~Text Texts},\n// {@link module:engine/view/emptyelement~EmptyElement EmptyElements},\n// {@link module:engine/view/uielement~UIElement UIElements},\n// {@link module:engine/view/attributeelement~AttributeElement AttributeElements} or\n// {@link module:engine/view/containerelement~ContainerElement ContainerElements}.\n//\n// @param Iterable. nodes\n// @param {Object} errorContext\n\n\nfunction validateNodesToInsert(nodes, errorContext) {\n var _iteratorNormalCompletion14 = true;\n var _didIteratorError14 = false;\n var _iteratorError14 = undefined;\n\n try {\n var _loop = function _loop() {\n var node = _step14.value;\n\n if (!validNodesToInsert.some(function (validNode) {\n return node instanceof validNode;\n })) {\n // eslint-disable-line no-use-before-define\n\n /**\n * Inserted nodes should be valid to insert. of {@link module:engine/view/attributeelement~AttributeElement AttributeElement},\n * {@link module:engine/view/containerelement~ContainerElement ContainerElement},\n * {@link module:engine/view/emptyelement~EmptyElement EmptyElement},\n * {@link module:engine/view/uielement~UIElement UIElement}, {@link module:engine/view/text~Text Text}.\n *\n * @error view-writer-insert-invalid-node\n */\n throw new CKEditorError('view-writer-insert-invalid-node', errorContext);\n }\n\n if (!node.is('text')) {\n validateNodesToInsert(node.getChildren(), errorContext);\n }\n };\n\n for (var _iterator14 = nodes[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {\n _loop();\n }\n } catch (err) {\n _didIteratorError14 = true;\n _iteratorError14 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion14 && _iterator14.return != null) {\n _iterator14.return();\n }\n } finally {\n if (_didIteratorError14) {\n throw _iteratorError14;\n }\n }\n }\n}\n\nvar validNodesToInsert = [Text, AttributeElement, ContainerElement, EmptyElement, UIElement]; // Checks if node is ContainerElement or DocumentFragment, because in most cases they should be treated the same way.\n//\n// @param {module:engine/view/node~Node} node\n// @returns {Boolean} Returns `true` if node is instance of ContainerElement or DocumentFragment.\n\nfunction isContainerOrFragment(node) {\n return node && (node.is('containerElement') || node.is('documentFragment'));\n} // Checks if {@link module:engine/view/range~Range#start range start} and {@link module:engine/view/range~Range#end range end} are placed\n// inside same {@link module:engine/view/containerelement~ContainerElement container element}.\n// Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when validation fails.\n//\n// @param {module:engine/view/range~Range} range\n// @param {Object} errorContext\n\n\nfunction validateRangeContainer(range, errorContext) {\n var startContainer = getParentContainer(range.start);\n var endContainer = getParentContainer(range.end);\n\n if (!startContainer || !endContainer || startContainer !== endContainer) {\n /**\n * Range container is invalid. This can happen if {@link module:engine/view/range~Range#start range start} and\n * {@link module:engine/view/range~Range#end range end} positions are not placed inside same container or\n * parent container for these positions cannot be found.\n *\n * @error view-writer-invalid-range-container\n */\n throw new CKEditorError('view-writer-invalid-range-container', errorContext);\n }\n} // Checks if two attribute elements can be joined together. Elements can be joined together if, and only if\n// they do not have ids specified.\n//\n// @private\n// @param {module:engine/view/element~Element} a\n// @param {module:engine/view/element~Element} b\n// @returns {Boolean}\n\n\nfunction canBeJoined(a, b) {\n return a.id === null && b.id === null;\n}","import \"core-js/modules/es6.regexp.to-string\";\n\n/**\n * @license Copyright (c) 2003-2019, 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 return Object.prototype.toString.call(obj) == '[object Text]';\n}","/**\n * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\nimport { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';\nimport isText from '@ckeditor/ckeditor5-utils/src/dom/istext';\n/**\n * Set of utils related to block and inline fillers handling.\n *\n * Browsers do not allow to put caret in elements which does not have height. Because of it, we need to fill all\n * empty elements which should be selectable with elements or characters called \"fillers\". Unfortunately there is no one\n * universal filler, this is why two types are uses:\n *\n * * Block filler is an element which fill block elements, like ``. CKEditor uses `
` as a block filler during the editing,\n * as browsers do natively. So instead of an empty `
` there will be `
`. The advantage of block filler is that\n * it is transparent for the selection, so when the caret is before the `
` and user presses right arrow he will be\n * moved to the next paragraph, not after the `
`. The disadvantage is that it breaks a block, so it can not be used\n * in the middle of a line of text. The {@link module:engine/view/filler~BR_FILLER `
` filler} can be replaced with any other\n * character in the data output, for instance {@link module:engine/view/filler~NBSP_FILLER non-breaking space}.\n *\n * * Inline filler is a filler which does not break a line of text, so it can be used inside the text, for instance in the empty\n * `` surrendered by text: `foobar`, if we want to put the caret there. CKEditor uses a sequence of the zero-width\n * spaces as an {@link module:engine/view/filler~INLINE_FILLER inline filler} having the predetermined\n * {@link module:engine/view/filler~INLINE_FILLER_LENGTH length}. A sequence is used, instead of a single character to\n * avoid treating random zero-width spaces as the inline filler. Disadvantage of the inline filler is that it is not\n * transparent for the selection. The arrow key moves the caret between zero-width spaces characters, so the additional\n * code is needed to handle the caret.\n *\n * Both inline and block fillers are handled by the {@link module:engine/view/renderer~Renderer renderer} and are not present in the\n * view.\n *\n * @module engine/view/filler\n */\n\n/**\n * Non-breaking space filler creator. This is a function which creates ` ` text node.\n * It defines how the filler is created.\n *\n * @see module:engine/view/filler~BR_FILLER\n * @function\n */\n\nexport var NBSP_FILLER = function NBSP_FILLER(domDocument) {\n return domDocument.createTextNode(\"\\xA0\");\n};\n/**\n * `
` filler creator. This is a function which creates `
` element.\n * It defines how the filler is created.\n *\n * @see module:engine/view/filler~NBSP_FILLER\n * @function\n */\n\nexport var BR_FILLER = function BR_FILLER(domDocument) {\n var fillerBr = domDocument.createElement('br');\n fillerBr.dataset.ckeFiller = true;\n return fillerBr;\n};\n/**\n * Length of the {@link module:engine/view/filler~INLINE_FILLER INLINE_FILLER}.\n */\n\nexport var INLINE_FILLER_LENGTH = 7;\n/**\n * Inline filler which is a sequence of the zero width spaces.\n */\n\nexport var INLINE_FILLER = function () {\n var inlineFiller = '';\n\n for (var i = 0; i < INLINE_FILLER_LENGTH; i++) {\n inlineFiller += \"\\u200B\";\n }\n\n return inlineFiller;\n}(); // Usu IIF so the INLINE_FILLER appears as a constant in the docs.\n\n/**\n * Checks if the node is a text node which starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n *\n *\t\tstartsWithFiller( document.createTextNode( INLINE_FILLER ) ); // true\n *\t\tstartsWithFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ); // true\n *\t\tstartsWithFiller( document.createTextNode( 'foo' ) ); // false\n *\t\tstartsWithFiller( document.createElement( 'p' ) ); // false\n *\n * @param {Node} domNode DOM node.\n * @returns {Boolean} True if the text node starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n */\n\nexport function startsWithFiller(domNode) {\n return isText(domNode) && domNode.data.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER;\n}\n/**\n * Checks if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n *\n *\t\tisInlineFiller( document.createTextNode( INLINE_FILLER ) ); // true\n *\t\tisInlineFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ); // false\n *\n * @param {Text} domText DOM text node.\n * @returns {Boolean} True if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.\n */\n\nexport function isInlineFiller(domText) {\n return domText.data.length == INLINE_FILLER_LENGTH && startsWithFiller(domText);\n}\n/**\n * Get string data from the text node, removing an {@link module:engine/view/filler~INLINE_FILLER inline filler} from it,\n * if text node contains it.\n *\n *\t\tgetDataWithoutFiller( document.createTextNode( INLINE_FILLER + 'foo' ) ) == 'foo' // true\n *\t\tgetDataWithoutFiller( document.createTextNode( 'foo' ) ) == 'foo' // true\n *\n * @param {Text} domText DOM text node, possible with inline filler.\n * @returns {String} Data without filler.\n */\n\nexport function getDataWithoutFiller(domText) {\n if (startsWithFiller(domText)) {\n return domText.data.slice(INLINE_FILLER_LENGTH);\n } else {\n return domText.data;\n }\n}\n/**\n * Assign key observer which move cursor from the end of the inline filler to the beginning of it when\n * the left arrow is pressed, so the filler does not break navigation.\n *\n * @param {module:engine/view/view~View} view View controller instance we should inject quirks handling on.\n */\n\nexport function injectQuirksHandling(view) {\n view.document.on('keydown', jumpOverInlineFiller);\n} // Move cursor from the end of the inline filler to the beginning of it when, so the filler does not break navigation.\n\nfunction jumpOverInlineFiller(evt, data) {\n if (data.keyCode == keyCodes.arrowleft) {\n var domSelection = data.domTarget.ownerDocument.defaultView.getSelection();\n\n if (domSelection.rangeCount == 1 && domSelection.getRangeAt(0).collapsed) {\n var domParent = domSelection.getRangeAt(0).startContainer;\n var domOffset = domSelection.getRangeAt(0).startOffset;\n\n if (startsWithFiller(domParent) && domOffset <= INLINE_FILLER_LENGTH) {\n domSelection.collapse(domParent, 0);\n }\n }\n }\n}","import \"core-js/modules/es6.array.fill\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.array.from\";\n\n/**\n * @license Copyright (c) 2003-2019, 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/fastdiff\n */\n\n/**\n * Finds positions of the first and last change in the given string/array and generates a set of changes:\n *\n *\t\tfastDiff( '12a', '12xyza' );\n *\t\t// [ { index: 2, type: 'insert', values: [ 'x', 'y', 'z' ] } ]\n *\n *\t\tfastDiff( '12a', '12aa' );\n *\t\t// [ { index: 3, type: 'insert', values: [ 'a' ] } ]\n *\n *\t\tfastDiff( '12xyza', '12a' );\n *\t\t// [ { index: 2, type: 'delete', howMany: 3 } ]\n *\n *\t\tfastDiff( [ '1', '2', 'a', 'a' ], [ '1', '2', 'a' ] );\n *\t\t// [ { index: 3, type: 'delete', howMany: 1 } ]\n *\n *\t\tfastDiff( [ '1', '2', 'a', 'b', 'c', '3' ], [ '2', 'a', 'b' ] );\n *\t\t// [ { index: 0, type: 'insert', values: [ '2', 'a', 'b' ] }, { index: 3, type: 'delete', howMany: 6 } ]\n *\n * Passed arrays can contain any type of data, however to compare them correctly custom comparator function\n * should be passed as a third parameter:\n *\n *\t\tfastDiff( [ { value: 1 }, { value: 2 } ], [ { value: 1 }, { value: 3 } ], ( a, b ) => {\n *\t\t\treturn a.value === b.value;\n *\t\t} );\n *\t\t// [ { index: 1, type: 'insert', values: [ { value: 3 } ] }, { index: 2, type: 'delete', howMany: 1 } ]\n *\n * The resulted set of changes can be applied to the input in order to transform it into the output, for example:\n *\n *\t\tlet input = '12abc3';\n *\t\tconst output = '2ab';\n *\t\tconst changes = fastDiff( input, output );\n *\n *\t\tchanges.forEach( change => {\n *\t\t\tif ( change.type == 'insert' ) {\n *\t\t\t\tinput = input.substring( 0, change.index ) + change.values.join( '' ) + input.substring( change.index );\n *\t\t\t} else if ( change.type == 'delete' ) {\n *\t\t\t\tinput = input.substring( 0, change.index ) + input.substring( change.index + change.howMany );\n *\t\t\t}\n *\t\t} );\n *\n *\t\t// input equals output now\n *\n * or in case of arrays:\n *\n *\t\tlet input = [ '1', '2', 'a', 'b', 'c', '3' ];\n *\t\tconst output = [ '2', 'a', 'b' ];\n *\t\tconst changes = fastDiff( input, output );\n *\n *\t\tchanges.forEach( change => {\n *\t\t\tif ( change.type == 'insert' ) {\n *\t\t\t\tinput = input.slice( 0, change.index ).concat( change.values, input.slice( change.index ) );\n *\t\t\t} else if ( change.type == 'delete' ) {\n *\t\t\t\tinput = input.slice( 0, change.index ).concat( input.slice( change.index + change.howMany ) );\n *\t\t\t}\n *\t\t} );\n *\n *\t\t// input equals output now\n *\n * By passing `true` as the fourth parameter (`atomicChanges`) the output of this function will become compatible with\n * the {@link module:utils/diff~diff `diff()`} function:\n *\n *\t\tfastDiff( '12a', '12xyza' );\n *\t\t// [ 'equal', 'equal', 'insert', 'insert', 'insert', 'equal' ]\n *\n * The default output format of this function is compatible with the output format of\n * {@link module:utils/difftochanges~diffToChanges `diffToChanges()`}. The `diffToChanges()` input format is, in turn,\n * compatible with the output of {@link module:utils/diff~diff `diff()`}:\n *\n *\t\tconst a = '1234';\n *\t\tconst b = '12xyz34';\n *\n *\t\t// Both calls will return the same results (grouped changes format).\n *\t\tfastDiff( a, b );\n *\t\tdiffToChanges( diff( a, b ) );\n *\n *\t\t// Again, both calls will return the same results (atomic changes format).\n *\t\tfastDiff( a, b, null, true );\n *\t\tdiff( a, b );\n *\n *\n * @param {Array|String} a Input array or string.\n * @param {Array|String} b Input array or string.\n * @param {Function} [cmp] Optional function used to compare array values, by default `===` (strict equal operator) is used.\n * @param {Boolean} [atomicChanges=false] Whether an array of `inset|delete|equal` operations should\n * be returned instead of changes set. This makes this function compatible with {@link module:utils/diff~diff `diff()`}.\n * @returns {Array} Array of changes.\n */\nexport default function fastDiff(a, b, cmp) {\n var atomicChanges = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n // Set the comparator function.\n cmp = cmp || function (a, b) {\n return a === b;\n }; // Transform text or any iterable into arrays for easier, consistent processing.\n\n\n if (!Array.isArray(a)) {\n a = Array.from(a);\n }\n\n if (!Array.isArray(b)) {\n b = Array.from(b);\n } // Find first and last change.\n\n\n var changeIndexes = findChangeBoundaryIndexes(a, b, cmp); // Transform into changes array.\n\n return atomicChanges ? changeIndexesToAtomicChanges(changeIndexes, b.length) : changeIndexesToChanges(b, changeIndexes);\n} // Finds position of the first and last change in the given arrays. For example:\n//\n//\t\tconst indexes = findChangeBoundaryIndexes( [ '1', '2', '3', '4' ], [ '1', '3', '4', '2', '4' ] );\n//\t\tconsole.log( indexes ); // { firstIndex: 1, lastIndexOld: 3, lastIndexNew: 4 }\n//\n// The above indexes means that in the first array the modified part is `1[23]4` and in the second array it is `1[342]4`.\n// Based on such indexes, array with `insert`/`delete` operations which allows transforming first value into the second one\n// can be generated.\n//\n// @param {Array} arr1\n// @param {Array} arr2\n// @param {Function} cmp Comparator function.\n// @returns {Object}\n// @returns {Number} return.firstIndex Index of the first change in both values (always the same for both).\n// @returns {Number} result.lastIndexOld Index of the last common value in `arr1`.\n// @returns {Number} result.lastIndexNew Index of the last common value in `arr2`.\n\nfunction findChangeBoundaryIndexes(arr1, arr2, cmp) {\n // Find the first difference between passed values.\n var firstIndex = findFirstDifferenceIndex(arr1, arr2, cmp); // If arrays are equal return -1 indexes object.\n\n if (firstIndex === -1) {\n return {\n firstIndex: -1,\n lastIndexOld: -1,\n lastIndexNew: -1\n };\n } // Remove the common part of each value and reverse them to make it simpler to find the last difference between them.\n\n\n var oldArrayReversed = cutAndReverse(arr1, firstIndex);\n var newArrayReversed = cutAndReverse(arr2, firstIndex); // Find the first difference between reversed values.\n // It should be treated as \"how many elements from the end the last difference occurred\".\n //\n // For example:\n //\n // \t\t\t\tinitial\t->\tafter cut\t-> reversed:\n // oldValue:\t'321ba'\t->\t'21ba'\t\t-> 'ab12'\n // newValue:\t'31xba'\t->\t'1xba'\t\t-> 'abx1'\n // lastIndex:\t\t\t\t\t\t\t-> 2\n //\n // So the last change occurred two characters from the end of the arrays.\n\n var lastIndex = findFirstDifferenceIndex(oldArrayReversed, newArrayReversed, cmp); // Use `lastIndex` to calculate proper offset, starting from the beginning (`lastIndex` kind of starts from the end).\n\n var lastIndexOld = arr1.length - lastIndex;\n var lastIndexNew = arr2.length - lastIndex;\n return {\n firstIndex: firstIndex,\n lastIndexOld: lastIndexOld,\n lastIndexNew: lastIndexNew\n };\n} // Returns a first index on which given arrays differ. If both arrays are the same, -1 is returned.\n//\n// @param {Array} arr1\n// @param {Array} arr2\n// @param {Function} cmp Comparator function.\n// @returns {Number}\n\n\nfunction findFirstDifferenceIndex(arr1, arr2, cmp) {\n for (var i = 0; i < Math.max(arr1.length, arr2.length); i++) {\n if (arr1[i] === undefined || arr2[i] === undefined || !cmp(arr1[i], arr2[i])) {\n return i;\n }\n }\n\n return -1; // Return -1 if arrays are equal.\n} // Returns a copy of the given array with `howMany` elements removed starting from the beginning and in reversed order.\n//\n// @param {Array} arr Array to be processed.\n// @param {Number} howMany How many elements from array beginning to remove.\n// @returns {Array} Shortened and reversed array.\n\n\nfunction cutAndReverse(arr, howMany) {\n return arr.slice(howMany).reverse();\n} // Generates changes array based on change indexes from `findChangeBoundaryIndexes` function. This function will\n// generate array with 0 (no changes), 1 (deletion or insertion) or 2 records (insertion and deletion).\n//\n// @param {Array} newArray New array for which change indexes were calculated.\n// @param {Object} changeIndexes Change indexes object from `findChangeBoundaryIndexes` function.\n// @returns {Array.