/******/ (function() { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js":
/*!************************************************************!*\
  !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***!
  \************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ _extends; }
/* harmony export */ });
function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}


/***/ }),

/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js":
/*!******************************************************************!*\
  !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***!
  \******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ _inheritsLoose; }
/* harmony export */ });
/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");

function _inheritsLoose(t, o) {
  t.prototype = Object.create(o.prototype), t.prototype.constructor = t, (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, o);
}


/***/ }),

/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js":
/*!*********************************************************************************!*\
  !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ _objectWithoutPropertiesLoose; }
/* harmony export */ });
function _objectWithoutPropertiesLoose(r, e) {
  if (null == r) return {};
  var t = {};
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
    if (-1 !== e.indexOf(n)) continue;
    t[n] = r[n];
  }
  return t;
}


/***/ }),

/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":
/*!*******************************************************************!*\
  !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***!
  \*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ _setPrototypeOf; }
/* harmony export */ });
function _setPrototypeOf(t, e) {
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
    return t.__proto__ = e, t;
  }, _setPrototypeOf(t, e);
}


/***/ }),

/***/ "./node_modules/@tiptap/core/dist/index.js":
/*!*************************************************!*\
  !*** ./node_modules/@tiptap/core/dist/index.js ***!
  \*************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CommandManager: function() { return /* binding */ CommandManager; },
/* harmony export */   Editor: function() { return /* binding */ Editor; },
/* harmony export */   Extendable: function() { return /* binding */ Extendable; },
/* harmony export */   Extension: function() { return /* binding */ Extension; },
/* harmony export */   Fragment: function() { return /* binding */ Fragment6; },
/* harmony export */   InputRule: function() { return /* binding */ InputRule; },
/* harmony export */   MappablePosition: function() { return /* binding */ MappablePosition; },
/* harmony export */   Mark: function() { return /* binding */ Mark; },
/* harmony export */   MarkView: function() { return /* binding */ MarkView; },
/* harmony export */   Node: function() { return /* binding */ Node3; },
/* harmony export */   NodePos: function() { return /* binding */ NodePos; },
/* harmony export */   NodeView: function() { return /* binding */ NodeView; },
/* harmony export */   PasteRule: function() { return /* binding */ PasteRule; },
/* harmony export */   ResizableNodeView: function() { return /* binding */ ResizableNodeView; },
/* harmony export */   ResizableNodeview: function() { return /* binding */ ResizableNodeview; },
/* harmony export */   Tracker: function() { return /* binding */ Tracker; },
/* harmony export */   callOrReturn: function() { return /* binding */ callOrReturn; },
/* harmony export */   canInsertNode: function() { return /* binding */ canInsertNode; },
/* harmony export */   combineTransactionSteps: function() { return /* binding */ combineTransactionSteps; },
/* harmony export */   commands: function() { return /* binding */ commands_exports; },
/* harmony export */   createAtomBlockMarkdownSpec: function() { return /* binding */ createAtomBlockMarkdownSpec; },
/* harmony export */   createBlockMarkdownSpec: function() { return /* binding */ createBlockMarkdownSpec; },
/* harmony export */   createChainableState: function() { return /* binding */ createChainableState; },
/* harmony export */   createDocument: function() { return /* binding */ createDocument; },
/* harmony export */   createElement: function() { return /* binding */ h; },
/* harmony export */   createInlineMarkdownSpec: function() { return /* binding */ createInlineMarkdownSpec; },
/* harmony export */   createMappablePosition: function() { return /* binding */ createMappablePosition; },
/* harmony export */   createNodeFromContent: function() { return /* binding */ createNodeFromContent; },
/* harmony export */   createStyleTag: function() { return /* binding */ createStyleTag; },
/* harmony export */   defaultBlockAt: function() { return /* binding */ defaultBlockAt; },
/* harmony export */   deleteProps: function() { return /* binding */ deleteProps; },
/* harmony export */   elementFromString: function() { return /* binding */ elementFromString; },
/* harmony export */   escapeForRegEx: function() { return /* binding */ escapeForRegEx; },
/* harmony export */   extensions: function() { return /* binding */ extensions_exports; },
/* harmony export */   findChildren: function() { return /* binding */ findChildren; },
/* harmony export */   findChildrenInRange: function() { return /* binding */ findChildrenInRange; },
/* harmony export */   findDuplicates: function() { return /* binding */ findDuplicates; },
/* harmony export */   findParentNode: function() { return /* binding */ findParentNode; },
/* harmony export */   findParentNodeClosestToPos: function() { return /* binding */ findParentNodeClosestToPos; },
/* harmony export */   flattenExtensions: function() { return /* binding */ flattenExtensions; },
/* harmony export */   fromString: function() { return /* binding */ fromString; },
/* harmony export */   generateHTML: function() { return /* binding */ generateHTML; },
/* harmony export */   generateJSON: function() { return /* binding */ generateJSON; },
/* harmony export */   generateText: function() { return /* binding */ generateText; },
/* harmony export */   getAttributes: function() { return /* binding */ getAttributes; },
/* harmony export */   getAttributesFromExtensions: function() { return /* binding */ getAttributesFromExtensions; },
/* harmony export */   getChangedRanges: function() { return /* binding */ getChangedRanges; },
/* harmony export */   getDebugJSON: function() { return /* binding */ getDebugJSON; },
/* harmony export */   getExtensionField: function() { return /* binding */ getExtensionField; },
/* harmony export */   getHTMLFromFragment: function() { return /* binding */ getHTMLFromFragment; },
/* harmony export */   getMarkAttributes: function() { return /* binding */ getMarkAttributes; },
/* harmony export */   getMarkRange: function() { return /* binding */ getMarkRange; },
/* harmony export */   getMarkType: function() { return /* binding */ getMarkType; },
/* harmony export */   getMarksBetween: function() { return /* binding */ getMarksBetween; },
/* harmony export */   getNodeAtPosition: function() { return /* binding */ getNodeAtPosition; },
/* harmony export */   getNodeAttributes: function() { return /* binding */ getNodeAttributes; },
/* harmony export */   getNodeType: function() { return /* binding */ getNodeType; },
/* harmony export */   getRenderedAttributes: function() { return /* binding */ getRenderedAttributes; },
/* harmony export */   getSchema: function() { return /* binding */ getSchema; },
/* harmony export */   getSchemaByResolvedExtensions: function() { return /* binding */ getSchemaByResolvedExtensions; },
/* harmony export */   getSchemaTypeByName: function() { return /* binding */ getSchemaTypeByName; },
/* harmony export */   getSchemaTypeNameByName: function() { return /* binding */ getSchemaTypeNameByName; },
/* harmony export */   getSplittedAttributes: function() { return /* binding */ getSplittedAttributes; },
/* harmony export */   getText: function() { return /* binding */ getText; },
/* harmony export */   getTextBetween: function() { return /* binding */ getTextBetween; },
/* harmony export */   getTextContentFromNodes: function() { return /* binding */ getTextContentFromNodes; },
/* harmony export */   getTextSerializersFromSchema: function() { return /* binding */ getTextSerializersFromSchema; },
/* harmony export */   getUpdatedPosition: function() { return /* binding */ getUpdatedPosition; },
/* harmony export */   h: function() { return /* binding */ h; },
/* harmony export */   injectExtensionAttributesToParseRule: function() { return /* binding */ injectExtensionAttributesToParseRule; },
/* harmony export */   inputRulesPlugin: function() { return /* binding */ inputRulesPlugin; },
/* harmony export */   isActive: function() { return /* binding */ isActive; },
/* harmony export */   isAndroid: function() { return /* binding */ isAndroid; },
/* harmony export */   isAtEndOfNode: function() { return /* binding */ isAtEndOfNode; },
/* harmony export */   isAtStartOfNode: function() { return /* binding */ isAtStartOfNode; },
/* harmony export */   isEmptyObject: function() { return /* binding */ isEmptyObject; },
/* harmony export */   isExtensionRulesEnabled: function() { return /* binding */ isExtensionRulesEnabled; },
/* harmony export */   isFirefox: function() { return /* binding */ isFirefox; },
/* harmony export */   isFunction: function() { return /* binding */ isFunction; },
/* harmony export */   isList: function() { return /* binding */ isList; },
/* harmony export */   isMacOS: function() { return /* binding */ isMacOS; },
/* harmony export */   isMarkActive: function() { return /* binding */ isMarkActive; },
/* harmony export */   isNodeActive: function() { return /* binding */ isNodeActive; },
/* harmony export */   isNodeEmpty: function() { return /* binding */ isNodeEmpty; },
/* harmony export */   isNodeSelection: function() { return /* binding */ isNodeSelection; },
/* harmony export */   isNumber: function() { return /* binding */ isNumber; },
/* harmony export */   isPlainObject: function() { return /* binding */ isPlainObject; },
/* harmony export */   isRegExp: function() { return /* binding */ isRegExp; },
/* harmony export */   isSafari: function() { return /* binding */ isSafari; },
/* harmony export */   isString: function() { return /* binding */ isString; },
/* harmony export */   isTextSelection: function() { return /* binding */ isTextSelection; },
/* harmony export */   isiOS: function() { return /* binding */ isiOS; },
/* harmony export */   markInputRule: function() { return /* binding */ markInputRule; },
/* harmony export */   markPasteRule: function() { return /* binding */ markPasteRule; },
/* harmony export */   markdown: function() { return /* binding */ markdown_exports; },
/* harmony export */   mergeAttributes: function() { return /* binding */ mergeAttributes; },
/* harmony export */   mergeDeep: function() { return /* binding */ mergeDeep; },
/* harmony export */   minMax: function() { return /* binding */ minMax; },
/* harmony export */   nodeInputRule: function() { return /* binding */ nodeInputRule; },
/* harmony export */   nodePasteRule: function() { return /* binding */ nodePasteRule; },
/* harmony export */   objectIncludes: function() { return /* binding */ objectIncludes; },
/* harmony export */   parseAttributes: function() { return /* binding */ parseAttributes; },
/* harmony export */   parseIndentedBlocks: function() { return /* binding */ parseIndentedBlocks; },
/* harmony export */   pasteRulesPlugin: function() { return /* binding */ pasteRulesPlugin; },
/* harmony export */   posToDOMRect: function() { return /* binding */ posToDOMRect; },
/* harmony export */   removeDuplicates: function() { return /* binding */ removeDuplicates; },
/* harmony export */   renderNestedMarkdownContent: function() { return /* binding */ renderNestedMarkdownContent; },
/* harmony export */   resolveExtensions: function() { return /* binding */ resolveExtensions; },
/* harmony export */   resolveFocusPosition: function() { return /* binding */ resolveFocusPosition; },
/* harmony export */   rewriteUnknownContent: function() { return /* binding */ rewriteUnknownContent; },
/* harmony export */   selectionToInsertionEnd: function() { return /* binding */ selectionToInsertionEnd; },
/* harmony export */   serializeAttributes: function() { return /* binding */ serializeAttributes; },
/* harmony export */   sortExtensions: function() { return /* binding */ sortExtensions; },
/* harmony export */   splitExtensions: function() { return /* binding */ splitExtensions; },
/* harmony export */   textInputRule: function() { return /* binding */ textInputRule; },
/* harmony export */   textPasteRule: function() { return /* binding */ textPasteRule; },
/* harmony export */   textblockTypeInputRule: function() { return /* binding */ textblockTypeInputRule; },
/* harmony export */   updateMarkViewAttributes: function() { return /* binding */ updateMarkViewAttributes; },
/* harmony export */   wrappingInputRule: function() { return /* binding */ wrappingInputRule; }
/* harmony export */ });
/* harmony import */ var _tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/pm/transform */ "./node_modules/@tiptap/pm/dist/transform/index.js");
/* harmony import */ var _tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tiptap/pm/commands */ "./node_modules/@tiptap/pm/dist/commands/index.js");
/* harmony import */ var _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiptap/pm/state */ "./node_modules/@tiptap/pm/dist/state/index.js");
/* harmony import */ var _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tiptap/pm/model */ "./node_modules/@tiptap/pm/dist/model/index.js");
/* harmony import */ var _tiptap_pm_schema_list__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tiptap/pm/schema-list */ "./node_modules/@tiptap/pm/dist/schema-list/index.js");
/* harmony import */ var _tiptap_pm_view__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tiptap/pm/view */ "./node_modules/@tiptap/pm/dist/view/index.js");
/* harmony import */ var _tiptap_pm_keymap__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @tiptap/pm/keymap */ "./node_modules/@tiptap/pm/dist/keymap/index.js");
var __defProp = Object.defineProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};

// src/helpers/createChainableState.ts
function createChainableState(config) {
  const { state, transaction } = config;
  let { selection } = transaction;
  let { doc } = transaction;
  let { storedMarks } = transaction;
  return {
    ...state,
    apply: state.apply.bind(state),
    applyTransaction: state.applyTransaction.bind(state),
    plugins: state.plugins,
    schema: state.schema,
    reconfigure: state.reconfigure.bind(state),
    toJSON: state.toJSON.bind(state),
    get storedMarks() {
      return storedMarks;
    },
    get selection() {
      return selection;
    },
    get doc() {
      return doc;
    },
    get tr() {
      selection = transaction.selection;
      doc = transaction.doc;
      storedMarks = transaction.storedMarks;
      return transaction;
    }
  };
}

// src/CommandManager.ts
var CommandManager = class {
  constructor(props) {
    this.editor = props.editor;
    this.rawCommands = this.editor.extensionManager.commands;
    this.customState = props.state;
  }
  get hasCustomState() {
    return !!this.customState;
  }
  get state() {
    return this.customState || this.editor.state;
  }
  get commands() {
    const { rawCommands, editor, state } = this;
    const { view } = editor;
    const { tr } = state;
    const props = this.buildProps(tr);
    return Object.fromEntries(
      Object.entries(rawCommands).map(([name, command2]) => {
        const method = (...args) => {
          const callback = command2(...args)(props);
          if (!tr.getMeta("preventDispatch") && !this.hasCustomState) {
            view.dispatch(tr);
          }
          return callback;
        };
        return [name, method];
      })
    );
  }
  get chain() {
    return () => this.createChain();
  }
  get can() {
    return () => this.createCan();
  }
  createChain(startTr, shouldDispatch = true) {
    const { rawCommands, editor, state } = this;
    const { view } = editor;
    const callbacks = [];
    const hasStartTransaction = !!startTr;
    const tr = startTr || state.tr;
    const run3 = () => {
      if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) {
        view.dispatch(tr);
      }
      return callbacks.every((callback) => callback === true);
    };
    const chain = {
      ...Object.fromEntries(
        Object.entries(rawCommands).map(([name, command2]) => {
          const chainedCommand = (...args) => {
            const props = this.buildProps(tr, shouldDispatch);
            const callback = command2(...args)(props);
            callbacks.push(callback);
            return chain;
          };
          return [name, chainedCommand];
        })
      ),
      run: run3
    };
    return chain;
  }
  createCan(startTr) {
    const { rawCommands, state } = this;
    const dispatch = false;
    const tr = startTr || state.tr;
    const props = this.buildProps(tr, dispatch);
    const formattedCommands = Object.fromEntries(
      Object.entries(rawCommands).map(([name, command2]) => {
        return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
      })
    );
    return {
      ...formattedCommands,
      chain: () => this.createChain(tr, dispatch)
    };
  }
  buildProps(tr, shouldDispatch = true) {
    const { rawCommands, editor, state } = this;
    const { view } = editor;
    const props = {
      tr,
      editor,
      view,
      state: createChainableState({
        state,
        transaction: tr
      }),
      dispatch: shouldDispatch ? () => void 0 : void 0,
      chain: () => this.createChain(tr, shouldDispatch),
      can: () => this.createCan(tr),
      get commands() {
        return Object.fromEntries(
          Object.entries(rawCommands).map(([name, command2]) => {
            return [name, (...args) => command2(...args)(props)];
          })
        );
      }
    };
    return props;
  }
};

// src/commands/index.ts
var commands_exports = {};
__export(commands_exports, {
  blur: () => blur,
  clearContent: () => clearContent,
  clearNodes: () => clearNodes,
  command: () => command,
  createParagraphNear: () => createParagraphNear,
  cut: () => cut,
  deleteCurrentNode: () => deleteCurrentNode,
  deleteNode: () => deleteNode,
  deleteRange: () => deleteRange,
  deleteSelection: () => deleteSelection,
  enter: () => enter,
  exitCode: () => exitCode,
  extendMarkRange: () => extendMarkRange,
  first: () => first,
  focus: () => focus,
  forEach: () => forEach,
  insertContent: () => insertContent,
  insertContentAt: () => insertContentAt,
  joinBackward: () => joinBackward,
  joinDown: () => joinDown,
  joinForward: () => joinForward,
  joinItemBackward: () => joinItemBackward,
  joinItemForward: () => joinItemForward,
  joinTextblockBackward: () => joinTextblockBackward,
  joinTextblockForward: () => joinTextblockForward,
  joinUp: () => joinUp,
  keyboardShortcut: () => keyboardShortcut,
  lift: () => lift,
  liftEmptyBlock: () => liftEmptyBlock,
  liftListItem: () => liftListItem,
  newlineInCode: () => newlineInCode,
  resetAttributes: () => resetAttributes,
  scrollIntoView: () => scrollIntoView,
  selectAll: () => selectAll,
  selectNodeBackward: () => selectNodeBackward,
  selectNodeForward: () => selectNodeForward,
  selectParentNode: () => selectParentNode,
  selectTextblockEnd: () => selectTextblockEnd,
  selectTextblockStart: () => selectTextblockStart,
  setContent: () => setContent,
  setMark: () => setMark,
  setMeta: () => setMeta,
  setNode: () => setNode,
  setNodeSelection: () => setNodeSelection,
  setTextDirection: () => setTextDirection,
  setTextSelection: () => setTextSelection,
  sinkListItem: () => sinkListItem,
  splitBlock: () => splitBlock,
  splitListItem: () => splitListItem,
  toggleList: () => toggleList,
  toggleMark: () => toggleMark,
  toggleNode: () => toggleNode,
  toggleWrap: () => toggleWrap,
  undoInputRule: () => undoInputRule,
  unsetAllMarks: () => unsetAllMarks,
  unsetMark: () => unsetMark,
  unsetTextDirection: () => unsetTextDirection,
  updateAttributes: () => updateAttributes,
  wrapIn: () => wrapIn,
  wrapInList: () => wrapInList
});

// src/commands/blur.ts
var blur = () => ({ editor, view }) => {
  requestAnimationFrame(() => {
    var _a;
    if (!editor.isDestroyed) {
      ;
      view.dom.blur();
      (_a = window == null ? void 0 : window.getSelection()) == null ? void 0 : _a.removeAllRanges();
    }
  });
  return true;
};

// src/commands/clearContent.ts
var clearContent = (emitUpdate = true) => ({ commands }) => {
  return commands.setContent("", { emitUpdate });
};

// src/commands/clearNodes.ts

var clearNodes = () => ({ state, tr, dispatch }) => {
  const { selection } = tr;
  const { ranges } = selection;
  if (!dispatch) {
    return true;
  }
  ranges.forEach(({ $from, $to }) => {
    state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
      if (node.type.isText) {
        return;
      }
      const { doc, mapping } = tr;
      const $mappedFrom = doc.resolve(mapping.map(pos));
      const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
      const nodeRange = $mappedFrom.blockRange($mappedTo);
      if (!nodeRange) {
        return;
      }
      const targetLiftDepth = (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(nodeRange);
      if (node.type.isTextblock) {
        const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
        tr.setNodeMarkup(nodeRange.start, defaultType);
      }
      if (targetLiftDepth || targetLiftDepth === 0) {
        tr.lift(nodeRange, targetLiftDepth);
      }
    });
  });
  return true;
};

// src/commands/command.ts
var command = (fn) => (props) => {
  return fn(props);
};

// src/commands/createParagraphNear.ts

var createParagraphNear = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.createParagraphNear)(state, dispatch);
};

// src/commands/cut.ts

var cut = (originRange, targetPos) => ({ editor, tr }) => {
  const { state } = editor;
  const contentSlice = state.doc.slice(originRange.from, originRange.to);
  tr.deleteRange(originRange.from, originRange.to);
  const newPos = tr.mapping.map(targetPos);
  tr.insert(newPos, contentSlice.content);
  tr.setSelection(new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
  return true;
};

// src/commands/deleteCurrentNode.ts
var deleteCurrentNode = () => ({ tr, dispatch }) => {
  const { selection } = tr;
  const currentNode = selection.$anchor.node();
  if (currentNode.content.size > 0) {
    return false;
  }
  const $pos = tr.selection.$anchor;
  for (let depth = $pos.depth; depth > 0; depth -= 1) {
    const node = $pos.node(depth);
    if (node.type === currentNode.type) {
      if (dispatch) {
        const from = $pos.before(depth);
        const to = $pos.after(depth);
        tr.delete(from, to).scrollIntoView();
      }
      return true;
    }
  }
  return false;
};

// src/helpers/getNodeType.ts
function getNodeType(nameOrType, schema) {
  if (typeof nameOrType === "string") {
    if (!schema.nodes[nameOrType]) {
      throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
    }
    return schema.nodes[nameOrType];
  }
  return nameOrType;
}

// src/commands/deleteNode.ts
var deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  const $pos = tr.selection.$anchor;
  for (let depth = $pos.depth; depth > 0; depth -= 1) {
    const node = $pos.node(depth);
    if (node.type === type) {
      if (dispatch) {
        const from = $pos.before(depth);
        const to = $pos.after(depth);
        tr.delete(from, to).scrollIntoView();
      }
      return true;
    }
  }
  return false;
};

// src/commands/deleteRange.ts
var deleteRange = (range) => ({ tr, dispatch }) => {
  const { from, to } = range;
  if (dispatch) {
    tr.delete(from, to);
  }
  return true;
};

// src/commands/deleteSelection.ts

var deleteSelection = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.deleteSelection)(state, dispatch);
};

// src/commands/enter.ts
var enter = () => ({ commands }) => {
  return commands.keyboardShortcut("Enter");
};

// src/commands/exitCode.ts

var exitCode = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.exitCode)(state, dispatch);
};

// src/commands/extendMarkRange.ts


// src/utilities/isRegExp.ts
function isRegExp(value) {
  return Object.prototype.toString.call(value) === "[object RegExp]";
}

// src/utilities/objectIncludes.ts
function objectIncludes(object1, object2, options = { strict: true }) {
  const keys = Object.keys(object2);
  if (!keys.length) {
    return true;
  }
  return keys.every((key) => {
    if (options.strict) {
      return object2[key] === object1[key];
    }
    if (isRegExp(object2[key])) {
      return object2[key].test(object1[key]);
    }
    return object2[key] === object1[key];
  });
}

// src/helpers/getMarkRange.ts
function findMarkInSet(marks, type, attributes = {}) {
  return marks.find((item) => {
    return item.type === type && objectIncludes(
      // Only check equality for the attributes that are provided
      Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])),
      attributes
    );
  });
}
function isMarkInSet(marks, type, attributes = {}) {
  return !!findMarkInSet(marks, type, attributes);
}
function getMarkRange($pos, type, attributes) {
  var _a;
  if (!$pos || !type) {
    return;
  }
  let start = $pos.parent.childAfter($pos.parentOffset);
  if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
    start = $pos.parent.childBefore($pos.parentOffset);
  }
  if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {
    return;
  }
  attributes = attributes || ((_a = start.node.marks[0]) == null ? void 0 : _a.attrs);
  const mark = findMarkInSet([...start.node.marks], type, attributes);
  if (!mark) {
    return;
  }
  let startIndex = start.index;
  let startPos = $pos.start() + start.offset;
  let endIndex = startIndex + 1;
  let endPos = startPos + start.node.nodeSize;
  while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
    startIndex -= 1;
    startPos -= $pos.parent.child(startIndex).nodeSize;
  }
  while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
    endPos += $pos.parent.child(endIndex).nodeSize;
    endIndex += 1;
  }
  return {
    from: startPos,
    to: endPos
  };
}

// src/helpers/getMarkType.ts
function getMarkType(nameOrType, schema) {
  if (typeof nameOrType === "string") {
    if (!schema.marks[nameOrType]) {
      throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
    }
    return schema.marks[nameOrType];
  }
  return nameOrType;
}

// src/commands/extendMarkRange.ts
var extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
  const type = getMarkType(typeOrName, state.schema);
  const { doc, selection } = tr;
  const { $from, from, to } = selection;
  if (dispatch) {
    const range = getMarkRange($from, type, attributes);
    if (range && range.from <= from && range.to >= to) {
      const newSelection = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(doc, range.from, range.to);
      tr.setSelection(newSelection);
    }
  }
  return true;
};

// src/commands/first.ts
var first = (commands) => (props) => {
  const items = typeof commands === "function" ? commands(props) : commands;
  for (let i = 0; i < items.length; i += 1) {
    if (items[i](props)) {
      return true;
    }
  }
  return false;
};

// src/helpers/isTextSelection.ts

function isTextSelection(value) {
  return value instanceof _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection;
}

// src/helpers/resolveFocusPosition.ts


// src/utilities/minMax.ts
function minMax(value = 0, min = 0, max = 0) {
  return Math.min(Math.max(value, min), max);
}

// src/helpers/resolveFocusPosition.ts
function resolveFocusPosition(doc, position = null) {
  if (!position) {
    return null;
  }
  const selectionAtStart = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.atStart(doc);
  const selectionAtEnd = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.atEnd(doc);
  if (position === "start" || position === true) {
    return selectionAtStart;
  }
  if (position === "end") {
    return selectionAtEnd;
  }
  const minPos = selectionAtStart.from;
  const maxPos = selectionAtEnd.to;
  if (position === "all") {
    return _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
  }
  return _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
}

// src/utilities/isAndroid.ts
function isAndroid() {
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
}

// src/utilities/isiOS.ts
function isiOS() {
  return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
  navigator.userAgent.includes("Mac") && "ontouchend" in document;
}

// src/utilities/isSafari.ts
function isSafari() {
  return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
}

// src/commands/focus.ts
var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
  options = {
    scrollIntoView: true,
    ...options
  };
  const delayedFocus = () => {
    if (isiOS() || isAndroid()) {
      ;
      view.dom.focus();
    }
    if (isSafari() && !isiOS() && !isAndroid()) {
      ;
      view.dom.focus({ preventScroll: true });
    }
    requestAnimationFrame(() => {
      if (!editor.isDestroyed) {
        view.focus();
        if (options == null ? void 0 : options.scrollIntoView) {
          editor.commands.scrollIntoView();
        }
      }
    });
  };
  try {
    if (view.hasFocus() && position === null || position === false) {
      return true;
    }
  } catch {
    return false;
  }
  if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
    delayedFocus();
    return true;
  }
  const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
  const isSameSelection = editor.state.selection.eq(selection);
  if (dispatch) {
    if (!isSameSelection) {
      tr.setSelection(selection);
    }
    if (isSameSelection && tr.storedMarks) {
      tr.setStoredMarks(tr.storedMarks);
    }
    delayedFocus();
  }
  return true;
};

// src/commands/forEach.ts
var forEach = (items, fn) => (props) => {
  return items.every((item, index) => fn(item, { ...props, index }));
};

// src/commands/insertContent.ts
var insertContent = (value, options) => ({ tr, commands }) => {
  return commands.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
};

// src/commands/insertContentAt.ts


// src/helpers/createNodeFromContent.ts


// src/utilities/elementFromString.ts
var removeWhitespaces = (node) => {
  const children = node.childNodes;
  for (let i = children.length - 1; i >= 0; i -= 1) {
    const child = children[i];
    if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) {
      node.removeChild(child);
    } else if (child.nodeType === 1) {
      removeWhitespaces(child);
    }
  }
  return node;
};
function elementFromString(value) {
  if (typeof window === "undefined") {
    throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
  }
  const wrappedValue = `<body>${value}</body>`;
  const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
  return removeWhitespaces(html);
}

// src/helpers/createNodeFromContent.ts
function createNodeFromContent(content, schema, options) {
  if (content instanceof _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Node || content instanceof _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment) {
    return content;
  }
  options = {
    slice: true,
    parseOptions: {},
    ...options
  };
  const isJSONContent = typeof content === "object" && content !== null;
  const isTextContent = typeof content === "string";
  if (isJSONContent) {
    try {
      const isArrayContent = Array.isArray(content) && content.length > 0;
      if (isArrayContent) {
        return _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
      }
      const node = schema.nodeFromJSON(content);
      if (options.errorOnInvalidContent) {
        node.check();
      }
      return node;
    } catch (error) {
      if (options.errorOnInvalidContent) {
        throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
      }
      console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
      return createNodeFromContent("", schema, options);
    }
  }
  if (isTextContent) {
    if (options.errorOnInvalidContent) {
      let hasInvalidContent = false;
      let invalidContent = "";
      const contentCheckSchema = new _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Schema({
        topNode: schema.spec.topNode,
        marks: schema.spec.marks,
        // Prosemirror's schemas are executed such that: the last to execute, matches last
        // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
        nodes: schema.spec.nodes.append({
          __tiptap__private__unknown__catch__all__node: {
            content: "inline*",
            group: "block",
            parseDOM: [
              {
                tag: "*",
                getAttrs: (e) => {
                  hasInvalidContent = true;
                  invalidContent = typeof e === "string" ? e : e.outerHTML;
                  return null;
                }
              }
            ]
          }
        })
      });
      if (options.slice) {
        _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
      } else {
        _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
      }
      if (options.errorOnInvalidContent && hasInvalidContent) {
        throw new Error("[tiptap error]: Invalid HTML content", {
          cause: new Error(`Invalid element found: ${invalidContent}`)
        });
      }
    }
    const parser = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.DOMParser.fromSchema(schema);
    if (options.slice) {
      return parser.parseSlice(elementFromString(content), options.parseOptions).content;
    }
    return parser.parse(elementFromString(content), options.parseOptions);
  }
  return createNodeFromContent("", schema, options);
}

// src/helpers/selectionToInsertionEnd.ts


function selectionToInsertionEnd(tr, startLen, bias) {
  const last = tr.steps.length - 1;
  if (last < startLen) {
    return;
  }
  const step = tr.steps[last];
  if (!(step instanceof _tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceStep || step instanceof _tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep)) {
    return;
  }
  const map = tr.mapping.maps[last];
  let end = 0;
  map.forEach((_from, _to, _newFrom, newTo) => {
    if (end === 0) {
      end = newTo;
    }
  });
  tr.setSelection(_tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.near(tr.doc.resolve(end), bias));
}

// src/commands/insertContentAt.ts
var isFragment = (nodeOrFragment) => {
  return !("type" in nodeOrFragment);
};
var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
  var _a;
  if (dispatch) {
    options = {
      parseOptions: editor.options.parseOptions,
      updateSelection: true,
      applyInputRules: false,
      applyPasteRules: false,
      ...options
    };
    let content;
    const emitContentError = (error) => {
      editor.emit("contentError", {
        editor,
        error,
        disableCollaboration: () => {
          if ("collaboration" in editor.storage && typeof editor.storage.collaboration === "object" && editor.storage.collaboration) {
            ;
            editor.storage.collaboration.isDisabled = true;
          }
        }
      });
    };
    const parseOptions = {
      preserveWhitespace: "full",
      ...options.parseOptions
    };
    if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {
      try {
        createNodeFromContent(value, editor.schema, {
          parseOptions,
          errorOnInvalidContent: true
        });
      } catch (e) {
        emitContentError(e);
      }
    }
    try {
      content = createNodeFromContent(value, editor.schema, {
        parseOptions,
        errorOnInvalidContent: (_a = options.errorOnInvalidContent) != null ? _a : editor.options.enableContentCheck
      });
    } catch (e) {
      emitContentError(e);
      return false;
    }
    let { from, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
    let isOnlyTextContent = true;
    let isOnlyBlockContent = true;
    const nodes = isFragment(content) ? content : [content];
    nodes.forEach((node) => {
      node.check();
      isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
      isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
    });
    if (from === to && isOnlyBlockContent) {
      const { parent } = tr.doc.resolve(from);
      const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
      if (isEmptyTextBlock) {
        from -= 1;
        to += 1;
      }
    }
    let newContent;
    if (isOnlyTextContent) {
      if (Array.isArray(value)) {
        newContent = value.map((v) => v.text || "").join("");
      } else if (value instanceof _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment) {
        let text = "";
        value.forEach((node) => {
          if (node.text) {
            text += node.text;
          }
        });
        newContent = text;
      } else if (typeof value === "object" && !!value && !!value.text) {
        newContent = value.text;
      } else {
        newContent = value;
      }
      tr.insertText(newContent, from, to);
    } else {
      newContent = content;
      const $from = tr.doc.resolve(from);
      const $fromNode = $from.node();
      const fromSelectionAtStart = $from.parentOffset === 0;
      const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
      const hasContent = $fromNode.content.size > 0;
      if (fromSelectionAtStart && isTextSelection2 && hasContent) {
        from = Math.max(0, from - 1);
      }
      tr.replaceWith(from, to, newContent);
    }
    if (options.updateSelection) {
      selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
    }
    if (options.applyInputRules) {
      tr.setMeta("applyInputRules", { from, text: newContent });
    }
    if (options.applyPasteRules) {
      tr.setMeta("applyPasteRules", { from, text: newContent });
    }
  }
  return true;
};

// src/commands/join.ts

var joinUp = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinUp)(state, dispatch);
};
var joinDown = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinDown)(state, dispatch);
};
var joinBackward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinBackward)(state, dispatch);
};
var joinForward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinForward)(state, dispatch);
};

// src/commands/joinItemBackward.ts

var joinItemBackward = () => ({ state, dispatch, tr }) => {
  try {
    const point = (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.joinPoint)(state.doc, state.selection.$from.pos, -1);
    if (point === null || point === void 0) {
      return false;
    }
    tr.join(point, 2);
    if (dispatch) {
      dispatch(tr);
    }
    return true;
  } catch {
    return false;
  }
};

// src/commands/joinItemForward.ts

var joinItemForward = () => ({ state, dispatch, tr }) => {
  try {
    const point = (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.joinPoint)(state.doc, state.selection.$from.pos, 1);
    if (point === null || point === void 0) {
      return false;
    }
    tr.join(point, 2);
    if (dispatch) {
      dispatch(tr);
    }
    return true;
  } catch {
    return false;
  }
};

// src/commands/joinTextblockBackward.ts

var joinTextblockBackward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinTextblockBackward)(state, dispatch);
};

// src/commands/joinTextblockForward.ts

var joinTextblockForward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.joinTextblockForward)(state, dispatch);
};

// src/utilities/isMacOS.ts
function isMacOS() {
  return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
}

// src/commands/keyboardShortcut.ts
function normalizeKeyName(name) {
  const parts = name.split(/-(?!$)/);
  let result = parts[parts.length - 1];
  if (result === "Space") {
    result = " ";
  }
  let alt;
  let ctrl;
  let shift;
  let meta;
  for (let i = 0; i < parts.length - 1; i += 1) {
    const mod = parts[i];
    if (/^(cmd|meta|m)$/i.test(mod)) {
      meta = true;
    } else if (/^a(lt)?$/i.test(mod)) {
      alt = true;
    } else if (/^(c|ctrl|control)$/i.test(mod)) {
      ctrl = true;
    } else if (/^s(hift)?$/i.test(mod)) {
      shift = true;
    } else if (/^mod$/i.test(mod)) {
      if (isiOS() || isMacOS()) {
        meta = true;
      } else {
        ctrl = true;
      }
    } else {
      throw new Error(`Unrecognized modifier name: ${mod}`);
    }
  }
  if (alt) {
    result = `Alt-${result}`;
  }
  if (ctrl) {
    result = `Ctrl-${result}`;
  }
  if (meta) {
    result = `Meta-${result}`;
  }
  if (shift) {
    result = `Shift-${result}`;
  }
  return result;
}
var keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
  const keys = normalizeKeyName(name).split(/-(?!$)/);
  const key = keys.find((item) => !["Alt", "Ctrl", "Meta", "Shift"].includes(item));
  const event = new KeyboardEvent("keydown", {
    key: key === "Space" ? " " : key,
    altKey: keys.includes("Alt"),
    ctrlKey: keys.includes("Ctrl"),
    metaKey: keys.includes("Meta"),
    shiftKey: keys.includes("Shift"),
    bubbles: true,
    cancelable: true
  });
  const capturedTransaction = editor.captureTransaction(() => {
    view.someProp("handleKeyDown", (f) => f(view, event));
  });
  capturedTransaction == null ? void 0 : capturedTransaction.steps.forEach((step) => {
    const newStep = step.map(tr.mapping);
    if (newStep && dispatch) {
      tr.maybeStep(newStep);
    }
  });
  return true;
};

// src/commands/lift.ts


// src/helpers/isNodeActive.ts
function isNodeActive(state, typeOrName, attributes = {}) {
  const { from, to, empty } = state.selection;
  const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
  const nodeRanges = [];
  state.doc.nodesBetween(from, to, (node, pos) => {
    if (node.isText) {
      return;
    }
    const relativeFrom = Math.max(from, pos);
    const relativeTo = Math.min(to, pos + node.nodeSize);
    nodeRanges.push({
      node,
      from: relativeFrom,
      to: relativeTo
    });
  });
  const selectionRange = to - from;
  const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
    if (!type) {
      return true;
    }
    return type.name === nodeRange.node.type.name;
  }).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
  if (empty) {
    return !!matchedNodeRanges.length;
  }
  const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);
  return range >= selectionRange;
}

// src/commands/lift.ts
var lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  const isActive2 = isNodeActive(state, type, attributes);
  if (!isActive2) {
    return false;
  }
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.lift)(state, dispatch);
};

// src/commands/liftEmptyBlock.ts

var liftEmptyBlock = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.liftEmptyBlock)(state, dispatch);
};

// src/commands/liftListItem.ts

var liftListItem = (typeOrName) => ({ state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  return (0,_tiptap_pm_schema_list__WEBPACK_IMPORTED_MODULE_4__.liftListItem)(type)(state, dispatch);
};

// src/commands/newlineInCode.ts

var newlineInCode = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.newlineInCode)(state, dispatch);
};

// src/helpers/getSchemaTypeNameByName.ts
function getSchemaTypeNameByName(name, schema) {
  if (schema.nodes[name]) {
    return "node";
  }
  if (schema.marks[name]) {
    return "mark";
  }
  return null;
}

// src/utilities/deleteProps.ts
function deleteProps(obj, propOrProps) {
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
  return Object.keys(obj).reduce((newObj, prop) => {
    if (!props.includes(prop)) {
      newObj[prop] = obj[prop];
    }
    return newObj;
  }, {});
}

// src/commands/resetAttributes.ts
var resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
  let nodeType = null;
  let markType = null;
  const schemaType = getSchemaTypeNameByName(
    typeof typeOrName === "string" ? typeOrName : typeOrName.name,
    state.schema
  );
  if (!schemaType) {
    return false;
  }
  if (schemaType === "node") {
    nodeType = getNodeType(typeOrName, state.schema);
  }
  if (schemaType === "mark") {
    markType = getMarkType(typeOrName, state.schema);
  }
  let canReset = false;
  tr.selection.ranges.forEach((range) => {
    state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
      if (nodeType && nodeType === node.type) {
        canReset = true;
        if (dispatch) {
          tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
        }
      }
      if (markType && node.marks.length) {
        node.marks.forEach((mark) => {
          if (markType === mark.type) {
            canReset = true;
            if (dispatch) {
              tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
            }
          }
        });
      }
    });
  });
  return canReset;
};

// src/commands/scrollIntoView.ts
var scrollIntoView = () => ({ tr, dispatch }) => {
  if (dispatch) {
    tr.scrollIntoView();
  }
  return true;
};

// src/commands/selectAll.ts

var selectAll = () => ({ tr, dispatch }) => {
  if (dispatch) {
    const selection = new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.AllSelection(tr.doc);
    tr.setSelection(selection);
  }
  return true;
};

// src/commands/selectNodeBackward.ts

var selectNodeBackward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.selectNodeBackward)(state, dispatch);
};

// src/commands/selectNodeForward.ts

var selectNodeForward = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.selectNodeForward)(state, dispatch);
};

// src/commands/selectParentNode.ts

var selectParentNode = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.selectParentNode)(state, dispatch);
};

// src/commands/selectTextblockEnd.ts

var selectTextblockEnd = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.selectTextblockEnd)(state, dispatch);
};

// src/commands/selectTextblockStart.ts

var selectTextblockStart = () => ({ state, dispatch }) => {
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.selectTextblockStart)(state, dispatch);
};

// src/helpers/createDocument.ts
function createDocument(content, schema, parseOptions = {}, options = {}) {
  return createNodeFromContent(content, schema, {
    slice: false,
    parseOptions,
    errorOnInvalidContent: options.errorOnInvalidContent
  });
}

// src/commands/setContent.ts
var setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {
  const { doc } = tr;
  if (parseOptions.preserveWhitespace !== "full") {
    const document2 = createDocument(content, editor.schema, parseOptions, {
      errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck
    });
    if (dispatch) {
      tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
    }
    return true;
  }
  if (dispatch) {
    tr.setMeta("preventUpdate", !emitUpdate);
  }
  return commands.insertContentAt({ from: 0, to: doc.content.size }, content, {
    parseOptions,
    errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck
  });
};

// src/helpers/getMarkAttributes.ts
function getMarkAttributes(state, typeOrName) {
  const type = getMarkType(typeOrName, state.schema);
  const { from, to, empty } = state.selection;
  const marks = [];
  if (empty) {
    if (state.storedMarks) {
      marks.push(...state.storedMarks);
    }
    marks.push(...state.selection.$head.marks());
  } else {
    state.doc.nodesBetween(from, to, (node) => {
      marks.push(...node.marks);
    });
  }
  const mark = marks.find((markItem) => markItem.type.name === type.name);
  if (!mark) {
    return {};
  }
  return { ...mark.attrs };
}

// src/helpers/combineTransactionSteps.ts

function combineTransactionSteps(oldDoc, transactions) {
  const transform = new _tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.Transform(oldDoc);
  transactions.forEach((transaction) => {
    transaction.steps.forEach((step) => {
      transform.step(step);
    });
  });
  return transform;
}

// src/helpers/defaultBlockAt.ts
function defaultBlockAt(match) {
  for (let i = 0; i < match.edgeCount; i += 1) {
    const { type } = match.edge(i);
    if (type.isTextblock && !type.hasRequiredAttrs()) {
      return type;
    }
  }
  return null;
}

// src/helpers/findChildren.ts
function findChildren(node, predicate) {
  const nodesWithPos = [];
  node.descendants((child, pos) => {
    if (predicate(child)) {
      nodesWithPos.push({
        node: child,
        pos
      });
    }
  });
  return nodesWithPos;
}

// src/helpers/findChildrenInRange.ts
function findChildrenInRange(node, range, predicate) {
  const nodesWithPos = [];
  node.nodesBetween(range.from, range.to, (child, pos) => {
    if (predicate(child)) {
      nodesWithPos.push({
        node: child,
        pos
      });
    }
  });
  return nodesWithPos;
}

// src/helpers/findParentNodeClosestToPos.ts
function findParentNodeClosestToPos($pos, predicate) {
  for (let i = $pos.depth; i > 0; i -= 1) {
    const node = $pos.node(i);
    if (predicate(node)) {
      return {
        pos: i > 0 ? $pos.before(i) : 0,
        start: $pos.start(i),
        depth: i,
        node
      };
    }
  }
}

// src/helpers/findParentNode.ts
function findParentNode(predicate) {
  return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
}

// src/helpers/getExtensionField.ts
function getExtensionField(extension, field, context) {
  if (extension.config[field] === void 0 && extension.parent) {
    return getExtensionField(extension.parent, field, context);
  }
  if (typeof extension.config[field] === "function") {
    const value = extension.config[field].bind({
      ...context,
      parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
    });
    return value;
  }
  return extension.config[field];
}

// src/helpers/flattenExtensions.ts
function flattenExtensions(extensions) {
  return extensions.map((extension) => {
    const context = {
      name: extension.name,
      options: extension.options,
      storage: extension.storage
    };
    const addExtensions = getExtensionField(extension, "addExtensions", context);
    if (addExtensions) {
      return [extension, ...flattenExtensions(addExtensions())];
    }
    return extension;
  }).flat(10);
}

// src/helpers/generateHTML.ts


// src/helpers/getHTMLFromFragment.ts

function getHTMLFromFragment(fragment, schema) {
  const documentFragment = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.DOMSerializer.fromSchema(schema).serializeFragment(fragment);
  const temporaryDocument = document.implementation.createHTMLDocument();
  const container = temporaryDocument.createElement("div");
  container.appendChild(documentFragment);
  return container.innerHTML;
}

// src/helpers/getSchemaByResolvedExtensions.ts


// src/utilities/isFunction.ts
function isFunction(value) {
  return typeof value === "function";
}

// src/utilities/callOrReturn.ts
function callOrReturn(value, context = void 0, ...props) {
  if (isFunction(value)) {
    if (context) {
      return value.bind(context)(...props);
    }
    return value(...props);
  }
  return value;
}

// src/utilities/isEmptyObject.ts
function isEmptyObject(value = {}) {
  return Object.keys(value).length === 0 && value.constructor === Object;
}

// src/helpers/splitExtensions.ts
function splitExtensions(extensions) {
  const baseExtensions = extensions.filter((extension) => extension.type === "extension");
  const nodeExtensions = extensions.filter((extension) => extension.type === "node");
  const markExtensions = extensions.filter((extension) => extension.type === "mark");
  return {
    baseExtensions,
    nodeExtensions,
    markExtensions
  };
}

// src/helpers/getAttributesFromExtensions.ts
function getAttributesFromExtensions(extensions) {
  const extensionAttributes = [];
  const { nodeExtensions, markExtensions } = splitExtensions(extensions);
  const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];
  const defaultAttribute = {
    default: null,
    validate: void 0,
    rendered: true,
    renderHTML: null,
    parseHTML: null,
    keepOnSplit: true,
    isRequired: false
  };
  const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
  const markExtensionTypes = markExtensions.map((ext) => ext.name);
  const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
  extensions.forEach((extension) => {
    const context = {
      name: extension.name,
      options: extension.options,
      storage: extension.storage,
      extensions: nodeAndMarkExtensions
    };
    const addGlobalAttributes = getExtensionField(
      extension,
      "addGlobalAttributes",
      context
    );
    if (!addGlobalAttributes) {
      return;
    }
    const globalAttributes = addGlobalAttributes();
    globalAttributes.forEach((globalAttribute) => {
      let resolvedTypes;
      if (Array.isArray(globalAttribute.types)) {
        resolvedTypes = globalAttribute.types;
      } else if (globalAttribute.types === "*") {
        resolvedTypes = allExtensionTypes;
      } else if (globalAttribute.types === "nodes") {
        resolvedTypes = nodeExtensionTypes;
      } else if (globalAttribute.types === "marks") {
        resolvedTypes = markExtensionTypes;
      } else {
        resolvedTypes = [];
      }
      resolvedTypes.forEach((type) => {
        Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
          extensionAttributes.push({
            type,
            name,
            attribute: {
              ...defaultAttribute,
              ...attribute
            }
          });
        });
      });
    });
  });
  nodeAndMarkExtensions.forEach((extension) => {
    const context = {
      name: extension.name,
      options: extension.options,
      storage: extension.storage
    };
    const addAttributes = getExtensionField(
      extension,
      "addAttributes",
      context
    );
    if (!addAttributes) {
      return;
    }
    const attributes = addAttributes();
    Object.entries(attributes).forEach(([name, attribute]) => {
      const mergedAttr = {
        ...defaultAttribute,
        ...attribute
      };
      if (typeof (mergedAttr == null ? void 0 : mergedAttr.default) === "function") {
        mergedAttr.default = mergedAttr.default();
      }
      if ((mergedAttr == null ? void 0 : mergedAttr.isRequired) && (mergedAttr == null ? void 0 : mergedAttr.default) === void 0) {
        delete mergedAttr.default;
      }
      extensionAttributes.push({
        type: extension.name,
        name,
        attribute: mergedAttr
      });
    });
  });
  return extensionAttributes;
}

// src/utilities/mergeAttributes.ts
function mergeAttributes(...objects) {
  return objects.filter((item) => !!item).reduce((items, item) => {
    const mergedAttributes = { ...items };
    Object.entries(item).forEach(([key, value]) => {
      const exists = mergedAttributes[key];
      if (!exists) {
        mergedAttributes[key] = value;
        return;
      }
      if (key === "class") {
        const valueClasses = value ? String(value).split(" ") : [];
        const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
        const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
        mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
      } else if (key === "style") {
        const newStyles = value ? value.split(";").map((style2) => style2.trim()).filter(Boolean) : [];
        const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style2) => style2.trim()).filter(Boolean) : [];
        const styleMap = /* @__PURE__ */ new Map();
        existingStyles.forEach((style2) => {
          const [property, val] = style2.split(":").map((part) => part.trim());
          styleMap.set(property, val);
        });
        newStyles.forEach((style2) => {
          const [property, val] = style2.split(":").map((part) => part.trim());
          styleMap.set(property, val);
        });
        mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
      } else {
        mergedAttributes[key] = value;
      }
    });
    return mergedAttributes;
  }, {});
}

// src/helpers/getRenderedAttributes.ts
function getRenderedAttributes(nodeOrMark, extensionAttributes) {
  return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {
    if (!item.attribute.renderHTML) {
      return {
        [item.name]: nodeOrMark.attrs[item.name]
      };
    }
    return item.attribute.renderHTML(nodeOrMark.attrs) || {};
  }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});
}

// src/utilities/fromString.ts
function fromString(value) {
  if (typeof value !== "string") {
    return value;
  }
  if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) {
    return Number(value);
  }
  if (value === "true") {
    return true;
  }
  if (value === "false") {
    return false;
  }
  return value;
}

// src/helpers/injectExtensionAttributesToParseRule.ts
function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
  if ("style" in parseRule) {
    return parseRule;
  }
  return {
    ...parseRule,
    getAttrs: (node) => {
      const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;
      if (oldAttributes === false) {
        return false;
      }
      const newAttributes = extensionAttributes.reduce((items, item) => {
        const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));
        if (value === null || value === void 0) {
          return items;
        }
        return {
          ...items,
          [item.name]: value
        };
      }, {});
      return { ...oldAttributes, ...newAttributes };
    }
  };
}

// src/helpers/getSchemaByResolvedExtensions.ts
function cleanUpSchemaItem(data) {
  return Object.fromEntries(
    // @ts-ignore
    Object.entries(data).filter(([key, value]) => {
      if (key === "attrs" && isEmptyObject(value)) {
        return false;
      }
      return value !== null && value !== void 0;
    })
  );
}
function buildAttributeSpec(extensionAttribute) {
  var _a, _b;
  const spec = {};
  if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && "default" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) {
    spec.default = extensionAttribute.attribute.default;
  }
  if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) {
    spec.validate = extensionAttribute.attribute.validate;
  }
  return [extensionAttribute.name, spec];
}
function getSchemaByResolvedExtensions(extensions, editor) {
  var _a;
  const allAttributes = getAttributesFromExtensions(extensions);
  const { nodeExtensions, markExtensions } = splitExtensions(extensions);
  const topNode = (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) == null ? void 0 : _a.name;
  const nodes = Object.fromEntries(
    nodeExtensions.map((extension) => {
      const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
      const context = {
        name: extension.name,
        options: extension.options,
        storage: extension.storage,
        editor
      };
      const extraNodeFields = extensions.reduce((fields, e) => {
        const extendNodeSchema = getExtensionField(e, "extendNodeSchema", context);
        return {
          ...fields,
          ...extendNodeSchema ? extendNodeSchema(extension) : {}
        };
      }, {});
      const schema = cleanUpSchemaItem({
        ...extraNodeFields,
        content: callOrReturn(getExtensionField(extension, "content", context)),
        marks: callOrReturn(getExtensionField(extension, "marks", context)),
        group: callOrReturn(getExtensionField(extension, "group", context)),
        inline: callOrReturn(getExtensionField(extension, "inline", context)),
        atom: callOrReturn(getExtensionField(extension, "atom", context)),
        selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
        draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
        code: callOrReturn(getExtensionField(extension, "code", context)),
        whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
        linebreakReplacement: callOrReturn(
          getExtensionField(extension, "linebreakReplacement", context)
        ),
        defining: callOrReturn(getExtensionField(extension, "defining", context)),
        isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
        attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
      });
      const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
      if (parseHTML) {
        schema.parseDOM = parseHTML.map(
          (parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
        );
      }
      const renderHTML = getExtensionField(extension, "renderHTML", context);
      if (renderHTML) {
        schema.toDOM = (node) => renderHTML({
          node,
          HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
        });
      }
      const renderText = getExtensionField(extension, "renderText", context);
      if (renderText) {
        schema.toText = renderText;
      }
      return [extension.name, schema];
    })
  );
  const marks = Object.fromEntries(
    markExtensions.map((extension) => {
      const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
      const context = {
        name: extension.name,
        options: extension.options,
        storage: extension.storage,
        editor
      };
      const extraMarkFields = extensions.reduce((fields, e) => {
        const extendMarkSchema = getExtensionField(e, "extendMarkSchema", context);
        return {
          ...fields,
          ...extendMarkSchema ? extendMarkSchema(extension) : {}
        };
      }, {});
      const schema = cleanUpSchemaItem({
        ...extraMarkFields,
        inclusive: callOrReturn(getExtensionField(extension, "inclusive", context)),
        excludes: callOrReturn(getExtensionField(extension, "excludes", context)),
        group: callOrReturn(getExtensionField(extension, "group", context)),
        spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
        code: callOrReturn(getExtensionField(extension, "code", context)),
        attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
      });
      const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
      if (parseHTML) {
        schema.parseDOM = parseHTML.map(
          (parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)
        );
      }
      const renderHTML = getExtensionField(extension, "renderHTML", context);
      if (renderHTML) {
        schema.toDOM = (mark) => renderHTML({
          mark,
          HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)
        });
      }
      return [extension.name, schema];
    })
  );
  return new _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Schema({
    topNode,
    nodes,
    marks
  });
}

// src/utilities/findDuplicates.ts
function findDuplicates(items) {
  const filtered = items.filter((el, index) => items.indexOf(el) !== index);
  return Array.from(new Set(filtered));
}

// src/helpers/sortExtensions.ts
function sortExtensions(extensions) {
  const defaultPriority = 100;
  return extensions.sort((a, b) => {
    const priorityA = getExtensionField(a, "priority") || defaultPriority;
    const priorityB = getExtensionField(b, "priority") || defaultPriority;
    if (priorityA > priorityB) {
      return -1;
    }
    if (priorityA < priorityB) {
      return 1;
    }
    return 0;
  });
}

// src/helpers/resolveExtensions.ts
function resolveExtensions(extensions) {
  const resolvedExtensions = sortExtensions(flattenExtensions(extensions));
  const duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));
  if (duplicatedNames.length) {
    console.warn(
      `[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(", ")}]. This can lead to issues.`
    );
  }
  return resolvedExtensions;
}

// src/helpers/getSchema.ts
function getSchema(extensions, editor) {
  const resolvedExtensions = resolveExtensions(extensions);
  return getSchemaByResolvedExtensions(resolvedExtensions, editor);
}

// src/helpers/generateHTML.ts
function generateHTML(doc, extensions) {
  const schema = getSchema(extensions);
  const contentNode = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Node.fromJSON(schema, doc);
  return getHTMLFromFragment(contentNode.content, schema);
}

// src/helpers/generateJSON.ts

function generateJSON(html, extensions) {
  const schema = getSchema(extensions);
  const dom = elementFromString(html);
  return _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.DOMParser.fromSchema(schema).parse(dom).toJSON();
}

// src/helpers/generateText.ts


// src/helpers/getTextBetween.ts
function getTextBetween(startNode, range, options) {
  const { from, to } = range;
  const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
  let text = "";
  startNode.nodesBetween(from, to, (node, pos, parent, index) => {
    var _a;
    if (node.isBlock && pos > from) {
      text += blockSeparator;
    }
    const textSerializer = textSerializers == null ? void 0 : textSerializers[node.type.name];
    if (textSerializer) {
      if (parent) {
        text += textSerializer({
          node,
          pos,
          parent,
          index,
          range
        });
      }
      return false;
    }
    if (node.isText) {
      text += (_a = node == null ? void 0 : node.text) == null ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
    }
  });
  return text;
}

// src/helpers/getText.ts
function getText(node, options) {
  const range = {
    from: 0,
    to: node.content.size
  };
  return getTextBetween(node, range, options);
}

// src/helpers/getTextSerializersFromSchema.ts
function getTextSerializersFromSchema(schema) {
  return Object.fromEntries(
    Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText])
  );
}

// src/helpers/generateText.ts
function generateText(doc, extensions, options) {
  const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
  const schema = getSchema(extensions);
  const contentNode = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Node.fromJSON(schema, doc);
  return getText(contentNode, {
    blockSeparator,
    textSerializers: {
      ...getTextSerializersFromSchema(schema),
      ...textSerializers
    }
  });
}

// src/helpers/getNodeAttributes.ts
function getNodeAttributes(state, typeOrName) {
  const type = getNodeType(typeOrName, state.schema);
  const { from, to } = state.selection;
  const nodes = [];
  state.doc.nodesBetween(from, to, (node2) => {
    nodes.push(node2);
  });
  const node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);
  if (!node) {
    return {};
  }
  return { ...node.attrs };
}

// src/helpers/getAttributes.ts
function getAttributes(state, typeOrName) {
  const schemaType = getSchemaTypeNameByName(
    typeof typeOrName === "string" ? typeOrName : typeOrName.name,
    state.schema
  );
  if (schemaType === "node") {
    return getNodeAttributes(state, typeOrName);
  }
  if (schemaType === "mark") {
    return getMarkAttributes(state, typeOrName);
  }
  return {};
}

// src/utilities/removeDuplicates.ts
function removeDuplicates(array, by = JSON.stringify) {
  const seen = {};
  return array.filter((item) => {
    const key = by(item);
    return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;
  });
}

// src/helpers/getChangedRanges.ts
function simplifyChangedRanges(changes) {
  const uniqueChanges = removeDuplicates(changes);
  return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
    const rest = uniqueChanges.filter((_, i) => i !== index);
    return !rest.some((otherChange) => {
      return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
    });
  });
}
function getChangedRanges(transform) {
  const { mapping, steps } = transform;
  const changes = [];
  mapping.maps.forEach((stepMap, index) => {
    const ranges = [];
    if (!stepMap.ranges.length) {
      const { from, to } = steps[index];
      if (from === void 0 || to === void 0) {
        return;
      }
      ranges.push({ from, to });
    } else {
      stepMap.forEach((from, to) => {
        ranges.push({ from, to });
      });
    }
    ranges.forEach(({ from, to }) => {
      const newStart = mapping.slice(index).map(from, -1);
      const newEnd = mapping.slice(index).map(to);
      const oldStart = mapping.invert().map(newStart, -1);
      const oldEnd = mapping.invert().map(newEnd);
      changes.push({
        oldRange: {
          from: oldStart,
          to: oldEnd
        },
        newRange: {
          from: newStart,
          to: newEnd
        }
      });
    });
  });
  return simplifyChangedRanges(changes);
}

// src/helpers/getDebugJSON.ts
function getDebugJSON(node, startOffset = 0) {
  const isTopNode = node.type === node.type.schema.topNodeType;
  const increment = isTopNode ? 0 : 1;
  const from = startOffset;
  const to = from + node.nodeSize;
  const marks = node.marks.map((mark) => {
    const output2 = {
      type: mark.type.name
    };
    if (Object.keys(mark.attrs).length) {
      output2.attrs = { ...mark.attrs };
    }
    return output2;
  });
  const attrs = { ...node.attrs };
  const output = {
    type: node.type.name,
    from,
    to
  };
  if (Object.keys(attrs).length) {
    output.attrs = attrs;
  }
  if (marks.length) {
    output.marks = marks;
  }
  if (node.content.childCount) {
    output.content = [];
    node.forEach((child, offset) => {
      var _a;
      (_a = output.content) == null ? void 0 : _a.push(getDebugJSON(child, startOffset + offset + increment));
    });
  }
  if (node.text) {
    output.text = node.text;
  }
  return output;
}

// src/helpers/getMarksBetween.ts
function getMarksBetween(from, to, doc) {
  const marks = [];
  if (from === to) {
    doc.resolve(from).marks().forEach((mark) => {
      const $pos = doc.resolve(from);
      const range = getMarkRange($pos, mark.type);
      if (!range) {
        return;
      }
      marks.push({
        mark,
        ...range
      });
    });
  } else {
    doc.nodesBetween(from, to, (node, pos) => {
      if (!node || (node == null ? void 0 : node.nodeSize) === void 0) {
        return;
      }
      marks.push(
        ...node.marks.map((mark) => ({
          from: pos,
          to: pos + node.nodeSize,
          mark
        }))
      );
    });
  }
  return marks;
}

// src/helpers/getNodeAtPosition.ts
var getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {
  const $pos = state.doc.resolve(pos);
  let currentDepth = maxDepth;
  let node = null;
  while (currentDepth > 0 && node === null) {
    const currentNode = $pos.node(currentDepth);
    if ((currentNode == null ? void 0 : currentNode.type.name) === typeOrName) {
      node = currentNode;
    } else {
      currentDepth -= 1;
    }
  }
  return [node, currentDepth];
};

// src/helpers/getSchemaTypeByName.ts
function getSchemaTypeByName(name, schema) {
  return schema.nodes[name] || schema.marks[name] || null;
}

// src/helpers/getSplittedAttributes.ts
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
  return Object.fromEntries(
    Object.entries(attributes).filter(([name]) => {
      const extensionAttribute = extensionAttributes.find((item) => {
        return item.type === typeName && item.name === name;
      });
      if (!extensionAttribute) {
        return false;
      }
      return extensionAttribute.attribute.keepOnSplit;
    })
  );
}

// src/helpers/getTextContentFromNodes.ts
var getTextContentFromNodes = ($from, maxMatch = 500) => {
  let textBefore = "";
  const sliceEndPos = $from.parentOffset;
  $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
    var _a, _b;
    const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {
      node,
      pos,
      parent,
      index
    })) || node.textContent || "%leaf%";
    textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
  });
  return textBefore;
};

// src/helpers/isMarkActive.ts
function isMarkActive(state, typeOrName, attributes = {}) {
  const { empty, ranges } = state.selection;
  const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
  if (empty) {
    return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
      if (!type) {
        return true;
      }
      return type.name === mark.type.name;
    }).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
  }
  let selectionRange = 0;
  const markRanges = [];
  ranges.forEach(({ $from, $to }) => {
    const from = $from.pos;
    const to = $to.pos;
    state.doc.nodesBetween(from, to, (node, pos) => {
      if (type && node.inlineContent && !node.type.allowsMarkType(type)) {
        return false;
      }
      if (!node.isText && !node.marks.length) {
        return;
      }
      const relativeFrom = Math.max(from, pos);
      const relativeTo = Math.min(to, pos + node.nodeSize);
      const range2 = relativeTo - relativeFrom;
      selectionRange += range2;
      markRanges.push(
        ...node.marks.map((mark) => ({
          mark,
          from: relativeFrom,
          to: relativeTo
        }))
      );
    });
  });
  if (selectionRange === 0) {
    return false;
  }
  const matchedRange = markRanges.filter((markRange) => {
    if (!type) {
      return true;
    }
    return type.name === markRange.mark.type.name;
  }).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
  const excludedRange = markRanges.filter((markRange) => {
    if (!type) {
      return true;
    }
    return markRange.mark.type !== type && markRange.mark.type.excludes(type);
  }).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
  const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;
  return range >= selectionRange;
}

// src/helpers/isActive.ts
function isActive(state, name, attributes = {}) {
  if (!name) {
    return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);
  }
  const schemaType = getSchemaTypeNameByName(name, state.schema);
  if (schemaType === "node") {
    return isNodeActive(state, name, attributes);
  }
  if (schemaType === "mark") {
    return isMarkActive(state, name, attributes);
  }
  return false;
}

// src/helpers/isAtEndOfNode.ts
var isAtEndOfNode = (state, nodeType) => {
  const { $from, $to, $anchor } = state.selection;
  if (nodeType) {
    const parentNode = findParentNode((node) => node.type.name === nodeType)(state.selection);
    if (!parentNode) {
      return false;
    }
    const $parentPos = state.doc.resolve(parentNode.pos + 1);
    if ($anchor.pos + 1 === $parentPos.end()) {
      return true;
    }
    return false;
  }
  if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {
    return false;
  }
  return true;
};

// src/helpers/isAtStartOfNode.ts
var isAtStartOfNode = (state) => {
  const { $from, $to } = state.selection;
  if ($from.parentOffset > 0 || $from.pos !== $to.pos) {
    return false;
  }
  return true;
};

// src/helpers/isExtensionRulesEnabled.ts
function isExtensionRulesEnabled(extension, enabled) {
  if (Array.isArray(enabled)) {
    return enabled.some((enabledExtension) => {
      const name = typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name;
      return name === extension.name;
    });
  }
  return enabled;
}

// src/helpers/isList.ts
function isList(name, extensions) {
  const { nodeExtensions } = splitExtensions(extensions);
  const extension = nodeExtensions.find((item) => item.name === name);
  if (!extension) {
    return false;
  }
  const context = {
    name: extension.name,
    options: extension.options,
    storage: extension.storage
  };
  const group = callOrReturn(getExtensionField(extension, "group", context));
  if (typeof group !== "string") {
    return false;
  }
  return group.split(" ").includes("list");
}

// src/helpers/isNodeEmpty.ts
function isNodeEmpty(node, {
  checkChildren = true,
  ignoreWhitespace = false
} = {}) {
  var _a;
  if (ignoreWhitespace) {
    if (node.type.name === "hardBreak") {
      return true;
    }
    if (node.isText) {
      return /^\s*$/m.test((_a = node.text) != null ? _a : "");
    }
  }
  if (node.isText) {
    return !node.text;
  }
  if (node.isAtom || node.isLeaf) {
    return false;
  }
  if (node.content.childCount === 0) {
    return true;
  }
  if (checkChildren) {
    let isContentEmpty = true;
    node.content.forEach((childNode) => {
      if (isContentEmpty === false) {
        return;
      }
      if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {
        isContentEmpty = false;
      }
    });
    return isContentEmpty;
  }
  return false;
}

// src/helpers/isNodeSelection.ts

function isNodeSelection(value) {
  return value instanceof _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection;
}

// src/helpers/MappablePosition.ts
var MappablePosition = class _MappablePosition {
  constructor(position) {
    this.position = position;
  }
  /**
   * Creates a MappablePosition from a JSON object.
   */
  static fromJSON(json) {
    return new _MappablePosition(json.position);
  }
  /**
   * Converts the MappablePosition to a JSON object.
   */
  toJSON() {
    return {
      position: this.position
    };
  }
};
function getUpdatedPosition(position, transaction) {
  const mapResult = transaction.mapping.mapResult(position.position);
  return {
    position: new MappablePosition(mapResult.pos),
    mapResult
  };
}
function createMappablePosition(position) {
  return new MappablePosition(position);
}

// src/helpers/posToDOMRect.ts
function posToDOMRect(view, from, to) {
  const minPos = 0;
  const maxPos = view.state.doc.content.size;
  const resolvedFrom = minMax(from, minPos, maxPos);
  const resolvedEnd = minMax(to, minPos, maxPos);
  const start = view.coordsAtPos(resolvedFrom);
  const end = view.coordsAtPos(resolvedEnd, -1);
  const top = Math.min(start.top, end.top);
  const bottom = Math.max(start.bottom, end.bottom);
  const left = Math.min(start.left, end.left);
  const right = Math.max(start.right, end.right);
  const width = right - left;
  const height = bottom - top;
  const x = left;
  const y = top;
  const data = {
    top,
    bottom,
    left,
    right,
    width,
    height,
    x,
    y
  };
  return {
    ...data,
    toJSON: () => data
  };
}

// src/helpers/rewriteUnknownContent.ts
function rewriteUnknownContentInner({
  json,
  validMarks,
  validNodes,
  options,
  rewrittenContent = []
}) {
  if (json.marks && Array.isArray(json.marks)) {
    json.marks = json.marks.filter((mark) => {
      const name = typeof mark === "string" ? mark : mark.type;
      if (validMarks.has(name)) {
        return true;
      }
      rewrittenContent.push({
        original: JSON.parse(JSON.stringify(mark)),
        unsupported: name
      });
      return false;
    });
  }
  if (json.content && Array.isArray(json.content)) {
    json.content = json.content.map(
      (value) => rewriteUnknownContentInner({
        json: value,
        validMarks,
        validNodes,
        options,
        rewrittenContent
      }).json
    ).filter((a) => a !== null && a !== void 0);
  }
  if (json.type && !validNodes.has(json.type)) {
    rewrittenContent.push({
      original: JSON.parse(JSON.stringify(json)),
      unsupported: json.type
    });
    if (json.content && Array.isArray(json.content) && (options == null ? void 0 : options.fallbackToParagraph) !== false) {
      json.type = "paragraph";
      return {
        json,
        rewrittenContent
      };
    }
    return {
      json: null,
      rewrittenContent
    };
  }
  return { json, rewrittenContent };
}
function rewriteUnknownContent(json, schema, options) {
  return rewriteUnknownContentInner({
    json,
    validNodes: new Set(Object.keys(schema.nodes)),
    validMarks: new Set(Object.keys(schema.marks)),
    options
  });
}

// src/commands/setMark.ts
function canSetMark(state, tr, newMarkType) {
  var _a;
  const { selection } = tr;
  let cursor = null;
  if (isTextSelection(selection)) {
    cursor = selection.$cursor;
  }
  if (cursor) {
    const currentMarks = (_a = state.storedMarks) != null ? _a : cursor.marks();
    const parentAllowsMarkType = cursor.parent.type.allowsMarkType(newMarkType);
    return parentAllowsMarkType && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));
  }
  const { ranges } = selection;
  return ranges.some(({ $from, $to }) => {
    let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
    state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
      if (someNodeSupportsMark) {
        return false;
      }
      if (node.isInline) {
        const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
        const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
        someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
      }
      return !someNodeSupportsMark;
    });
    return someNodeSupportsMark;
  });
}
var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
  const { selection } = tr;
  const { empty, ranges } = selection;
  const type = getMarkType(typeOrName, state.schema);
  if (dispatch) {
    if (empty) {
      const oldAttributes = getMarkAttributes(state, type);
      tr.addStoredMark(
        type.create({
          ...oldAttributes,
          ...attributes
        })
      );
    } else {
      ranges.forEach((range) => {
        const from = range.$from.pos;
        const to = range.$to.pos;
        state.doc.nodesBetween(from, to, (node, pos) => {
          const trimmedFrom = Math.max(pos, from);
          const trimmedTo = Math.min(pos + node.nodeSize, to);
          const someHasMark = node.marks.find((mark) => mark.type === type);
          if (someHasMark) {
            node.marks.forEach((mark) => {
              if (type === mark.type) {
                tr.addMark(
                  trimmedFrom,
                  trimmedTo,
                  type.create({
                    ...mark.attrs,
                    ...attributes
                  })
                );
              }
            });
          } else {
            tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
          }
        });
      });
    }
  }
  return canSetMark(state, tr, type);
};

// src/commands/setMeta.ts
var setMeta = (key, value) => ({ tr }) => {
  tr.setMeta(key, value);
  return true;
};

// src/commands/setNode.ts

var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
  const type = getNodeType(typeOrName, state.schema);
  let attributesToCopy;
  if (state.selection.$anchor.sameParent(state.selection.$head)) {
    attributesToCopy = state.selection.$anchor.parent.attrs;
  }
  if (!type.isTextblock) {
    console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');
    return false;
  }
  return chain().command(({ commands }) => {
    const canSetBlock = (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.setBlockType)(type, { ...attributesToCopy, ...attributes })(state);
    if (canSetBlock) {
      return true;
    }
    return commands.clearNodes();
  }).command(({ state: updatedState }) => {
    return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.setBlockType)(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
  }).run();
};

// src/commands/setNodeSelection.ts

var setNodeSelection = (position) => ({ tr, dispatch }) => {
  if (dispatch) {
    const { doc } = tr;
    const from = minMax(position, 0, doc.content.size);
    const selection = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(doc, from);
    tr.setSelection(selection);
  }
  return true;
};

// src/commands/setTextDirection.ts
var setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {
  const { selection } = state;
  let from;
  let to;
  if (typeof position === "number") {
    from = position;
    to = position;
  } else if (position && "from" in position && "to" in position) {
    from = position.from;
    to = position.to;
  } else {
    from = selection.from;
    to = selection.to;
  }
  if (dispatch) {
    tr.doc.nodesBetween(from, to, (node, pos) => {
      if (node.isText) {
        return;
      }
      tr.setNodeMarkup(pos, void 0, {
        ...node.attrs,
        dir: direction
      });
    });
  }
  return true;
};

// src/commands/setTextSelection.ts

var setTextSelection = (position) => ({ tr, dispatch }) => {
  if (dispatch) {
    const { doc } = tr;
    const { from, to } = typeof position === "number" ? { from: position, to: position } : position;
    const minPos = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.atStart(doc).from;
    const maxPos = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.atEnd(doc).to;
    const resolvedFrom = minMax(from, minPos, maxPos);
    const resolvedEnd = minMax(to, minPos, maxPos);
    const selection = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(doc, resolvedFrom, resolvedEnd);
    tr.setSelection(selection);
  }
  return true;
};

// src/commands/sinkListItem.ts

var sinkListItem = (typeOrName) => ({ state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  return (0,_tiptap_pm_schema_list__WEBPACK_IMPORTED_MODULE_4__.sinkListItem)(type)(state, dispatch);
};

// src/commands/splitBlock.ts


function ensureMarks(state, splittableMarks) {
  const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
  if (marks) {
    const filteredMarks = marks.filter((mark) => splittableMarks == null ? void 0 : splittableMarks.includes(mark.type.name));
    state.tr.ensureMarks(filteredMarks);
  }
}
var splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
  const { selection, doc } = tr;
  const { $from, $to } = selection;
  const extensionAttributes = editor.extensionManager.attributes;
  const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
  if (selection instanceof _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection && selection.node.isBlock) {
    if (!$from.parentOffset || !(0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(doc, $from.pos)) {
      return false;
    }
    if (dispatch) {
      if (keepMarks) {
        ensureMarks(state, editor.extensionManager.splittableMarks);
      }
      tr.split($from.pos).scrollIntoView();
    }
    return true;
  }
  if (!$from.parent.isBlock) {
    return false;
  }
  const atEnd = $to.parentOffset === $to.parent.content.size;
  const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
  let types = atEnd && deflt ? [
    {
      type: deflt,
      attrs: newAttributes
    }
  ] : void 0;
  let can = (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, types);
  if (!types && !can && (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
    can = true;
    types = deflt ? [
      {
        type: deflt,
        attrs: newAttributes
      }
    ] : void 0;
  }
  if (dispatch) {
    if (can) {
      if (selection instanceof _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection) {
        tr.deleteSelection();
      }
      tr.split(tr.mapping.map($from.pos), 1, types);
      if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
        const first2 = tr.mapping.map($from.before());
        const $first = tr.doc.resolve(first2);
        if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
          tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
        }
      }
    }
    if (keepMarks) {
      ensureMarks(state, editor.extensionManager.splittableMarks);
    }
    tr.scrollIntoView();
  }
  return can;
};

// src/commands/splitListItem.ts



var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
  var _a;
  const type = getNodeType(typeOrName, state.schema);
  const { $from, $to } = state.selection;
  const node = state.selection.node;
  if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
    return false;
  }
  const grandParent = $from.node(-1);
  if (grandParent.type !== type) {
    return false;
  }
  const extensionAttributes = editor.extensionManager.attributes;
  if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
    if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {
      return false;
    }
    if (dispatch) {
      let wrap = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.empty;
      const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
      for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
        wrap = _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.from($from.node(d).copy(wrap));
      }
      const depthAfter = (
        // eslint-disable-next-line no-nested-ternary
        $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3
      );
      const newNextTypeAttributes2 = {
        ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
        ...overrideAttrs
      };
      const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
      wrap = wrap.append(_tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.from(type.createAndFill(null, nextType2) || void 0));
      const start = $from.before($from.depth - (depthBefore - 1));
      tr.replace(start, $from.after(-depthAfter), new _tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Slice(wrap, 4 - depthBefore, 0));
      let sel = -1;
      tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
        if (sel > -1) {
          return false;
        }
        if (n.isTextblock && n.content.size === 0) {
          sel = pos + 1;
        }
      });
      if (sel > -1) {
        tr.setSelection(_tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.near(tr.doc.resolve(sel)));
      }
      tr.scrollIntoView();
    }
    return true;
  }
  const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
  const newTypeAttributes = {
    ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
    ...overrideAttrs
  };
  const newNextTypeAttributes = {
    ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
    ...overrideAttrs
  };
  tr.delete($from.pos, $to.pos);
  const types = nextType ? [
    { type, attrs: newTypeAttributes },
    { type: nextType, attrs: newNextTypeAttributes }
  ] : [{ type, attrs: newTypeAttributes }];
  if (!(0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, $from.pos, 2)) {
    return false;
  }
  if (dispatch) {
    const { selection, storedMarks } = state;
    const { splittableMarks } = editor.extensionManager;
    const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
    tr.split($from.pos, 2, types).scrollIntoView();
    if (!marks || !dispatch) {
      return true;
    }
    const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
    tr.ensureMarks(filteredMarks);
  }
  return true;
};

// src/commands/toggleList.ts

var joinListBackwards = (tr, listType) => {
  const list = findParentNode((node) => node.type === listType)(tr.selection);
  if (!list) {
    return true;
  }
  const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
  if (before === void 0) {
    return true;
  }
  const nodeBefore = tr.doc.nodeAt(before);
  const canJoinBackwards = list.node.type === (nodeBefore == null ? void 0 : nodeBefore.type) && (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, list.pos);
  if (!canJoinBackwards) {
    return true;
  }
  tr.join(list.pos);
  return true;
};
var joinListForwards = (tr, listType) => {
  const list = findParentNode((node) => node.type === listType)(tr.selection);
  if (!list) {
    return true;
  }
  const after = tr.doc.resolve(list.start).after(list.depth);
  if (after === void 0) {
    return true;
  }
  const nodeAfter = tr.doc.nodeAt(after);
  const canJoinForwards = list.node.type === (nodeAfter == null ? void 0 : nodeAfter.type) && (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, after);
  if (!canJoinForwards) {
    return true;
  }
  tr.join(after);
  return true;
};
var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
  const { extensions, splittableMarks } = editor.extensionManager;
  const listType = getNodeType(listTypeOrName, state.schema);
  const itemType = getNodeType(itemTypeOrName, state.schema);
  const { selection, storedMarks } = state;
  const { $from, $to } = selection;
  const range = $from.blockRange($to);
  const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
  if (!range) {
    return false;
  }
  const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
  if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
    if (parentList.node.type === listType) {
      return commands.liftListItem(itemType);
    }
    if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {
      return chain().command(() => {
        tr.setNodeMarkup(parentList.pos, listType);
        return true;
      }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
    }
  }
  if (!keepMarks || !marks || !dispatch) {
    return chain().command(() => {
      const canWrapInList = can().wrapInList(listType, attributes);
      if (canWrapInList) {
        return true;
      }
      return commands.clearNodes();
    }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
  }
  return chain().command(() => {
    const canWrapInList = can().wrapInList(listType, attributes);
    const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
    tr.ensureMarks(filteredMarks);
    if (canWrapInList) {
      return true;
    }
    return commands.clearNodes();
  }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
};

// src/commands/toggleMark.ts
var toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {
  const { extendEmptyMarkRange = false } = options;
  const type = getMarkType(typeOrName, state.schema);
  const isActive2 = isMarkActive(state, type, attributes);
  if (isActive2) {
    return commands.unsetMark(type, { extendEmptyMarkRange });
  }
  return commands.setMark(type, attributes);
};

// src/commands/toggleNode.ts
var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {
  const type = getNodeType(typeOrName, state.schema);
  const toggleType = getNodeType(toggleTypeOrName, state.schema);
  const isActive2 = isNodeActive(state, type, attributes);
  let attributesToCopy;
  if (state.selection.$anchor.sameParent(state.selection.$head)) {
    attributesToCopy = state.selection.$anchor.parent.attrs;
  }
  if (isActive2) {
    return commands.setNode(toggleType, attributesToCopy);
  }
  return commands.setNode(type, { ...attributesToCopy, ...attributes });
};

// src/commands/toggleWrap.ts
var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {
  const type = getNodeType(typeOrName, state.schema);
  const isActive2 = isNodeActive(state, type, attributes);
  if (isActive2) {
    return commands.lift(type);
  }
  return commands.wrapIn(type, attributes);
};

// src/commands/undoInputRule.ts
var undoInputRule = () => ({ state, dispatch }) => {
  const plugins = state.plugins;
  for (let i = 0; i < plugins.length; i += 1) {
    const plugin = plugins[i];
    let undoable;
    if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
      if (dispatch) {
        const tr = state.tr;
        const toUndo = undoable.transform;
        for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {
          tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
        }
        if (undoable.text) {
          const marks = tr.doc.resolve(undoable.from).marks();
          tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
        } else {
          tr.delete(undoable.from, undoable.to);
        }
      }
      return true;
    }
  }
  return false;
};

// src/commands/unsetAllMarks.ts
var unsetAllMarks = () => ({ tr, dispatch }) => {
  const { selection } = tr;
  const { empty, ranges } = selection;
  if (empty) {
    return true;
  }
  if (dispatch) {
    ranges.forEach((range) => {
      tr.removeMark(range.$from.pos, range.$to.pos);
    });
  }
  return true;
};

// src/commands/unsetMark.ts
var unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
  var _a;
  const { extendEmptyMarkRange = false } = options;
  const { selection } = tr;
  const type = getMarkType(typeOrName, state.schema);
  const { $from, empty, ranges } = selection;
  if (!dispatch) {
    return true;
  }
  if (empty && extendEmptyMarkRange) {
    let { from, to } = selection;
    const attrs = (_a = $from.marks().find((mark) => mark.type === type)) == null ? void 0 : _a.attrs;
    const range = getMarkRange($from, type, attrs);
    if (range) {
      from = range.from;
      to = range.to;
    }
    tr.removeMark(from, to, type);
  } else {
    ranges.forEach((range) => {
      tr.removeMark(range.$from.pos, range.$to.pos, type);
    });
  }
  tr.removeStoredMark(type);
  return true;
};

// src/commands/unsetTextDirection.ts
var unsetTextDirection = (position) => ({ tr, state, dispatch }) => {
  const { selection } = state;
  let from;
  let to;
  if (typeof position === "number") {
    from = position;
    to = position;
  } else if (position && "from" in position && "to" in position) {
    from = position.from;
    to = position.to;
  } else {
    from = selection.from;
    to = selection.to;
  }
  if (dispatch) {
    tr.doc.nodesBetween(from, to, (node, pos) => {
      if (node.isText) {
        return;
      }
      const newAttrs = { ...node.attrs };
      delete newAttrs.dir;
      tr.setNodeMarkup(pos, void 0, newAttrs);
    });
  }
  return true;
};

// src/commands/updateAttributes.ts
var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
  let nodeType = null;
  let markType = null;
  const schemaType = getSchemaTypeNameByName(
    typeof typeOrName === "string" ? typeOrName : typeOrName.name,
    state.schema
  );
  if (!schemaType) {
    return false;
  }
  if (schemaType === "node") {
    nodeType = getNodeType(typeOrName, state.schema);
  }
  if (schemaType === "mark") {
    markType = getMarkType(typeOrName, state.schema);
  }
  let canUpdate = false;
  tr.selection.ranges.forEach((range) => {
    const from = range.$from.pos;
    const to = range.$to.pos;
    let lastPos;
    let lastNode;
    let trimmedFrom;
    let trimmedTo;
    if (tr.selection.empty) {
      state.doc.nodesBetween(from, to, (node, pos) => {
        if (nodeType && nodeType === node.type) {
          canUpdate = true;
          trimmedFrom = Math.max(pos, from);
          trimmedTo = Math.min(pos + node.nodeSize, to);
          lastPos = pos;
          lastNode = node;
        }
      });
    } else {
      state.doc.nodesBetween(from, to, (node, pos) => {
        if (pos < from && nodeType && nodeType === node.type) {
          canUpdate = true;
          trimmedFrom = Math.max(pos, from);
          trimmedTo = Math.min(pos + node.nodeSize, to);
          lastPos = pos;
          lastNode = node;
        }
        if (pos >= from && pos <= to) {
          if (nodeType && nodeType === node.type) {
            canUpdate = true;
            if (dispatch) {
              tr.setNodeMarkup(pos, void 0, {
                ...node.attrs,
                ...attributes
              });
            }
          }
          if (markType && node.marks.length) {
            node.marks.forEach((mark) => {
              if (markType === mark.type) {
                canUpdate = true;
                if (dispatch) {
                  const trimmedFrom2 = Math.max(pos, from);
                  const trimmedTo2 = Math.min(pos + node.nodeSize, to);
                  tr.addMark(
                    trimmedFrom2,
                    trimmedTo2,
                    markType.create({
                      ...mark.attrs,
                      ...attributes
                    })
                  );
                }
              }
            });
          }
        }
      });
    }
    if (lastNode) {
      if (lastPos !== void 0 && dispatch) {
        tr.setNodeMarkup(lastPos, void 0, {
          ...lastNode.attrs,
          ...attributes
        });
      }
      if (markType && lastNode.marks.length) {
        lastNode.marks.forEach((mark) => {
          if (markType === mark.type && dispatch) {
            tr.addMark(
              trimmedFrom,
              trimmedTo,
              markType.create({
                ...mark.attrs,
                ...attributes
              })
            );
          }
        });
      }
    }
  });
  return canUpdate;
};

// src/commands/wrapIn.ts

var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  return (0,_tiptap_pm_commands__WEBPACK_IMPORTED_MODULE_1__.wrapIn)(type, attributes)(state, dispatch);
};

// src/commands/wrapInList.ts

var wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
  const type = getNodeType(typeOrName, state.schema);
  return (0,_tiptap_pm_schema_list__WEBPACK_IMPORTED_MODULE_4__.wrapInList)(type, attributes)(state, dispatch);
};

// src/Editor.ts



// src/EventEmitter.ts
var EventEmitter = class {
  constructor() {
    this.callbacks = {};
  }
  on(event, fn) {
    if (!this.callbacks[event]) {
      this.callbacks[event] = [];
    }
    this.callbacks[event].push(fn);
    return this;
  }
  emit(event, ...args) {
    const callbacks = this.callbacks[event];
    if (callbacks) {
      callbacks.forEach((callback) => callback.apply(this, args));
    }
    return this;
  }
  off(event, fn) {
    const callbacks = this.callbacks[event];
    if (callbacks) {
      if (fn) {
        this.callbacks[event] = callbacks.filter((callback) => callback !== fn);
      } else {
        delete this.callbacks[event];
      }
    }
    return this;
  }
  once(event, fn) {
    const onceFn = (...args) => {
      this.off(event, onceFn);
      fn.apply(this, args);
    };
    return this.on(event, onceFn);
  }
  removeAllListeners() {
    this.callbacks = {};
  }
};

// src/ExtensionManager.ts


// src/InputRule.ts


var InputRule = class {
  constructor(config) {
    var _a;
    this.find = config.find;
    this.handler = config.handler;
    this.undoable = (_a = config.undoable) != null ? _a : true;
  }
};
var inputRuleMatcherHandler = (text, find) => {
  if (isRegExp(find)) {
    return find.exec(text);
  }
  const inputRuleMatch = find(text);
  if (!inputRuleMatch) {
    return null;
  }
  const result = [inputRuleMatch.text];
  result.index = inputRuleMatch.index;
  result.input = text;
  result.data = inputRuleMatch.data;
  if (inputRuleMatch.replaceWith) {
    if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {
      console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".');
    }
    result.push(inputRuleMatch.replaceWith);
  }
  return result;
};
function run(config) {
  var _a;
  const { editor, from, to, text, rules, plugin } = config;
  const { view } = editor;
  if (view.composing) {
    return false;
  }
  const $from = view.state.doc.resolve(from);
  if (
    // check for code node
    $from.parent.type.spec.code || // check for code mark
    !!((_a = $from.nodeBefore || $from.nodeAfter) == null ? void 0 : _a.marks.find((mark) => mark.type.spec.code))
  ) {
    return false;
  }
  let matched = false;
  const textBefore = getTextContentFromNodes($from) + text;
  rules.forEach((rule) => {
    if (matched) {
      return;
    }
    const match = inputRuleMatcherHandler(textBefore, rule.find);
    if (!match) {
      return;
    }
    const tr = view.state.tr;
    const state = createChainableState({
      state: view.state,
      transaction: tr
    });
    const range = {
      from: from - (match[0].length - text.length),
      to
    };
    const { commands, chain, can } = new CommandManager({
      editor,
      state
    });
    const handler = rule.handler({
      state,
      range,
      match,
      commands,
      chain,
      can
    });
    if (handler === null || !tr.steps.length) {
      return;
    }
    if (rule.undoable) {
      tr.setMeta(plugin, {
        transform: tr,
        from,
        to,
        text
      });
    }
    view.dispatch(tr);
    matched = true;
  });
  return matched;
}
function inputRulesPlugin(props) {
  const { editor, rules } = props;
  const plugin = new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
    state: {
      init() {
        return null;
      },
      apply(tr, prev, state) {
        const stored = tr.getMeta(plugin);
        if (stored) {
          return stored;
        }
        const simulatedInputMeta = tr.getMeta("applyInputRules");
        const isSimulatedInput = !!simulatedInputMeta;
        if (isSimulatedInput) {
          setTimeout(() => {
            let { text } = simulatedInputMeta;
            if (typeof text === "string") {
              text = text;
            } else {
              text = getHTMLFromFragment(_tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.from(text), state.schema);
            }
            const { from } = simulatedInputMeta;
            const to = from + text.length;
            run({
              editor,
              from,
              to,
              text,
              rules,
              plugin
            });
          });
        }
        return tr.selectionSet || tr.docChanged ? null : prev;
      }
    },
    props: {
      handleTextInput(view, from, to, text) {
        return run({
          editor,
          from,
          to,
          text,
          rules,
          plugin
        });
      },
      handleDOMEvents: {
        compositionend: (view) => {
          setTimeout(() => {
            const { $cursor } = view.state.selection;
            if ($cursor) {
              run({
                editor,
                from: $cursor.pos,
                to: $cursor.pos,
                text: "",
                rules,
                plugin
              });
            }
          });
          return false;
        }
      },
      // add support for input rules to trigger on enter
      // this is useful for example for code blocks
      handleKeyDown(view, event) {
        if (event.key !== "Enter") {
          return false;
        }
        const { $cursor } = view.state.selection;
        if ($cursor) {
          return run({
            editor,
            from: $cursor.pos,
            to: $cursor.pos,
            text: "\n",
            rules,
            plugin
          });
        }
        return false;
      }
    },
    // @ts-ignore
    isInputRules: true
  });
  return plugin;
}

// src/utilities/isPlainObject.ts
function getType(value) {
  return Object.prototype.toString.call(value).slice(8, -1);
}
function isPlainObject(value) {
  if (getType(value) !== "Object") {
    return false;
  }
  return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
}

// src/utilities/mergeDeep.ts
function mergeDeep(target, source) {
  const output = { ...target };
  if (isPlainObject(target) && isPlainObject(source)) {
    Object.keys(source).forEach((key) => {
      if (isPlainObject(source[key]) && isPlainObject(target[key])) {
        output[key] = mergeDeep(target[key], source[key]);
      } else {
        output[key] = source[key];
      }
    });
  }
  return output;
}

// src/Extendable.ts
var Extendable = class {
  constructor(config = {}) {
    this.type = "extendable";
    this.parent = null;
    this.child = null;
    this.name = "";
    this.config = {
      name: this.name
    };
    this.config = {
      ...this.config,
      ...config
    };
    this.name = this.config.name;
  }
  get options() {
    return {
      ...callOrReturn(
        getExtensionField(this, "addOptions", {
          name: this.name
        })
      ) || {}
    };
  }
  get storage() {
    return {
      ...callOrReturn(
        getExtensionField(this, "addStorage", {
          name: this.name,
          options: this.options
        })
      ) || {}
    };
  }
  configure(options = {}) {
    const extension = this.extend({
      ...this.config,
      addOptions: () => {
        return mergeDeep(this.options, options);
      }
    });
    extension.name = this.name;
    extension.parent = this.parent;
    return extension;
  }
  extend(extendedConfig = {}) {
    const extension = new this.constructor({ ...this.config, ...extendedConfig });
    extension.parent = this;
    this.child = extension;
    extension.name = "name" in extendedConfig ? extendedConfig.name : extension.parent.name;
    return extension;
  }
};

// src/Mark.ts
var Mark = class _Mark extends Extendable {
  constructor() {
    super(...arguments);
    this.type = "mark";
  }
  /**
   * Create a new Mark instance
   * @param config - Mark configuration object or a function that returns a configuration object
   */
  static create(config = {}) {
    const resolvedConfig = typeof config === "function" ? config() : config;
    return new _Mark(resolvedConfig);
  }
  static handleExit({ editor, mark }) {
    const { tr } = editor.state;
    const currentPos = editor.state.selection.$from;
    const isAtEnd = currentPos.pos === currentPos.end();
    if (isAtEnd) {
      const currentMarks = currentPos.marks();
      const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
      if (!isInMark) {
        return false;
      }
      const removeMark = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
      if (removeMark) {
        tr.removeStoredMark(removeMark);
      }
      tr.insertText(" ", currentPos.pos);
      editor.view.dispatch(tr);
      return true;
    }
    return false;
  }
  configure(options) {
    return super.configure(options);
  }
  extend(extendedConfig) {
    const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
    return super.extend(resolvedConfig);
  }
};

// src/PasteRule.ts



// src/utilities/isNumber.ts
function isNumber(value) {
  return typeof value === "number";
}

// src/PasteRule.ts
var PasteRule = class {
  constructor(config) {
    this.find = config.find;
    this.handler = config.handler;
  }
};
var pasteRuleMatcherHandler = (text, find, event) => {
  if (isRegExp(find)) {
    return [...text.matchAll(find)];
  }
  const matches = find(text, event);
  if (!matches) {
    return [];
  }
  return matches.map((pasteRuleMatch) => {
    const result = [pasteRuleMatch.text];
    result.index = pasteRuleMatch.index;
    result.input = text;
    result.data = pasteRuleMatch.data;
    if (pasteRuleMatch.replaceWith) {
      if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {
        console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".');
      }
      result.push(pasteRuleMatch.replaceWith);
    }
    return result;
  });
};
function run2(config) {
  const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;
  const { commands, chain, can } = new CommandManager({
    editor,
    state
  });
  const handlers = [];
  state.doc.nodesBetween(from, to, (node, pos) => {
    var _a, _b, _c, _d, _e;
    if (((_b = (_a = node.type) == null ? void 0 : _a.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) {
      return;
    }
    const contentSize = (_e = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e : 0;
    const resolvedFrom = Math.max(from, pos);
    const resolvedTo = Math.min(to, pos + contentSize);
    if (resolvedFrom >= resolvedTo) {
      return;
    }
    const textToMatch = node.isText ? node.text || "" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "\uFFFC");
    const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
    matches.forEach((match) => {
      if (match.index === void 0) {
        return;
      }
      const start = resolvedFrom + match.index + 1;
      const end = start + match[0].length;
      const range = {
        from: state.tr.mapping.map(start),
        to: state.tr.mapping.map(end)
      };
      const handler = rule.handler({
        state,
        range,
        match,
        commands,
        chain,
        can,
        pasteEvent,
        dropEvent
      });
      handlers.push(handler);
    });
  });
  const success = handlers.every((handler) => handler !== null);
  return success;
}
var tiptapDragFromOtherEditor = null;
var createClipboardPasteEvent = (text) => {
  var _a;
  const event = new ClipboardEvent("paste", {
    clipboardData: new DataTransfer()
  });
  (_a = event.clipboardData) == null ? void 0 : _a.setData("text/html", text);
  return event;
};
function pasteRulesPlugin(props) {
  const { editor, rules } = props;
  let dragSourceElement = null;
  let isPastedFromProseMirror = false;
  let isDroppedFromProseMirror = false;
  let pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
  let dropEvent;
  try {
    dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
  } catch {
    dropEvent = null;
  }
  const processEvent = ({
    state,
    from,
    to,
    rule,
    pasteEvt
  }) => {
    const tr = state.tr;
    const chainableState = createChainableState({
      state,
      transaction: tr
    });
    const handler = run2({
      editor,
      state: chainableState,
      from: Math.max(from - 1, 0),
      to: to.b - 1,
      rule,
      pasteEvent: pasteEvt,
      dropEvent
    });
    if (!handler || !tr.steps.length) {
      return;
    }
    try {
      dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
    } catch {
      dropEvent = null;
    }
    pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
    return tr;
  };
  const plugins = rules.map((rule) => {
    return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
      // we register a global drag handler to track the current drag source element
      view(view) {
        const handleDragstart = (event) => {
          var _a;
          dragSourceElement = ((_a = view.dom.parentElement) == null ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;
          if (dragSourceElement) {
            tiptapDragFromOtherEditor = editor;
          }
        };
        const handleDragend = () => {
          if (tiptapDragFromOtherEditor) {
            tiptapDragFromOtherEditor = null;
          }
        };
        window.addEventListener("dragstart", handleDragstart);
        window.addEventListener("dragend", handleDragend);
        return {
          destroy() {
            window.removeEventListener("dragstart", handleDragstart);
            window.removeEventListener("dragend", handleDragend);
          }
        };
      },
      props: {
        handleDOMEvents: {
          drop: (view, event) => {
            isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
            dropEvent = event;
            if (!isDroppedFromProseMirror) {
              const dragFromOtherEditor = tiptapDragFromOtherEditor;
              if (dragFromOtherEditor == null ? void 0 : dragFromOtherEditor.isEditable) {
                setTimeout(() => {
                  const selection = dragFromOtherEditor.state.selection;
                  if (selection) {
                    dragFromOtherEditor.commands.deleteRange({ from: selection.from, to: selection.to });
                  }
                }, 10);
              }
            }
            return false;
          },
          paste: (_view, event) => {
            var _a;
            const html = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/html");
            pasteEvent = event;
            isPastedFromProseMirror = !!(html == null ? void 0 : html.includes("data-pm-slice"));
            return false;
          }
        }
      },
      appendTransaction: (transactions, oldState, state) => {
        const transaction = transactions[0];
        const isPaste = transaction.getMeta("uiEvent") === "paste" && !isPastedFromProseMirror;
        const isDrop = transaction.getMeta("uiEvent") === "drop" && !isDroppedFromProseMirror;
        const simulatedPasteMeta = transaction.getMeta("applyPasteRules");
        const isSimulatedPaste = !!simulatedPasteMeta;
        if (!isPaste && !isDrop && !isSimulatedPaste) {
          return;
        }
        if (isSimulatedPaste) {
          let { text } = simulatedPasteMeta;
          if (typeof text === "string") {
            text = text;
          } else {
            text = getHTMLFromFragment(_tiptap_pm_model__WEBPACK_IMPORTED_MODULE_3__.Fragment.from(text), state.schema);
          }
          const { from: from2 } = simulatedPasteMeta;
          const to2 = from2 + text.length;
          const pasteEvt = createClipboardPasteEvent(text);
          return processEvent({
            rule,
            state,
            from: from2,
            to: { b: to2 },
            pasteEvt
          });
        }
        const from = oldState.doc.content.findDiffStart(state.doc.content);
        const to = oldState.doc.content.findDiffEnd(state.doc.content);
        if (!isNumber(from) || !to || from === to.b) {
          return;
        }
        return processEvent({
          rule,
          state,
          from,
          to,
          pasteEvt: pasteEvent
        });
      }
    });
  });
  return plugins;
}

// src/ExtensionManager.ts
var ExtensionManager = class {
  constructor(extensions, editor) {
    this.splittableMarks = [];
    this.editor = editor;
    this.baseExtensions = extensions;
    this.extensions = resolveExtensions(extensions);
    this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
    this.setupExtensions();
  }
  /**
   * Get all commands from the extensions.
   * @returns An object with all commands where the key is the command name and the value is the command function
   */
  get commands() {
    return this.extensions.reduce((commands, extension) => {
      const context = {
        name: extension.name,
        options: extension.options,
        storage: this.editor.extensionStorage[extension.name],
        editor: this.editor,
        type: getSchemaTypeByName(extension.name, this.schema)
      };
      const addCommands = getExtensionField(extension, "addCommands", context);
      if (!addCommands) {
        return commands;
      }
      return {
        ...commands,
        ...addCommands()
      };
    }, {});
  }
  /**
   * Get all registered Prosemirror plugins from the extensions.
   * @returns An array of Prosemirror plugins
   */
  get plugins() {
    const { editor } = this;
    const extensions = sortExtensions([...this.extensions].reverse());
    const allPlugins = extensions.flatMap((extension) => {
      const context = {
        name: extension.name,
        options: extension.options,
        storage: this.editor.extensionStorage[extension.name],
        editor,
        type: getSchemaTypeByName(extension.name, this.schema)
      };
      const plugins = [];
      const addKeyboardShortcuts = getExtensionField(
        extension,
        "addKeyboardShortcuts",
        context
      );
      let defaultBindings = {};
      if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) {
        defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });
      }
      if (addKeyboardShortcuts) {
        const bindings = Object.fromEntries(
          Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {
            return [shortcut, () => method({ editor })];
          })
        );
        defaultBindings = { ...defaultBindings, ...bindings };
      }
      const keyMapPlugin = (0,_tiptap_pm_keymap__WEBPACK_IMPORTED_MODULE_6__.keymap)(defaultBindings);
      plugins.push(keyMapPlugin);
      const addInputRules = getExtensionField(extension, "addInputRules", context);
      if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
        const rules = addInputRules();
        if (rules && rules.length) {
          const inputResult = inputRulesPlugin({
            editor,
            rules
          });
          const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];
          plugins.push(...inputPlugins);
        }
      }
      const addPasteRules = getExtensionField(extension, "addPasteRules", context);
      if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
        const rules = addPasteRules();
        if (rules && rules.length) {
          const pasteRules = pasteRulesPlugin({ editor, rules });
          plugins.push(...pasteRules);
        }
      }
      const addProseMirrorPlugins = getExtensionField(
        extension,
        "addProseMirrorPlugins",
        context
      );
      if (addProseMirrorPlugins) {
        const proseMirrorPlugins = addProseMirrorPlugins();
        plugins.push(...proseMirrorPlugins);
      }
      return plugins;
    });
    return allPlugins;
  }
  /**
   * Get all attributes from the extensions.
   * @returns An array of attributes
   */
  get attributes() {
    return getAttributesFromExtensions(this.extensions);
  }
  /**
   * Get all node views from the extensions.
   * @returns An object with all node views where the key is the node name and the value is the node view function
   */
  get nodeViews() {
    const { editor } = this;
    const { nodeExtensions } = splitExtensions(this.extensions);
    return Object.fromEntries(
      nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
        const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
        const context = {
          name: extension.name,
          options: extension.options,
          storage: this.editor.extensionStorage[extension.name],
          editor,
          type: getNodeType(extension.name, this.schema)
        };
        const addNodeView = getExtensionField(extension, "addNodeView", context);
        if (!addNodeView) {
          return [];
        }
        const nodeViewResult = addNodeView();
        if (!nodeViewResult) {
          return [];
        }
        const nodeview = (node, view, getPos, decorations, innerDecorations) => {
          const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);
          return nodeViewResult({
            // pass-through
            node,
            view,
            getPos,
            decorations,
            innerDecorations,
            // tiptap-specific
            editor,
            extension,
            HTMLAttributes
          });
        };
        return [extension.name, nodeview];
      })
    );
  }
  /**
   * Get the composed dispatchTransaction function from all extensions.
   * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
   * @returns A composed dispatch function
   */
  dispatchTransaction(baseDispatch) {
    const { editor } = this;
    const extensions = sortExtensions([...this.extensions].reverse());
    return extensions.reduceRight((next, extension) => {
      const context = {
        name: extension.name,
        options: extension.options,
        storage: this.editor.extensionStorage[extension.name],
        editor,
        type: getSchemaTypeByName(extension.name, this.schema)
      };
      const dispatchTransaction = getExtensionField(
        extension,
        "dispatchTransaction",
        context
      );
      if (!dispatchTransaction) {
        return next;
      }
      return (transaction) => {
        dispatchTransaction.call(context, { transaction, next });
      };
    }, baseDispatch);
  }
  /**
   * Get the composed transformPastedHTML function from all extensions.
   * @param baseTransform The base transform function (e.g. from the editor props)
   * @returns A composed transform function that chains all extension transforms
   */
  transformPastedHTML(baseTransform) {
    const { editor } = this;
    const extensions = sortExtensions([...this.extensions]);
    return extensions.reduce(
      (transform, extension) => {
        const context = {
          name: extension.name,
          options: extension.options,
          storage: this.editor.extensionStorage[extension.name],
          editor,
          type: getSchemaTypeByName(extension.name, this.schema)
        };
        const extensionTransform = getExtensionField(
          extension,
          "transformPastedHTML",
          context
        );
        if (!extensionTransform) {
          return transform;
        }
        return (html, view) => {
          const transformedHtml = transform(html, view);
          return extensionTransform.call(context, transformedHtml);
        };
      },
      baseTransform || ((html) => html)
    );
  }
  get markViews() {
    const { editor } = this;
    const { markExtensions } = splitExtensions(this.extensions);
    return Object.fromEntries(
      markExtensions.filter((extension) => !!getExtensionField(extension, "addMarkView")).map((extension) => {
        const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
        const context = {
          name: extension.name,
          options: extension.options,
          storage: this.editor.extensionStorage[extension.name],
          editor,
          type: getMarkType(extension.name, this.schema)
        };
        const addMarkView = getExtensionField(extension, "addMarkView", context);
        if (!addMarkView) {
          return [];
        }
        const markView = (mark, view, inline) => {
          const HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);
          return addMarkView()({
            // pass-through
            mark,
            view,
            inline,
            // tiptap-specific
            editor,
            extension,
            HTMLAttributes,
            updateAttributes: (attrs) => {
              updateMarkViewAttributes(mark, editor, attrs);
            }
          });
        };
        return [extension.name, markView];
      })
    );
  }
  /**
   * Go through all extensions, create extension storages & setup marks
   * & bind editor event listener.
   */
  setupExtensions() {
    const extensions = this.extensions;
    this.editor.extensionStorage = Object.fromEntries(
      extensions.map((extension) => [extension.name, extension.storage])
    );
    extensions.forEach((extension) => {
      var _a;
      const context = {
        name: extension.name,
        options: extension.options,
        storage: this.editor.extensionStorage[extension.name],
        editor: this.editor,
        type: getSchemaTypeByName(extension.name, this.schema)
      };
      if (extension.type === "mark") {
        const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, "keepOnSplit", context))) != null ? _a : true;
        if (keepOnSplit) {
          this.splittableMarks.push(extension.name);
        }
      }
      const onBeforeCreate = getExtensionField(extension, "onBeforeCreate", context);
      const onCreate = getExtensionField(extension, "onCreate", context);
      const onUpdate = getExtensionField(extension, "onUpdate", context);
      const onSelectionUpdate = getExtensionField(
        extension,
        "onSelectionUpdate",
        context
      );
      const onTransaction = getExtensionField(extension, "onTransaction", context);
      const onFocus = getExtensionField(extension, "onFocus", context);
      const onBlur = getExtensionField(extension, "onBlur", context);
      const onDestroy = getExtensionField(extension, "onDestroy", context);
      if (onBeforeCreate) {
        this.editor.on("beforeCreate", onBeforeCreate);
      }
      if (onCreate) {
        this.editor.on("create", onCreate);
      }
      if (onUpdate) {
        this.editor.on("update", onUpdate);
      }
      if (onSelectionUpdate) {
        this.editor.on("selectionUpdate", onSelectionUpdate);
      }
      if (onTransaction) {
        this.editor.on("transaction", onTransaction);
      }
      if (onFocus) {
        this.editor.on("focus", onFocus);
      }
      if (onBlur) {
        this.editor.on("blur", onBlur);
      }
      if (onDestroy) {
        this.editor.on("destroy", onDestroy);
      }
    });
  }
};
ExtensionManager.resolve = resolveExtensions;
ExtensionManager.sort = sortExtensions;
ExtensionManager.flatten = flattenExtensions;

// src/extensions/index.ts
var extensions_exports = {};
__export(extensions_exports, {
  ClipboardTextSerializer: () => ClipboardTextSerializer,
  Commands: () => Commands,
  Delete: () => Delete,
  Drop: () => Drop,
  Editable: () => Editable,
  FocusEvents: () => FocusEvents,
  Keymap: () => Keymap,
  Paste: () => Paste,
  Tabindex: () => Tabindex,
  TextDirection: () => TextDirection,
  focusEventsPluginKey: () => focusEventsPluginKey
});

// src/extensions/clipboardTextSerializer.ts


// src/Extension.ts
var Extension = class _Extension extends Extendable {
  constructor() {
    super(...arguments);
    this.type = "extension";
  }
  /**
   * Create a new Extension instance
   * @param config - Extension configuration object or a function that returns a configuration object
   */
  static create(config = {}) {
    const resolvedConfig = typeof config === "function" ? config() : config;
    return new _Extension(resolvedConfig);
  }
  configure(options) {
    return super.configure(options);
  }
  extend(extendedConfig) {
    const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
    return super.extend(resolvedConfig);
  }
};

// src/extensions/clipboardTextSerializer.ts
var ClipboardTextSerializer = Extension.create({
  name: "clipboardTextSerializer",
  addOptions() {
    return {
      blockSeparator: void 0
    };
  },
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("clipboardTextSerializer"),
        props: {
          clipboardTextSerializer: () => {
            const { editor } = this;
            const { state, schema } = editor;
            const { doc, selection } = state;
            const { ranges } = selection;
            const from = Math.min(...ranges.map((range2) => range2.$from.pos));
            const to = Math.max(...ranges.map((range2) => range2.$to.pos));
            const textSerializers = getTextSerializersFromSchema(schema);
            const range = { from, to };
            return getTextBetween(doc, range, {
              ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
              textSerializers
            });
          }
        }
      })
    ];
  }
});

// src/extensions/commands.ts
var Commands = Extension.create({
  name: "commands",
  addCommands() {
    return {
      ...commands_exports
    };
  }
});

// src/extensions/delete.ts

var Delete = Extension.create({
  name: "delete",
  onUpdate({ transaction, appendedTransactions }) {
    var _a, _b, _c;
    const callback = () => {
      var _a2, _b2, _c2, _d;
      if ((_d = (_c2 = (_b2 = (_a2 = this.editor.options.coreExtensionOptions) == null ? void 0 : _a2.delete) == null ? void 0 : _b2.filterTransaction) == null ? void 0 : _c2.call(_b2, transaction)) != null ? _d : transaction.getMeta("y-sync$")) {
        return;
      }
      const nextTransaction = combineTransactionSteps(transaction.before, [transaction, ...appendedTransactions]);
      const changes = getChangedRanges(nextTransaction);
      changes.forEach((change) => {
        if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) {
          nextTransaction.before.nodesBetween(change.oldRange.from, change.oldRange.to, (node, from) => {
            const to = from + node.nodeSize - 2;
            const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;
            this.editor.emit("delete", {
              type: "node",
              node,
              from,
              to,
              newFrom: nextTransaction.mapping.map(from),
              newTo: nextTransaction.mapping.map(to),
              deletedRange: change.oldRange,
              newRange: change.newRange,
              partial: !isFullyWithinRange,
              editor: this.editor,
              transaction,
              combinedTransform: nextTransaction
            });
          });
        }
      });
      const mapping = nextTransaction.mapping;
      nextTransaction.steps.forEach((step, index) => {
        var _a3, _b3;
        if (step instanceof _tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.RemoveMarkStep) {
          const newStart = mapping.slice(index).map(step.from, -1);
          const newEnd = mapping.slice(index).map(step.to);
          const oldStart = mapping.invert().map(newStart, -1);
          const oldEnd = mapping.invert().map(newEnd);
          const foundBeforeMark = (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark));
          const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
          this.editor.emit("delete", {
            type: "mark",
            mark: step.mark,
            from: step.from,
            to: step.to,
            deletedRange: {
              from: oldStart,
              to: oldEnd
            },
            newRange: {
              from: newStart,
              to: newEnd
            },
            partial: Boolean(foundAfterMark || foundBeforeMark),
            editor: this.editor,
            transaction,
            combinedTransform: nextTransaction
          });
        }
      });
    };
    if ((_c = (_b = (_a = this.editor.options.coreExtensionOptions) == null ? void 0 : _a.delete) == null ? void 0 : _b.async) != null ? _c : true) {
      setTimeout(callback, 0);
    } else {
      callback();
    }
  }
});

// src/extensions/drop.ts

var Drop = Extension.create({
  name: "drop",
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("tiptapDrop"),
        props: {
          handleDrop: (_, e, slice, moved) => {
            this.editor.emit("drop", {
              editor: this.editor,
              event: e,
              slice,
              moved
            });
          }
        }
      })
    ];
  }
});

// src/extensions/editable.ts

var Editable = Extension.create({
  name: "editable",
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("editable"),
        props: {
          editable: () => this.editor.options.editable
        }
      })
    ];
  }
});

// src/extensions/focusEvents.ts

var focusEventsPluginKey = new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("focusEvents");
var FocusEvents = Extension.create({
  name: "focusEvents",
  addProseMirrorPlugins() {
    const { editor } = this;
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: focusEventsPluginKey,
        props: {
          handleDOMEvents: {
            focus: (view, event) => {
              editor.isFocused = true;
              const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
              view.dispatch(transaction);
              return false;
            },
            blur: (view, event) => {
              editor.isFocused = false;
              const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
              view.dispatch(transaction);
              return false;
            }
          }
        }
      })
    ];
  }
});

// src/extensions/keymap.ts

var Keymap = Extension.create({
  name: "keymap",
  addKeyboardShortcuts() {
    const handleBackspace = () => this.editor.commands.first(({ commands }) => [
      () => commands.undoInputRule(),
      // maybe convert first text block node to default node
      () => commands.command(({ tr }) => {
        const { selection, doc } = tr;
        const { empty, $anchor } = selection;
        const { pos, parent } = $anchor;
        const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
        const parentIsIsolating = $parentPos.parent.type.spec.isolating;
        const parentPos = $anchor.pos - $anchor.parentOffset;
        const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.atStart(doc).from === pos;
        if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") {
          return false;
        }
        return commands.clearNodes();
      }),
      () => commands.deleteSelection(),
      () => commands.joinBackward(),
      () => commands.selectNodeBackward()
    ]);
    const handleDelete = () => this.editor.commands.first(({ commands }) => [
      () => commands.deleteSelection(),
      () => commands.deleteCurrentNode(),
      () => commands.joinForward(),
      () => commands.selectNodeForward()
    ]);
    const handleEnter = () => this.editor.commands.first(({ commands }) => [
      () => commands.newlineInCode(),
      () => commands.createParagraphNear(),
      () => commands.liftEmptyBlock(),
      () => commands.splitBlock()
    ]);
    const baseKeymap = {
      Enter: handleEnter,
      "Mod-Enter": () => this.editor.commands.exitCode(),
      Backspace: handleBackspace,
      "Mod-Backspace": handleBackspace,
      "Shift-Backspace": handleBackspace,
      Delete: handleDelete,
      "Mod-Delete": handleDelete,
      "Mod-a": () => this.editor.commands.selectAll()
    };
    const pcKeymap = {
      ...baseKeymap
    };
    const macKeymap = {
      ...baseKeymap,
      "Ctrl-h": handleBackspace,
      "Alt-Backspace": handleBackspace,
      "Ctrl-d": handleDelete,
      "Ctrl-Alt-Backspace": handleDelete,
      "Alt-Delete": handleDelete,
      "Alt-d": handleDelete,
      "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
      "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
    };
    if (isiOS() || isMacOS()) {
      return macKeymap;
    }
    return pcKeymap;
  },
  addProseMirrorPlugins() {
    return [
      // With this plugin we check if the whole document was selected and deleted.
      // In this case we will additionally call `clearNodes()` to convert e.g. a heading
      // to a paragraph if necessary.
      // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
      // with many other commands.
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("clearDocument"),
        appendTransaction: (transactions, oldState, newState) => {
          if (transactions.some((tr2) => tr2.getMeta("composition"))) {
            return;
          }
          const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
          const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
          if (!docChanges || ignoreTr) {
            return;
          }
          const { empty, from, to } = oldState.selection;
          const allFrom = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.atStart(oldState.doc).from;
          const allEnd = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Selection.atEnd(oldState.doc).to;
          const allWasSelected = from === allFrom && to === allEnd;
          if (empty || !allWasSelected) {
            return;
          }
          const isEmpty = isNodeEmpty(newState.doc);
          if (!isEmpty) {
            return;
          }
          const tr = newState.tr;
          const state = createChainableState({
            state: newState,
            transaction: tr
          });
          const { commands } = new CommandManager({
            editor: this.editor,
            state
          });
          commands.clearNodes();
          if (!tr.steps.length) {
            return;
          }
          return tr;
        }
      })
    ];
  }
});

// src/extensions/paste.ts

var Paste = Extension.create({
  name: "paste",
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("tiptapPaste"),
        props: {
          handlePaste: (_view, e, slice) => {
            this.editor.emit("paste", {
              editor: this.editor,
              event: e,
              slice
            });
          }
        }
      })
    ];
  }
});

// src/extensions/tabindex.ts

var Tabindex = Extension.create({
  name: "tabindex",
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("tabindex"),
        props: {
          attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
        }
      })
    ];
  }
});

// src/extensions/textDirection.ts

var TextDirection = Extension.create({
  name: "textDirection",
  addOptions() {
    return {
      direction: void 0
    };
  },
  addGlobalAttributes() {
    if (!this.options.direction) {
      return [];
    }
    const { nodeExtensions } = splitExtensions(this.extensions);
    return [
      {
        types: nodeExtensions.filter((extension) => extension.name !== "text").map((extension) => extension.name),
        attributes: {
          dir: {
            default: this.options.direction,
            parseHTML: (element) => {
              const dir = element.getAttribute("dir");
              if (dir && (dir === "ltr" || dir === "rtl" || dir === "auto")) {
                return dir;
              }
              return this.options.direction;
            },
            renderHTML: (attributes) => {
              if (!attributes.dir) {
                return {};
              }
              return {
                dir: attributes.dir
              };
            }
          }
        }
      }
    ];
  },
  addProseMirrorPlugins() {
    return [
      new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
        key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("textDirection"),
        props: {
          attributes: () => {
            const direction = this.options.direction;
            if (!direction) {
              return {};
            }
            return {
              dir: direction
            };
          }
        }
      })
    ];
  }
});

// src/NodePos.ts
var NodePos = class _NodePos {
  constructor(pos, editor, isBlock = false, node = null) {
    this.currentNode = null;
    this.actualDepth = null;
    this.isBlock = isBlock;
    this.resolvedPos = pos;
    this.editor = editor;
    this.currentNode = node;
  }
  get name() {
    return this.node.type.name;
  }
  get node() {
    return this.currentNode || this.resolvedPos.node();
  }
  get element() {
    return this.editor.view.domAtPos(this.pos).node;
  }
  get depth() {
    var _a;
    return (_a = this.actualDepth) != null ? _a : this.resolvedPos.depth;
  }
  get pos() {
    return this.resolvedPos.pos;
  }
  get content() {
    return this.node.content;
  }
  set content(content) {
    let from = this.from;
    let to = this.to;
    if (this.isBlock) {
      if (this.content.size === 0) {
        console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
        return;
      }
      from = this.from + 1;
      to = this.to - 1;
    }
    this.editor.commands.insertContentAt({ from, to }, content);
  }
  get attributes() {
    return this.node.attrs;
  }
  get textContent() {
    return this.node.textContent;
  }
  get size() {
    return this.node.nodeSize;
  }
  get from() {
    if (this.isBlock) {
      return this.pos;
    }
    return this.resolvedPos.start(this.resolvedPos.depth);
  }
  get range() {
    return {
      from: this.from,
      to: this.to
    };
  }
  get to() {
    if (this.isBlock) {
      return this.pos + this.size;
    }
    return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
  }
  get parent() {
    if (this.depth === 0) {
      return null;
    }
    const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);
    const $pos = this.resolvedPos.doc.resolve(parentPos);
    return new _NodePos($pos, this.editor);
  }
  get before() {
    let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
    if ($pos.depth !== this.depth) {
      $pos = this.resolvedPos.doc.resolve(this.from - 3);
    }
    return new _NodePos($pos, this.editor);
  }
  get after() {
    let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
    if ($pos.depth !== this.depth) {
      $pos = this.resolvedPos.doc.resolve(this.to + 3);
    }
    return new _NodePos($pos, this.editor);
  }
  get children() {
    const children = [];
    this.node.content.forEach((node, offset) => {
      const isBlock = node.isBlock && !node.isTextblock;
      const isNonTextAtom = node.isAtom && !node.isText;
      const isInline = node.isInline;
      const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
      if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {
        return;
      }
      const $pos = this.resolvedPos.doc.resolve(targetPos);
      if (!isBlock && !isInline && $pos.depth <= this.depth) {
        return;
      }
      const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);
      if (isBlock) {
        childNodePos.actualDepth = this.depth + 1;
      }
      children.push(childNodePos);
    });
    return children;
  }
  get firstChild() {
    return this.children[0] || null;
  }
  get lastChild() {
    const children = this.children;
    return children[children.length - 1] || null;
  }
  closest(selector, attributes = {}) {
    let node = null;
    let currentNode = this.parent;
    while (currentNode && !node) {
      if (currentNode.node.type.name === selector) {
        if (Object.keys(attributes).length > 0) {
          const nodeAttributes = currentNode.node.attrs;
          const attrKeys = Object.keys(attributes);
          for (let index = 0; index < attrKeys.length; index += 1) {
            const key = attrKeys[index];
            if (nodeAttributes[key] !== attributes[key]) {
              break;
            }
          }
        } else {
          node = currentNode;
        }
      }
      currentNode = currentNode.parent;
    }
    return node;
  }
  querySelector(selector, attributes = {}) {
    return this.querySelectorAll(selector, attributes, true)[0] || null;
  }
  querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
    let nodes = [];
    if (!this.children || this.children.length === 0) {
      return nodes;
    }
    const attrKeys = Object.keys(attributes);
    this.children.forEach((childPos) => {
      if (firstItemOnly && nodes.length > 0) {
        return;
      }
      if (childPos.node.type.name === selector) {
        const doesAllAttributesMatch = attrKeys.every((key) => attributes[key] === childPos.node.attrs[key]);
        if (doesAllAttributesMatch) {
          nodes.push(childPos);
        }
      }
      if (firstItemOnly && nodes.length > 0) {
        return;
      }
      nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
    });
    return nodes;
  }
  setAttribute(attributes) {
    const { tr } = this.editor.state;
    tr.setNodeMarkup(this.from, void 0, {
      ...this.node.attrs,
      ...attributes
    });
    this.editor.view.dispatch(tr);
  }
};

// src/style.ts
var style = `.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}`;

// src/utilities/createStyleTag.ts
function createStyleTag(style2, nonce, suffix) {
  const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
  if (tiptapStyleTag !== null) {
    return tiptapStyleTag;
  }
  const styleNode = document.createElement("style");
  if (nonce) {
    styleNode.setAttribute("nonce", nonce);
  }
  styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
  styleNode.innerHTML = style2;
  document.getElementsByTagName("head")[0].appendChild(styleNode);
  return styleNode;
}

// src/Editor.ts
var Editor = class extends EventEmitter {
  constructor(options = {}) {
    super();
    this.css = null;
    this.className = "tiptap";
    this.editorView = null;
    this.isFocused = false;
    /**
     * The editor is considered initialized after the `create` event has been emitted.
     */
    this.isInitialized = false;
    this.extensionStorage = {};
    /**
     * A unique ID for this editor instance.
     */
    this.instanceId = Math.random().toString(36).slice(2, 9);
    this.options = {
      element: typeof document !== "undefined" ? document.createElement("div") : null,
      content: "",
      injectCSS: true,
      injectNonce: void 0,
      extensions: [],
      autofocus: false,
      editable: true,
      textDirection: void 0,
      editorProps: {},
      parseOptions: {},
      coreExtensionOptions: {},
      enableInputRules: true,
      enablePasteRules: true,
      enableCoreExtensions: true,
      enableContentCheck: false,
      emitContentError: false,
      onBeforeCreate: () => null,
      onCreate: () => null,
      onMount: () => null,
      onUnmount: () => null,
      onUpdate: () => null,
      onSelectionUpdate: () => null,
      onTransaction: () => null,
      onFocus: () => null,
      onBlur: () => null,
      onDestroy: () => null,
      onContentError: ({ error }) => {
        throw error;
      },
      onPaste: () => null,
      onDrop: () => null,
      onDelete: () => null,
      enableExtensionDispatchTransaction: true
    };
    this.isCapturingTransaction = false;
    this.capturedTransaction = null;
    /**
     * Returns a set of utilities for working with positions and ranges.
     */
    this.utils = {
      getUpdatedPosition,
      createMappablePosition
    };
    this.setOptions(options);
    this.createExtensionManager();
    this.createCommandManager();
    this.createSchema();
    this.on("beforeCreate", this.options.onBeforeCreate);
    this.emit("beforeCreate", { editor: this });
    this.on("mount", this.options.onMount);
    this.on("unmount", this.options.onUnmount);
    this.on("contentError", this.options.onContentError);
    this.on("create", this.options.onCreate);
    this.on("update", this.options.onUpdate);
    this.on("selectionUpdate", this.options.onSelectionUpdate);
    this.on("transaction", this.options.onTransaction);
    this.on("focus", this.options.onFocus);
    this.on("blur", this.options.onBlur);
    this.on("destroy", this.options.onDestroy);
    this.on("drop", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));
    this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
    this.on("delete", this.options.onDelete);
    const initialDoc = this.createDoc();
    const selection = resolveFocusPosition(initialDoc, this.options.autofocus);
    this.editorState = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.create({
      doc: initialDoc,
      schema: this.schema,
      selection: selection || void 0
    });
    if (this.options.element) {
      this.mount(this.options.element);
    }
  }
  /**
   * Attach the editor to the DOM, creating a new editor view.
   */
  mount(el) {
    if (typeof document === "undefined") {
      throw new Error(
        `[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`
      );
    }
    this.createView(el);
    this.emit("mount", { editor: this });
    if (this.css && !document.head.contains(this.css)) {
      document.head.appendChild(this.css);
    }
    window.setTimeout(() => {
      if (this.isDestroyed) {
        return;
      }
      if (this.options.autofocus !== false && this.options.autofocus !== null) {
        this.commands.focus(this.options.autofocus);
      }
      this.emit("create", { editor: this });
      this.isInitialized = true;
    }, 0);
  }
  /**
   * Remove the editor from the DOM, but still allow remounting at a different point in time
   */
  unmount() {
    if (this.editorView) {
      const dom = this.editorView.dom;
      if (dom == null ? void 0 : dom.editor) {
        delete dom.editor;
      }
      this.editorView.destroy();
    }
    this.editorView = null;
    this.isInitialized = false;
    if (this.css && !document.querySelectorAll(`.${this.className}`).length) {
      try {
        if (typeof this.css.remove === "function") {
          this.css.remove();
        } else if (this.css.parentNode) {
          this.css.parentNode.removeChild(this.css);
        }
      } catch (error) {
        console.warn("Failed to remove CSS element:", error);
      }
    }
    this.css = null;
    this.emit("unmount", { editor: this });
  }
  /**
   * Returns the editor storage.
   */
  get storage() {
    return this.extensionStorage;
  }
  /**
   * An object of all registered commands.
   */
  get commands() {
    return this.commandManager.commands;
  }
  /**
   * Create a command chain to call multiple commands at once.
   */
  chain() {
    return this.commandManager.chain();
  }
  /**
   * Check if a command or a command chain can be executed. Without executing it.
   */
  can() {
    return this.commandManager.can();
  }
  /**
   * Inject CSS styles.
   */
  injectCSS() {
    if (this.options.injectCSS && typeof document !== "undefined") {
      this.css = createStyleTag(style, this.options.injectNonce);
    }
  }
  /**
   * Update editor options.
   *
   * @param options A list of options
   */
  setOptions(options = {}) {
    this.options = {
      ...this.options,
      ...options
    };
    if (!this.editorView || !this.state || this.isDestroyed) {
      return;
    }
    if (this.options.editorProps) {
      this.view.setProps(this.options.editorProps);
    }
    this.view.updateState(this.state);
  }
  /**
   * Update editable state of the editor.
   */
  setEditable(editable, emitUpdate = true) {
    this.setOptions({ editable });
    if (emitUpdate) {
      this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
    }
  }
  /**
   * Returns whether the editor is editable.
   */
  get isEditable() {
    return this.options.editable && this.view && this.view.editable;
  }
  /**
   * Returns the editor view.
   */
  get view() {
    if (this.editorView) {
      return this.editorView;
    }
    return new Proxy(
      {
        state: this.editorState,
        updateState: (state) => {
          this.editorState = state;
        },
        dispatch: (tr) => {
          this.dispatchTransaction(tr);
        },
        // Stub some commonly accessed properties to prevent errors
        composing: false,
        dragging: null,
        editable: true,
        isDestroyed: false
      },
      {
        get: (obj, key) => {
          if (this.editorView) {
            return this.editorView[key];
          }
          if (key === "state") {
            return this.editorState;
          }
          if (key in obj) {
            return Reflect.get(obj, key);
          }
          throw new Error(
            `[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`
          );
        }
      }
    );
  }
  /**
   * Returns the editor state.
   */
  get state() {
    if (this.editorView) {
      this.editorState = this.view.state;
    }
    return this.editorState;
  }
  /**
   * Register a ProseMirror plugin.
   *
   * @param plugin A ProseMirror plugin
   * @param handlePlugins Control how to merge the plugin into the existing plugins.
   * @returns The new editor state
   */
  registerPlugin(plugin, handlePlugins) {
    const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];
    const state = this.state.reconfigure({ plugins });
    this.view.updateState(state);
    return state;
  }
  /**
   * Unregister a ProseMirror plugin.
   *
   * @param nameOrPluginKeyToRemove The plugins name
   * @returns The new editor state or undefined if the editor is destroyed
   */
  unregisterPlugin(nameOrPluginKeyToRemove) {
    if (this.isDestroyed) {
      return void 0;
    }
    const prevPlugins = this.state.plugins;
    let plugins = prevPlugins;
    [].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {
      const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
      plugins = plugins.filter((plugin) => !plugin.key.startsWith(name));
    });
    if (prevPlugins.length === plugins.length) {
      return void 0;
    }
    const state = this.state.reconfigure({
      plugins
    });
    this.view.updateState(state);
    return state;
  }
  /**
   * Creates an extension manager.
   */
  createExtensionManager() {
    var _a, _b;
    const coreExtensions = this.options.enableCoreExtensions ? [
      Editable,
      ClipboardTextSerializer.configure({
        blockSeparator: (_b = (_a = this.options.coreExtensionOptions) == null ? void 0 : _a.clipboardTextSerializer) == null ? void 0 : _b.blockSeparator
      }),
      Commands,
      FocusEvents,
      Keymap,
      Tabindex,
      Drop,
      Paste,
      Delete,
      TextDirection.configure({
        direction: this.options.textDirection
      })
    ].filter((ext) => {
      if (typeof this.options.enableCoreExtensions === "object") {
        return this.options.enableCoreExtensions[ext.name] !== false;
      }
      return true;
    }) : [];
    const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
      return ["extension", "node", "mark"].includes(extension == null ? void 0 : extension.type);
    });
    this.extensionManager = new ExtensionManager(allExtensions, this);
  }
  /**
   * Creates an command manager.
   */
  createCommandManager() {
    this.commandManager = new CommandManager({
      editor: this
    });
  }
  /**
   * Creates a ProseMirror schema.
   */
  createSchema() {
    this.schema = this.extensionManager.schema;
  }
  /**
   * Creates the initial document.
   */
  createDoc() {
    let doc;
    try {
      doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {
        errorOnInvalidContent: this.options.enableContentCheck
      });
    } catch (e) {
      if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) {
        throw e;
      }
      this.emit("contentError", {
        editor: this,
        error: e,
        disableCollaboration: () => {
          if ("collaboration" in this.storage && typeof this.storage.collaboration === "object" && this.storage.collaboration) {
            ;
            this.storage.collaboration.isDisabled = true;
          }
          this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
          this.createExtensionManager();
        }
      });
      doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {
        errorOnInvalidContent: false
      });
    }
    return doc;
  }
  /**
   * Creates a ProseMirror view.
   */
  createView(element) {
    const { editorProps, enableExtensionDispatchTransaction } = this.options;
    const baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);
    const dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;
    const baseTransformPastedHTML = editorProps.transformPastedHTML;
    const transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);
    this.editorView = new _tiptap_pm_view__WEBPACK_IMPORTED_MODULE_5__.EditorView(element, {
      ...editorProps,
      attributes: {
        // add `role="textbox"` to the editor element
        role: "textbox",
        ...editorProps == null ? void 0 : editorProps.attributes
      },
      dispatchTransaction: dispatch,
      transformPastedHTML,
      state: this.editorState,
      markViews: this.extensionManager.markViews,
      nodeViews: this.extensionManager.nodeViews
    });
    const newState = this.state.reconfigure({
      plugins: this.extensionManager.plugins
    });
    this.view.updateState(newState);
    this.prependClass();
    this.injectCSS();
    const dom = this.view.dom;
    dom.editor = this;
  }
  /**
   * Creates all node and mark views.
   */
  createNodeViews() {
    if (this.view.isDestroyed) {
      return;
    }
    this.view.setProps({
      markViews: this.extensionManager.markViews,
      nodeViews: this.extensionManager.nodeViews
    });
  }
  /**
   * Prepend class name to element.
   */
  prependClass() {
    this.view.dom.className = `${this.className} ${this.view.dom.className}`;
  }
  captureTransaction(fn) {
    this.isCapturingTransaction = true;
    fn();
    this.isCapturingTransaction = false;
    const tr = this.capturedTransaction;
    this.capturedTransaction = null;
    return tr;
  }
  /**
   * The callback over which to send transactions (state updates) produced by the view.
   *
   * @param transaction An editor state transaction
   */
  dispatchTransaction(transaction) {
    if (this.view.isDestroyed) {
      return;
    }
    if (this.isCapturingTransaction) {
      if (!this.capturedTransaction) {
        this.capturedTransaction = transaction;
        return;
      }
      transaction.steps.forEach((step) => {
        var _a;
        return (_a = this.capturedTransaction) == null ? void 0 : _a.step(step);
      });
      return;
    }
    const { state, transactions } = this.state.applyTransaction(transaction);
    const selectionHasChanged = !this.state.selection.eq(state.selection);
    const rootTrWasApplied = transactions.includes(transaction);
    const prevState = this.state;
    this.emit("beforeTransaction", {
      editor: this,
      transaction,
      nextState: state
    });
    if (!rootTrWasApplied) {
      return;
    }
    this.view.updateState(state);
    this.emit("transaction", {
      editor: this,
      transaction,
      appendedTransactions: transactions.slice(1)
    });
    if (selectionHasChanged) {
      this.emit("selectionUpdate", {
        editor: this,
        transaction
      });
    }
    const mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta("focus") || tr.getMeta("blur"));
    const focus2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("focus");
    const blur2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("blur");
    if (focus2) {
      this.emit("focus", {
        editor: this,
        event: focus2.event,
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        transaction: mostRecentFocusTr
      });
    }
    if (blur2) {
      this.emit("blur", {
        editor: this,
        event: blur2.event,
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        transaction: mostRecentFocusTr
      });
    }
    if (transaction.getMeta("preventUpdate") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) {
      return;
    }
    this.emit("update", {
      editor: this,
      transaction,
      appendedTransactions: transactions.slice(1)
    });
  }
  /**
   * Get attributes of the currently selected node or mark.
   */
  getAttributes(nameOrType) {
    return getAttributes(this.state, nameOrType);
  }
  isActive(nameOrAttributes, attributesOrUndefined) {
    const name = typeof nameOrAttributes === "string" ? nameOrAttributes : null;
    const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
    return isActive(this.state, name, attributes);
  }
  /**
   * Get the document as JSON.
   */
  getJSON() {
    return this.state.doc.toJSON();
  }
  /**
   * Get the document as HTML.
   */
  getHTML() {
    return getHTMLFromFragment(this.state.doc.content, this.schema);
  }
  /**
   * Get the document as text.
   */
  getText(options) {
    const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
    return getText(this.state.doc, {
      blockSeparator,
      textSerializers: {
        ...getTextSerializersFromSchema(this.schema),
        ...textSerializers
      }
    });
  }
  /**
   * Check if there is no content.
   */
  get isEmpty() {
    return isNodeEmpty(this.state.doc);
  }
  /**
   * Destroy the editor.
   */
  destroy() {
    this.emit("destroy");
    this.unmount();
    this.removeAllListeners();
  }
  /**
   * Check if the editor is already destroyed.
   */
  get isDestroyed() {
    var _a, _b;
    return (_b = (_a = this.editorView) == null ? void 0 : _a.isDestroyed) != null ? _b : true;
  }
  $node(selector, attributes) {
    var _a;
    return ((_a = this.$doc) == null ? void 0 : _a.querySelector(selector, attributes)) || null;
  }
  $nodes(selector, attributes) {
    var _a;
    return ((_a = this.$doc) == null ? void 0 : _a.querySelectorAll(selector, attributes)) || null;
  }
  $pos(pos) {
    const $pos = this.state.doc.resolve(pos);
    return new NodePos($pos, this);
  }
  get $doc() {
    return this.$pos(0);
  }
};

// src/inputRules/markInputRule.ts
function markInputRule(config) {
  return new InputRule({
    find: config.find,
    handler: ({ state, range, match }) => {
      const attributes = callOrReturn(config.getAttributes, void 0, match);
      if (attributes === false || attributes === null) {
        return null;
      }
      const { tr } = state;
      const captureGroup = match[match.length - 1];
      const fullMatch = match[0];
      if (captureGroup) {
        const startSpaces = fullMatch.search(/\S/);
        const textStart = range.from + fullMatch.indexOf(captureGroup);
        const textEnd = textStart + captureGroup.length;
        const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {
          const excluded = item.mark.type.excluded;
          return excluded.find((type) => type === config.type && type !== item.mark.type);
        }).filter((item) => item.to > textStart);
        if (excludedMarks.length) {
          return null;
        }
        if (textEnd < range.to) {
          tr.delete(textEnd, range.to);
        }
        if (textStart > range.from) {
          tr.delete(range.from + startSpaces, textStart);
        }
        const markEnd = range.from + startSpaces + captureGroup.length;
        tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
        tr.removeStoredMark(config.type);
      }
    },
    undoable: config.undoable
  });
}

// src/inputRules/nodeInputRule.ts
function nodeInputRule(config) {
  return new InputRule({
    find: config.find,
    handler: ({ state, range, match }) => {
      const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
      const { tr } = state;
      const start = range.from;
      let end = range.to;
      const newNode = config.type.create(attributes);
      if (match[1]) {
        const offset = match[0].lastIndexOf(match[1]);
        let matchStart = start + offset;
        if (matchStart > end) {
          matchStart = end;
        } else {
          end = matchStart + match[1].length;
        }
        const lastChar = match[0][match[0].length - 1];
        tr.insertText(lastChar, start + match[0].length - 1);
        tr.replaceWith(matchStart, end, newNode);
      } else if (match[0]) {
        const insertionStart = config.type.isInline ? start : start - 1;
        tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
      }
      tr.scrollIntoView();
    },
    undoable: config.undoable
  });
}

// src/inputRules/textblockTypeInputRule.ts
function textblockTypeInputRule(config) {
  return new InputRule({
    find: config.find,
    handler: ({ state, range, match }) => {
      const $start = state.doc.resolve(range.from);
      const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
      if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {
        return null;
      }
      state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);
    },
    undoable: config.undoable
  });
}

// src/inputRules/textInputRule.ts
function textInputRule(config) {
  return new InputRule({
    find: config.find,
    handler: ({ state, range, match }) => {
      let insert = config.replace;
      let start = range.from;
      const end = range.to;
      if (match[1]) {
        const offset = match[0].lastIndexOf(match[1]);
        insert += match[0].slice(offset + match[1].length);
        start += offset;
        const cutOff = start - end;
        if (cutOff > 0) {
          insert = match[0].slice(offset - cutOff, offset) + insert;
          start = end;
        }
      }
      state.tr.insertText(insert, start, end);
    },
    undoable: config.undoable
  });
}

// src/inputRules/wrappingInputRule.ts

function wrappingInputRule(config) {
  return new InputRule({
    find: config.find,
    handler: ({ state, range, match, chain }) => {
      const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
      const tr = state.tr.delete(range.from, range.to);
      const $start = tr.doc.resolve(range.from);
      const blockRange = $start.blockRange();
      const wrapping = blockRange && (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.findWrapping)(blockRange, config.type, attributes);
      if (!wrapping) {
        return null;
      }
      tr.wrap(blockRange, wrapping);
      if (config.keepMarks && config.editor) {
        const { selection, storedMarks } = state;
        const { splittableMarks } = config.editor.extensionManager;
        const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
        if (marks) {
          const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
          tr.ensureMarks(filteredMarks);
        }
      }
      if (config.keepAttributes) {
        const nodeType = config.type.name === "bulletList" || config.type.name === "orderedList" ? "listItem" : "taskList";
        chain().updateAttributes(nodeType, attributes).run();
      }
      const before = tr.doc.resolve(range.from - 1).nodeBefore;
      if (before && before.type === config.type && (0,_tiptap_pm_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {
        tr.join(range.from - 1);
      }
    },
    undoable: config.undoable
  });
}

// src/jsx-runtime.ts
function Fragment6(props) {
  return props.children;
}
var h = (tag, attributes) => {
  if (tag === "slot") {
    return 0;
  }
  if (tag instanceof Function) {
    return tag(attributes);
  }
  const { children, ...rest } = attributes != null ? attributes : {};
  if (tag === "svg") {
    throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
  }
  return [tag, rest, children];
};

// src/lib/ResizableNodeView.ts
var isTouchEvent = (e) => {
  return "touches" in e;
};
var ResizableNodeView = class {
  /**
   * Creates a new ResizableNodeView instance.
   *
   * The constructor sets up the resize handles, applies initial sizing from
   * node attributes, and configures all resize behavior options.
   *
   * @param options - Configuration options for the resizable node view
   */
  constructor(options) {
    /** Active resize handle directions */
    this.directions = ["bottom-left", "bottom-right", "top-left", "top-right"];
    /** Minimum allowed dimensions */
    this.minSize = {
      height: 8,
      width: 8
    };
    /** Whether to always preserve aspect ratio */
    this.preserveAspectRatio = false;
    /** CSS class names for elements */
    this.classNames = {
      container: "",
      wrapper: "",
      handle: "",
      resizing: ""
    };
    /** Initial width of the element (for aspect ratio calculation) */
    this.initialWidth = 0;
    /** Initial height of the element (for aspect ratio calculation) */
    this.initialHeight = 0;
    /** Calculated aspect ratio (width / height) */
    this.aspectRatio = 1;
    /** Whether a resize operation is currently active */
    this.isResizing = false;
    /** The handle currently being dragged */
    this.activeHandle = null;
    /** Starting mouse X position when resize began */
    this.startX = 0;
    /** Starting mouse Y position when resize began */
    this.startY = 0;
    /** Element width when resize began */
    this.startWidth = 0;
    /** Element height when resize began */
    this.startHeight = 0;
    /** Whether Shift key is currently pressed (for temporary aspect ratio lock) */
    this.isShiftKeyPressed = false;
    /** Last known editable state of the editor */
    this.lastEditableState = void 0;
    /** Map of handle elements by direction */
    this.handleMap = /* @__PURE__ */ new Map();
    /**
     * Handles mouse movement during an active resize.
     *
     * Calculates the delta from the starting position, computes new dimensions
     * based on the active handle direction, applies constraints and aspect ratio,
     * then updates the element's style and calls the onResize callback.
     *
     * @param event - The mouse move event
     */
    this.handleMouseMove = (event) => {
      if (!this.isResizing || !this.activeHandle) {
        return;
      }
      const deltaX = event.clientX - this.startX;
      const deltaY = event.clientY - this.startY;
      this.handleResize(deltaX, deltaY);
    };
    this.handleTouchMove = (event) => {
      if (!this.isResizing || !this.activeHandle) {
        return;
      }
      const touch = event.touches[0];
      if (!touch) {
        return;
      }
      const deltaX = touch.clientX - this.startX;
      const deltaY = touch.clientY - this.startY;
      this.handleResize(deltaX, deltaY);
    };
    /**
     * Completes the resize operation when the mouse button is released.
     *
     * Captures final dimensions, calls the onCommit callback to persist changes,
     * removes the resizing state and class, and cleans up document-level listeners.
     */
    this.handleMouseUp = () => {
      if (!this.isResizing) {
        return;
      }
      const finalWidth = this.element.offsetWidth;
      const finalHeight = this.element.offsetHeight;
      this.onCommit(finalWidth, finalHeight);
      this.isResizing = false;
      this.activeHandle = null;
      this.container.dataset.resizeState = "false";
      if (this.classNames.resizing) {
        this.container.classList.remove(this.classNames.resizing);
      }
      document.removeEventListener("mousemove", this.handleMouseMove);
      document.removeEventListener("mouseup", this.handleMouseUp);
      document.removeEventListener("keydown", this.handleKeyDown);
      document.removeEventListener("keyup", this.handleKeyUp);
    };
    /**
     * Tracks Shift key state to enable temporary aspect ratio locking.
     *
     * When Shift is pressed during resize, aspect ratio is preserved even if
     * preserveAspectRatio is false.
     *
     * @param event - The keyboard event
     */
    this.handleKeyDown = (event) => {
      if (event.key === "Shift") {
        this.isShiftKeyPressed = true;
      }
    };
    /**
     * Tracks Shift key release to disable temporary aspect ratio locking.
     *
     * @param event - The keyboard event
     */
    this.handleKeyUp = (event) => {
      if (event.key === "Shift") {
        this.isShiftKeyPressed = false;
      }
    };
    var _a, _b, _c, _d, _e, _f;
    this.node = options.node;
    this.editor = options.editor;
    this.element = options.element;
    this.contentElement = options.contentElement;
    this.getPos = options.getPos;
    this.onResize = options.onResize;
    this.onCommit = options.onCommit;
    this.onUpdate = options.onUpdate;
    if ((_a = options.options) == null ? void 0 : _a.min) {
      this.minSize = {
        ...this.minSize,
        ...options.options.min
      };
    }
    if ((_b = options.options) == null ? void 0 : _b.max) {
      this.maxSize = options.options.max;
    }
    if ((_c = options == null ? void 0 : options.options) == null ? void 0 : _c.directions) {
      this.directions = options.options.directions;
    }
    if ((_d = options.options) == null ? void 0 : _d.preserveAspectRatio) {
      this.preserveAspectRatio = options.options.preserveAspectRatio;
    }
    if ((_e = options.options) == null ? void 0 : _e.className) {
      this.classNames = {
        container: options.options.className.container || "",
        wrapper: options.options.className.wrapper || "",
        handle: options.options.className.handle || "",
        resizing: options.options.className.resizing || ""
      };
    }
    if ((_f = options.options) == null ? void 0 : _f.createCustomHandle) {
      this.createCustomHandle = options.options.createCustomHandle;
    }
    this.wrapper = this.createWrapper();
    this.container = this.createContainer();
    this.applyInitialSize();
    this.attachHandles();
    this.editor.on("update", this.handleEditorUpdate.bind(this));
  }
  /**
   * Returns the top-level DOM node that should be placed in the editor.
   *
   * This is required by the ProseMirror NodeView interface. The container
   * includes the wrapper, handles, and the actual content element.
   *
   * @returns The container element to be inserted into the editor
   */
  get dom() {
    return this.container;
  }
  get contentDOM() {
    var _a;
    return (_a = this.contentElement) != null ? _a : null;
  }
  handleEditorUpdate() {
    const isEditable = this.editor.isEditable;
    if (isEditable === this.lastEditableState) {
      return;
    }
    this.lastEditableState = isEditable;
    if (!isEditable) {
      this.removeHandles();
    } else if (isEditable && this.handleMap.size === 0) {
      this.attachHandles();
    }
  }
  /**
   * Called when the node's content or attributes change.
   *
   * Updates the internal node reference. If a custom `onUpdate` callback
   * was provided, it will be called to handle additional update logic.
   *
   * @param node - The new/updated node
   * @param decorations - Node decorations
   * @param innerDecorations - Inner decorations
   * @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`
   */
  update(node, decorations, innerDecorations) {
    if (node.type !== this.node.type) {
      return false;
    }
    this.node = node;
    if (this.onUpdate) {
      return this.onUpdate(node, decorations, innerDecorations);
    }
    return true;
  }
  /**
   * Cleanup method called when the node view is being removed.
   *
   * Removes all event listeners to prevent memory leaks. This is required
   * by the ProseMirror NodeView interface. If a resize is active when
   * destroy is called, it will be properly cancelled.
   */
  destroy() {
    if (this.isResizing) {
      this.container.dataset.resizeState = "false";
      if (this.classNames.resizing) {
        this.container.classList.remove(this.classNames.resizing);
      }
      document.removeEventListener("mousemove", this.handleMouseMove);
      document.removeEventListener("mouseup", this.handleMouseUp);
      document.removeEventListener("keydown", this.handleKeyDown);
      document.removeEventListener("keyup", this.handleKeyUp);
      this.isResizing = false;
      this.activeHandle = null;
    }
    this.editor.off("update", this.handleEditorUpdate.bind(this));
    this.container.remove();
  }
  /**
   * Creates the outer container element.
   *
   * The container is the top-level element returned by the NodeView and
   * wraps the entire resizable node. It's set up with flexbox to handle
   * alignment and includes data attributes for styling and identification.
   *
   * @returns The container element
   */
  createContainer() {
    const element = document.createElement("div");
    element.dataset.resizeContainer = "";
    element.dataset.node = this.node.type.name;
    element.style.display = "flex";
    if (this.classNames.container) {
      element.className = this.classNames.container;
    }
    element.appendChild(this.wrapper);
    return element;
  }
  /**
   * Creates the wrapper element that contains the content and handles.
   *
   * The wrapper uses relative positioning so that resize handles can be
   * positioned absolutely within it. This is the direct parent of the
   * content element being made resizable.
   *
   * @returns The wrapper element
   */
  createWrapper() {
    const element = document.createElement("div");
    element.style.position = "relative";
    element.style.display = "block";
    element.dataset.resizeWrapper = "";
    if (this.classNames.wrapper) {
      element.className = this.classNames.wrapper;
    }
    element.appendChild(this.element);
    return element;
  }
  /**
   * Creates a resize handle element for a specific direction.
   *
   * Each handle is absolutely positioned and includes a data attribute
   * identifying its direction for styling purposes.
   *
   * @param direction - The resize direction for this handle
   * @returns The handle element
   */
  createHandle(direction) {
    const handle = document.createElement("div");
    handle.dataset.resizeHandle = direction;
    handle.style.position = "absolute";
    if (this.classNames.handle) {
      handle.className = this.classNames.handle;
    }
    return handle;
  }
  /**
   * Positions a handle element according to its direction.
   *
   * Corner handles (e.g., 'top-left') are positioned at the intersection
   * of two edges. Edge handles (e.g., 'top') span the full width or height.
   *
   * @param handle - The handle element to position
   * @param direction - The direction determining the position
   */
  positionHandle(handle, direction) {
    const isTop = direction.includes("top");
    const isBottom = direction.includes("bottom");
    const isLeft = direction.includes("left");
    const isRight = direction.includes("right");
    if (isTop) {
      handle.style.top = "0";
    }
    if (isBottom) {
      handle.style.bottom = "0";
    }
    if (isLeft) {
      handle.style.left = "0";
    }
    if (isRight) {
      handle.style.right = "0";
    }
    if (direction === "top" || direction === "bottom") {
      handle.style.left = "0";
      handle.style.right = "0";
    }
    if (direction === "left" || direction === "right") {
      handle.style.top = "0";
      handle.style.bottom = "0";
    }
  }
  /**
   * Creates and attaches all resize handles to the wrapper.
   *
   * Iterates through the configured directions, creates a handle for each,
   * positions it, attaches the mousedown listener, and appends it to the DOM.
   */
  attachHandles() {
    this.directions.forEach((direction) => {
      let handle;
      if (this.createCustomHandle) {
        handle = this.createCustomHandle(direction);
      } else {
        handle = this.createHandle(direction);
      }
      if (!(handle instanceof HTMLElement)) {
        console.warn(
          `[ResizableNodeView] createCustomHandle("${direction}") did not return an HTMLElement. Falling back to default handle.`
        );
        handle = this.createHandle(direction);
      }
      if (!this.createCustomHandle) {
        this.positionHandle(handle, direction);
      }
      handle.addEventListener("mousedown", (event) => this.handleResizeStart(event, direction));
      handle.addEventListener("touchstart", (event) => this.handleResizeStart(event, direction));
      this.handleMap.set(direction, handle);
      this.wrapper.appendChild(handle);
    });
  }
  /**
   * Removes all resize handles from the wrapper.
   *
   * Cleans up the handle map and removes each handle element from the DOM.
   */
  removeHandles() {
    this.handleMap.forEach((el) => el.remove());
    this.handleMap.clear();
  }
  /**
   * Applies initial sizing from node attributes to the element.
   *
   * If width/height attributes exist on the node, they're applied to the element.
   * Otherwise, the element's natural/current dimensions are measured. The aspect
   * ratio is calculated for later use in aspect-ratio-preserving resizes.
   */
  applyInitialSize() {
    const width = this.node.attrs.width;
    const height = this.node.attrs.height;
    if (width) {
      this.element.style.width = `${width}px`;
      this.initialWidth = width;
    } else {
      this.initialWidth = this.element.offsetWidth;
    }
    if (height) {
      this.element.style.height = `${height}px`;
      this.initialHeight = height;
    } else {
      this.initialHeight = this.element.offsetHeight;
    }
    if (this.initialWidth > 0 && this.initialHeight > 0) {
      this.aspectRatio = this.initialWidth / this.initialHeight;
    }
  }
  /**
   * Initiates a resize operation when a handle is clicked.
   *
   * Captures the starting mouse position and element dimensions, sets up
   * the resize state, adds the resizing class and state attribute, and
   * attaches document-level listeners for mouse movement and keyboard input.
   *
   * @param event - The mouse down event
   * @param direction - The direction of the handle being dragged
   */
  handleResizeStart(event, direction) {
    event.preventDefault();
    event.stopPropagation();
    this.isResizing = true;
    this.activeHandle = direction;
    if (isTouchEvent(event)) {
      this.startX = event.touches[0].clientX;
      this.startY = event.touches[0].clientY;
    } else {
      this.startX = event.clientX;
      this.startY = event.clientY;
    }
    this.startWidth = this.element.offsetWidth;
    this.startHeight = this.element.offsetHeight;
    if (this.startWidth > 0 && this.startHeight > 0) {
      this.aspectRatio = this.startWidth / this.startHeight;
    }
    const pos = this.getPos();
    if (pos !== void 0) {
    }
    this.container.dataset.resizeState = "true";
    if (this.classNames.resizing) {
      this.container.classList.add(this.classNames.resizing);
    }
    document.addEventListener("mousemove", this.handleMouseMove);
    document.addEventListener("touchmove", this.handleTouchMove);
    document.addEventListener("mouseup", this.handleMouseUp);
    document.addEventListener("keydown", this.handleKeyDown);
    document.addEventListener("keyup", this.handleKeyUp);
  }
  handleResize(deltaX, deltaY) {
    if (!this.activeHandle) {
      return;
    }
    const shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;
    const { width, height } = this.calculateNewDimensions(this.activeHandle, deltaX, deltaY);
    const constrained = this.applyConstraints(width, height, shouldPreserveAspectRatio);
    this.element.style.width = `${constrained.width}px`;
    this.element.style.height = `${constrained.height}px`;
    if (this.onResize) {
      this.onResize(constrained.width, constrained.height);
    }
  }
  /**
   * Calculates new dimensions based on mouse delta and resize direction.
   *
   * Takes the starting dimensions and applies the mouse movement delta
   * according to the handle direction. For corner handles, both dimensions
   * are affected. For edge handles, only one dimension changes. If aspect
   * ratio should be preserved, delegates to applyAspectRatio.
   *
   * @param direction - The active resize handle direction
   * @param deltaX - Horizontal mouse movement since resize start
   * @param deltaY - Vertical mouse movement since resize start
   * @returns The calculated width and height
   */
  calculateNewDimensions(direction, deltaX, deltaY) {
    let newWidth = this.startWidth;
    let newHeight = this.startHeight;
    const isRight = direction.includes("right");
    const isLeft = direction.includes("left");
    const isBottom = direction.includes("bottom");
    const isTop = direction.includes("top");
    if (isRight) {
      newWidth = this.startWidth + deltaX;
    } else if (isLeft) {
      newWidth = this.startWidth - deltaX;
    }
    if (isBottom) {
      newHeight = this.startHeight + deltaY;
    } else if (isTop) {
      newHeight = this.startHeight - deltaY;
    }
    if (direction === "right" || direction === "left") {
      newWidth = this.startWidth + (isRight ? deltaX : -deltaX);
    }
    if (direction === "top" || direction === "bottom") {
      newHeight = this.startHeight + (isBottom ? deltaY : -deltaY);
    }
    const shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;
    if (shouldPreserveAspectRatio) {
      return this.applyAspectRatio(newWidth, newHeight, direction);
    }
    return { width: newWidth, height: newHeight };
  }
  /**
   * Applies min/max constraints to dimensions.
   *
   * When aspect ratio is NOT preserved, constraints are applied independently
   * to width and height. When aspect ratio IS preserved, constraints are
   * applied while maintaining the aspect ratio—if one dimension hits a limit,
   * the other is recalculated proportionally.
   *
   * This ensures that aspect ratio is never broken when constrained.
   *
   * @param width - The unconstrained width
   * @param height - The unconstrained height
   * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
   * @returns The constrained dimensions
   */
  applyConstraints(width, height, preserveAspectRatio) {
    var _a, _b, _c, _d;
    if (!preserveAspectRatio) {
      let constrainedWidth2 = Math.max(this.minSize.width, width);
      let constrainedHeight2 = Math.max(this.minSize.height, height);
      if ((_a = this.maxSize) == null ? void 0 : _a.width) {
        constrainedWidth2 = Math.min(this.maxSize.width, constrainedWidth2);
      }
      if ((_b = this.maxSize) == null ? void 0 : _b.height) {
        constrainedHeight2 = Math.min(this.maxSize.height, constrainedHeight2);
      }
      return { width: constrainedWidth2, height: constrainedHeight2 };
    }
    let constrainedWidth = width;
    let constrainedHeight = height;
    if (constrainedWidth < this.minSize.width) {
      constrainedWidth = this.minSize.width;
      constrainedHeight = constrainedWidth / this.aspectRatio;
    }
    if (constrainedHeight < this.minSize.height) {
      constrainedHeight = this.minSize.height;
      constrainedWidth = constrainedHeight * this.aspectRatio;
    }
    if (((_c = this.maxSize) == null ? void 0 : _c.width) && constrainedWidth > this.maxSize.width) {
      constrainedWidth = this.maxSize.width;
      constrainedHeight = constrainedWidth / this.aspectRatio;
    }
    if (((_d = this.maxSize) == null ? void 0 : _d.height) && constrainedHeight > this.maxSize.height) {
      constrainedHeight = this.maxSize.height;
      constrainedWidth = constrainedHeight * this.aspectRatio;
    }
    return { width: constrainedWidth, height: constrainedHeight };
  }
  /**
   * Adjusts dimensions to maintain the original aspect ratio.
   *
   * For horizontal handles (left/right), uses width as the primary dimension
   * and calculates height from it. For vertical handles (top/bottom), uses
   * height as primary and calculates width. For corner handles, uses width
   * as the primary dimension.
   *
   * @param width - The new width
   * @param height - The new height
   * @param direction - The active resize direction
   * @returns Dimensions adjusted to preserve aspect ratio
   */
  applyAspectRatio(width, height, direction) {
    const isHorizontal = direction === "left" || direction === "right";
    const isVertical = direction === "top" || direction === "bottom";
    if (isHorizontal) {
      return {
        width,
        height: width / this.aspectRatio
      };
    }
    if (isVertical) {
      return {
        width: height * this.aspectRatio,
        height
      };
    }
    return {
      width,
      height: width / this.aspectRatio
    };
  }
};
var ResizableNodeview = ResizableNodeView;

// src/utilities/canInsertNode.ts

function canInsertNode(state, nodeType) {
  const { selection } = state;
  const { $from } = selection;
  if (selection instanceof _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection) {
    const index = $from.index();
    const parent = $from.parent;
    return parent.canReplaceWith(index, index + 1, nodeType);
  }
  let depth = $from.depth;
  while (depth >= 0) {
    const index = $from.index(depth);
    const parent = $from.node(depth);
    const match = parent.contentMatchAt(index);
    if (match.matchType(nodeType)) {
      return true;
    }
    depth -= 1;
  }
  return false;
}

// src/utilities/escapeForRegEx.ts
function escapeForRegEx(string) {
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}

// src/utilities/isFirefox.ts
function isFirefox() {
  return typeof navigator !== "undefined" ? /Firefox/.test(navigator.userAgent) : false;
}

// src/utilities/isString.ts
function isString(value) {
  return typeof value === "string";
}

// src/utilities/markdown/index.ts
var markdown_exports = {};
__export(markdown_exports, {
  createAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,
  createBlockMarkdownSpec: () => createBlockMarkdownSpec,
  createInlineMarkdownSpec: () => createInlineMarkdownSpec,
  parseAttributes: () => parseAttributes,
  parseIndentedBlocks: () => parseIndentedBlocks,
  renderNestedMarkdownContent: () => renderNestedMarkdownContent,
  serializeAttributes: () => serializeAttributes
});

// src/utilities/markdown/attributeUtils.ts
function parseAttributes(attrString) {
  if (!(attrString == null ? void 0 : attrString.trim())) {
    return {};
  }
  const attributes = {};
  const quotedStrings = [];
  const tempString = attrString.replace(/["']([^"']*)["']/g, (match) => {
    quotedStrings.push(match);
    return `__QUOTED_${quotedStrings.length - 1}__`;
  });
  const classMatches = tempString.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
  if (classMatches) {
    const classes = classMatches.map((match) => match.trim().slice(1));
    attributes.class = classes.join(" ");
  }
  const idMatch = tempString.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
  if (idMatch) {
    attributes.id = idMatch[1];
  }
  const kvRegex = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
  const kvMatches = Array.from(tempString.matchAll(kvRegex));
  kvMatches.forEach(([, key, quotedRef]) => {
    var _a;
    const quotedIndex = parseInt(((_a = quotedRef.match(/__QUOTED_(\d+)__/)) == null ? void 0 : _a[1]) || "0", 10);
    const quotedValue = quotedStrings[quotedIndex];
    if (quotedValue) {
      attributes[key] = quotedValue.slice(1, -1);
    }
  });
  const cleanString = tempString.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
  if (cleanString) {
    const booleanAttrs = cleanString.split(/\s+/).filter(Boolean);
    booleanAttrs.forEach((attr) => {
      if (attr.match(/^[a-zA-Z][\w-]*$/)) {
        attributes[attr] = true;
      }
    });
  }
  return attributes;
}
function serializeAttributes(attributes) {
  if (!attributes || Object.keys(attributes).length === 0) {
    return "";
  }
  const parts = [];
  if (attributes.class) {
    const classes = String(attributes.class).split(/\s+/).filter(Boolean);
    classes.forEach((cls) => parts.push(`.${cls}`));
  }
  if (attributes.id) {
    parts.push(`#${attributes.id}`);
  }
  Object.entries(attributes).forEach(([key, value]) => {
    if (key === "class" || key === "id") {
      return;
    }
    if (value === true) {
      parts.push(key);
    } else if (value !== false && value != null) {
      parts.push(`${key}="${String(value)}"`);
    }
  });
  return parts.join(" ");
}

// src/utilities/markdown/createAtomBlockMarkdownSpec.ts
function createAtomBlockMarkdownSpec(options) {
  const {
    nodeName,
    name: markdownName,
    parseAttributes: parseAttributes2 = parseAttributes,
    serializeAttributes: serializeAttributes2 = serializeAttributes,
    defaultAttributes = {},
    requiredAttributes = [],
    allowedAttributes
  } = options;
  const blockName = markdownName || nodeName;
  const filterAttributes = (attrs) => {
    if (!allowedAttributes) {
      return attrs;
    }
    const filtered = {};
    allowedAttributes.forEach((key) => {
      if (key in attrs) {
        filtered[key] = attrs[key];
      }
    });
    return filtered;
  };
  return {
    parseMarkdown: (token, h2) => {
      const attrs = { ...defaultAttributes, ...token.attributes };
      return h2.createNode(nodeName, attrs, []);
    },
    markdownTokenizer: {
      name: nodeName,
      level: "block",
      start(src) {
        var _a;
        const regex = new RegExp(`^:::${blockName}(?:\\s|$)`, "m");
        const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
        return index !== void 0 ? index : -1;
      },
      tokenize(src, _tokens, _lexer) {
        const regex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`);
        const match = src.match(regex);
        if (!match) {
          return void 0;
        }
        const attrString = match[1] || "";
        const attributes = parseAttributes2(attrString);
        const missingRequired = requiredAttributes.find((required) => !(required in attributes));
        if (missingRequired) {
          return void 0;
        }
        return {
          type: nodeName,
          raw: match[0],
          attributes
        };
      }
    },
    renderMarkdown: (node) => {
      const filteredAttrs = filterAttributes(node.attrs || {});
      const attrs = serializeAttributes2(filteredAttrs);
      const attrString = attrs ? ` {${attrs}}` : "";
      return `:::${blockName}${attrString} :::`;
    }
  };
}

// src/utilities/markdown/createBlockMarkdownSpec.ts
function createBlockMarkdownSpec(options) {
  const {
    nodeName,
    name: markdownName,
    getContent,
    parseAttributes: parseAttributes2 = parseAttributes,
    serializeAttributes: serializeAttributes2 = serializeAttributes,
    defaultAttributes = {},
    content = "block",
    allowedAttributes
  } = options;
  const blockName = markdownName || nodeName;
  const filterAttributes = (attrs) => {
    if (!allowedAttributes) {
      return attrs;
    }
    const filtered = {};
    allowedAttributes.forEach((key) => {
      if (key in attrs) {
        filtered[key] = attrs[key];
      }
    });
    return filtered;
  };
  return {
    parseMarkdown: (token, h2) => {
      let nodeContent;
      if (getContent) {
        const contentResult = getContent(token);
        nodeContent = typeof contentResult === "string" ? [{ type: "text", text: contentResult }] : contentResult;
      } else if (content === "block") {
        nodeContent = h2.parseChildren(token.tokens || []);
      } else {
        nodeContent = h2.parseInline(token.tokens || []);
      }
      const attrs = { ...defaultAttributes, ...token.attributes };
      return h2.createNode(nodeName, attrs, nodeContent);
    },
    markdownTokenizer: {
      name: nodeName,
      level: "block",
      start(src) {
        var _a;
        const regex = new RegExp(`^:::${blockName}`, "m");
        const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
        return index !== void 0 ? index : -1;
      },
      tokenize(src, _tokens, lexer) {
        var _a;
        const openingRegex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*\\n`);
        const openingMatch = src.match(openingRegex);
        if (!openingMatch) {
          return void 0;
        }
        const [openingTag, attrString = ""] = openingMatch;
        const attributes = parseAttributes2(attrString);
        let level = 1;
        const position = openingTag.length;
        let matchedContent = "";
        const blockPattern = /^:::([\w-]*)(\s.*)?/gm;
        const remaining = src.slice(position);
        blockPattern.lastIndex = 0;
        for (; ; ) {
          const match = blockPattern.exec(remaining);
          if (match === null) {
            break;
          }
          const matchPos = match.index;
          const blockType = match[1];
          if ((_a = match[2]) == null ? void 0 : _a.endsWith(":::")) {
            continue;
          }
          if (blockType) {
            level += 1;
          } else {
            level -= 1;
            if (level === 0) {
              const rawContent = remaining.slice(0, matchPos);
              matchedContent = rawContent.trim();
              const fullMatch = src.slice(0, position + matchPos + match[0].length);
              let contentTokens = [];
              if (matchedContent) {
                if (content === "block") {
                  contentTokens = lexer.blockTokens(rawContent);
                  contentTokens.forEach((token) => {
                    if (token.text && (!token.tokens || token.tokens.length === 0)) {
                      token.tokens = lexer.inlineTokens(token.text);
                    }
                  });
                  while (contentTokens.length > 0) {
                    const lastToken = contentTokens[contentTokens.length - 1];
                    if (lastToken.type === "paragraph" && (!lastToken.text || lastToken.text.trim() === "")) {
                      contentTokens.pop();
                    } else {
                      break;
                    }
                  }
                } else {
                  contentTokens = lexer.inlineTokens(matchedContent);
                }
              }
              return {
                type: nodeName,
                raw: fullMatch,
                attributes,
                content: matchedContent,
                tokens: contentTokens
              };
            }
          }
        }
        return void 0;
      }
    },
    renderMarkdown: (node, h2) => {
      const filteredAttrs = filterAttributes(node.attrs || {});
      const attrs = serializeAttributes2(filteredAttrs);
      const attrString = attrs ? ` {${attrs}}` : "";
      const renderedContent = h2.renderChildren(node.content || [], "\n\n");
      return `:::${blockName}${attrString}

${renderedContent}

:::`;
    }
  };
}

// src/utilities/markdown/createInlineMarkdownSpec.ts
function parseShortcodeAttributes(attrString) {
  if (!attrString.trim()) {
    return {};
  }
  const attributes = {};
  const regex = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
  let match = regex.exec(attrString);
  while (match !== null) {
    const [, key, doubleQuoted, singleQuoted] = match;
    attributes[key] = doubleQuoted || singleQuoted;
    match = regex.exec(attrString);
  }
  return attributes;
}
function serializeShortcodeAttributes(attrs) {
  return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}="${value}"`).join(" ");
}
function createInlineMarkdownSpec(options) {
  const {
    nodeName,
    name: shortcodeName,
    getContent,
    parseAttributes: parseAttributes2 = parseShortcodeAttributes,
    serializeAttributes: serializeAttributes2 = serializeShortcodeAttributes,
    defaultAttributes = {},
    selfClosing = false,
    allowedAttributes
  } = options;
  const shortcode = shortcodeName || nodeName;
  const filterAttributes = (attrs) => {
    if (!allowedAttributes) {
      return attrs;
    }
    const filtered = {};
    allowedAttributes.forEach((attr) => {
      const attrName = typeof attr === "string" ? attr : attr.name;
      const skipIfDefault = typeof attr === "string" ? void 0 : attr.skipIfDefault;
      if (attrName in attrs) {
        const value = attrs[attrName];
        if (skipIfDefault !== void 0 && value === skipIfDefault) {
          return;
        }
        filtered[attrName] = value;
      }
    });
    return filtered;
  };
  const escapedShortcode = shortcode.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  return {
    parseMarkdown: (token, h2) => {
      const attrs = { ...defaultAttributes, ...token.attributes };
      if (selfClosing) {
        return h2.createNode(nodeName, attrs);
      }
      const content = getContent ? getContent(token) : token.content || "";
      if (content) {
        return h2.createNode(nodeName, attrs, [h2.createTextNode(content)]);
      }
      return h2.createNode(nodeName, attrs, []);
    },
    markdownTokenizer: {
      name: nodeName,
      level: "inline",
      start(src) {
        const startPattern = selfClosing ? new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\]`) : new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${escapedShortcode}\\]`);
        const match = src.match(startPattern);
        const index = match == null ? void 0 : match.index;
        return index !== void 0 ? index : -1;
      },
      tokenize(src, _tokens, _lexer) {
        const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`);
        const match = src.match(tokenPattern);
        if (!match) {
          return void 0;
        }
        let content = "";
        let attrString = "";
        if (selfClosing) {
          const [, attrs] = match;
          attrString = attrs;
        } else {
          const [, attrs, contentMatch] = match;
          attrString = attrs;
          content = contentMatch || "";
        }
        const attributes = parseAttributes2(attrString.trim());
        return {
          type: nodeName,
          raw: match[0],
          content: content.trim(),
          attributes
        };
      }
    },
    renderMarkdown: (node) => {
      let content = "";
      if (getContent) {
        content = getContent(node);
      } else if (node.content && node.content.length > 0) {
        content = node.content.filter((child) => child.type === "text").map((child) => child.text).join("");
      }
      const filteredAttrs = filterAttributes(node.attrs || {});
      const attrs = serializeAttributes2(filteredAttrs);
      const attrString = attrs ? ` ${attrs}` : "";
      if (selfClosing) {
        return `[${shortcode}${attrString}]`;
      }
      return `[${shortcode}${attrString}]${content}[/${shortcode}]`;
    }
  };
}

// src/utilities/markdown/parseIndentedBlocks.ts
function parseIndentedBlocks(src, config, lexer) {
  var _a, _b, _c, _d;
  const lines = src.split("\n");
  const items = [];
  let totalRaw = "";
  let i = 0;
  const baseIndentSize = config.baseIndentSize || 2;
  while (i < lines.length) {
    const currentLine = lines[i];
    const itemMatch = currentLine.match(config.itemPattern);
    if (!itemMatch) {
      if (items.length > 0) {
        break;
      } else if (currentLine.trim() === "") {
        i += 1;
        totalRaw = `${totalRaw}${currentLine}
`;
        continue;
      } else {
        return void 0;
      }
    }
    const itemData = config.extractItemData(itemMatch);
    const { indentLevel, mainContent } = itemData;
    totalRaw = `${totalRaw}${currentLine}
`;
    const itemContent = [mainContent];
    i += 1;
    while (i < lines.length) {
      const nextLine = lines[i];
      if (nextLine.trim() === "") {
        const nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== "");
        if (nextNonEmptyIndex === -1) {
          break;
        }
        const nextNonEmpty = lines[i + 1 + nextNonEmptyIndex];
        const nextIndent2 = ((_b = (_a = nextNonEmpty.match(/^(\s*)/)) == null ? void 0 : _a[1]) == null ? void 0 : _b.length) || 0;
        if (nextIndent2 > indentLevel) {
          itemContent.push(nextLine);
          totalRaw = `${totalRaw}${nextLine}
`;
          i += 1;
          continue;
        } else {
          break;
        }
      }
      const nextIndent = ((_d = (_c = nextLine.match(/^(\s*)/)) == null ? void 0 : _c[1]) == null ? void 0 : _d.length) || 0;
      if (nextIndent > indentLevel) {
        itemContent.push(nextLine);
        totalRaw = `${totalRaw}${nextLine}
`;
        i += 1;
      } else {
        break;
      }
    }
    let nestedTokens;
    const nestedContent = itemContent.slice(1);
    if (nestedContent.length > 0) {
      const dedentedNested = nestedContent.map((nestedLine) => nestedLine.slice(indentLevel + baseIndentSize)).join("\n");
      if (dedentedNested.trim()) {
        if (config.customNestedParser) {
          nestedTokens = config.customNestedParser(dedentedNested);
        } else {
          nestedTokens = lexer.blockTokens(dedentedNested);
        }
      }
    }
    const token = config.createToken(itemData, nestedTokens);
    items.push(token);
  }
  if (items.length === 0) {
    return void 0;
  }
  return {
    items,
    raw: totalRaw
  };
}

// src/utilities/markdown/renderNestedMarkdownContent.ts
function renderNestedMarkdownContent(node, h2, prefixOrGenerator, ctx) {
  if (!node || !Array.isArray(node.content)) {
    return "";
  }
  const prefix = typeof prefixOrGenerator === "function" ? prefixOrGenerator(ctx) : prefixOrGenerator;
  const [content, ...children] = node.content;
  const mainContent = h2.renderChildren([content]);
  const output = [`${prefix}${mainContent}`];
  if (children && children.length > 0) {
    children.forEach((child) => {
      const childContent = h2.renderChildren([child]);
      if (childContent) {
        const indentedChild = childContent.split("\n").map((line) => line ? h2.indent(line) : "").join("\n");
        output.push(indentedChild);
      }
    });
  }
  return output.join("\n");
}

// src/MarkView.ts
function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
  const { state } = editor;
  const { doc, tr } = state;
  const thisMark = checkMark;
  doc.descendants((node, pos) => {
    const from = tr.mapping.map(pos);
    const to = tr.mapping.map(pos) + node.nodeSize;
    let foundMark = null;
    node.marks.forEach((mark) => {
      if (mark !== thisMark) {
        return false;
      }
      foundMark = mark;
    });
    if (!foundMark) {
      return;
    }
    let needsUpdate = false;
    Object.keys(attrs).forEach((k) => {
      if (attrs[k] !== foundMark.attrs[k]) {
        needsUpdate = true;
      }
    });
    if (needsUpdate) {
      const updatedMark = checkMark.type.create({
        ...checkMark.attrs,
        ...attrs
      });
      tr.removeMark(from, to, checkMark.type);
      tr.addMark(from, to, updatedMark);
    }
  });
  if (tr.docChanged) {
    editor.view.dispatch(tr);
  }
}
var MarkView = class {
  constructor(component, props, options) {
    this.component = component;
    this.editor = props.editor;
    this.options = { ...options };
    this.mark = props.mark;
    this.HTMLAttributes = props.HTMLAttributes;
  }
  get dom() {
    return this.editor.view.dom;
  }
  get contentDOM() {
    return null;
  }
  /**
   * Update the attributes of the mark in the document.
   * @param attrs The attributes to update.
   */
  updateAttributes(attrs, checkMark) {
    updateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);
  }
  ignoreMutation(mutation) {
    if (!this.dom || !this.contentDOM) {
      return true;
    }
    if (typeof this.options.ignoreMutation === "function") {
      return this.options.ignoreMutation({ mutation });
    }
    if (mutation.type === "selection") {
      return false;
    }
    if (this.dom.contains(mutation.target) && mutation.type === "childList" && (isiOS() || isAndroid()) && this.editor.isFocused) {
      const changedNodes = [...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)];
      if (changedNodes.every((node) => node.isContentEditable)) {
        return false;
      }
    }
    if (this.contentDOM === mutation.target && mutation.type === "attributes") {
      return true;
    }
    if (this.contentDOM.contains(mutation.target)) {
      return false;
    }
    return true;
  }
};

// src/Node.ts
var Node3 = class _Node extends Extendable {
  constructor() {
    super(...arguments);
    this.type = "node";
  }
  /**
   * Create a new Node instance
   * @param config - Node configuration object or a function that returns a configuration object
   */
  static create(config = {}) {
    const resolvedConfig = typeof config === "function" ? config() : config;
    return new _Node(resolvedConfig);
  }
  configure(options) {
    return super.configure(options);
  }
  extend(extendedConfig) {
    const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
    return super.extend(resolvedConfig);
  }
};

// src/NodeView.ts

var NodeView = class {
  constructor(component, props, options) {
    this.isDragging = false;
    this.component = component;
    this.editor = props.editor;
    this.options = {
      stopEvent: null,
      ignoreMutation: null,
      ...options
    };
    this.extension = props.extension;
    this.node = props.node;
    this.decorations = props.decorations;
    this.innerDecorations = props.innerDecorations;
    this.view = props.view;
    this.HTMLAttributes = props.HTMLAttributes;
    this.getPos = props.getPos;
    this.mount();
  }
  mount() {
    return;
  }
  get dom() {
    return this.editor.view.dom;
  }
  get contentDOM() {
    return null;
  }
  onDragStart(event) {
    var _a, _b, _c, _d, _e, _f, _g;
    const { view } = this.editor;
    const target = event.target;
    const dragHandle = target.nodeType === 3 ? (_a = target.parentElement) == null ? void 0 : _a.closest("[data-drag-handle]") : target.closest("[data-drag-handle]");
    if (!this.dom || ((_b = this.contentDOM) == null ? void 0 : _b.contains(target)) || !dragHandle) {
      return;
    }
    let x = 0;
    let y = 0;
    if (this.dom !== dragHandle) {
      const domBox = this.dom.getBoundingClientRect();
      const handleBox = dragHandle.getBoundingClientRect();
      const offsetX = (_d = event.offsetX) != null ? _d : (_c = event.nativeEvent) == null ? void 0 : _c.offsetX;
      const offsetY = (_f = event.offsetY) != null ? _f : (_e = event.nativeEvent) == null ? void 0 : _e.offsetY;
      x = handleBox.x - domBox.x + offsetX;
      y = handleBox.y - domBox.y + offsetY;
    }
    const clonedNode = this.dom.cloneNode(true);
    try {
      const domBox = this.dom.getBoundingClientRect();
      clonedNode.style.width = `${Math.round(domBox.width)}px`;
      clonedNode.style.height = `${Math.round(domBox.height)}px`;
      clonedNode.style.boxSizing = "border-box";
      clonedNode.style.pointerEvents = "none";
    } catch {
    }
    let dragImageWrapper = null;
    try {
      dragImageWrapper = document.createElement("div");
      dragImageWrapper.style.position = "absolute";
      dragImageWrapper.style.top = "-9999px";
      dragImageWrapper.style.left = "-9999px";
      dragImageWrapper.style.pointerEvents = "none";
      dragImageWrapper.appendChild(clonedNode);
      document.body.appendChild(dragImageWrapper);
      (_g = event.dataTransfer) == null ? void 0 : _g.setDragImage(clonedNode, x, y);
    } finally {
      if (dragImageWrapper) {
        setTimeout(() => {
          try {
            dragImageWrapper == null ? void 0 : dragImageWrapper.remove();
          } catch {
          }
        }, 0);
      }
    }
    const pos = this.getPos();
    if (typeof pos !== "number") {
      return;
    }
    const selection = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(view.state.doc, pos);
    const transaction = view.state.tr.setSelection(selection);
    view.dispatch(transaction);
  }
  stopEvent(event) {
    var _a;
    if (!this.dom) {
      return false;
    }
    if (typeof this.options.stopEvent === "function") {
      return this.options.stopEvent({ event });
    }
    const target = event.target;
    const isInElement = this.dom.contains(target) && !((_a = this.contentDOM) == null ? void 0 : _a.contains(target));
    if (!isInElement) {
      return false;
    }
    const isDragEvent = event.type.startsWith("drag");
    const isDropEvent = event.type === "drop";
    const isInput = ["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(target.tagName) || target.isContentEditable;
    if (isInput && !isDropEvent && !isDragEvent) {
      return true;
    }
    const { isEditable } = this.editor;
    const { isDragging } = this;
    const isDraggable = !!this.node.type.spec.draggable;
    const isSelectable = _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.isSelectable(this.node);
    const isCopyEvent = event.type === "copy";
    const isPasteEvent = event.type === "paste";
    const isCutEvent = event.type === "cut";
    const isClickEvent = event.type === "mousedown";
    if (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) {
      event.preventDefault();
    }
    if (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {
      event.preventDefault();
      return false;
    }
    if (isDraggable && isEditable && !isDragging && isClickEvent) {
      const dragHandle = target.closest("[data-drag-handle]");
      const isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));
      if (isValidDragHandle) {
        this.isDragging = true;
        document.addEventListener(
          "dragend",
          () => {
            this.isDragging = false;
          },
          { once: true }
        );
        document.addEventListener(
          "drop",
          () => {
            this.isDragging = false;
          },
          { once: true }
        );
        document.addEventListener(
          "mouseup",
          () => {
            this.isDragging = false;
          },
          { once: true }
        );
      }
    }
    if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
      return false;
    }
    return true;
  }
  /**
   * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.
   * @return `false` if the editor should re-read the selection or re-parse the range around the mutation
   * @return `true` if it can safely be ignored.
   */
  ignoreMutation(mutation) {
    if (!this.dom || !this.contentDOM) {
      return true;
    }
    if (typeof this.options.ignoreMutation === "function") {
      return this.options.ignoreMutation({ mutation });
    }
    if (this.node.isLeaf || this.node.isAtom) {
      return true;
    }
    if (mutation.type === "selection") {
      return false;
    }
    if (this.dom.contains(mutation.target) && mutation.type === "childList" && (isiOS() || isAndroid()) && this.editor.isFocused) {
      const changedNodes = [...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)];
      if (changedNodes.every((node) => node.isContentEditable)) {
        return false;
      }
    }
    if (this.contentDOM === mutation.target && mutation.type === "attributes") {
      return true;
    }
    if (this.contentDOM.contains(mutation.target)) {
      return false;
    }
    return true;
  }
  /**
   * Update the attributes of the prosemirror node.
   */
  updateAttributes(attributes) {
    this.editor.commands.command(({ tr }) => {
      const pos = this.getPos();
      if (typeof pos !== "number") {
        return false;
      }
      tr.setNodeMarkup(pos, void 0, {
        ...this.node.attrs,
        ...attributes
      });
      return true;
    });
  }
  /**
   * Delete the node.
   */
  deleteNode() {
    const from = this.getPos();
    if (typeof from !== "number") {
      return;
    }
    const to = from + this.node.nodeSize;
    this.editor.commands.deleteRange({ from, to });
  }
};

// src/pasteRules/markPasteRule.ts
function markPasteRule(config) {
  return new PasteRule({
    find: config.find,
    handler: ({ state, range, match, pasteEvent }) => {
      const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
      if (attributes === false || attributes === null) {
        return null;
      }
      const { tr } = state;
      const captureGroup = match[match.length - 1];
      const fullMatch = match[0];
      let markEnd = range.to;
      if (captureGroup) {
        const startSpaces = fullMatch.search(/\S/);
        const textStart = range.from + fullMatch.indexOf(captureGroup);
        const textEnd = textStart + captureGroup.length;
        const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {
          const excluded = item.mark.type.excluded;
          return excluded.find((type) => type === config.type && type !== item.mark.type);
        }).filter((item) => item.to > textStart);
        if (excludedMarks.length) {
          return null;
        }
        if (textEnd < range.to) {
          tr.delete(textEnd, range.to);
        }
        if (textStart > range.from) {
          tr.delete(range.from + startSpaces, textStart);
        }
        markEnd = range.from + startSpaces + captureGroup.length;
        tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
        tr.removeStoredMark(config.type);
      }
    }
  });
}

// src/pasteRules/nodePasteRule.ts
function nodePasteRule(config) {
  return new PasteRule({
    find: config.find,
    handler({ match, chain, range, pasteEvent }) {
      const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
      const content = callOrReturn(config.getContent, void 0, attributes);
      if (attributes === false || attributes === null) {
        return null;
      }
      const node = { type: config.type.name, attrs: attributes };
      if (content) {
        node.content = content;
      }
      if (match.input) {
        chain().deleteRange(range).insertContentAt(range.from, node);
      }
    }
  });
}

// src/pasteRules/textPasteRule.ts
function textPasteRule(config) {
  return new PasteRule({
    find: config.find,
    handler: ({ state, range, match }) => {
      let insert = config.replace;
      let start = range.from;
      const end = range.to;
      if (match[1]) {
        const offset = match[0].lastIndexOf(match[1]);
        insert += match[0].slice(offset + match[1].length);
        start += offset;
        const cutOff = start - end;
        if (cutOff > 0) {
          insert = match[0].slice(offset - cutOff, offset) + insert;
          start = end;
        }
      }
      state.tr.insertText(insert, start, end);
    }
  });
}

// src/Tracker.ts
var Tracker = class {
  constructor(transaction) {
    this.transaction = transaction;
    this.currentStep = this.transaction.steps.length;
  }
  map(position) {
    let deleted = false;
    const mappedPosition = this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {
      const mapResult = step.getMap().mapResult(newPosition);
      if (mapResult.deleted) {
        deleted = true;
      }
      return mapResult.pos;
    }, position);
    return {
      position: mappedPosition,
      deleted
    };
  }
};

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js":
/*!*******************************************************************!*\
  !*** ./node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js ***!
  \*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Fragment: function() { return /* binding */ Fragment; },
/* harmony export */   createElement: function() { return /* binding */ h; },
/* harmony export */   h: function() { return /* binding */ h; },
/* harmony export */   jsx: function() { return /* binding */ h; },
/* harmony export */   jsxDEV: function() { return /* binding */ h; },
/* harmony export */   jsxs: function() { return /* binding */ h; }
/* harmony export */ });
// src/jsx-runtime.ts
function Fragment(props) {
  return props.children;
}
var h = (tag, attributes) => {
  if (tag === "slot") {
    return 0;
  }
  if (tag instanceof Function) {
    return tag(attributes);
  }
  const { children, ...rest } = attributes != null ? attributes : {};
  if (tag === "svg") {
    throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
  }
  return [tag, rest, children];
};

//# sourceMappingURL=jsx-runtime.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-bold/dist/index.js":
/*!***********************************************************!*\
  !*** ./node_modules/@tiptap/extension-bold/dist/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Bold: function() { return /* binding */ Bold; },
/* harmony export */   "default": function() { return /* binding */ index_default; },
/* harmony export */   starInputRegex: function() { return /* binding */ starInputRegex; },
/* harmony export */   starPasteRegex: function() { return /* binding */ starPasteRegex; },
/* harmony export */   underscoreInputRegex: function() { return /* binding */ underscoreInputRegex; },
/* harmony export */   underscorePasteRegex: function() { return /* binding */ underscorePasteRegex; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
/* harmony import */ var _tiptap_core_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tiptap/core/jsx-runtime */ "./node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js");
// src/bold.tsx


var starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
var starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
var underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
var underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
var Bold = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "bold",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "strong"
      },
      {
        tag: "b",
        getAttrs: (node) => node.style.fontWeight !== "normal" && null
      },
      {
        style: "font-weight=400",
        clearMark: (mark) => mark.type.name === this.name
      },
      {
        style: "font-weight",
        getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return /* @__PURE__ */ (0,_tiptap_core_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("strong", { ...(0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), children: /* @__PURE__ */ (0,_tiptap_core_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("slot", {}) });
  },
  markdownTokenName: "strong",
  parseMarkdown: (token, helpers) => {
    return helpers.applyMark("bold", helpers.parseInline(token.tokens || []));
  },
  renderMarkdown: (node, h) => {
    return `**${h.renderChildren(node)}**`;
  },
  addCommands() {
    return {
      setBold: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleBold: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetBold: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-b": () => this.editor.commands.toggleBold(),
      "Mod-B": () => this.editor.commands.toggleBold()
    };
  },
  addInputRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markInputRule)({
        find: starInputRegex,
        type: this.type
      }),
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markInputRule)({
        find: underscoreInputRegex,
        type: this.type
      })
    ];
  },
  addPasteRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: starPasteRegex,
        type: this.type
      }),
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: underscorePasteRegex,
        type: this.type
      })
    ];
  }
});

// src/index.ts
var index_default = Bold;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-document/dist/index.js":
/*!***************************************************************!*\
  !*** ./node_modules/@tiptap/extension-document/dist/index.js ***!
  \***************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Document: function() { return /* binding */ Document; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/document.ts

var Document = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({
  name: "doc",
  topNode: true,
  content: "block+",
  renderMarkdown: (node, h) => {
    if (!node.content) {
      return "";
    }
    return h.renderChildren(node.content, "\n\n");
  }
});

// src/index.ts
var index_default = Document;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-hard-break/dist/index.js":
/*!*****************************************************************!*\
  !*** ./node_modules/@tiptap/extension-hard-break/dist/index.js ***!
  \*****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   HardBreak: function() { return /* binding */ HardBreak; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/hard-break.ts

var HardBreak = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({
  name: "hardBreak",
  markdownTokenName: "br",
  addOptions() {
    return {
      keepMarks: true,
      HTMLAttributes: {}
    };
  },
  inline: true,
  group: "inline",
  selectable: false,
  linebreakReplacement: true,
  parseHTML() {
    return [{ tag: "br" }];
  },
  renderHTML({ HTMLAttributes }) {
    return ["br", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
  },
  renderText() {
    return "\n";
  },
  renderMarkdown: () => `  
`,
  parseMarkdown: () => {
    return {
      type: "hardBreak"
    };
  },
  addCommands() {
    return {
      setHardBreak: () => ({ commands, chain, state, editor }) => {
        return commands.first([
          () => commands.exitCode(),
          () => commands.command(() => {
            const { selection, storedMarks } = state;
            if (selection.$from.parent.type.spec.isolating) {
              return false;
            }
            const { keepMarks } = this.options;
            const { splittableMarks } = editor.extensionManager;
            const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
            return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
              if (dispatch && marks && keepMarks) {
                const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
                tr.ensureMarks(filteredMarks);
              }
              return true;
            }).run();
          })
        ]);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-Enter": () => this.editor.commands.setHardBreak(),
      "Shift-Enter": () => this.editor.commands.setHardBreak()
    };
  }
});

// src/index.ts
var index_default = HardBreak;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-heading/dist/index.js":
/*!**************************************************************!*\
  !*** ./node_modules/@tiptap/extension-heading/dist/index.js ***!
  \**************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Heading: function() { return /* binding */ Heading; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/heading.ts

var Heading = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({
  name: "heading",
  addOptions() {
    return {
      levels: [1, 2, 3, 4, 5, 6],
      HTMLAttributes: {}
    };
  },
  content: "inline*",
  group: "block",
  defining: true,
  addAttributes() {
    return {
      level: {
        default: 1,
        rendered: false
      }
    };
  },
  parseHTML() {
    return this.options.levels.map((level) => ({
      tag: `h${level}`,
      attrs: { level }
    }));
  },
  renderHTML({ node, HTMLAttributes }) {
    const hasLevel = this.options.levels.includes(node.attrs.level);
    const level = hasLevel ? node.attrs.level : this.options.levels[0];
    return [`h${level}`, (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  parseMarkdown: (token, helpers) => {
    return helpers.createNode("heading", { level: token.depth || 1 }, helpers.parseInline(token.tokens || []));
  },
  renderMarkdown: (node, h) => {
    var _a;
    const level = ((_a = node.attrs) == null ? void 0 : _a.level) ? parseInt(node.attrs.level, 10) : 1;
    const headingChars = "#".repeat(level);
    if (!node.content) {
      return "";
    }
    return `${headingChars} ${h.renderChildren(node.content)}`;
  },
  addCommands() {
    return {
      setHeading: (attributes) => ({ commands }) => {
        if (!this.options.levels.includes(attributes.level)) {
          return false;
        }
        return commands.setNode(this.name, attributes);
      },
      toggleHeading: (attributes) => ({ commands }) => {
        if (!this.options.levels.includes(attributes.level)) {
          return false;
        }
        return commands.toggleNode(this.name, "paragraph", attributes);
      }
    };
  },
  addKeyboardShortcuts() {
    return this.options.levels.reduce(
      (items, level) => ({
        ...items,
        ...{
          [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
        }
      }),
      {}
    );
  },
  addInputRules() {
    return this.options.levels.map((level) => {
      return (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.textblockTypeInputRule)({
        find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
        type: this.type,
        getAttributes: {
          level
        }
      });
    });
  }
});

// src/index.ts
var index_default = Heading;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-italic/dist/index.js":
/*!*************************************************************!*\
  !*** ./node_modules/@tiptap/extension-italic/dist/index.js ***!
  \*************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Italic: function() { return /* binding */ Italic; },
/* harmony export */   "default": function() { return /* binding */ index_default; },
/* harmony export */   starInputRegex: function() { return /* binding */ starInputRegex; },
/* harmony export */   starPasteRegex: function() { return /* binding */ starPasteRegex; },
/* harmony export */   underscoreInputRegex: function() { return /* binding */ underscoreInputRegex; },
/* harmony export */   underscorePasteRegex: function() { return /* binding */ underscorePasteRegex; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/italic.ts

var starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
var starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
var underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
var underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
var Italic = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "italic",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "em"
      },
      {
        tag: "i",
        getAttrs: (node) => node.style.fontStyle !== "normal" && null
      },
      {
        style: "font-style=normal",
        clearMark: (mark) => mark.type.name === this.name
      },
      {
        style: "font-style=italic"
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["em", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  addCommands() {
    return {
      setItalic: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleItalic: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetItalic: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  markdownTokenName: "em",
  parseMarkdown: (token, helpers) => {
    return helpers.applyMark("italic", helpers.parseInline(token.tokens || []));
  },
  renderMarkdown: (node, h) => {
    return `*${h.renderChildren(node)}*`;
  },
  addKeyboardShortcuts() {
    return {
      "Mod-i": () => this.editor.commands.toggleItalic(),
      "Mod-I": () => this.editor.commands.toggleItalic()
    };
  },
  addInputRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markInputRule)({
        find: starInputRegex,
        type: this.type
      }),
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markInputRule)({
        find: underscoreInputRegex,
        type: this.type
      })
    ];
  },
  addPasteRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: starPasteRegex,
        type: this.type
      }),
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: underscorePasteRegex,
        type: this.type
      })
    ];
  }
});

// src/index.ts
var index_default = Italic;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-link/dist/index.js":
/*!***********************************************************!*\
  !*** ./node_modules/@tiptap/extension-link/dist/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Link: function() { return /* binding */ Link; },
/* harmony export */   "default": function() { return /* binding */ index_default; },
/* harmony export */   isAllowedUri: function() { return /* binding */ isAllowedUri; },
/* harmony export */   pasteRegex: function() { return /* binding */ pasteRegex; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
/* harmony import */ var linkifyjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! linkifyjs */ "./node_modules/linkifyjs/dist/linkify.mjs");
/* harmony import */ var _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiptap/pm/state */ "./node_modules/@tiptap/pm/dist/state/index.js");
// src/link.ts



// src/helpers/autolink.ts




// src/helpers/whitespace.ts
var UNICODE_WHITESPACE_PATTERN = "[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]";
var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
var UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);
var UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, "g");

// src/helpers/autolink.ts
function isValidLinkStructure(tokens) {
  if (tokens.length === 1) {
    return tokens[0].isLink;
  }
  if (tokens.length === 3 && tokens[1].isLink) {
    return ["()", "[]"].includes(tokens[0].value + tokens[2].value);
  }
  return false;
}
function autolink(options) {
  return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
    key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("autolink"),
    appendTransaction: (transactions, oldState, newState) => {
      const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
      const preventAutolink = transactions.some((transaction) => transaction.getMeta("preventAutolink"));
      if (!docChanges || preventAutolink) {
        return;
      }
      const { tr } = newState;
      const transform = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.combineTransactionSteps)(oldState.doc, [...transactions]);
      const changes = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getChangedRanges)(transform);
      changes.forEach(({ newRange }) => {
        const nodesInChangedRanges = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.findChildrenInRange)(newState.doc, newRange, (node) => node.isTextblock);
        let textBlock;
        let textBeforeWhitespace;
        if (nodesInChangedRanges.length > 1) {
          textBlock = nodesInChangedRanges[0];
          textBeforeWhitespace = newState.doc.textBetween(
            textBlock.pos,
            textBlock.pos + textBlock.node.nodeSize,
            void 0,
            " "
          );
        } else if (nodesInChangedRanges.length) {
          const endText = newState.doc.textBetween(newRange.from, newRange.to, " ", " ");
          if (!UNICODE_WHITESPACE_REGEX_END.test(endText)) {
            return;
          }
          textBlock = nodesInChangedRanges[0];
          textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, void 0, " ");
        }
        if (textBlock && textBeforeWhitespace) {
          const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);
          if (wordsBeforeWhitespace.length <= 0) {
            return false;
          }
          const lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];
          const lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);
          if (!lastWordBeforeSpace) {
            return false;
          }
          const linksBeforeSpace = (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.tokenize)(lastWordBeforeSpace).map((t) => t.toObject(options.defaultProtocol));
          if (!isValidLinkStructure(linksBeforeSpace)) {
            return false;
          }
          linksBeforeSpace.filter((link) => link.isLink).map((link) => ({
            ...link,
            from: lastWordAndBlockOffset + link.start + 1,
            to: lastWordAndBlockOffset + link.end + 1
          })).filter((link) => {
            if (!newState.schema.marks.code) {
              return true;
            }
            return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
          }).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {
            if ((0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getMarksBetween)(link.from, link.to, newState.doc).some((item) => item.mark.type === options.type)) {
              return;
            }
            tr.addMark(
              link.from,
              link.to,
              options.type.create({
                href: link.href
              })
            );
          });
        }
      });
      if (!tr.steps.length) {
        return;
      }
      return tr;
    }
  });
}

// src/helpers/clickHandler.ts


function clickHandler(options) {
  return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
    key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("handleClickLink"),
    props: {
      handleClick: (view, pos, event) => {
        var _a, _b;
        if (event.button !== 0) {
          return false;
        }
        if (!view.editable) {
          return false;
        }
        let link = null;
        if (event.target instanceof HTMLAnchorElement) {
          link = event.target;
        } else {
          const target = event.target;
          if (!target) {
            return false;
          }
          const root = options.editor.view.dom;
          link = target.closest("a");
          if (link && !root.contains(link)) {
            link = null;
          }
        }
        if (!link) {
          return false;
        }
        let handled = false;
        if (options.enableClickSelection) {
          const commandResult = options.editor.commands.extendMarkRange(options.type.name);
          handled = commandResult;
        }
        if (options.openOnClick) {
          const attrs = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.getAttributes)(view.state, options.type.name);
          const href = (_a = link.href) != null ? _a : attrs.href;
          const target = (_b = link.target) != null ? _b : attrs.target;
          if (href) {
            window.open(href, target);
            handled = true;
          }
        }
        return handled;
      }
    }
  });
}

// src/helpers/pasteHandler.ts


function pasteHandler(options) {
  return new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.Plugin({
    key: new _tiptap_pm_state__WEBPACK_IMPORTED_MODULE_2__.PluginKey("handlePasteLink"),
    props: {
      handlePaste: (view, _event, slice) => {
        const { shouldAutoLink } = options;
        const { state } = view;
        const { selection } = state;
        const { empty } = selection;
        if (empty) {
          return false;
        }
        let textContent = "";
        slice.content.forEach((node) => {
          textContent += node.textContent;
        });
        const link = (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.find)(textContent, { defaultProtocol: options.defaultProtocol }).find(
          (item) => item.isLink && item.value === textContent
        );
        if (!textContent || !link || shouldAutoLink !== void 0 && !shouldAutoLink(link.value)) {
          return false;
        }
        return options.editor.commands.setMark(options.type, {
          href: link.href
        });
      }
    }
  });
}

// src/link.ts
var pasteRegex = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi;
function isAllowedUri(uri, protocols) {
  const allowedProtocols = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
  if (protocols) {
    protocols.forEach((protocol) => {
      const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
      if (nextProtocol) {
        allowedProtocols.push(nextProtocol);
      }
    });
  }
  return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, "").match(
    new RegExp(
      // eslint-disable-next-line no-useless-escape
      `^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
      "i"
    )
  );
}
var Link = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "link",
  priority: 1e3,
  keepOnSplit: false,
  exitable: true,
  onCreate() {
    if (this.options.validate && !this.options.shouldAutoLink) {
      this.options.shouldAutoLink = this.options.validate;
      console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.");
    }
    this.options.protocols.forEach((protocol) => {
      if (typeof protocol === "string") {
        (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.registerCustomProtocol)(protocol);
        return;
      }
      (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.registerCustomProtocol)(protocol.scheme, protocol.optionalSlashes);
    });
  },
  onDestroy() {
    (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.reset)();
  },
  inclusive() {
    return this.options.autolink;
  },
  addOptions() {
    return {
      openOnClick: true,
      enableClickSelection: false,
      linkOnPaste: true,
      autolink: true,
      protocols: [],
      defaultProtocol: "http",
      HTMLAttributes: {
        target: "_blank",
        rel: "noopener noreferrer nofollow",
        class: null
      },
      isAllowedUri: (url, ctx) => !!isAllowedUri(url, ctx.protocols),
      validate: (url) => !!url,
      shouldAutoLink: (url) => {
        const hasProtocol = /^[a-z][a-z0-9+.-]*:\/\//i.test(url);
        const hasMaybeProtocol = /^[a-z][a-z0-9+.-]*:/i.test(url);
        if (hasProtocol || hasMaybeProtocol && !url.includes("@")) {
          return true;
        }
        const urlWithoutUserinfo = url.includes("@") ? url.split("@").pop() : url;
        const hostname = urlWithoutUserinfo.split(/[/?#:]/)[0];
        if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)) {
          return false;
        }
        if (!/\./.test(hostname)) {
          return false;
        }
        return true;
      }
    };
  },
  addAttributes() {
    return {
      href: {
        default: null,
        parseHTML(element) {
          return element.getAttribute("href");
        }
      },
      target: {
        default: this.options.HTMLAttributes.target
      },
      rel: {
        default: this.options.HTMLAttributes.rel
      },
      class: {
        default: this.options.HTMLAttributes.class
      },
      title: {
        default: null
      }
    };
  },
  parseHTML() {
    return [
      {
        tag: "a[href]",
        getAttrs: (dom) => {
          const href = dom.getAttribute("href");
          if (!href || !this.options.isAllowedUri(href, {
            defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
            protocols: this.options.protocols,
            defaultProtocol: this.options.defaultProtocol
          })) {
            return false;
          }
          return null;
        }
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    if (!this.options.isAllowedUri(HTMLAttributes.href, {
      defaultValidate: (href) => !!isAllowedUri(href, this.options.protocols),
      protocols: this.options.protocols,
      defaultProtocol: this.options.defaultProtocol
    })) {
      return ["a", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, { ...HTMLAttributes, href: "" }), 0];
    }
    return ["a", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  markdownTokenName: "link",
  parseMarkdown: (token, helpers) => {
    return helpers.applyMark("link", helpers.parseInline(token.tokens || []), {
      href: token.href,
      title: token.title || null
    });
  },
  renderMarkdown: (node, h) => {
    var _a, _b, _c, _d;
    const href = (_b = (_a = node.attrs) == null ? void 0 : _a.href) != null ? _b : "";
    const title = (_d = (_c = node.attrs) == null ? void 0 : _c.title) != null ? _d : "";
    const text = h.renderChildren(node);
    return title ? `[${text}](${href} "${title}")` : `[${text}](${href})`;
  },
  addCommands() {
    return {
      setLink: (attributes) => ({ chain }) => {
        const { href } = attributes;
        if (!this.options.isAllowedUri(href, {
          defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
          protocols: this.options.protocols,
          defaultProtocol: this.options.defaultProtocol
        })) {
          return false;
        }
        return chain().setMark(this.name, attributes).setMeta("preventAutolink", true).run();
      },
      toggleLink: (attributes) => ({ chain }) => {
        const { href } = attributes || {};
        if (href && !this.options.isAllowedUri(href, {
          defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
          protocols: this.options.protocols,
          defaultProtocol: this.options.defaultProtocol
        })) {
          return false;
        }
        return chain().toggleMark(this.name, attributes, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
      },
      unsetLink: () => ({ chain }) => {
        return chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
      }
    };
  },
  addPasteRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: (text) => {
          const foundLinks = [];
          if (text) {
            const { protocols, defaultProtocol } = this.options;
            const links = (0,linkifyjs__WEBPACK_IMPORTED_MODULE_1__.find)(text).filter(
              (item) => item.isLink && this.options.isAllowedUri(item.value, {
                defaultValidate: (href) => !!isAllowedUri(href, protocols),
                protocols,
                defaultProtocol
              })
            );
            if (links.length) {
              links.forEach((link) => {
                if (!this.options.shouldAutoLink(link.value)) {
                  return;
                }
                foundLinks.push({
                  text: link.value,
                  data: {
                    href: link.href
                  },
                  index: link.start
                });
              });
            }
          }
          return foundLinks;
        },
        type: this.type,
        getAttributes: (match) => {
          var _a;
          return {
            href: (_a = match.data) == null ? void 0 : _a.href
          };
        }
      })
    ];
  },
  addProseMirrorPlugins() {
    const plugins = [];
    const { protocols, defaultProtocol } = this.options;
    if (this.options.autolink) {
      plugins.push(
        autolink({
          type: this.type,
          defaultProtocol: this.options.defaultProtocol,
          validate: (url) => this.options.isAllowedUri(url, {
            defaultValidate: (href) => !!isAllowedUri(href, protocols),
            protocols,
            defaultProtocol
          }),
          shouldAutoLink: this.options.shouldAutoLink
        })
      );
    }
    plugins.push(
      clickHandler({
        type: this.type,
        editor: this.editor,
        openOnClick: this.options.openOnClick === "whenNotEditable" ? true : this.options.openOnClick,
        enableClickSelection: this.options.enableClickSelection
      })
    );
    if (this.options.linkOnPaste) {
      plugins.push(
        pasteHandler({
          editor: this.editor,
          defaultProtocol: this.options.defaultProtocol,
          type: this.type,
          shouldAutoLink: this.options.shouldAutoLink
        })
      );
    }
    return plugins;
  }
});

// src/index.ts
var index_default = Link;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-paragraph/dist/index.js":
/*!****************************************************************!*\
  !*** ./node_modules/@tiptap/extension-paragraph/dist/index.js ***!
  \****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Paragraph: function() { return /* binding */ Paragraph; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/paragraph.ts

var EMPTY_PARAGRAPH_MARKDOWN = "&nbsp;";
var NBSP_CHAR = "\xA0";
var Paragraph = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({
  name: "paragraph",
  priority: 1e3,
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  group: "block",
  content: "inline*",
  parseHTML() {
    return [{ tag: "p" }];
  },
  renderHTML({ HTMLAttributes }) {
    return ["p", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  parseMarkdown: (token, helpers) => {
    const tokens = token.tokens || [];
    if (tokens.length === 1 && tokens[0].type === "image") {
      return helpers.parseChildren([tokens[0]]);
    }
    const content = helpers.parseInline(tokens);
    if (content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) {
      return helpers.createNode("paragraph", void 0, []);
    }
    return helpers.createNode("paragraph", void 0, content);
  },
  renderMarkdown: (node, h) => {
    if (!node) {
      return "";
    }
    const content = Array.isArray(node.content) ? node.content : [];
    if (content.length === 0) {
      return EMPTY_PARAGRAPH_MARKDOWN;
    }
    return h.renderChildren(content);
  },
  addCommands() {
    return {
      setParagraph: () => ({ commands }) => {
        return commands.setNode(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-Alt-0": () => this.editor.commands.setParagraph()
    };
  }
});

// src/index.ts
var index_default = Paragraph;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-strike/dist/index.js":
/*!*************************************************************!*\
  !*** ./node_modules/@tiptap/extension-strike/dist/index.js ***!
  \*************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Strike: function() { return /* binding */ Strike; },
/* harmony export */   "default": function() { return /* binding */ index_default; },
/* harmony export */   inputRegex: function() { return /* binding */ inputRegex; },
/* harmony export */   pasteRegex: function() { return /* binding */ pasteRegex; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/strike.ts

var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
var Strike = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "strike",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "s"
      },
      {
        tag: "del"
      },
      {
        tag: "strike"
      },
      {
        style: "text-decoration",
        consuming: false,
        getAttrs: (style) => style.includes("line-through") ? {} : false
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["s", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  markdownTokenName: "del",
  parseMarkdown: (token, helpers) => {
    return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
  },
  renderMarkdown: (node, h) => {
    return `~~${h.renderChildren(node)}~~`;
  },
  addCommands() {
    return {
      setStrike: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleStrike: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetStrike: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-Shift-s": () => this.editor.commands.toggleStrike()
    };
  },
  addInputRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markInputRule)({
        find: inputRegex,
        type: this.type
      })
    ];
  },
  addPasteRules() {
    return [
      (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.markPasteRule)({
        find: pasteRegex,
        type: this.type
      })
    ];
  }
});

// src/index.ts
var index_default = Strike;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-subscript/dist/index.js":
/*!****************************************************************!*\
  !*** ./node_modules/@tiptap/extension-subscript/dist/index.js ***!
  \****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Subscript: function() { return /* binding */ Subscript; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/subscript.ts

var Subscript = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "subscript",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "sub"
      },
      {
        style: "vertical-align",
        getAttrs(value) {
          if (value !== "sub") {
            return false;
          }
          return null;
        }
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["sub", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  addCommands() {
    return {
      setSubscript: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleSubscript: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetSubscript: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-,": () => this.editor.commands.toggleSubscript()
    };
  }
});

// src/index.ts
var index_default = Subscript;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-superscript/dist/index.js":
/*!******************************************************************!*\
  !*** ./node_modules/@tiptap/extension-superscript/dist/index.js ***!
  \******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Superscript: function() { return /* binding */ Superscript; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/superscript.ts

var Superscript = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "superscript",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "sup"
      },
      {
        style: "vertical-align",
        getAttrs(value) {
          if (value !== "super") {
            return false;
          }
          return null;
        }
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["sup", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  addCommands() {
    return {
      setSuperscript: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleSuperscript: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetSuperscript: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-.": () => this.editor.commands.toggleSuperscript()
    };
  }
});

// src/index.ts
var index_default = Superscript;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-text/dist/index.js":
/*!***********************************************************!*\
  !*** ./node_modules/@tiptap/extension-text/dist/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Text: function() { return /* binding */ Text; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/text.ts

var Text = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Node.create({
  name: "text",
  group: "inline",
  parseMarkdown: (token) => {
    return {
      type: "text",
      text: token.text || ""
    };
  },
  renderMarkdown: (node) => node.text || ""
});

// src/index.ts
var index_default = Text;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/extension-underline/dist/index.js":
/*!****************************************************************!*\
  !*** ./node_modules/@tiptap/extension-underline/dist/index.js ***!
  \****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Underline: function() { return /* binding */ Underline; },
/* harmony export */   "default": function() { return /* binding */ index_default; }
/* harmony export */ });
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
// src/underline.ts

var Underline = _tiptap_core__WEBPACK_IMPORTED_MODULE_0__.Mark.create({
  name: "underline",
  addOptions() {
    return {
      HTMLAttributes: {}
    };
  },
  parseHTML() {
    return [
      {
        tag: "u"
      },
      {
        style: "text-decoration",
        consuming: false,
        getAttrs: (style) => style.includes("underline") ? {} : false
      }
    ];
  },
  renderHTML({ HTMLAttributes }) {
    return ["u", (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
  },
  parseMarkdown(token, helpers) {
    return helpers.applyMark(this.name || "underline", helpers.parseInline(token.tokens || []));
  },
  renderMarkdown(node, helpers) {
    return `++${helpers.renderChildren(node)}++`;
  },
  markdownTokenizer: {
    name: "underline",
    level: "inline",
    start(src) {
      return src.indexOf("++");
    },
    tokenize(src, _tokens, lexer) {
      const rule = /^(\+\+)([\s\S]+?)(\+\+)/;
      const match = rule.exec(src);
      if (!match) {
        return void 0;
      }
      const innerContent = match[2].trim();
      return {
        type: "underline",
        raw: match[0],
        text: innerContent,
        tokens: lexer.inlineTokens(innerContent)
      };
    }
  },
  addCommands() {
    return {
      setUnderline: () => ({ commands }) => {
        return commands.setMark(this.name);
      },
      toggleUnderline: () => ({ commands }) => {
        return commands.toggleMark(this.name);
      },
      unsetUnderline: () => ({ commands }) => {
        return commands.unsetMark(this.name);
      }
    };
  },
  addKeyboardShortcuts() {
    return {
      "Mod-u": () => this.editor.commands.toggleUnderline(),
      "Mod-U": () => this.editor.commands.toggleUnderline()
    };
  }
});

// src/index.ts
var index_default = Underline;

//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/commands/index.js":
/*!********************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/commands/index.js ***!
  \********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   autoJoin: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.autoJoin; },
/* harmony export */   baseKeymap: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.baseKeymap; },
/* harmony export */   chainCommands: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.chainCommands; },
/* harmony export */   createParagraphNear: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.createParagraphNear; },
/* harmony export */   deleteSelection: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.deleteSelection; },
/* harmony export */   exitCode: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.exitCode; },
/* harmony export */   joinBackward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinBackward; },
/* harmony export */   joinDown: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinDown; },
/* harmony export */   joinForward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinForward; },
/* harmony export */   joinTextblockBackward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinTextblockBackward; },
/* harmony export */   joinTextblockForward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinTextblockForward; },
/* harmony export */   joinUp: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.joinUp; },
/* harmony export */   lift: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.lift; },
/* harmony export */   liftEmptyBlock: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.liftEmptyBlock; },
/* harmony export */   macBaseKeymap: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.macBaseKeymap; },
/* harmony export */   newlineInCode: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.newlineInCode; },
/* harmony export */   pcBaseKeymap: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.pcBaseKeymap; },
/* harmony export */   selectAll: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectAll; },
/* harmony export */   selectNodeBackward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectNodeBackward; },
/* harmony export */   selectNodeForward: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectNodeForward; },
/* harmony export */   selectParentNode: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectParentNode; },
/* harmony export */   selectTextblockEnd: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectTextblockEnd; },
/* harmony export */   selectTextblockStart: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.selectTextblockStart; },
/* harmony export */   setBlockType: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.setBlockType; },
/* harmony export */   splitBlock: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.splitBlock; },
/* harmony export */   splitBlockAs: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.splitBlockAs; },
/* harmony export */   splitBlockKeepMarks: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.splitBlockKeepMarks; },
/* harmony export */   toggleMark: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.toggleMark; },
/* harmony export */   wrapIn: function() { return /* reexport safe */ prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__.wrapIn; }
/* harmony export */ });
/* harmony import */ var prosemirror_commands__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-commands */ "./node_modules/prosemirror-commands/dist/index.js");
// commands/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/keymap/index.js":
/*!******************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/keymap/index.js ***!
  \******************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   keydownHandler: function() { return /* reexport safe */ prosemirror_keymap__WEBPACK_IMPORTED_MODULE_0__.keydownHandler; },
/* harmony export */   keymap: function() { return /* reexport safe */ prosemirror_keymap__WEBPACK_IMPORTED_MODULE_0__.keymap; }
/* harmony export */ });
/* harmony import */ var prosemirror_keymap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-keymap */ "./node_modules/prosemirror-keymap/dist/index.js");
// keymap/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/model/index.js":
/*!*****************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/model/index.js ***!
  \*****************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ContentMatch: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ContentMatch; },
/* harmony export */   DOMParser: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.DOMParser; },
/* harmony export */   DOMSerializer: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.DOMSerializer; },
/* harmony export */   Fragment: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment; },
/* harmony export */   Mark: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Mark; },
/* harmony export */   MarkType: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.MarkType; },
/* harmony export */   Node: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Node; },
/* harmony export */   NodeRange: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.NodeRange; },
/* harmony export */   NodeType: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.NodeType; },
/* harmony export */   ReplaceError: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ReplaceError; },
/* harmony export */   ResolvedPos: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ResolvedPos; },
/* harmony export */   Schema: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Schema; },
/* harmony export */   Slice: function() { return /* reexport safe */ prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice; }
/* harmony export */ });
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");
// model/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/schema-list/index.js":
/*!***********************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/schema-list/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   addListNodes: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.addListNodes; },
/* harmony export */   bulletList: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.bulletList; },
/* harmony export */   liftListItem: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.liftListItem; },
/* harmony export */   listItem: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.listItem; },
/* harmony export */   orderedList: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.orderedList; },
/* harmony export */   sinkListItem: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.sinkListItem; },
/* harmony export */   splitListItem: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.splitListItem; },
/* harmony export */   splitListItemKeepMarks: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.splitListItemKeepMarks; },
/* harmony export */   wrapInList: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.wrapInList; },
/* harmony export */   wrapRangeInList: function() { return /* reexport safe */ prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__.wrapRangeInList; }
/* harmony export */ });
/* harmony import */ var prosemirror_schema_list__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-schema-list */ "./node_modules/prosemirror-schema-list/dist/index.js");
// schema-list/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/state/index.js":
/*!*****************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/state/index.js ***!
  \*****************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AllSelection: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.AllSelection; },
/* harmony export */   EditorState: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorState; },
/* harmony export */   NodeSelection: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection; },
/* harmony export */   Plugin: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Plugin; },
/* harmony export */   PluginKey: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.PluginKey; },
/* harmony export */   Selection: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection; },
/* harmony export */   SelectionRange: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.SelectionRange; },
/* harmony export */   TextSelection: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection; },
/* harmony export */   Transaction: function() { return /* reexport safe */ prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Transaction; }
/* harmony export */ });
/* harmony import */ var prosemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-state */ "./node_modules/prosemirror-state/dist/index.js");
// state/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/transform/index.js":
/*!*********************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/transform/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AddMarkStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.AddMarkStep; },
/* harmony export */   AddNodeMarkStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.AddNodeMarkStep; },
/* harmony export */   AttrStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.AttrStep; },
/* harmony export */   DocAttrStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.DocAttrStep; },
/* harmony export */   MapResult: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.MapResult; },
/* harmony export */   Mapping: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.Mapping; },
/* harmony export */   RemoveMarkStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.RemoveMarkStep; },
/* harmony export */   RemoveNodeMarkStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.RemoveNodeMarkStep; },
/* harmony export */   ReplaceAroundStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep; },
/* harmony export */   ReplaceStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceStep; },
/* harmony export */   Step: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.Step; },
/* harmony export */   StepMap: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.StepMap; },
/* harmony export */   StepResult: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.StepResult; },
/* harmony export */   Transform: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.Transform; },
/* harmony export */   TransformError: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.TransformError; },
/* harmony export */   canJoin: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin; },
/* harmony export */   canSplit: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit; },
/* harmony export */   dropPoint: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.dropPoint; },
/* harmony export */   findWrapping: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.findWrapping; },
/* harmony export */   insertPoint: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.insertPoint; },
/* harmony export */   joinPoint: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.joinPoint; },
/* harmony export */   liftTarget: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget; },
/* harmony export */   replaceStep: function() { return /* reexport safe */ prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.replaceStep; }
/* harmony export */ });
/* harmony import */ var prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-transform */ "./node_modules/prosemirror-transform/dist/index.js");
// transform/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/pm/dist/view/index.js":
/*!****************************************************!*\
  !*** ./node_modules/@tiptap/pm/dist/view/index.js ***!
  \****************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Decoration: function() { return /* reexport safe */ prosemirror_view__WEBPACK_IMPORTED_MODULE_0__.Decoration; },
/* harmony export */   DecorationSet: function() { return /* reexport safe */ prosemirror_view__WEBPACK_IMPORTED_MODULE_0__.DecorationSet; },
/* harmony export */   EditorView: function() { return /* reexport safe */ prosemirror_view__WEBPACK_IMPORTED_MODULE_0__.EditorView; },
/* harmony export */   __endComposition: function() { return /* reexport safe */ prosemirror_view__WEBPACK_IMPORTED_MODULE_0__.__endComposition; },
/* harmony export */   __parseFromClipboard: function() { return /* reexport safe */ prosemirror_view__WEBPACK_IMPORTED_MODULE_0__.__parseFromClipboard; }
/* harmony export */ });
/* harmony import */ var prosemirror_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-view */ "./node_modules/prosemirror-view/dist/index.js");
// view/index.ts



/***/ }),

/***/ "./node_modules/@tiptap/react/dist/index.js":
/*!**************************************************!*\
  !*** ./node_modules/@tiptap/react/dist/index.js ***!
  \**************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CommandManager: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.CommandManager; },
/* harmony export */   Editor: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Editor; },
/* harmony export */   EditorConsumer: function() { return /* binding */ EditorConsumer; },
/* harmony export */   EditorContent: function() { return /* binding */ EditorContent; },
/* harmony export */   EditorContext: function() { return /* binding */ EditorContext; },
/* harmony export */   EditorProvider: function() { return /* binding */ EditorProvider; },
/* harmony export */   Extendable: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Extendable; },
/* harmony export */   Extension: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Extension; },
/* harmony export */   Fragment: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Fragment; },
/* harmony export */   InputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.InputRule; },
/* harmony export */   MappablePosition: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.MappablePosition; },
/* harmony export */   Mark: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Mark; },
/* harmony export */   MarkView: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.MarkView; },
/* harmony export */   MarkViewContent: function() { return /* binding */ MarkViewContent; },
/* harmony export */   Node: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Node; },
/* harmony export */   NodePos: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.NodePos; },
/* harmony export */   NodeView: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.NodeView; },
/* harmony export */   NodeViewContent: function() { return /* binding */ NodeViewContent; },
/* harmony export */   NodeViewWrapper: function() { return /* binding */ NodeViewWrapper; },
/* harmony export */   PasteRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.PasteRule; },
/* harmony export */   PureEditorContent: function() { return /* binding */ PureEditorContent; },
/* harmony export */   ReactMarkView: function() { return /* binding */ ReactMarkView; },
/* harmony export */   ReactMarkViewContext: function() { return /* binding */ ReactMarkViewContext; },
/* harmony export */   ReactMarkViewRenderer: function() { return /* binding */ ReactMarkViewRenderer; },
/* harmony export */   ReactNodeView: function() { return /* binding */ ReactNodeView; },
/* harmony export */   ReactNodeViewContentProvider: function() { return /* binding */ ReactNodeViewContentProvider; },
/* harmony export */   ReactNodeViewContext: function() { return /* binding */ ReactNodeViewContext; },
/* harmony export */   ReactNodeViewRenderer: function() { return /* binding */ ReactNodeViewRenderer; },
/* harmony export */   ReactRenderer: function() { return /* binding */ ReactRenderer; },
/* harmony export */   ResizableNodeView: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.ResizableNodeView; },
/* harmony export */   ResizableNodeview: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.ResizableNodeview; },
/* harmony export */   Tiptap: function() { return /* binding */ Tiptap; },
/* harmony export */   TiptapContent: function() { return /* binding */ TiptapContent; },
/* harmony export */   TiptapContext: function() { return /* binding */ TiptapContext; },
/* harmony export */   TiptapWrapper: function() { return /* binding */ TiptapWrapper; },
/* harmony export */   Tracker: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Tracker; },
/* harmony export */   callOrReturn: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.callOrReturn; },
/* harmony export */   canInsertNode: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.canInsertNode; },
/* harmony export */   combineTransactionSteps: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.combineTransactionSteps; },
/* harmony export */   commands: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.commands; },
/* harmony export */   createAtomBlockMarkdownSpec: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createAtomBlockMarkdownSpec; },
/* harmony export */   createBlockMarkdownSpec: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createBlockMarkdownSpec; },
/* harmony export */   createChainableState: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createChainableState; },
/* harmony export */   createDocument: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createDocument; },
/* harmony export */   createElement: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createElement; },
/* harmony export */   createInlineMarkdownSpec: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createInlineMarkdownSpec; },
/* harmony export */   createMappablePosition: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createMappablePosition; },
/* harmony export */   createNodeFromContent: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createNodeFromContent; },
/* harmony export */   createStyleTag: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.createStyleTag; },
/* harmony export */   defaultBlockAt: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.defaultBlockAt; },
/* harmony export */   deleteProps: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.deleteProps; },
/* harmony export */   elementFromString: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.elementFromString; },
/* harmony export */   escapeForRegEx: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.escapeForRegEx; },
/* harmony export */   extensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.extensions; },
/* harmony export */   findChildren: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.findChildren; },
/* harmony export */   findChildrenInRange: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.findChildrenInRange; },
/* harmony export */   findDuplicates: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.findDuplicates; },
/* harmony export */   findParentNode: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.findParentNode; },
/* harmony export */   findParentNodeClosestToPos: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.findParentNodeClosestToPos; },
/* harmony export */   flattenExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.flattenExtensions; },
/* harmony export */   fromString: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.fromString; },
/* harmony export */   generateHTML: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.generateHTML; },
/* harmony export */   generateJSON: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.generateJSON; },
/* harmony export */   generateText: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.generateText; },
/* harmony export */   getAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getAttributes; },
/* harmony export */   getAttributesFromExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getAttributesFromExtensions; },
/* harmony export */   getChangedRanges: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getChangedRanges; },
/* harmony export */   getDebugJSON: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getDebugJSON; },
/* harmony export */   getExtensionField: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getExtensionField; },
/* harmony export */   getHTMLFromFragment: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getHTMLFromFragment; },
/* harmony export */   getMarkAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getMarkAttributes; },
/* harmony export */   getMarkRange: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getMarkRange; },
/* harmony export */   getMarkType: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getMarkType; },
/* harmony export */   getMarksBetween: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getMarksBetween; },
/* harmony export */   getNodeAtPosition: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getNodeAtPosition; },
/* harmony export */   getNodeAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getNodeAttributes; },
/* harmony export */   getNodeType: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getNodeType; },
/* harmony export */   getRenderedAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getRenderedAttributes; },
/* harmony export */   getSchema: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getSchema; },
/* harmony export */   getSchemaByResolvedExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getSchemaByResolvedExtensions; },
/* harmony export */   getSchemaTypeByName: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getSchemaTypeByName; },
/* harmony export */   getSchemaTypeNameByName: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getSchemaTypeNameByName; },
/* harmony export */   getSplittedAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getSplittedAttributes; },
/* harmony export */   getText: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getText; },
/* harmony export */   getTextBetween: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getTextBetween; },
/* harmony export */   getTextContentFromNodes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getTextContentFromNodes; },
/* harmony export */   getTextSerializersFromSchema: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getTextSerializersFromSchema; },
/* harmony export */   getUpdatedPosition: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getUpdatedPosition; },
/* harmony export */   h: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.h; },
/* harmony export */   injectExtensionAttributesToParseRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.injectExtensionAttributesToParseRule; },
/* harmony export */   inputRulesPlugin: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.inputRulesPlugin; },
/* harmony export */   isActive: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isActive; },
/* harmony export */   isAndroid: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isAndroid; },
/* harmony export */   isAtEndOfNode: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isAtEndOfNode; },
/* harmony export */   isAtStartOfNode: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isAtStartOfNode; },
/* harmony export */   isEmptyObject: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isEmptyObject; },
/* harmony export */   isExtensionRulesEnabled: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isExtensionRulesEnabled; },
/* harmony export */   isFirefox: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isFirefox; },
/* harmony export */   isFunction: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isFunction; },
/* harmony export */   isList: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isList; },
/* harmony export */   isMacOS: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isMacOS; },
/* harmony export */   isMarkActive: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isMarkActive; },
/* harmony export */   isNodeActive: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isNodeActive; },
/* harmony export */   isNodeEmpty: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isNodeEmpty; },
/* harmony export */   isNodeSelection: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isNodeSelection; },
/* harmony export */   isNumber: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isNumber; },
/* harmony export */   isPlainObject: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isPlainObject; },
/* harmony export */   isRegExp: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isRegExp; },
/* harmony export */   isSafari: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isSafari; },
/* harmony export */   isString: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isString; },
/* harmony export */   isTextSelection: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isTextSelection; },
/* harmony export */   isiOS: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.isiOS; },
/* harmony export */   markInputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.markInputRule; },
/* harmony export */   markPasteRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.markPasteRule; },
/* harmony export */   markdown: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.markdown; },
/* harmony export */   mergeAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.mergeAttributes; },
/* harmony export */   mergeDeep: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.mergeDeep; },
/* harmony export */   minMax: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.minMax; },
/* harmony export */   nodeInputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.nodeInputRule; },
/* harmony export */   nodePasteRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.nodePasteRule; },
/* harmony export */   objectIncludes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.objectIncludes; },
/* harmony export */   parseAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.parseAttributes; },
/* harmony export */   parseIndentedBlocks: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.parseIndentedBlocks; },
/* harmony export */   pasteRulesPlugin: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.pasteRulesPlugin; },
/* harmony export */   posToDOMRect: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.posToDOMRect; },
/* harmony export */   removeDuplicates: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.removeDuplicates; },
/* harmony export */   renderNestedMarkdownContent: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.renderNestedMarkdownContent; },
/* harmony export */   resolveExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.resolveExtensions; },
/* harmony export */   resolveFocusPosition: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.resolveFocusPosition; },
/* harmony export */   rewriteUnknownContent: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.rewriteUnknownContent; },
/* harmony export */   selectionToInsertionEnd: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.selectionToInsertionEnd; },
/* harmony export */   serializeAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.serializeAttributes; },
/* harmony export */   sortExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.sortExtensions; },
/* harmony export */   splitExtensions: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.splitExtensions; },
/* harmony export */   textInputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.textInputRule; },
/* harmony export */   textPasteRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.textPasteRule; },
/* harmony export */   textblockTypeInputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.textblockTypeInputRule; },
/* harmony export */   updateMarkViewAttributes: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.updateMarkViewAttributes; },
/* harmony export */   useCurrentEditor: function() { return /* binding */ useCurrentEditor; },
/* harmony export */   useEditor: function() { return /* binding */ useEditor; },
/* harmony export */   useEditorState: function() { return /* binding */ useEditorState; },
/* harmony export */   useReactNodeView: function() { return /* binding */ useReactNodeView; },
/* harmony export */   useTiptap: function() { return /* binding */ useTiptap; },
/* harmony export */   useTiptapState: function() { return /* binding */ useTiptapState; },
/* harmony export */   wrappingInputRule: function() { return /* reexport safe */ _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.wrappingInputRule; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
/* harmony import */ var use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! use-sync-external-store/shim/index.js */ "./node_modules/use-sync-external-store/shim/index.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
/* harmony import */ var _tiptap_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tiptap/core */ "./node_modules/@tiptap/core/dist/index.js");
/* harmony import */ var fast_equals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! fast-equals */ "./node_modules/fast-equals/dist/es/index.mjs");
/* harmony import */ var use_sync_external_store_shim_with_selector_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! use-sync-external-store/shim/with-selector.js */ "./node_modules/use-sync-external-store/shim/with-selector.js");
// src/Context.tsx


// src/EditorContent.tsx




var mergeRefs = (...refs) => {
  return (node) => {
    refs.forEach((ref) => {
      if (typeof ref === "function") {
        ref(node);
      } else if (ref) {
        ;
        ref.current = node;
      }
    });
  };
};
var Portals = ({ contentComponent }) => {
  const renderers = (0,use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_2__.useSyncExternalStore)(
    contentComponent.subscribe,
    contentComponent.getSnapshot,
    contentComponent.getServerSnapshot
  );
  return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment, { children: Object.values(renderers) });
};
function getInstance() {
  const subscribers = /* @__PURE__ */ new Set();
  let renderers = {};
  return {
    /**
     * Subscribe to the editor instance's changes.
     */
    subscribe(callback) {
      subscribers.add(callback);
      return () => {
        subscribers.delete(callback);
      };
    },
    getSnapshot() {
      return renderers;
    },
    getServerSnapshot() {
      return renderers;
    },
    /**
     * Adds a new NodeView Renderer to the editor.
     */
    setRenderer(id, renderer) {
      renderers = {
        ...renderers,
        [id]: react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal(renderer.reactElement, renderer.element, id)
      };
      subscribers.forEach((subscriber) => subscriber());
    },
    /**
     * Removes a NodeView Renderer from the editor.
     */
    removeRenderer(id) {
      const nextRenderers = { ...renderers };
      delete nextRenderers[id];
      renderers = nextRenderers;
      subscribers.forEach((subscriber) => subscriber());
    }
  };
}
var PureEditorContent = class extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
  constructor(props) {
    var _a;
    super(props);
    this.editorContentRef = react__WEBPACK_IMPORTED_MODULE_0__.createRef();
    this.initialized = false;
    this.state = {
      hasContentComponentInitialized: Boolean((_a = props.editor) == null ? void 0 : _a.contentComponent)
    };
  }
  componentDidMount() {
    this.init();
  }
  componentDidUpdate() {
    this.init();
  }
  init() {
    var _a;
    const editor = this.props.editor;
    if (editor && !editor.isDestroyed && ((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) {
      if (editor.contentComponent) {
        return;
      }
      const element = this.editorContentRef.current;
      element.append(...editor.view.dom.parentNode.childNodes);
      editor.setOptions({
        element
      });
      editor.contentComponent = getInstance();
      if (!this.state.hasContentComponentInitialized) {
        this.unsubscribeToContentComponent = editor.contentComponent.subscribe(() => {
          this.setState((prevState) => {
            if (!prevState.hasContentComponentInitialized) {
              return {
                hasContentComponentInitialized: true
              };
            }
            return prevState;
          });
          if (this.unsubscribeToContentComponent) {
            this.unsubscribeToContentComponent();
          }
        });
      }
      editor.createNodeViews();
      this.initialized = true;
    }
  }
  componentWillUnmount() {
    var _a;
    const editor = this.props.editor;
    if (!editor) {
      return;
    }
    this.initialized = false;
    if (!editor.isDestroyed) {
      editor.view.setProps({
        nodeViews: {}
      });
    }
    if (this.unsubscribeToContentComponent) {
      this.unsubscribeToContentComponent();
    }
    editor.contentComponent = null;
    try {
      if (!((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) {
        return;
      }
      const newElement = document.createElement("div");
      newElement.append(...editor.view.dom.parentNode.childNodes);
      editor.setOptions({
        element: newElement
      });
    } catch {
    }
  }
  render() {
    const { editor, innerRef, ...rest } = this.props;
    return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment, { children: [
      /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { ref: mergeRefs(innerRef, this.editorContentRef), ...rest }),
      (editor == null ? void 0 : editor.contentComponent) && /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Portals, { contentComponent: editor.contentComponent })
    ] });
  }
};
var EditorContentWithKey = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
  (props, ref) => {
    const key = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => {
      return Math.floor(Math.random() * 4294967295).toString();
    }, [props.editor]);
    return react__WEBPACK_IMPORTED_MODULE_0__.createElement(PureEditorContent, {
      key,
      innerRef: ref,
      ...props
    });
  }
);
var EditorContent = react__WEBPACK_IMPORTED_MODULE_0__.memo(EditorContentWithKey);

// src/useEditor.ts




// src/useEditorState.ts



var useIsomorphicLayoutEffect = typeof window !== "undefined" ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect;
var EditorStateManager = class {
  constructor(initialEditor) {
    this.transactionNumber = 0;
    this.lastTransactionNumber = 0;
    this.subscribers = /* @__PURE__ */ new Set();
    this.editor = initialEditor;
    this.lastSnapshot = { editor: initialEditor, transactionNumber: 0 };
    this.getSnapshot = this.getSnapshot.bind(this);
    this.getServerSnapshot = this.getServerSnapshot.bind(this);
    this.watch = this.watch.bind(this);
    this.subscribe = this.subscribe.bind(this);
  }
  /**
   * Get the current editor instance.
   */
  getSnapshot() {
    if (this.transactionNumber === this.lastTransactionNumber) {
      return this.lastSnapshot;
    }
    this.lastTransactionNumber = this.transactionNumber;
    this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber };
    return this.lastSnapshot;
  }
  /**
   * Always disable the editor on the server-side.
   */
  getServerSnapshot() {
    return { editor: null, transactionNumber: 0 };
  }
  /**
   * Subscribe to the editor instance's changes.
   */
  subscribe(callback) {
    this.subscribers.add(callback);
    return () => {
      this.subscribers.delete(callback);
    };
  }
  /**
   * Watch the editor instance for changes.
   */
  watch(nextEditor) {
    this.editor = nextEditor;
    if (this.editor) {
      const fn = () => {
        this.transactionNumber += 1;
        this.subscribers.forEach((callback) => callback());
      };
      const currentEditor = this.editor;
      currentEditor.on("transaction", fn);
      return () => {
        currentEditor.off("transaction", fn);
      };
    }
    return void 0;
  }
};
function useEditorState(options) {
  var _a;
  const [editorStateManager] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => new EditorStateManager(options.editor));
  const selectedState = (0,use_sync_external_store_shim_with_selector_js__WEBPACK_IMPORTED_MODULE_6__.useSyncExternalStoreWithSelector)(
    editorStateManager.subscribe,
    editorStateManager.getSnapshot,
    editorStateManager.getServerSnapshot,
    options.selector,
    (_a = options.equalityFn) != null ? _a : fast_equals__WEBPACK_IMPORTED_MODULE_5__.deepEqual
  );
  useIsomorphicLayoutEffect(() => {
    return editorStateManager.watch(options.editor);
  }, [options.editor, editorStateManager]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(selectedState);
  return selectedState;
}

// src/useEditor.ts
var isDev = "development" !== "production";
var isSSR = typeof window === "undefined";
var isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
var EditorInstanceManager = class _EditorInstanceManager {
  constructor(options) {
    /**
     * The current editor instance.
     */
    this.editor = null;
    /**
     * The subscriptions to notify when the editor instance
     * has been created or destroyed.
     */
    this.subscriptions = /* @__PURE__ */ new Set();
    /**
     * Whether the editor has been mounted.
     */
    this.isComponentMounted = false;
    /**
     * The most recent dependencies array.
     */
    this.previousDeps = null;
    /**
     * The unique instance ID. This is used to identify the editor instance. And will be re-generated for each new instance.
     */
    this.instanceId = "";
    this.options = options;
    this.subscriptions = /* @__PURE__ */ new Set();
    this.setEditor(this.getInitialEditor());
    this.scheduleDestroy();
    this.getEditor = this.getEditor.bind(this);
    this.getServerSnapshot = this.getServerSnapshot.bind(this);
    this.subscribe = this.subscribe.bind(this);
    this.refreshEditorInstance = this.refreshEditorInstance.bind(this);
    this.scheduleDestroy = this.scheduleDestroy.bind(this);
    this.onRender = this.onRender.bind(this);
    this.createEditor = this.createEditor.bind(this);
  }
  setEditor(editor) {
    this.editor = editor;
    this.instanceId = Math.random().toString(36).slice(2, 9);
    this.subscriptions.forEach((cb) => cb());
  }
  getInitialEditor() {
    if (this.options.current.immediatelyRender === void 0) {
      if (isSSR || isNext) {
        if (isDev) {
          throw new Error(
            "Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."
          );
        }
        return null;
      }
      return this.createEditor();
    }
    if (this.options.current.immediatelyRender && isSSR && isDev) {
      throw new Error(
        "Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches."
      );
    }
    if (this.options.current.immediatelyRender) {
      return this.createEditor();
    }
    return null;
  }
  /**
   * Create a new editor instance. And attach event listeners.
   */
  createEditor() {
    const optionsToApply = {
      ...this.options.current,
      // Always call the most recent version of the callback function by default
      onBeforeCreate: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onBeforeCreate) == null ? void 0 : _b.call(_a, ...args);
      },
      onBlur: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onBlur) == null ? void 0 : _b.call(_a, ...args);
      },
      onCreate: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onCreate) == null ? void 0 : _b.call(_a, ...args);
      },
      onDestroy: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onDestroy) == null ? void 0 : _b.call(_a, ...args);
      },
      onFocus: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onFocus) == null ? void 0 : _b.call(_a, ...args);
      },
      onSelectionUpdate: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onSelectionUpdate) == null ? void 0 : _b.call(_a, ...args);
      },
      onTransaction: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onTransaction) == null ? void 0 : _b.call(_a, ...args);
      },
      onUpdate: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onUpdate) == null ? void 0 : _b.call(_a, ...args);
      },
      onContentError: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onContentError) == null ? void 0 : _b.call(_a, ...args);
      },
      onDrop: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onDrop) == null ? void 0 : _b.call(_a, ...args);
      },
      onPaste: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onPaste) == null ? void 0 : _b.call(_a, ...args);
      },
      onDelete: (...args) => {
        var _a, _b;
        return (_b = (_a = this.options.current).onDelete) == null ? void 0 : _b.call(_a, ...args);
      }
    };
    const editor = new _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.Editor(optionsToApply);
    return editor;
  }
  /**
   * Get the current editor instance.
   */
  getEditor() {
    return this.editor;
  }
  /**
   * Always disable the editor on the server-side.
   */
  getServerSnapshot() {
    return null;
  }
  /**
   * Subscribe to the editor instance's changes.
   */
  subscribe(onStoreChange) {
    this.subscriptions.add(onStoreChange);
    return () => {
      this.subscriptions.delete(onStoreChange);
    };
  }
  static compareOptions(a, b) {
    return Object.keys(a).every((key) => {
      if ([
        "onCreate",
        "onBeforeCreate",
        "onDestroy",
        "onUpdate",
        "onTransaction",
        "onFocus",
        "onBlur",
        "onSelectionUpdate",
        "onContentError",
        "onDrop",
        "onPaste"
      ].includes(key)) {
        return true;
      }
      if (key === "extensions" && a.extensions && b.extensions) {
        if (a.extensions.length !== b.extensions.length) {
          return false;
        }
        return a.extensions.every((extension, index) => {
          var _a;
          if (extension !== ((_a = b.extensions) == null ? void 0 : _a[index])) {
            return false;
          }
          return true;
        });
      }
      if (a[key] !== b[key]) {
        return false;
      }
      return true;
    });
  }
  /**
   * On each render, we will create, update, or destroy the editor instance.
   * @param deps The dependencies to watch for changes
   * @returns A cleanup function
   */
  onRender(deps) {
    return () => {
      this.isComponentMounted = true;
      clearTimeout(this.scheduledDestructionTimeout);
      if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
        if (!_EditorInstanceManager.compareOptions(this.options.current, this.editor.options)) {
          this.editor.setOptions({
            ...this.options.current,
            editable: this.editor.isEditable
          });
        }
      } else {
        this.refreshEditorInstance(deps);
      }
      return () => {
        this.isComponentMounted = false;
        this.scheduleDestroy();
      };
    };
  }
  /**
   * Recreate the editor instance if the dependencies have changed.
   */
  refreshEditorInstance(deps) {
    if (this.editor && !this.editor.isDestroyed) {
      if (this.previousDeps === null) {
        this.previousDeps = deps;
        return;
      }
      const depsAreEqual = this.previousDeps.length === deps.length && this.previousDeps.every((dep, index) => dep === deps[index]);
      if (depsAreEqual) {
        return;
      }
    }
    if (this.editor && !this.editor.isDestroyed) {
      this.editor.destroy();
    }
    this.setEditor(this.createEditor());
    this.previousDeps = deps;
  }
  /**
   * Schedule the destruction of the editor instance.
   * This will only destroy the editor if it was not mounted on the next tick.
   * This is to avoid destroying the editor instance when it's actually still mounted.
   */
  scheduleDestroy() {
    const currentInstanceId = this.instanceId;
    const currentEditor = this.editor;
    this.scheduledDestructionTimeout = setTimeout(() => {
      if (this.isComponentMounted && this.instanceId === currentInstanceId) {
        if (currentEditor) {
          currentEditor.setOptions(this.options.current);
        }
        return;
      }
      if (currentEditor && !currentEditor.isDestroyed) {
        currentEditor.destroy();
        if (this.instanceId === currentInstanceId) {
          this.setEditor(null);
        }
      }
    }, 1);
  }
};
function useEditor(options = {}, deps = []) {
  const mostRecentOptions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(options);
  mostRecentOptions.current = options;
  const [instanceManager] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => new EditorInstanceManager(mostRecentOptions));
  const editor = (0,use_sync_external_store_shim_index_js__WEBPACK_IMPORTED_MODULE_2__.useSyncExternalStore)(
    instanceManager.subscribe,
    instanceManager.getEditor,
    instanceManager.getServerSnapshot
  );
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(editor);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(instanceManager.onRender(deps));
  useEditorState({
    editor,
    selector: ({ transactionNumber }) => {
      if (options.shouldRerenderOnTransaction === false || options.shouldRerenderOnTransaction === void 0) {
        return null;
      }
      if (options.immediatelyRender && transactionNumber === 0) {
        return 0;
      }
      return transactionNumber + 1;
    }
  });
  return editor;
}

// src/Context.tsx

var EditorContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
  editor: null
});
var EditorConsumer = EditorContext.Consumer;
var useCurrentEditor = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(EditorContext);
function EditorProvider({
  children,
  slotAfter,
  slotBefore,
  editorContainerProps = {},
  ...editorOptions
}) {
  const editor = useEditor(editorOptions);
  const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ editor }), [editor]);
  if (!editor) {
    return null;
  }
  return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(EditorContext.Provider, { value: contextValue, children: [
    slotBefore,
    /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(EditorConsumer, { children: ({ editor: currentEditor }) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(EditorContent, { editor: currentEditor, ...editorContainerProps }) }),
    children,
    slotAfter
  ] });
}

// src/useReactNodeView.ts

var ReactNodeViewContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
  onDragStart: () => {
  },
  nodeViewContentChildren: void 0,
  nodeViewContentRef: () => {
  }
});
var ReactNodeViewContentProvider = ({ children, content }) => {
  return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ReactNodeViewContext.Provider, { value: { nodeViewContentChildren: content } }, children);
};
var useReactNodeView = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ReactNodeViewContext);

// src/NodeViewContent.tsx

function NodeViewContent({
  as: Tag = "div",
  ...props
}) {
  const { nodeViewContentRef, nodeViewContentChildren } = useReactNodeView();
  return (
    // @ts-ignore
    /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(
      Tag,
      {
        ...props,
        ref: nodeViewContentRef,
        "data-node-view-content": "",
        style: {
          whiteSpace: "pre-wrap",
          ...props.style
        },
        children: nodeViewContentChildren
      }
    )
  );
}

// src/NodeViewWrapper.tsx


var NodeViewWrapper = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props, ref) => {
  const { onDragStart } = useReactNodeView();
  const Tag = props.as || "div";
  return (
    // @ts-ignore
    /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(
      Tag,
      {
        ...props,
        ref,
        "data-node-view-wrapper": "",
        onDragStart,
        style: {
          whiteSpace: "normal",
          ...props.style
        }
      }
    )
  );
});

// src/ReactMarkViewRenderer.tsx



// src/ReactRenderer.tsx



function isClassComponent(Component) {
  return !!(typeof Component === "function" && Component.prototype && Component.prototype.isReactComponent);
}
function isForwardRefComponent(Component) {
  return !!(typeof Component === "object" && Component.$$typeof && (Component.$$typeof.toString() === "Symbol(react.forward_ref)" || Component.$$typeof.description === "react.forward_ref"));
}
function isMemoComponent(Component) {
  return !!(typeof Component === "object" && Component.$$typeof && (Component.$$typeof.toString() === "Symbol(react.memo)" || Component.$$typeof.description === "react.memo"));
}
function canReceiveRef(Component) {
  if (isClassComponent(Component)) {
    return true;
  }
  if (isForwardRefComponent(Component)) {
    return true;
  }
  if (isMemoComponent(Component)) {
    const wrappedComponent = Component.type;
    if (wrappedComponent) {
      return isClassComponent(wrappedComponent) || isForwardRefComponent(wrappedComponent);
    }
  }
  return false;
}
function isReact19Plus() {
  try {
    if (react__WEBPACK_IMPORTED_MODULE_0__.version) {
      const majorVersion = parseInt(react__WEBPACK_IMPORTED_MODULE_0__.version.split(".")[0], 10);
      return majorVersion >= 19;
    }
  } catch {
  }
  return false;
}
var ReactRenderer = class {
  /**
   * Immediately creates element and renders the provided React component.
   */
  constructor(component, { editor, props = {}, as = "div", className = "" }) {
    this.ref = null;
    /**
     * Flag to track if the renderer has been destroyed, preventing queued or asynchronous renders from executing after teardown.
     */
    this.destroyed = false;
    this.id = Math.floor(Math.random() * 4294967295).toString();
    this.component = component;
    this.editor = editor;
    this.props = props;
    this.element = document.createElement(as);
    this.element.classList.add("react-renderer");
    if (className) {
      this.element.classList.add(...className.split(" "));
    }
    if (this.editor.isInitialized) {
      (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync)(() => {
        this.render();
      });
    } else {
      queueMicrotask(() => {
        if (this.destroyed) {
          return;
        }
        this.render();
      });
    }
  }
  /**
   * Render the React component.
   */
  render() {
    var _a;
    if (this.destroyed) {
      return;
    }
    const Component = this.component;
    const props = this.props;
    const editor = this.editor;
    const isReact19 = isReact19Plus();
    const componentCanReceiveRef = canReceiveRef(Component);
    const elementProps = { ...props };
    if (elementProps.ref && !(isReact19 || componentCanReceiveRef)) {
      delete elementProps.ref;
    }
    if (!elementProps.ref && (isReact19 || componentCanReceiveRef)) {
      elementProps.ref = (ref) => {
        this.ref = ref;
      };
    }
    this.reactElement = /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Component, { ...elementProps });
    (_a = editor == null ? void 0 : editor.contentComponent) == null ? void 0 : _a.setRenderer(this.id, this);
  }
  /**
   * Re-renders the React component with new props.
   */
  updateProps(props = {}) {
    if (this.destroyed) {
      return;
    }
    this.props = {
      ...this.props,
      ...props
    };
    this.render();
  }
  /**
   * Destroy the React component.
   */
  destroy() {
    var _a;
    this.destroyed = true;
    const editor = this.editor;
    (_a = editor == null ? void 0 : editor.contentComponent) == null ? void 0 : _a.removeRenderer(this.id);
    try {
      if (this.element && this.element.parentNode) {
        this.element.parentNode.removeChild(this.element);
      }
    } catch {
    }
  }
  /**
   * Update the attributes of the element that holds the React component.
   */
  updateAttributes(attributes) {
    Object.keys(attributes).forEach((key) => {
      this.element.setAttribute(key, attributes[key]);
    });
  }
};

// src/ReactMarkViewRenderer.tsx

var ReactMarkViewContext = react__WEBPACK_IMPORTED_MODULE_0__.createContext({
  markViewContentRef: () => {
  }
});
var MarkViewContent = (props) => {
  const { as: Tag = "span", ...rest } = props;
  const { markViewContentRef } = react__WEBPACK_IMPORTED_MODULE_0__.useContext(ReactMarkViewContext);
  return (
    // @ts-ignore
    /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Tag, { ...rest, ref: markViewContentRef, "data-mark-view-content": "" })
  );
};
var ReactMarkView = class extends _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.MarkView {
  constructor(component, props, options) {
    super(component, props, options);
    const { as = "span", attrs, className = "" } = options || {};
    const componentProps = { ...props, updateAttributes: this.updateAttributes.bind(this) };
    this.contentDOMElement = document.createElement("span");
    const markViewContentRef = (el) => {
      if (el && !el.contains(this.contentDOMElement)) {
        el.appendChild(this.contentDOMElement);
      }
    };
    const context = {
      markViewContentRef
    };
    const ReactMarkViewProvider = react__WEBPACK_IMPORTED_MODULE_0__.memo((componentProps2) => {
      return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ReactMarkViewContext.Provider, { value: context, children: react__WEBPACK_IMPORTED_MODULE_0__.createElement(component, componentProps2) });
    });
    ReactMarkViewProvider.displayName = "ReactMarkView";
    this.renderer = new ReactRenderer(ReactMarkViewProvider, {
      editor: props.editor,
      props: componentProps,
      as,
      className: `mark-${props.mark.type.name} ${className}`.trim()
    });
    if (attrs) {
      this.renderer.updateAttributes(attrs);
    }
  }
  get dom() {
    return this.renderer.element;
  }
  get contentDOM() {
    return this.contentDOMElement;
  }
};
function ReactMarkViewRenderer(component, options = {}) {
  return (props) => new ReactMarkView(component, props, options);
}

// src/ReactNodeViewRenderer.tsx



var ReactNodeView = class extends _tiptap_core__WEBPACK_IMPORTED_MODULE_4__.NodeView {
  constructor(component, props, options) {
    super(component, props, options);
    /**
     * The requestAnimationFrame ID used for selection updates.
     */
    this.selectionRafId = null;
    this.cachedExtensionWithSyncedStorage = null;
    if (!this.node.isLeaf) {
      if (this.options.contentDOMElementTag) {
        this.contentDOMElement = document.createElement(this.options.contentDOMElementTag);
      } else {
        this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div");
      }
      this.contentDOMElement.dataset.nodeViewContentReact = "";
      this.contentDOMElement.dataset.nodeViewWrapper = "";
      this.contentDOMElement.style.whiteSpace = "inherit";
      const contentTarget = this.dom.querySelector("[data-node-view-content]");
      if (!contentTarget) {
        return;
      }
      contentTarget.appendChild(this.contentDOMElement);
    }
  }
  /**
   * Returns a proxy of the extension that redirects storage access to the editor's mutable storage.
   * This preserves the original prototype chain (instanceof checks, methods like configure/extend work).
   * Cached to avoid proxy creation on every update.
   */
  get extensionWithSyncedStorage() {
    if (!this.cachedExtensionWithSyncedStorage) {
      const editor = this.editor;
      const extension = this.extension;
      this.cachedExtensionWithSyncedStorage = new Proxy(extension, {
        get(target, prop, receiver) {
          var _a;
          if (prop === "storage") {
            return (_a = editor.storage[extension.name]) != null ? _a : {};
          }
          return Reflect.get(target, prop, receiver);
        }
      });
    }
    return this.cachedExtensionWithSyncedStorage;
  }
  /**
   * Setup the React component.
   * Called on initialization.
   */
  mount() {
    const props = {
      editor: this.editor,
      node: this.node,
      decorations: this.decorations,
      innerDecorations: this.innerDecorations,
      view: this.view,
      selected: false,
      extension: this.extensionWithSyncedStorage,
      HTMLAttributes: this.HTMLAttributes,
      getPos: () => this.getPos(),
      updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
      deleteNode: () => this.deleteNode(),
      ref: (0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)()
    };
    if (!this.component.displayName) {
      const capitalizeFirstChar = (string) => {
        return string.charAt(0).toUpperCase() + string.substring(1);
      };
      this.component.displayName = capitalizeFirstChar(this.extension.name);
    }
    const onDragStart = this.onDragStart.bind(this);
    const nodeViewContentRef = (element) => {
      if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {
        if (element.hasAttribute("data-node-view-wrapper")) {
          element.removeAttribute("data-node-view-wrapper");
        }
        element.appendChild(this.contentDOMElement);
      }
    };
    const context = { onDragStart, nodeViewContentRef };
    const Component = this.component;
    const ReactNodeViewProvider = (0,react__WEBPACK_IMPORTED_MODULE_0__.memo)((componentProps) => {
      return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ReactNodeViewContext.Provider, { value: context, children: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Component, componentProps) });
    });
    ReactNodeViewProvider.displayName = "ReactNodeView";
    let as = this.node.isInline ? "span" : "div";
    if (this.options.as) {
      as = this.options.as;
    }
    const { className = "" } = this.options;
    this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
    this.renderer = new ReactRenderer(ReactNodeViewProvider, {
      editor: this.editor,
      props,
      as,
      className: `node-${this.node.type.name} ${className}`.trim()
    });
    this.editor.on("selectionUpdate", this.handleSelectionUpdate);
    this.updateElementAttributes();
  }
  /**
   * Return the DOM element.
   * This is the element that will be used to display the node view.
   */
  get dom() {
    var _a;
    if (this.renderer.element.firstElementChild && !((_a = this.renderer.element.firstElementChild) == null ? void 0 : _a.hasAttribute("data-node-view-wrapper"))) {
      throw Error("Please use the NodeViewWrapper component for your node view.");
    }
    return this.renderer.element;
  }
  /**
   * Return the content DOM element.
   * This is the element that will be used to display the rich-text content of the node.
   */
  get contentDOM() {
    if (this.node.isLeaf) {
      return null;
    }
    return this.contentDOMElement;
  }
  /**
   * On editor selection update, check if the node is selected.
   * If it is, call `selectNode`, otherwise call `deselectNode`.
   */
  handleSelectionUpdate() {
    if (this.selectionRafId) {
      cancelAnimationFrame(this.selectionRafId);
      this.selectionRafId = null;
    }
    this.selectionRafId = requestAnimationFrame(() => {
      this.selectionRafId = null;
      const { from, to } = this.editor.state.selection;
      const pos = this.getPos();
      if (typeof pos !== "number") {
        return;
      }
      if (from <= pos && to >= pos + this.node.nodeSize) {
        if (this.renderer.props.selected) {
          return;
        }
        this.selectNode();
      } else {
        if (!this.renderer.props.selected) {
          return;
        }
        this.deselectNode();
      }
    });
  }
  /**
   * On update, update the React component.
   * To prevent unnecessary updates, the `update` option can be used.
   */
  update(node, decorations, innerDecorations) {
    const rerenderComponent = (props) => {
      this.renderer.updateProps(props);
      if (typeof this.options.attrs === "function") {
        this.updateElementAttributes();
      }
    };
    if (node.type !== this.node.type) {
      return false;
    }
    if (typeof this.options.update === "function") {
      const oldNode = this.node;
      const oldDecorations = this.decorations;
      const oldInnerDecorations = this.innerDecorations;
      this.node = node;
      this.decorations = decorations;
      this.innerDecorations = innerDecorations;
      return this.options.update({
        oldNode,
        oldDecorations,
        newNode: node,
        newDecorations: decorations,
        oldInnerDecorations,
        innerDecorations,
        updateProps: () => rerenderComponent({ node, decorations, innerDecorations, extension: this.extensionWithSyncedStorage })
      });
    }
    if (node === this.node && this.decorations === decorations && this.innerDecorations === innerDecorations) {
      return true;
    }
    this.node = node;
    this.decorations = decorations;
    this.innerDecorations = innerDecorations;
    rerenderComponent({ node, decorations, innerDecorations, extension: this.extensionWithSyncedStorage });
    return true;
  }
  /**
   * Select the node.
   * Add the `selected` prop and the `ProseMirror-selectednode` class.
   */
  selectNode() {
    this.renderer.updateProps({
      selected: true
    });
    this.renderer.element.classList.add("ProseMirror-selectednode");
  }
  /**
   * Deselect the node.
   * Remove the `selected` prop and the `ProseMirror-selectednode` class.
   */
  deselectNode() {
    this.renderer.updateProps({
      selected: false
    });
    this.renderer.element.classList.remove("ProseMirror-selectednode");
  }
  /**
   * Destroy the React component instance.
   */
  destroy() {
    this.renderer.destroy();
    this.editor.off("selectionUpdate", this.handleSelectionUpdate);
    this.contentDOMElement = null;
    if (this.selectionRafId) {
      cancelAnimationFrame(this.selectionRafId);
      this.selectionRafId = null;
    }
  }
  /**
   * Update the attributes of the top-level element that holds the React component.
   * Applying the attributes defined in the `attrs` option.
   */
  updateElementAttributes() {
    if (this.options.attrs) {
      let attrsObj = {};
      if (typeof this.options.attrs === "function") {
        const extensionAttributes = this.editor.extensionManager.attributes;
        const HTMLAttributes = (0,_tiptap_core__WEBPACK_IMPORTED_MODULE_4__.getRenderedAttributes)(this.node, extensionAttributes);
        attrsObj = this.options.attrs({ node: this.node, HTMLAttributes });
      } else {
        attrsObj = this.options.attrs;
      }
      this.renderer.updateAttributes(attrsObj);
    }
  }
};
function ReactNodeViewRenderer(component, options) {
  return (props) => {
    if (!props.editor.contentComponent) {
      return {};
    }
    return new ReactNodeView(component, props, options);
  };
}

// src/Tiptap.tsx


var TiptapContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
  get editor() {
    throw new Error("useTiptap must be used within a <Tiptap> provider");
  }
});
TiptapContext.displayName = "TiptapContext";
var useTiptap = () => (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(TiptapContext);
function useTiptapState(selector, equalityFn) {
  const { editor } = useTiptap();
  return useEditorState({
    editor,
    selector,
    equalityFn
  });
}
function TiptapWrapper({ editor, instance, children }) {
  const resolvedEditor = editor != null ? editor : instance;
  if (!resolvedEditor) {
    throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
  }
  const tiptapContextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
  const legacyContextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
  return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(EditorContext.Provider, { value: legacyContextValue, children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(TiptapContext.Provider, { value: tiptapContextValue, children }) });
}
TiptapWrapper.displayName = "Tiptap";
function TiptapContent({ ...rest }) {
  const { editor } = useTiptap();
  return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(EditorContent, { editor, ...rest });
}
TiptapContent.displayName = "Tiptap.Content";
var Tiptap = Object.assign(TiptapWrapper, {
  /**
   * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
   * @see TiptapContent
   */
  Content: TiptapContent
});

// src/index.ts


//# sourceMappingURL=index.js.map

/***/ }),

/***/ "./node_modules/dayjs/dayjs.min.js":
/*!*****************************************!*\
  !*** ./node_modules/dayjs/dayjs.min.js ***!
  \*****************************************/
/***/ (function(module) {

!function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));

/***/ }),

/***/ "./node_modules/dom-helpers/esm/addClass.js":
/*!**************************************************!*\
  !*** ./node_modules/dom-helpers/esm/addClass.js ***!
  \**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ addClass; }
/* harmony export */ });
/* harmony import */ var _hasClass__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hasClass */ "./node_modules/dom-helpers/esm/hasClass.js");

/**
 * Adds a CSS class to a given element.
 * 
 * @param element the element
 * @param className the CSS class name
 */

function addClass(element, className) {
  if (element.classList) element.classList.add(className);else if (!(0,_hasClass__WEBPACK_IMPORTED_MODULE_0__["default"])(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
}

/***/ }),

/***/ "./node_modules/dom-helpers/esm/hasClass.js":
/*!**************************************************!*\
  !*** ./node_modules/dom-helpers/esm/hasClass.js ***!
  \**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ hasClass; }
/* harmony export */ });
/**
 * Checks if a given element has a CSS class.
 * 
 * @param element the element
 * @param className the CSS class name
 */
function hasClass(element, className) {
  if (element.classList) return !!className && element.classList.contains(className);
  return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
}

/***/ }),

/***/ "./node_modules/dom-helpers/esm/removeClass.js":
/*!*****************************************************!*\
  !*** ./node_modules/dom-helpers/esm/removeClass.js ***!
  \*****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ removeClass; }
/* harmony export */ });
function replaceClassName(origClass, classToRemove) {
  return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
}
/**
 * Removes a CSS class from a given element.
 * 
 * @param element the element
 * @param className the CSS class name
 */


function removeClass(element, className) {
  if (element.classList) {
    element.classList.remove(className);
  } else if (typeof element.className === 'string') {
    element.className = replaceClassName(element.className, className);
  } else {
    element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
  }
}

/***/ }),

/***/ "./node_modules/fast-equals/dist/es/index.mjs":
/*!****************************************************!*\
  !*** ./node_modules/fast-equals/dist/es/index.mjs ***!
  \****************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   circularDeepEqual: function() { return /* binding */ circularDeepEqual; },
/* harmony export */   circularShallowEqual: function() { return /* binding */ circularShallowEqual; },
/* harmony export */   createCustomEqual: function() { return /* binding */ createCustomEqual; },
/* harmony export */   deepEqual: function() { return /* binding */ deepEqual; },
/* harmony export */   sameValueZeroEqual: function() { return /* binding */ sameValueZeroEqual; },
/* harmony export */   shallowEqual: function() { return /* binding */ shallowEqual; },
/* harmony export */   strictCircularDeepEqual: function() { return /* binding */ strictCircularDeepEqual; },
/* harmony export */   strictCircularShallowEqual: function() { return /* binding */ strictCircularShallowEqual; },
/* harmony export */   strictDeepEqual: function() { return /* binding */ strictDeepEqual; },
/* harmony export */   strictShallowEqual: function() { return /* binding */ strictShallowEqual; }
/* harmony export */ });
const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
// eslint-disable-next-line @typescript-eslint/unbound-method
const { hasOwnProperty } = Object.prototype;
/**
 * Combine two comparators into a single comparators.
 */
function combineComparators(comparatorA, comparatorB) {
    return function isEqual(a, b, state) {
        return comparatorA(a, b, state) && comparatorB(a, b, state);
    };
}
/**
 * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
 * for circular references to be safely included in the comparison without creating
 * stack overflows.
 */
function createIsCircular(areItemsEqual) {
    return function isCircular(a, b, state) {
        if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
            return areItemsEqual(a, b, state);
        }
        const { cache } = state;
        const cachedA = cache.get(a);
        const cachedB = cache.get(b);
        if (cachedA && cachedB) {
            return cachedA === b && cachedB === a;
        }
        cache.set(a, b);
        cache.set(b, a);
        const result = areItemsEqual(a, b, state);
        cache.delete(a);
        cache.delete(b);
        return result;
    };
}
/**
 * Get the `@@toStringTag` of the value, if it exists.
 */
function getShortTag(value) {
    return value != null ? value[Symbol.toStringTag] : undefined;
}
/**
 * Get the properties to strictly examine, which include both own properties that are
 * not enumerable and symbol properties.
 */
function getStrictProperties(object) {
    return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
}
/**
 * Whether the object contains the property passed as an own property.
 */
const hasOwn = 
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
/**
 * Whether the values passed are strictly equal or both NaN.
 */
function sameValueZeroEqual(a, b) {
    return a === b || (!a && !b && a !== a && b !== b);
}

const PREACT_VNODE = '__v';
const PREACT_OWNER = '__o';
const REACT_OWNER = '_owner';
const { getOwnPropertyDescriptor, keys } = Object;
/**
 * Whether the array buffers are equal in value.
 */
function areArrayBuffersEqual(a, b) {
    return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
}
/**
 * Whether the arrays are equal in value.
 */
function areArraysEqual(a, b, state) {
    let index = a.length;
    if (b.length !== index) {
        return false;
    }
    while (index-- > 0) {
        if (!state.equals(a[index], b[index], index, index, a, b, state)) {
            return false;
        }
    }
    return true;
}
/**
 * Whether the dataviews are equal in value.
 */
function areDataViewsEqual(a, b) {
    return (a.byteLength === b.byteLength
        && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)));
}
/**
 * Whether the dates passed are equal in value.
 */
function areDatesEqual(a, b) {
    return sameValueZeroEqual(a.getTime(), b.getTime());
}
/**
 * Whether the errors passed are equal in value.
 */
function areErrorsEqual(a, b) {
    return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
}
/**
 * Whether the functions passed are equal in value.
 */
function areFunctionsEqual(a, b) {
    return a === b;
}
/**
 * Whether the `Map`s are equal in value.
 */
function areMapsEqual(a, b, state) {
    const size = a.size;
    if (size !== b.size) {
        return false;
    }
    if (!size) {
        return true;
    }
    const matchedIndices = new Array(size);
    const aIterable = a.entries();
    let aResult;
    let bResult;
    let index = 0;
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
    while ((aResult = aIterable.next())) {
        if (aResult.done) {
            break;
        }
        const bIterable = b.entries();
        let hasMatch = false;
        let matchIndex = 0;
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
        while ((bResult = bIterable.next())) {
            if (bResult.done) {
                break;
            }
            if (matchedIndices[matchIndex]) {
                matchIndex++;
                continue;
            }
            const aEntry = aResult.value;
            const bEntry = bResult.value;
            if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
                && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
                hasMatch = matchedIndices[matchIndex] = true;
                break;
            }
            matchIndex++;
        }
        if (!hasMatch) {
            return false;
        }
        index++;
    }
    return true;
}
/**
 * Whether the numbers are equal in value.
 */
const areNumbersEqual = sameValueZeroEqual;
/**
 * Whether the objects are equal in value.
 */
function areObjectsEqual(a, b, state) {
    const properties = keys(a);
    let index = properties.length;
    if (keys(b).length !== index) {
        return false;
    }
    // Decrementing `while` showed faster results than either incrementing or
    // decrementing `for` loop and than an incrementing `while` loop. Declarative
    // methods like `some` / `every` were not used to avoid incurring the garbage
    // cost of anonymous callbacks.
    while (index-- > 0) {
        if (!isPropertyEqual(a, b, state, properties[index])) {
            return false;
        }
    }
    return true;
}
/**
 * Whether the objects are equal in value with strict property checking.
 */
function areObjectsEqualStrict(a, b, state) {
    const properties = getStrictProperties(a);
    let index = properties.length;
    if (getStrictProperties(b).length !== index) {
        return false;
    }
    let property;
    let descriptorA;
    let descriptorB;
    // Decrementing `while` showed faster results than either incrementing or
    // decrementing `for` loop and than an incrementing `while` loop. Declarative
    // methods like `some` / `every` were not used to avoid incurring the garbage
    // cost of anonymous callbacks.
    while (index-- > 0) {
        property = properties[index];
        if (!isPropertyEqual(a, b, state, property)) {
            return false;
        }
        descriptorA = getOwnPropertyDescriptor(a, property);
        descriptorB = getOwnPropertyDescriptor(b, property);
        if ((descriptorA || descriptorB)
            && (!descriptorA
                || !descriptorB
                || descriptorA.configurable !== descriptorB.configurable
                || descriptorA.enumerable !== descriptorB.enumerable
                || descriptorA.writable !== descriptorB.writable)) {
            return false;
        }
    }
    return true;
}
/**
 * Whether the primitive wrappers passed are equal in value.
 */
function arePrimitiveWrappersEqual(a, b) {
    return sameValueZeroEqual(a.valueOf(), b.valueOf());
}
/**
 * Whether the regexps passed are equal in value.
 */
function areRegExpsEqual(a, b) {
    return a.source === b.source && a.flags === b.flags;
}
/**
 * Whether the `Set`s are equal in value.
 */
function areSetsEqual(a, b, state) {
    const size = a.size;
    if (size !== b.size) {
        return false;
    }
    if (!size) {
        return true;
    }
    const matchedIndices = new Array(size);
    const aIterable = a.values();
    let aResult;
    let bResult;
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
    while ((aResult = aIterable.next())) {
        if (aResult.done) {
            break;
        }
        const bIterable = b.values();
        let hasMatch = false;
        let matchIndex = 0;
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
        while ((bResult = bIterable.next())) {
            if (bResult.done) {
                break;
            }
            if (!matchedIndices[matchIndex]
                && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
                hasMatch = matchedIndices[matchIndex] = true;
                break;
            }
            matchIndex++;
        }
        if (!hasMatch) {
            return false;
        }
    }
    return true;
}
/**
 * Whether the TypedArray instances are equal in value.
 */
function areTypedArraysEqual(a, b) {
    let index = a.byteLength;
    if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
        return false;
    }
    while (index-- > 0) {
        if (a[index] !== b[index]) {
            return false;
        }
    }
    return true;
}
/**
 * Whether the URL instances are equal in value.
 */
function areUrlsEqual(a, b) {
    return (a.hostname === b.hostname
        && a.pathname === b.pathname
        && a.protocol === b.protocol
        && a.port === b.port
        && a.hash === b.hash
        && a.username === b.username
        && a.password === b.password);
}
function isPropertyEqual(a, b, state, property) {
    if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)
        && (a.$$typeof || b.$$typeof)) {
        return true;
    }
    return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
}

const ARRAY_BUFFER_TAG = '[object ArrayBuffer]';
const ARGUMENTS_TAG = '[object Arguments]';
const BOOLEAN_TAG = '[object Boolean]';
const DATA_VIEW_TAG = '[object DataView]';
const DATE_TAG = '[object Date]';
const ERROR_TAG = '[object Error]';
const MAP_TAG = '[object Map]';
const NUMBER_TAG = '[object Number]';
const OBJECT_TAG = '[object Object]';
const REG_EXP_TAG = '[object RegExp]';
const SET_TAG = '[object Set]';
const STRING_TAG = '[object String]';
const TYPED_ARRAY_TAGS = {
    '[object Int8Array]': true,
    '[object Uint8Array]': true,
    '[object Uint8ClampedArray]': true,
    '[object Int16Array]': true,
    '[object Uint16Array]': true,
    '[object Int32Array]': true,
    '[object Uint32Array]': true,
    '[object Float16Array]': true,
    '[object Float32Array]': true,
    '[object Float64Array]': true,
    '[object BigInt64Array]': true,
    '[object BigUint64Array]': true,
};
const URL_TAG = '[object URL]';
// eslint-disable-next-line @typescript-eslint/unbound-method
const toString = Object.prototype.toString;
/**
 * Create a comparator method based on the type-specific equality comparators passed.
 */
function createEqualityComparator({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, unknownTagComparators, }) {
    /**
     * compare the value of the two objects and return true if they are equivalent in values
     */
    return function comparator(a, b, state) {
        // If the items are strictly equal, no need to do a value comparison.
        if (a === b) {
            return true;
        }
        // If either of the items are nullish and fail the strictly equal check
        // above, then they must be unequal.
        if (a == null || b == null) {
            return false;
        }
        const type = typeof a;
        if (type !== typeof b) {
            return false;
        }
        if (type !== 'object') {
            if (type === 'number') {
                return areNumbersEqual(a, b, state);
            }
            if (type === 'function') {
                return areFunctionsEqual(a, b, state);
            }
            // If a primitive value that is not strictly equal, it must be unequal.
            return false;
        }
        const constructor = a.constructor;
        // Checks are listed in order of commonality of use-case:
        //   1. Common complex object types (plain object, array)
        //   2. Common data values (date, regexp)
        //   3. Less-common complex object types (map, set)
        //   4. Less-common data values (promise, primitive wrappers)
        // Inherently this is both subjective and assumptive, however
        // when reviewing comparable libraries in the wild this order
        // appears to be generally consistent.
        // Constructors should match, otherwise there is potential for false positives
        // between class and subclass or custom object and POJO.
        if (constructor !== b.constructor) {
            return false;
        }
        // `isPlainObject` only checks against the object's own realm. Cross-realm
        // comparisons are rare, and will be handled in the ultimate fallback, so
        // we can avoid capturing the string tag.
        if (constructor === Object) {
            return areObjectsEqual(a, b, state);
        }
        // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing
        // the string tag or doing an `instanceof` check.
        if (Array.isArray(a)) {
            return areArraysEqual(a, b, state);
        }
        // Try to fast-path equality checks for other complex object types in the
        // same realm to avoid capturing the string tag. Strict equality is used
        // instead of `instanceof` because it is more performant for the common
        // use-case. If someone is subclassing a native class, it will be handled
        // with the string tag comparison.
        if (constructor === Date) {
            return areDatesEqual(a, b, state);
        }
        if (constructor === RegExp) {
            return areRegExpsEqual(a, b, state);
        }
        if (constructor === Map) {
            return areMapsEqual(a, b, state);
        }
        if (constructor === Set) {
            return areSetsEqual(a, b, state);
        }
        // Since this is a custom object, capture the string tag to determing its type.
        // This is reasonably performant in modern environments like v8 and SpiderMonkey.
        const tag = toString.call(a);
        if (tag === DATE_TAG) {
            return areDatesEqual(a, b, state);
        }
        // For RegExp, the properties are not enumerable, and therefore will give false positives if
        // tested like a standard object.
        if (tag === REG_EXP_TAG) {
            return areRegExpsEqual(a, b, state);
        }
        if (tag === MAP_TAG) {
            return areMapsEqual(a, b, state);
        }
        if (tag === SET_TAG) {
            return areSetsEqual(a, b, state);
        }
        if (tag === OBJECT_TAG) {
            // The exception for value comparison is custom `Promise`-like class instances. These should
            // be treated the same as standard `Promise` objects, which means strict equality, and if
            // it reaches this point then that strict equality comparison has already failed.
            return typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state);
        }
        // If a URL tag, it should be tested explicitly. Like RegExp, the properties are not
        // enumerable, and therefore will give false positives if tested like a standard object.
        if (tag === URL_TAG) {
            return areUrlsEqual(a, b, state);
        }
        // If an error tag, it should be tested explicitly. Like RegExp, the properties are not
        // enumerable, and therefore will give false positives if tested like a standard object.
        if (tag === ERROR_TAG) {
            return areErrorsEqual(a, b, state);
        }
        // If an arguments tag, it should be treated as a standard object.
        if (tag === ARGUMENTS_TAG) {
            return areObjectsEqual(a, b, state);
        }
        if (TYPED_ARRAY_TAGS[tag]) {
            return areTypedArraysEqual(a, b, state);
        }
        if (tag === ARRAY_BUFFER_TAG) {
            return areArrayBuffersEqual(a, b, state);
        }
        if (tag === DATA_VIEW_TAG) {
            return areDataViewsEqual(a, b, state);
        }
        // As the penultimate fallback, check if the values passed are primitive wrappers. This
        // is very rare in modern JS, which is why it is deprioritized compared to all other object
        // types.
        if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
            return arePrimitiveWrappersEqual(a, b, state);
        }
        if (unknownTagComparators) {
            let unknownTagComparator = unknownTagComparators[tag];
            if (!unknownTagComparator) {
                const shortTag = getShortTag(a);
                if (shortTag) {
                    unknownTagComparator = unknownTagComparators[shortTag];
                }
            }
            // If the custom config has an unknown tag comparator that matches the captured tag or the
            // @@toStringTag, it is the source of truth for whether the values are equal.
            if (unknownTagComparator) {
                return unknownTagComparator(a, b, state);
            }
        }
        // If not matching any tags that require a specific type of comparison, then we hard-code false because
        // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:
        //   - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
        //     comparison that can be made.
        //   - For types that can be introspected, but rarely have requirements to be compared
        //     (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common
        //     use-cases (may be included in a future release, if requested enough).
        //   - For types that can be introspected but do not have an objective definition of what
        //     equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
        // In all cases, these decisions should be reevaluated based on changes to the language and
        // common development practices.
        return false;
    };
}
/**
 * Create the configuration object used for building comparators.
 */
function createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {
    let config = {
        areArrayBuffersEqual,
        areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
        areDataViewsEqual,
        areDatesEqual: areDatesEqual,
        areErrorsEqual: areErrorsEqual,
        areFunctionsEqual: areFunctionsEqual,
        areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
        areNumbersEqual: areNumbersEqual,
        areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
        arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
        areRegExpsEqual: areRegExpsEqual,
        areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
        areTypedArraysEqual: strict
            ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)
            : areTypedArraysEqual,
        areUrlsEqual: areUrlsEqual,
        unknownTagComparators: undefined,
    };
    if (createCustomConfig) {
        config = Object.assign({}, config, createCustomConfig(config));
    }
    if (circular) {
        const areArraysEqual = createIsCircular(config.areArraysEqual);
        const areMapsEqual = createIsCircular(config.areMapsEqual);
        const areObjectsEqual = createIsCircular(config.areObjectsEqual);
        const areSetsEqual = createIsCircular(config.areSetsEqual);
        config = Object.assign({}, config, {
            areArraysEqual,
            areMapsEqual,
            areObjectsEqual,
            areSetsEqual,
        });
    }
    return config;
}
/**
 * Default equality comparator pass-through, used as the standard `isEqual` creator for
 * use inside the built comparator.
 */
function createInternalEqualityComparator(compare) {
    return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
        return compare(a, b, state);
    };
}
/**
 * Create the `isEqual` function used by the consuming application.
 */
function createIsEqual({ circular, comparator, createState, equals, strict }) {
    if (createState) {
        return function isEqual(a, b) {
            const { cache = circular ? new WeakMap() : undefined, meta } = createState();
            return comparator(a, b, {
                cache,
                equals,
                meta,
                strict,
            });
        };
    }
    if (circular) {
        return function isEqual(a, b) {
            return comparator(a, b, {
                cache: new WeakMap(),
                equals,
                meta: undefined,
                strict,
            });
        };
    }
    const state = {
        cache: undefined,
        equals,
        meta: undefined,
        strict,
    };
    return function isEqual(a, b) {
        return comparator(a, b, state);
    };
}

/**
 * Whether the items passed are deeply-equal in value.
 */
const deepEqual = createCustomEqual();
/**
 * Whether the items passed are deeply-equal in value based on strict comparison.
 */
const strictDeepEqual = createCustomEqual({ strict: true });
/**
 * Whether the items passed are deeply-equal in value, including circular references.
 */
const circularDeepEqual = createCustomEqual({ circular: true });
/**
 * Whether the items passed are deeply-equal in value, including circular references,
 * based on strict comparison.
 */
const strictCircularDeepEqual = createCustomEqual({
    circular: true,
    strict: true,
});
/**
 * Whether the items passed are shallowly-equal in value.
 */
const shallowEqual = createCustomEqual({
    createInternalComparator: () => sameValueZeroEqual,
});
/**
 * Whether the items passed are shallowly-equal in value based on strict comparison
 */
const strictShallowEqual = createCustomEqual({
    strict: true,
    createInternalComparator: () => sameValueZeroEqual,
});
/**
 * Whether the items passed are shallowly-equal in value, including circular references.
 */
const circularShallowEqual = createCustomEqual({
    circular: true,
    createInternalComparator: () => sameValueZeroEqual,
});
/**
 * Whether the items passed are shallowly-equal in value, including circular references,
 * based on strict comparison.
 */
const strictCircularShallowEqual = createCustomEqual({
    circular: true,
    createInternalComparator: () => sameValueZeroEqual,
    strict: true,
});
/**
 * Create a custom equality comparison method.
 *
 * This can be done to create very targeted comparisons in extreme hot-path scenarios
 * where the standard methods are not performant enough, but can also be used to provide
 * support for legacy environments that do not support expected features like
 * `RegExp.prototype.flags` out of the box.
 */
function createCustomEqual(options = {}) {
    const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;
    const config = createEqualityComparatorConfig(options);
    const comparator = createEqualityComparator(config);
    const equals = createCustomInternalComparator
        ? createCustomInternalComparator(comparator)
        : createInternalEqualityComparator(comparator);
    return createIsEqual({ circular, comparator, createState, equals, strict });
}


//# sourceMappingURL=index.mjs.map


/***/ }),

/***/ "./node_modules/linkifyjs/dist/linkify.mjs":
/*!*************************************************!*\
  !*** ./node_modules/linkifyjs/dist/linkify.mjs ***!
  \*************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   MultiToken: function() { return /* binding */ MultiToken; },
/* harmony export */   Options: function() { return /* binding */ Options; },
/* harmony export */   State: function() { return /* binding */ State; },
/* harmony export */   createTokenClass: function() { return /* binding */ createTokenClass; },
/* harmony export */   find: function() { return /* binding */ find; },
/* harmony export */   init: function() { return /* binding */ init; },
/* harmony export */   multi: function() { return /* binding */ multi; },
/* harmony export */   options: function() { return /* binding */ options; },
/* harmony export */   regexp: function() { return /* binding */ regexp; },
/* harmony export */   registerCustomProtocol: function() { return /* binding */ registerCustomProtocol; },
/* harmony export */   registerPlugin: function() { return /* binding */ registerPlugin; },
/* harmony export */   registerTokenPlugin: function() { return /* binding */ registerTokenPlugin; },
/* harmony export */   reset: function() { return /* binding */ reset; },
/* harmony export */   stringToArray: function() { return /* binding */ stringToArray; },
/* harmony export */   test: function() { return /* binding */ test; },
/* harmony export */   text: function() { return /* binding */ multi; },
/* harmony export */   tokenize: function() { return /* binding */ tokenize; }
/* harmony export */ });
// THIS FILE IS AUTOMATICALLY GENERATED DO NOT EDIT DIRECTLY
// See update-tlds.js for encoding/decoding format
// https://data.iana.org/TLD/tlds-alpha-by-domain.txt
const encodedTlds = ' ögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2';
// Internationalized domain names containing non-ASCII
const encodedUtlds = 'ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2';

/**
 * Finite State Machine generation utilities
 */

/**
 * @template T
 * @typedef {{ [group: string]: T[] }} Collections
 */

/**
 * @typedef {{ [group: string]: true }} Flags
 */

// Keys in scanner Collections instances
const numeric = 'numeric';
const ascii = 'ascii';
const alpha = 'alpha';
const asciinumeric = 'asciinumeric';
const alphanumeric = 'alphanumeric';
const domain = 'domain';
const emoji = 'emoji';
const scheme = 'scheme';
const slashscheme = 'slashscheme';
const whitespace = 'whitespace';

/**
 * @template T
 * @param {string} name
 * @param {Collections<T>} groups to register in
 * @returns {T[]} Current list of tokens in the given collection
 */
function registerGroup(name, groups) {
  if (!(name in groups)) {
    groups[name] = [];
  }
  return groups[name];
}

/**
 * @template T
 * @param {T} t token to add
 * @param {Collections<T>} groups
 * @param {Flags} flags
 */
function addToGroups(t, flags, groups) {
  if (flags[numeric]) {
    flags[asciinumeric] = true;
    flags[alphanumeric] = true;
  }
  if (flags[ascii]) {
    flags[asciinumeric] = true;
    flags[alpha] = true;
  }
  if (flags[asciinumeric]) {
    flags[alphanumeric] = true;
  }
  if (flags[alpha]) {
    flags[alphanumeric] = true;
  }
  if (flags[alphanumeric]) {
    flags[domain] = true;
  }
  if (flags[emoji]) {
    flags[domain] = true;
  }
  for (const k in flags) {
    const group = registerGroup(k, groups);
    if (group.indexOf(t) < 0) {
      group.push(t);
    }
  }
}

/**
 * @template T
 * @param {T} t token to check
 * @param {Collections<T>} groups
 * @returns {Flags} group flags that contain this token
 */
function flagsForToken(t, groups) {
  const result = {};
  for (const c in groups) {
    if (groups[c].indexOf(t) >= 0) {
      result[c] = true;
    }
  }
  return result;
}

/**
 * @template T
 * @typedef {null | T } Transition
 */

/**
 * Define a basic state machine state. j is the list of character transitions,
 * jr is the list of regex-match transitions, jd is the default state to
 * transition to t is the accepting token type, if any. If this is the terminal
 * state, then it does not emit a token.
 *
 * The template type T represents the type of the token this state accepts. This
 * should be a string (such as of the token exports in `text.js`) or a
 * MultiToken subclass (from `multi.js`)
 *
 * @template T
 * @param {T} [token] Token that this state emits
 */
function State(token = null) {
  // this.n = null; // DEBUG: State name
  /** @type {{ [input: string]: State<T> }} j */
  this.j = {}; // IMPLEMENTATION 1
  // this.j = []; // IMPLEMENTATION 2
  /** @type {[RegExp, State<T>][]} jr */
  this.jr = [];
  /** @type {?State<T>} jd */
  this.jd = null;
  /** @type {?T} t */
  this.t = token;
}

/**
 * Scanner token groups
 * @type Collections<string>
 */
State.groups = {};
State.prototype = {
  accepts() {
    return !!this.t;
  },
  /**
   * Follow an existing transition from the given input to the next state.
   * Does not mutate.
   * @param {string} input character or token type to transition on
   * @returns {?State<T>} the next state, if any
   */
  go(input) {
    const state = this;
    const nextState = state.j[input];
    if (nextState) {
      return nextState;
    }
    for (let i = 0; i < state.jr.length; i++) {
      const regex = state.jr[i][0];
      const nextState = state.jr[i][1]; // note: might be empty to prevent default jump
      if (nextState && regex.test(input)) {
        return nextState;
      }
    }
    // Nowhere left to jump! Return default, if any
    return state.jd;
  },
  /**
   * Whether the state has a transition for the given input. Set the second
   * argument to true to only look for an exact match (and not a default or
   * regular-expression-based transition)
   * @param {string} input
   * @param {boolean} exactOnly
   */
  has(input, exactOnly = false) {
    return exactOnly ? input in this.j : !!this.go(input);
  },
  /**
   * Short for "transition all"; create a transition from the array of items
   * in the given list to the same final resulting state.
   * @param {string | string[]} inputs Group of inputs to transition on
   * @param {Transition<T> | State<T>} [next] Transition options
   * @param {Flags} [flags] Collections flags to add token to
   * @param {Collections<T>} [groups] Master list of token groups
   */
  ta(inputs, next, flags, groups) {
    for (let i = 0; i < inputs.length; i++) {
      this.tt(inputs[i], next, flags, groups);
    }
  },
  /**
   * Short for "take regexp transition"; defines a transition for this state
   * when it encounters a token which matches the given regular expression
   * @param {RegExp} regexp Regular expression transition (populate first)
   * @param {T | State<T>} [next] Transition options
   * @param {Flags} [flags] Collections flags to add token to
   * @param {Collections<T>} [groups] Master list of token groups
   * @returns {State<T>} taken after the given input
   */
  tr(regexp, next, flags, groups) {
    groups = groups || State.groups;
    let nextState;
    if (next && next.j) {
      nextState = next;
    } else {
      // Token with maybe token groups
      nextState = new State(next);
      if (flags && groups) {
        addToGroups(next, flags, groups);
      }
    }
    this.jr.push([regexp, nextState]);
    return nextState;
  },
  /**
   * Short for "take transitions", will take as many sequential transitions as
   * the length of the given input and returns the
   * resulting final state.
   * @param {string | string[]} input
   * @param {T | State<T>} [next] Transition options
   * @param {Flags} [flags] Collections flags to add token to
   * @param {Collections<T>} [groups] Master list of token groups
   * @returns {State<T>} taken after the given input
   */
  ts(input, next, flags, groups) {
    let state = this;
    const len = input.length;
    if (!len) {
      return state;
    }
    for (let i = 0; i < len - 1; i++) {
      state = state.tt(input[i]);
    }
    return state.tt(input[len - 1], next, flags, groups);
  },
  /**
   * Short for "take transition", this is a method for building/working with
   * state machines.
   *
   * If a state already exists for the given input, returns it.
   *
   * If a token is specified, that state will emit that token when reached by
   * the linkify engine.
   *
   * If no state exists, it will be initialized with some default transitions
   * that resemble existing default transitions.
   *
   * If a state is given for the second argument, that state will be
   * transitioned to on the given input regardless of what that input
   * previously did.
   *
   * Specify a token group flags to define groups that this token belongs to.
   * The token will be added to corresponding entires in the given groups
   * object.
   *
   * @param {string} input character, token type to transition on
   * @param {T | State<T>} [next] Transition options
   * @param {Flags} [flags] Collections flags to add token to
   * @param {Collections<T>} [groups] Master list of groups
   * @returns {State<T>} taken after the given input
   */
  tt(input, next, flags, groups) {
    groups = groups || State.groups;
    const state = this;

    // Check if existing state given, just a basic transition
    if (next && next.j) {
      state.j[input] = next;
      return next;
    }
    const t = next;

    // Take the transition with the usual default mechanisms and use that as
    // a template for creating the next state
    let nextState,
      templateState = state.go(input);
    if (templateState) {
      nextState = new State();
      Object.assign(nextState.j, templateState.j);
      nextState.jr.push.apply(nextState.jr, templateState.jr);
      nextState.jd = templateState.jd;
      nextState.t = templateState.t;
    } else {
      nextState = new State();
    }
    if (t) {
      // Ensure newly token is in the same groups as the old token
      if (groups) {
        if (nextState.t && typeof nextState.t === 'string') {
          const allFlags = Object.assign(flagsForToken(nextState.t, groups), flags);
          addToGroups(t, allFlags, groups);
        } else if (flags) {
          addToGroups(t, flags, groups);
        }
      }
      nextState.t = t; // overwrite anything that was previously there
    }
    state.j[input] = nextState;
    return nextState;
  }
};

// Helper functions to improve minification (not exported outside linkifyjs module)

/**
 * @template T
 * @param {State<T>} state
 * @param {string | string[]} input
 * @param {Flags} [flags]
 * @param {Collections<T>} [groups]
 */
const ta = (state, input, next, flags, groups) => state.ta(input, next, flags, groups);

/**
 * @template T
 * @param {State<T>} state
 * @param {RegExp} regexp
 * @param {T | State<T>} [next]
 * @param {Flags} [flags]
 * @param {Collections<T>} [groups]
 */
const tr = (state, regexp, next, flags, groups) => state.tr(regexp, next, flags, groups);

/**
 * @template T
 * @param {State<T>} state
 * @param {string | string[]} input
 * @param {T | State<T>} [next]
 * @param {Flags} [flags]
 * @param {Collections<T>} [groups]
 */
const ts = (state, input, next, flags, groups) => state.ts(input, next, flags, groups);

/**
 * @template T
 * @param {State<T>} state
 * @param {string} input
 * @param {T | State<T>} [next]
 * @param {Collections<T>} [groups]
 * @param {Flags} [flags]
 */
const tt = (state, input, next, flags, groups) => state.tt(input, next, flags, groups);

/******************************************************************************
Text Tokens
Identifiers for token outputs from the regexp scanner
******************************************************************************/

// A valid web domain token
const WORD = 'WORD'; // only contains a-z
const UWORD = 'UWORD'; // contains letters other than a-z, used for IDN
const ASCIINUMERICAL = 'ASCIINUMERICAL'; // contains a-z, 0-9
const ALPHANUMERICAL = 'ALPHANUMERICAL'; // contains numbers and letters other than a-z, used for IDN

// Special case of word
const LOCALHOST = 'LOCALHOST';

// Valid top-level domain, special case of WORD (see tlds.js)
const TLD = 'TLD';

// Valid IDN TLD, special case of UWORD (see tlds.js)
const UTLD = 'UTLD';

// The scheme portion of a web URI protocol. Supported types include: `mailto`,
// `file`, and user-defined custom protocols. Limited to schemes that contain
// only letters
const SCHEME = 'SCHEME';

// Similar to SCHEME, except makes distinction for schemes that must always be
// followed by `://`, not just `:`. Supported types include `http`, `https`,
// `ftp`, `ftps`
const SLASH_SCHEME = 'SLASH_SCHEME';

// Any sequence of digits 0-9
const NUM = 'NUM';

// Any number of consecutive whitespace characters that are not newline
const WS = 'WS';

// New line (unix style)
const NL = 'NL'; // \n

// Opening/closing bracket classes
// TODO: Rename OPEN -> LEFT and CLOSE -> RIGHT in v5 to fit with Unicode names
// Also rename angle brackes to LESSTHAN and GREATER THAN
const OPENBRACE = 'OPENBRACE'; // {
const CLOSEBRACE = 'CLOSEBRACE'; // }
const OPENBRACKET = 'OPENBRACKET'; // [
const CLOSEBRACKET = 'CLOSEBRACKET'; // ]
const OPENPAREN = 'OPENPAREN'; // (
const CLOSEPAREN = 'CLOSEPAREN'; // )
const OPENANGLEBRACKET = 'OPENANGLEBRACKET'; // <
const CLOSEANGLEBRACKET = 'CLOSEANGLEBRACKET'; // >
const FULLWIDTHLEFTPAREN = 'FULLWIDTHLEFTPAREN'; // （
const FULLWIDTHRIGHTPAREN = 'FULLWIDTHRIGHTPAREN'; // ）
const LEFTCORNERBRACKET = 'LEFTCORNERBRACKET'; // 「
const RIGHTCORNERBRACKET = 'RIGHTCORNERBRACKET'; // 」
const LEFTWHITECORNERBRACKET = 'LEFTWHITECORNERBRACKET'; // 『
const RIGHTWHITECORNERBRACKET = 'RIGHTWHITECORNERBRACKET'; // 』
const FULLWIDTHLESSTHAN = 'FULLWIDTHLESSTHAN'; // ＜
const FULLWIDTHGREATERTHAN = 'FULLWIDTHGREATERTHAN'; // ＞

// Various symbols
const AMPERSAND = 'AMPERSAND'; // &
const APOSTROPHE = 'APOSTROPHE'; // '
const ASTERISK = 'ASTERISK'; // *
const AT = 'AT'; // @
const BACKSLASH = 'BACKSLASH'; // \
const BACKTICK = 'BACKTICK'; // `
const CARET = 'CARET'; // ^
const COLON = 'COLON'; // :
const COMMA = 'COMMA'; // ,
const DOLLAR = 'DOLLAR'; // $
const DOT = 'DOT'; // .
const EQUALS = 'EQUALS'; // =
const EXCLAMATION = 'EXCLAMATION'; // !
const HYPHEN = 'HYPHEN'; // -
const PERCENT = 'PERCENT'; // %
const PIPE = 'PIPE'; // |
const PLUS = 'PLUS'; // +
const POUND = 'POUND'; // #
const QUERY = 'QUERY'; // ?
const QUOTE = 'QUOTE'; // "
const FULLWIDTHMIDDLEDOT = 'FULLWIDTHMIDDLEDOT'; // ・

const SEMI = 'SEMI'; // ;
const SLASH = 'SLASH'; // /
const TILDE = 'TILDE'; // ~
const UNDERSCORE = 'UNDERSCORE'; // _

// Emoji symbol
const EMOJI$1 = 'EMOJI';

// Default token - anything that is not one of the above
const SYM = 'SYM';

var tk = /*#__PURE__*/Object.freeze({
	__proto__: null,
	ALPHANUMERICAL: ALPHANUMERICAL,
	AMPERSAND: AMPERSAND,
	APOSTROPHE: APOSTROPHE,
	ASCIINUMERICAL: ASCIINUMERICAL,
	ASTERISK: ASTERISK,
	AT: AT,
	BACKSLASH: BACKSLASH,
	BACKTICK: BACKTICK,
	CARET: CARET,
	CLOSEANGLEBRACKET: CLOSEANGLEBRACKET,
	CLOSEBRACE: CLOSEBRACE,
	CLOSEBRACKET: CLOSEBRACKET,
	CLOSEPAREN: CLOSEPAREN,
	COLON: COLON,
	COMMA: COMMA,
	DOLLAR: DOLLAR,
	DOT: DOT,
	EMOJI: EMOJI$1,
	EQUALS: EQUALS,
	EXCLAMATION: EXCLAMATION,
	FULLWIDTHGREATERTHAN: FULLWIDTHGREATERTHAN,
	FULLWIDTHLEFTPAREN: FULLWIDTHLEFTPAREN,
	FULLWIDTHLESSTHAN: FULLWIDTHLESSTHAN,
	FULLWIDTHMIDDLEDOT: FULLWIDTHMIDDLEDOT,
	FULLWIDTHRIGHTPAREN: FULLWIDTHRIGHTPAREN,
	HYPHEN: HYPHEN,
	LEFTCORNERBRACKET: LEFTCORNERBRACKET,
	LEFTWHITECORNERBRACKET: LEFTWHITECORNERBRACKET,
	LOCALHOST: LOCALHOST,
	NL: NL,
	NUM: NUM,
	OPENANGLEBRACKET: OPENANGLEBRACKET,
	OPENBRACE: OPENBRACE,
	OPENBRACKET: OPENBRACKET,
	OPENPAREN: OPENPAREN,
	PERCENT: PERCENT,
	PIPE: PIPE,
	PLUS: PLUS,
	POUND: POUND,
	QUERY: QUERY,
	QUOTE: QUOTE,
	RIGHTCORNERBRACKET: RIGHTCORNERBRACKET,
	RIGHTWHITECORNERBRACKET: RIGHTWHITECORNERBRACKET,
	SCHEME: SCHEME,
	SEMI: SEMI,
	SLASH: SLASH,
	SLASH_SCHEME: SLASH_SCHEME,
	SYM: SYM,
	TILDE: TILDE,
	TLD: TLD,
	UNDERSCORE: UNDERSCORE,
	UTLD: UTLD,
	UWORD: UWORD,
	WORD: WORD,
	WS: WS
});

// Note that these two Unicode ones expand into a really big one with Babel
const ASCII_LETTER = /[a-z]/;
const LETTER = /\p{L}/u; // Any Unicode character with letter data type
const EMOJI = /\p{Emoji}/u; // Any Unicode emoji character
const EMOJI_VARIATION$1 = /\ufe0f/;
const DIGIT = /\d/;
const SPACE = /\s/;

var regexp = /*#__PURE__*/Object.freeze({
	__proto__: null,
	ASCII_LETTER: ASCII_LETTER,
	DIGIT: DIGIT,
	EMOJI: EMOJI,
	EMOJI_VARIATION: EMOJI_VARIATION$1,
	LETTER: LETTER,
	SPACE: SPACE
});

/**
	The scanner provides an interface that takes a string of text as input, and
	outputs an array of tokens instances that can be used for easy URL parsing.
*/

const CR = '\r'; // carriage-return character
const LF = '\n'; // line-feed character
const EMOJI_VARIATION = '\ufe0f'; // Variation selector, follows heart and others
const EMOJI_JOINER = '\u200d'; // zero-width joiner
const OBJECT_REPLACEMENT = '\ufffc'; // whitespace placeholder that sometimes appears in rich text editors

let tlds = null,
  utlds = null; // don't change so only have to be computed once

/**
 * Scanner output token:
 * - `t` is the token name (e.g., 'NUM', 'EMOJI', 'TLD')
 * - `v` is the value of the token (e.g., '123', '❤️', 'com')
 * - `s` is the start index of the token in the original string
 * - `e` is the end index of the token in the original string
 * @typedef {{t: string, v: string, s: number, e: number}} Token
 */

/**
 * @template T
 * @typedef {{ [collection: string]: T[] }} Collections
 */

/**
 * Initialize the scanner character-based state machine for the given start
 * state
 * @param {[string, boolean][]} customSchemes List of custom schemes, where each
 * item is a length-2 tuple with the first element set to the string scheme, and
 * the second element set to `true` if the `://` after the scheme is optional
 */
function init$2(customSchemes = []) {
  // Frequently used states (name argument removed during minification)
  /** @type Collections<string> */
  const groups = {}; // of tokens
  State.groups = groups;
  /** @type State<string> */
  const Start = new State();
  if (tlds == null) {
    tlds = decodeTlds(encodedTlds);
  }
  if (utlds == null) {
    utlds = decodeTlds(encodedUtlds);
  }

  // States for special URL symbols that accept immediately after start
  tt(Start, "'", APOSTROPHE);
  tt(Start, '{', OPENBRACE);
  tt(Start, '}', CLOSEBRACE);
  tt(Start, '[', OPENBRACKET);
  tt(Start, ']', CLOSEBRACKET);
  tt(Start, '(', OPENPAREN);
  tt(Start, ')', CLOSEPAREN);
  tt(Start, '<', OPENANGLEBRACKET);
  tt(Start, '>', CLOSEANGLEBRACKET);
  tt(Start, '（', FULLWIDTHLEFTPAREN);
  tt(Start, '）', FULLWIDTHRIGHTPAREN);
  tt(Start, '「', LEFTCORNERBRACKET);
  tt(Start, '」', RIGHTCORNERBRACKET);
  tt(Start, '『', LEFTWHITECORNERBRACKET);
  tt(Start, '』', RIGHTWHITECORNERBRACKET);
  tt(Start, '＜', FULLWIDTHLESSTHAN);
  tt(Start, '＞', FULLWIDTHGREATERTHAN);
  tt(Start, '&', AMPERSAND);
  tt(Start, '*', ASTERISK);
  tt(Start, '@', AT);
  tt(Start, '`', BACKTICK);
  tt(Start, '^', CARET);
  tt(Start, ':', COLON);
  tt(Start, ',', COMMA);
  tt(Start, '$', DOLLAR);
  tt(Start, '.', DOT);
  tt(Start, '=', EQUALS);
  tt(Start, '!', EXCLAMATION);
  tt(Start, '-', HYPHEN);
  tt(Start, '%', PERCENT);
  tt(Start, '|', PIPE);
  tt(Start, '+', PLUS);
  tt(Start, '#', POUND);
  tt(Start, '?', QUERY);
  tt(Start, '"', QUOTE);
  tt(Start, '/', SLASH);
  tt(Start, ';', SEMI);
  tt(Start, '~', TILDE);
  tt(Start, '_', UNDERSCORE);
  tt(Start, '\\', BACKSLASH);
  tt(Start, '・', FULLWIDTHMIDDLEDOT);
  const Num = tr(Start, DIGIT, NUM, {
    [numeric]: true
  });
  tr(Num, DIGIT, Num);
  const Asciinumeric = tr(Num, ASCII_LETTER, ASCIINUMERICAL, {
    [asciinumeric]: true
  });
  const Alphanumeric = tr(Num, LETTER, ALPHANUMERICAL, {
    [alphanumeric]: true
  });

  // State which emits a word token
  const Word = tr(Start, ASCII_LETTER, WORD, {
    [ascii]: true
  });
  tr(Word, DIGIT, Asciinumeric);
  tr(Word, ASCII_LETTER, Word);
  tr(Asciinumeric, DIGIT, Asciinumeric);
  tr(Asciinumeric, ASCII_LETTER, Asciinumeric);

  // Same as previous, but specific to non-fsm.ascii alphabet words
  const UWord = tr(Start, LETTER, UWORD, {
    [alpha]: true
  });
  tr(UWord, ASCII_LETTER); // Non-accepting
  tr(UWord, DIGIT, Alphanumeric);
  tr(UWord, LETTER, UWord);
  tr(Alphanumeric, DIGIT, Alphanumeric);
  tr(Alphanumeric, ASCII_LETTER); // Non-accepting
  tr(Alphanumeric, LETTER, Alphanumeric); // Non-accepting

  // Whitespace jumps
  // Tokens of only non-newline whitespace are arbitrarily long
  // If any whitespace except newline, more whitespace!
  const Nl = tt(Start, LF, NL, {
    [whitespace]: true
  });
  const Cr = tt(Start, CR, WS, {
    [whitespace]: true
  });
  const Ws = tr(Start, SPACE, WS, {
    [whitespace]: true
  });
  tt(Start, OBJECT_REPLACEMENT, Ws);
  tt(Cr, LF, Nl); // \r\n
  tt(Cr, OBJECT_REPLACEMENT, Ws);
  tr(Cr, SPACE, Ws);
  tt(Ws, CR); // non-accepting state to avoid mixing whitespaces
  tt(Ws, LF); // non-accepting state to avoid mixing whitespaces
  tr(Ws, SPACE, Ws);
  tt(Ws, OBJECT_REPLACEMENT, Ws);

  // Emoji tokens. They are not grouped by the scanner except in cases where a
  // zero-width joiner is present
  const Emoji = tr(Start, EMOJI, EMOJI$1, {
    [emoji]: true
  });
  tt(Emoji, '#'); // no transition, emoji regex seems to match #
  tr(Emoji, EMOJI, Emoji);
  tt(Emoji, EMOJI_VARIATION, Emoji);
  // tt(Start, EMOJI_VARIATION, Emoji); // This one is sketchy

  const EmojiJoiner = tt(Emoji, EMOJI_JOINER);
  tt(EmojiJoiner, '#');
  tr(EmojiJoiner, EMOJI, Emoji);
  // tt(EmojiJoiner, EMOJI_VARIATION, Emoji); // also sketchy

  // Generates states for top-level domains
  // Note that this is most accurate when tlds are in alphabetical order
  const wordjr = [[ASCII_LETTER, Word], [DIGIT, Asciinumeric]];
  const uwordjr = [[ASCII_LETTER, null], [LETTER, UWord], [DIGIT, Alphanumeric]];
  for (let i = 0; i < tlds.length; i++) {
    fastts(Start, tlds[i], TLD, WORD, wordjr);
  }
  for (let i = 0; i < utlds.length; i++) {
    fastts(Start, utlds[i], UTLD, UWORD, uwordjr);
  }
  addToGroups(TLD, {
    tld: true,
    ascii: true
  }, groups);
  addToGroups(UTLD, {
    utld: true,
    alpha: true
  }, groups);

  // Collect the states generated by different protocols. NOTE: If any new TLDs
  // get added that are also protocols, set the token to be the same as the
  // protocol to ensure parsing works as expected.
  fastts(Start, 'file', SCHEME, WORD, wordjr);
  fastts(Start, 'mailto', SCHEME, WORD, wordjr);
  fastts(Start, 'http', SLASH_SCHEME, WORD, wordjr);
  fastts(Start, 'https', SLASH_SCHEME, WORD, wordjr);
  fastts(Start, 'ftp', SLASH_SCHEME, WORD, wordjr);
  fastts(Start, 'ftps', SLASH_SCHEME, WORD, wordjr);
  addToGroups(SCHEME, {
    scheme: true,
    ascii: true
  }, groups);
  addToGroups(SLASH_SCHEME, {
    slashscheme: true,
    ascii: true
  }, groups);

  // Register custom schemes. Assumes each scheme is asciinumeric with hyphens
  customSchemes = customSchemes.sort((a, b) => a[0] > b[0] ? 1 : -1);
  for (let i = 0; i < customSchemes.length; i++) {
    const sch = customSchemes[i][0];
    const optionalSlashSlash = customSchemes[i][1];
    const flags = optionalSlashSlash ? {
      [scheme]: true
    } : {
      [slashscheme]: true
    };
    if (sch.indexOf('-') >= 0) {
      flags[domain] = true;
    } else if (!ASCII_LETTER.test(sch)) {
      flags[numeric] = true; // numbers only
    } else if (DIGIT.test(sch)) {
      flags[asciinumeric] = true;
    } else {
      flags[ascii] = true;
    }
    ts(Start, sch, sch, flags);
  }

  // Localhost token
  ts(Start, 'localhost', LOCALHOST, {
    ascii: true
  });

  // Set default transition for start state (some symbol)
  Start.jd = new State(SYM);
  return {
    start: Start,
    tokens: Object.assign({
      groups
    }, tk)
  };
}

/**
	Given a string, returns an array of TOKEN instances representing the
	composition of that string.

	@method run
	@param {State<string>} start scanner starting state
	@param {string} str input string to scan
	@return {Token[]} list of tokens, each with a type and value
*/
function run$1(start, str) {
  // State machine is not case sensitive, so input is tokenized in lowercased
  // form (still returns regular case). Uses selective `toLowerCase` because
  // lowercasing the entire string causes the length and character position to
  // vary in some non-English strings with V8-based runtimes.
  const iterable = stringToArray(str.replace(/[A-Z]/g, c => c.toLowerCase()));
  const charCount = iterable.length; // <= len if there are emojis, etc
  const tokens = []; // return value

  // cursor through the string itself, accounting for characters that have
  // width with length 2 such as emojis
  let cursor = 0;

  // Cursor through the array-representation of the string
  let charCursor = 0;

  // Tokenize the string
  while (charCursor < charCount) {
    let state = start;
    let nextState = null;
    let tokenLength = 0;
    let latestAccepting = null;
    let sinceAccepts = -1;
    let charsSinceAccepts = -1;
    while (charCursor < charCount && (nextState = state.go(iterable[charCursor]))) {
      state = nextState;

      // Keep track of the latest accepting state
      if (state.accepts()) {
        sinceAccepts = 0;
        charsSinceAccepts = 0;
        latestAccepting = state;
      } else if (sinceAccepts >= 0) {
        sinceAccepts += iterable[charCursor].length;
        charsSinceAccepts++;
      }
      tokenLength += iterable[charCursor].length;
      cursor += iterable[charCursor].length;
      charCursor++;
    }

    // Roll back to the latest accepting state
    cursor -= sinceAccepts;
    charCursor -= charsSinceAccepts;
    tokenLength -= sinceAccepts;

    // No more jumps, just make a new token from the last accepting one
    tokens.push({
      t: latestAccepting.t,
      // token type/name
      v: str.slice(cursor - tokenLength, cursor),
      // string value
      s: cursor - tokenLength,
      // start index
      e: cursor // end index (excluding)
    });
  }
  return tokens;
}

/**
 * Convert a String to an Array of characters, taking into account that some
 * characters like emojis take up two string indexes.
 *
 * Adapted from core-js (MIT license)
 * https://github.com/zloirock/core-js/blob/2d69cf5f99ab3ea3463c395df81e5a15b68f49d9/packages/core-js/internals/string-multibyte.js
 *
 * @function stringToArray
 * @param {string} str
 * @returns {string[]}
 */
function stringToArray(str) {
  const result = [];
  const len = str.length;
  let index = 0;
  while (index < len) {
    let first = str.charCodeAt(index);
    let second;
    let char = first < 0xd800 || first > 0xdbff || index + 1 === len || (second = str.charCodeAt(index + 1)) < 0xdc00 || second > 0xdfff ? str[index] // single character
    : str.slice(index, index + 2); // two-index characters
    result.push(char);
    index += char.length;
  }
  return result;
}

/**
 * Fast version of ts function for when transition defaults are well known
 * @param {State<string>} state
 * @param {string} input
 * @param {string} t
 * @param {string} defaultt
 * @param {[RegExp, State<string>][]} jr
 * @returns {State<string>}
 */
function fastts(state, input, t, defaultt, jr) {
  let next;
  const len = input.length;
  for (let i = 0; i < len - 1; i++) {
    const char = input[i];
    if (state.j[char]) {
      next = state.j[char];
    } else {
      next = new State(defaultt);
      next.jr = jr.slice();
      state.j[char] = next;
    }
    state = next;
  }
  next = new State(t);
  next.jr = jr.slice();
  state.j[input[len - 1]] = next;
  return next;
}

/**
 * Converts a string of Top-Level Domain names encoded in update-tlds.js back
 * into a list of strings.
 * @param {str} encoded encoded TLDs string
 * @returns {str[]} original TLDs list
 */
function decodeTlds(encoded) {
  const words = [];
  const stack = [];
  let i = 0;
  let digits = '0123456789';
  while (i < encoded.length) {
    let popDigitCount = 0;
    while (digits.indexOf(encoded[i + popDigitCount]) >= 0) {
      popDigitCount++; // encountered some digits, have to pop to go one level up trie
    }
    if (popDigitCount > 0) {
      words.push(stack.join('')); // whatever preceded the pop digits must be a word
      for (let popCount = parseInt(encoded.substring(i, i + popDigitCount), 10); popCount > 0; popCount--) {
        stack.pop();
      }
      i += popDigitCount;
    } else {
      stack.push(encoded[i]); // drop down a level into the trie
      i++;
    }
  }
  return words;
}

/**
 * An object where each key is a valid DOM Event Name such as `click` or `focus`
 * and each value is an event handler function.
 *
 * https://developer.mozilla.org/en-US/docs/Web/API/Element#events
 * @typedef {?{ [event: string]: Function }} EventListeners
 */

/**
 * All formatted properties required to render a link, including `tagName`,
 * `attributes`, `content` and `eventListeners`.
 * @typedef {{ tagName: any, attributes: {[attr: string]: any}, content: string,
 * eventListeners: EventListeners }} IntermediateRepresentation
 */

/**
 * Specify either an object described by the template type `O` or a function.
 *
 * The function takes a string value (usually the link's href attribute), the
 * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
 * of the link. It should return an object of the template type `O`
 * @template O
 * @typedef {O | ((value: string, type: string, token: MultiToken) => O)} OptObj
 */

/**
 * Specify either a function described by template type `F` or an object.
 *
 * Each key in the object should be a link type (`'url'`, `'hashtag`', etc.). Each
 * value should be a function with template type `F` that is called when the
 * corresponding link type is encountered.
 * @template F
 * @typedef {F | { [type: string]: F}} OptFn
 */

/**
 * Specify either a value with template type `V`, a function that returns `V` or
 * an object where each value resolves to `V`.
 *
 * The function takes a string value (usually the link's href attribute), the
 * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
 * of the link. It should return an object of the template type `V`
 *
 * For the object, each key should be a link type (`'url'`, `'hashtag`', etc.).
 * Each value should either have type `V` or a function that returns V. This
 * function similarly takes a string value and a token.
 *
 * Example valid types for `Opt<string>`:
 *
 * ```js
 * 'hello'
 * (value, type, token) => 'world'
 * { url: 'hello', email: (value, token) => 'world'}
 * ```
 * @template V
 * @typedef {V | ((value: string, type: string, token: MultiToken) => V) | { [type: string]: V | ((value: string, token: MultiToken) => V) }} Opt
 */

/**
 * See available options: https://linkify.js.org/docs/options.html
 * @typedef {{
 * 	defaultProtocol?: string,
 *  events?: OptObj<EventListeners>,
 * 	format?: Opt<string>,
 * 	formatHref?: Opt<string>,
 * 	nl2br?: boolean,
 * 	tagName?: Opt<any>,
 * 	target?: Opt<string>,
 * 	rel?: Opt<string>,
 * 	validate?: Opt<boolean>,
 * 	truncate?: Opt<number>,
 * 	className?: Opt<string>,
 * 	attributes?: OptObj<({ [attr: string]: any })>,
 *  ignoreTags?: string[],
 * 	render?: OptFn<((ir: IntermediateRepresentation) => any)>
 * }} Opts
 */

/**
 * @type Required<Opts>
 */
const defaults = {
  defaultProtocol: 'http',
  events: null,
  format: noop,
  formatHref: noop,
  nl2br: false,
  tagName: 'a',
  target: null,
  rel: null,
  validate: true,
  truncate: Infinity,
  className: null,
  attributes: null,
  ignoreTags: [],
  render: null
};

/**
 * Utility class for linkify interfaces to apply specified
 * {@link Opts formatting and rendering options}.
 *
 * @param {Opts | Options} [opts] Option value overrides.
 * @param {(ir: IntermediateRepresentation) => any} [defaultRender] (For
 *   internal use) default render function that determines how to generate an
 *   HTML element based on a link token's derived tagName, attributes and HTML.
 *   Similar to render option
 */
function Options(opts, defaultRender = null) {
  let o = Object.assign({}, defaults);
  if (opts) {
    o = Object.assign(o, opts instanceof Options ? opts.o : opts);
  }

  // Ensure all ignored tags are uppercase
  const ignoredTags = o.ignoreTags;
  const uppercaseIgnoredTags = [];
  for (let i = 0; i < ignoredTags.length; i++) {
    uppercaseIgnoredTags.push(ignoredTags[i].toUpperCase());
  }
  /** @protected */
  this.o = o;
  if (defaultRender) {
    this.defaultRender = defaultRender;
  }
  this.ignoreTags = uppercaseIgnoredTags;
}
Options.prototype = {
  o: defaults,
  /**
   * @type string[]
   */
  ignoreTags: [],
  /**
   * @param {IntermediateRepresentation} ir
   * @returns {any}
   */
  defaultRender(ir) {
    return ir;
  },
  /**
   * Returns true or false based on whether a token should be displayed as a
   * link based on the user options.
   * @param {MultiToken} token
   * @returns {boolean}
   */
  check(token) {
    return this.get('validate', token.toString(), token);
  },
  // Private methods

  /**
   * Resolve an option's value based on the value of the option and the given
   * params. If operator and token are specified and the target option is
   * callable, automatically calls the function with the given argument.
   * @template {keyof Opts} K
   * @param {K} key Name of option to use
   * @param {string} [operator] will be passed to the target option if it's a
   * function. If not specified, RAW function value gets returned
   * @param {MultiToken} [token] The token from linkify.tokenize
   * @returns {Opts[K] | any}
   */
  get(key, operator, token) {
    const isCallable = operator != null;
    let option = this.o[key];
    if (!option) {
      return option;
    }
    if (typeof option === 'object') {
      option = token.t in option ? option[token.t] : defaults[key];
      if (typeof option === 'function' && isCallable) {
        option = option(operator, token);
      }
    } else if (typeof option === 'function' && isCallable) {
      option = option(operator, token.t, token);
    }
    return option;
  },
  /**
   * @template {keyof Opts} L
   * @param {L} key Name of options object to use
   * @param {string} [operator]
   * @param {MultiToken} [token]
   * @returns {Opts[L] | any}
   */
  getObj(key, operator, token) {
    let obj = this.o[key];
    if (typeof obj === 'function' && operator != null) {
      obj = obj(operator, token.t, token);
    }
    return obj;
  },
  /**
   * Convert the given token to a rendered element that may be added to the
   * calling-interface's DOM
   * @param {MultiToken} token Token to render to an HTML element
   * @returns {any} Render result; e.g., HTML string, DOM element, React
   *   Component, etc.
   */
  render(token) {
    const ir = token.render(this); // intermediate representation
    const renderFn = this.get('render', null, token) || this.defaultRender;
    return renderFn(ir, token.t, token);
  }
};
function noop(val) {
  return val;
}

var options = /*#__PURE__*/Object.freeze({
	__proto__: null,
	Options: Options,
	defaults: defaults
});

/******************************************************************************
	Multi-Tokens
	Tokens composed of arrays of TextTokens
******************************************************************************/

/**
 * @param {string} value
 * @param {Token[]} tokens
 */
function MultiToken(value, tokens) {
  this.t = 'token';
  this.v = value;
  this.tk = tokens;
}

/**
 * Abstract class used for manufacturing tokens of text tokens. That is rather
 * than the value for a token being a small string of text, it's value an array
 * of text tokens.
 *
 * Used for grouping together URLs, emails, hashtags, and other potential
 * creations.
 * @class MultiToken
 * @property {string} t
 * @property {string} v
 * @property {Token[]} tk
 * @abstract
 */
MultiToken.prototype = {
  isLink: false,
  /**
   * Return the string this token represents.
   * @return {string}
   */
  toString() {
    return this.v;
  },
  /**
   * What should the value for this token be in the `href` HTML attribute?
   * Returns the `.toString` value by default.
   * @param {string} [scheme]
   * @return {string}
   */
  toHref(scheme) {
    return this.toString();
  },
  /**
   * @param {Options} options Formatting options
   * @returns {string}
   */
  toFormattedString(options) {
    const val = this.toString();
    const truncate = options.get('truncate', val, this);
    const formatted = options.get('format', val, this);
    return truncate && formatted.length > truncate ? formatted.substring(0, truncate) + '…' : formatted;
  },
  /**
   *
   * @param {Options} options
   * @returns {string}
   */
  toFormattedHref(options) {
    return options.get('formatHref', this.toHref(options.get('defaultProtocol')), this);
  },
  /**
   * The start index of this token in the original input string
   * @returns {number}
   */
  startIndex() {
    return this.tk[0].s;
  },
  /**
   * The end index of this token in the original input string (up to this
   * index but not including it)
   * @returns {number}
   */
  endIndex() {
    return this.tk[this.tk.length - 1].e;
  },
  /**
  	Returns an object  of relevant values for this token, which includes keys
  	* type - Kind of token ('url', 'email', etc.)
  	* value - Original text
  	* href - The value that should be added to the anchor tag's href
  		attribute
  		@method toObject
  	@param {string} [protocol] `'http'` by default
  */
  toObject(protocol = defaults.defaultProtocol) {
    return {
      type: this.t,
      value: this.toString(),
      isLink: this.isLink,
      href: this.toHref(protocol),
      start: this.startIndex(),
      end: this.endIndex()
    };
  },
  /**
   *
   * @param {Options} options Formatting option
   */
  toFormattedObject(options) {
    return {
      type: this.t,
      value: this.toFormattedString(options),
      isLink: this.isLink,
      href: this.toFormattedHref(options),
      start: this.startIndex(),
      end: this.endIndex()
    };
  },
  /**
   * Whether this token should be rendered as a link according to the given options
   * @param {Options} options
   * @returns {boolean}
   */
  validate(options) {
    return options.get('validate', this.toString(), this);
  },
  /**
   * Return an object that represents how this link should be rendered.
   * @param {Options} options Formattinng options
   */
  render(options) {
    const token = this;
    const href = this.toHref(options.get('defaultProtocol'));
    const formattedHref = options.get('formatHref', href, this);
    const tagName = options.get('tagName', href, token);
    const content = this.toFormattedString(options);
    const attributes = {};
    const className = options.get('className', href, token);
    const target = options.get('target', href, token);
    const rel = options.get('rel', href, token);
    const attrs = options.getObj('attributes', href, token);
    const eventListeners = options.getObj('events', href, token);
    attributes.href = formattedHref;
    if (className) {
      attributes.class = className;
    }
    if (target) {
      attributes.target = target;
    }
    if (rel) {
      attributes.rel = rel;
    }
    if (attrs) {
      Object.assign(attributes, attrs);
    }
    return {
      tagName,
      attributes,
      content,
      eventListeners
    };
  }
};

/**
 * Create a new token that can be emitted by the parser state machine
 * @param {string} type readable type of the token
 * @param {object} props properties to assign or override, including isLink = true or false
 * @returns {new (value: string, tokens: Token[]) => MultiToken} new token class
 */
function createTokenClass(type, props) {
  class Token extends MultiToken {
    constructor(value, tokens) {
      super(value, tokens);
      this.t = type;
    }
  }
  for (const p in props) {
    Token.prototype[p] = props[p];
  }
  Token.t = type;
  return Token;
}

/**
	Represents a list of tokens making up a valid email address
*/
const Email = createTokenClass('email', {
  isLink: true,
  toHref() {
    return 'mailto:' + this.toString();
  }
});

/**
	Represents some plain text
*/
const Text = createTokenClass('text');

/**
	Multi-linebreak token - represents a line break
	@class Nl
*/
const Nl = createTokenClass('nl');

/**
	Represents a list of text tokens making up a valid URL
	@class Url
*/
const Url = createTokenClass('url', {
  isLink: true,
  /**
  	Lowercases relevant parts of the domain and adds the protocol if
  	required. Note that this will not escape unsafe HTML characters in the
  	URL.
  		@param {string} [scheme] default scheme (e.g., 'https')
  	@return {string} the full href
  */
  toHref(scheme = defaults.defaultProtocol) {
    // Check if already has a prefix scheme
    return this.hasProtocol() ? this.v : `${scheme}://${this.v}`;
  },
  /**
   * Check whether this URL token has a protocol
   * @return {boolean}
   */
  hasProtocol() {
    const tokens = this.tk;
    return tokens.length >= 2 && tokens[0].t !== LOCALHOST && tokens[1].t === COLON;
  }
});

var multi = /*#__PURE__*/Object.freeze({
	__proto__: null,
	Base: MultiToken,
	Email: Email,
	MultiToken: MultiToken,
	Nl: Nl,
	Text: Text,
	Url: Url,
	createTokenClass: createTokenClass
});

/**
	Not exactly parser, more like the second-stage scanner (although we can
	theoretically hotswap the code here with a real parser in the future... but
	for a little URL-finding utility abstract syntax trees may be a little
	overkill).

	URL format: http://en.wikipedia.org/wiki/URI_scheme
	Email format: http://en.wikipedia.org/wiki/EmailAddress (links to RFC in
	reference)

	@module linkify
	@submodule parser
	@main run
*/

const makeState = arg => new State(arg);

/**
 * Generate the parser multi token-based state machine
 * @param {{ groups: Collections<string> }} tokens
 */
function init$1({
  groups
}) {
  // Types of characters the URL can definitely end in
  const qsAccepting = groups.domain.concat([AMPERSAND, ASTERISK, AT, BACKSLASH, BACKTICK, CARET, DOLLAR, EQUALS, HYPHEN, NUM, PERCENT, PIPE, PLUS, POUND, SLASH, SYM, TILDE, UNDERSCORE]);

  // Types of tokens that can follow a URL and be part of the query string
  // but cannot be the very last characters
  // Characters that cannot appear in the URL at all should be excluded
  const qsNonAccepting = [APOSTROPHE, COLON, COMMA, DOT, EXCLAMATION, PERCENT, QUERY, QUOTE, SEMI, OPENANGLEBRACKET, CLOSEANGLEBRACKET, OPENBRACE, CLOSEBRACE, CLOSEBRACKET, OPENBRACKET, OPENPAREN, CLOSEPAREN, FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN, LEFTCORNERBRACKET, RIGHTCORNERBRACKET, LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET, FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN];

  // For addresses without the mailto prefix
  // Tokens allowed in the localpart of the email
  const localpartAccepting = [AMPERSAND, APOSTROPHE, ASTERISK, BACKSLASH, BACKTICK, CARET, DOLLAR, EQUALS, HYPHEN, OPENBRACE, CLOSEBRACE, PERCENT, PIPE, PLUS, POUND, QUERY, SLASH, SYM, TILDE, UNDERSCORE];

  // The universal starting state.
  /**
   * @type State<Token>
   */
  const Start = makeState();
  const Localpart = tt(Start, TILDE); // Local part of the email address
  ta(Localpart, localpartAccepting, Localpart);
  ta(Localpart, groups.domain, Localpart);
  const Domain = makeState(),
    Scheme = makeState(),
    SlashScheme = makeState();
  ta(Start, groups.domain, Domain); // parsed string ends with a potential domain name (A)
  ta(Start, groups.scheme, Scheme); // e.g., 'mailto'
  ta(Start, groups.slashscheme, SlashScheme); // e.g., 'http'

  ta(Domain, localpartAccepting, Localpart);
  ta(Domain, groups.domain, Domain);
  const LocalpartAt = tt(Domain, AT); // Local part of the email address plus @

  tt(Localpart, AT, LocalpartAt); // close to an email address now

  // Local part of an email address can be e.g. 'http' or 'mailto'
  tt(Scheme, AT, LocalpartAt);
  tt(SlashScheme, AT, LocalpartAt);
  const LocalpartDot = tt(Localpart, DOT); // Local part of the email address plus '.' (localpart cannot end in .)
  ta(LocalpartDot, localpartAccepting, Localpart);
  ta(LocalpartDot, groups.domain, Localpart);
  const EmailDomain = makeState();
  ta(LocalpartAt, groups.domain, EmailDomain); // parsed string starts with local email info + @ with a potential domain name
  ta(EmailDomain, groups.domain, EmailDomain);
  const EmailDomainDot = tt(EmailDomain, DOT); // domain followed by DOT
  ta(EmailDomainDot, groups.domain, EmailDomain);
  const Email$1 = makeState(Email); // Possible email address (could have more tlds)
  ta(EmailDomainDot, groups.tld, Email$1);
  ta(EmailDomainDot, groups.utld, Email$1);
  tt(LocalpartAt, LOCALHOST, Email$1);

  // Hyphen can jump back to a domain name
  const EmailDomainHyphen = tt(EmailDomain, HYPHEN); // parsed string starts with local email info + @ with a potential domain name
  tt(EmailDomainHyphen, HYPHEN, EmailDomainHyphen);
  ta(EmailDomainHyphen, groups.domain, EmailDomain);
  ta(Email$1, groups.domain, EmailDomain);
  tt(Email$1, DOT, EmailDomainDot);
  tt(Email$1, HYPHEN, EmailDomainHyphen);

  // Final possible email states
  const EmailColon = tt(Email$1, COLON); // URL followed by colon (potential port number here)
  /*const EmailColonPort = */
  ta(EmailColon, groups.numeric, Email); // URL followed by colon and port number

  // Account for dots and hyphens. Hyphens are usually parts of domain names
  // (but not TLDs)
  const DomainHyphen = tt(Domain, HYPHEN); // domain followed by hyphen
  const DomainDot = tt(Domain, DOT); // domain followed by DOT
  tt(DomainHyphen, HYPHEN, DomainHyphen);
  ta(DomainHyphen, groups.domain, Domain);
  ta(DomainDot, localpartAccepting, Localpart);
  ta(DomainDot, groups.domain, Domain);
  const DomainDotTld = makeState(Url); // Simplest possible URL with no query string
  ta(DomainDot, groups.tld, DomainDotTld);
  ta(DomainDot, groups.utld, DomainDotTld);
  ta(DomainDotTld, groups.domain, Domain);
  ta(DomainDotTld, localpartAccepting, Localpart);
  tt(DomainDotTld, DOT, DomainDot);
  tt(DomainDotTld, HYPHEN, DomainHyphen);
  tt(DomainDotTld, AT, LocalpartAt);
  const DomainDotTldColon = tt(DomainDotTld, COLON); // URL followed by colon (potential port number here)
  const DomainDotTldColonPort = makeState(Url); // TLD followed by a port number
  ta(DomainDotTldColon, groups.numeric, DomainDotTldColonPort);

  // Long URL with optional port and maybe query string
  const Url$1 = makeState(Url);

  // URL with extra symbols at the end, followed by an opening bracket
  const UrlNonaccept = makeState(); // URL followed by some symbols (will not be part of the final URL)

  // Query strings
  ta(Url$1, qsAccepting, Url$1);
  ta(Url$1, qsNonAccepting, UrlNonaccept);
  ta(UrlNonaccept, qsAccepting, Url$1);
  ta(UrlNonaccept, qsNonAccepting, UrlNonaccept);

  // Become real URLs after `SLASH` or `COLON NUM SLASH`
  // Here works with or without scheme:// prefix
  tt(DomainDotTld, SLASH, Url$1);
  tt(DomainDotTldColonPort, SLASH, Url$1);

  // Note that domains that begin with schemes are treated slighly differently
  const SchemeColon = tt(Scheme, COLON); // e.g., 'mailto:'
  const SlashSchemeColon = tt(SlashScheme, COLON); // e.g., 'http:'
  const SlashSchemeColonSlash = tt(SlashSchemeColon, SLASH); // e.g., 'http:/'

  const UriPrefix = tt(SlashSchemeColonSlash, SLASH); // e.g., 'http://'

  // Scheme states can transition to domain states
  ta(Scheme, groups.domain, Domain);
  tt(Scheme, DOT, DomainDot);
  tt(Scheme, HYPHEN, DomainHyphen);
  ta(SlashScheme, groups.domain, Domain);
  tt(SlashScheme, DOT, DomainDot);
  tt(SlashScheme, HYPHEN, DomainHyphen);

  // Force URL with scheme prefix followed by anything sane
  ta(SchemeColon, groups.domain, Url$1);
  tt(SchemeColon, SLASH, Url$1);
  tt(SchemeColon, QUERY, Url$1);
  ta(UriPrefix, groups.domain, Url$1);
  ta(UriPrefix, qsAccepting, Url$1);
  tt(UriPrefix, SLASH, Url$1);
  const bracketPairs = [[OPENBRACE, CLOSEBRACE],
  // {}
  [OPENBRACKET, CLOSEBRACKET],
  // []
  [OPENPAREN, CLOSEPAREN],
  // ()
  [OPENANGLEBRACKET, CLOSEANGLEBRACKET],
  // <>
  [FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN],
  // （）
  [LEFTCORNERBRACKET, RIGHTCORNERBRACKET],
  // 「」
  [LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET],
  // 『』
  [FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN] // ＜＞
  ];
  for (let i = 0; i < bracketPairs.length; i++) {
    const [OPEN, CLOSE] = bracketPairs[i];
    const UrlOpen = tt(Url$1, OPEN); // URL followed by open bracket

    // Continue not accepting for open brackets
    tt(UrlNonaccept, OPEN, UrlOpen);

    // Closing bracket component. This character WILL be included in the URL
    tt(UrlOpen, CLOSE, Url$1);

    // URL that beings with an opening bracket, followed by a symbols.
    // Note that the final state can still be `UrlOpen` (if the URL has a
    // single opening bracket for some reason).
    const UrlOpenQ = makeState(Url);
    ta(UrlOpen, qsAccepting, UrlOpenQ);
    const UrlOpenSyms = makeState(); // UrlOpen followed by some symbols it cannot end it
    ta(UrlOpen, qsNonAccepting);

    // URL that begins with an opening bracket, followed by some symbols
    ta(UrlOpenQ, qsAccepting, UrlOpenQ);
    ta(UrlOpenQ, qsNonAccepting, UrlOpenSyms);
    ta(UrlOpenSyms, qsAccepting, UrlOpenQ);
    ta(UrlOpenSyms, qsNonAccepting, UrlOpenSyms);

    // Close brace/bracket to become regular URL
    tt(UrlOpenQ, CLOSE, Url$1);
    tt(UrlOpenSyms, CLOSE, Url$1);
  }
  tt(Start, LOCALHOST, DomainDotTld); // localhost is a valid URL state
  tt(Start, NL, Nl); // single new line

  return {
    start: Start,
    tokens: tk
  };
}

/**
 * Run the parser state machine on a list of scanned string-based tokens to
 * create a list of multi tokens, each of which represents a URL, email address,
 * plain text, etc.
 *
 * @param {State<MultiToken>} start parser start state
 * @param {string} input the original input used to generate the given tokens
 * @param {Token[]} tokens list of scanned tokens
 * @returns {MultiToken[]}
 */
function run(start, input, tokens) {
  let len = tokens.length;
  let cursor = 0;
  let multis = [];
  let textTokens = [];
  while (cursor < len) {
    let state = start;
    let secondState = null;
    let nextState = null;
    let multiLength = 0;
    let latestAccepting = null;
    let sinceAccepts = -1;
    while (cursor < len && !(secondState = state.go(tokens[cursor].t))) {
      // Starting tokens with nowhere to jump to.
      // Consider these to be just plain text
      textTokens.push(tokens[cursor++]);
    }
    while (cursor < len && (nextState = secondState || state.go(tokens[cursor].t))) {
      // Get the next state
      secondState = null;
      state = nextState;

      // Keep track of the latest accepting state
      if (state.accepts()) {
        sinceAccepts = 0;
        latestAccepting = state;
      } else if (sinceAccepts >= 0) {
        sinceAccepts++;
      }
      cursor++;
      multiLength++;
    }
    if (sinceAccepts < 0) {
      // No accepting state was found, part of a regular text token add
      // the first text token to the text tokens array and try again from
      // the next
      cursor -= multiLength;
      if (cursor < len) {
        textTokens.push(tokens[cursor]);
        cursor++;
      }
    } else {
      // Accepting state!
      // First close off the textTokens (if available)
      if (textTokens.length > 0) {
        multis.push(initMultiToken(Text, input, textTokens));
        textTokens = [];
      }

      // Roll back to the latest accepting state
      cursor -= sinceAccepts;
      multiLength -= sinceAccepts;

      // Create a new multitoken
      const Multi = latestAccepting.t;
      const subtokens = tokens.slice(cursor - multiLength, cursor);
      multis.push(initMultiToken(Multi, input, subtokens));
    }
  }

  // Finally close off the textTokens (if available)
  if (textTokens.length > 0) {
    multis.push(initMultiToken(Text, input, textTokens));
  }
  return multis;
}

/**
 * Utility function for instantiating a new multitoken with all the relevant
 * fields during parsing.
 * @param {new (value: string, tokens: Token[]) => MultiToken} Multi class to instantiate
 * @param {string} input original input string
 * @param {Token[]} tokens consecutive tokens scanned from input string
 * @returns {MultiToken}
 */
function initMultiToken(Multi, input, tokens) {
  const startIdx = tokens[0].s;
  const endIdx = tokens[tokens.length - 1].e;
  const value = input.slice(startIdx, endIdx);
  return new Multi(value, tokens);
}

const warn = typeof console !== 'undefined' && console && console.warn || (() => {});
const warnAdvice = 'until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.';

// Side-effect initialization state
const INIT = {
  scanner: null,
  parser: null,
  tokenQueue: [],
  pluginQueue: [],
  customSchemes: [],
  initialized: false
};

/**
 * @typedef {{
 * 	start: State<string>,
 * 	tokens: { groups: Collections<string> } & typeof tk
 * }} ScannerInit
 */

/**
 * @typedef {{
 * 	start: State<MultiToken>,
 * 	tokens: typeof multi
 * }} ParserInit
 */

/**
 * @typedef {(arg: { scanner: ScannerInit }) => void} TokenPlugin
 */

/**
 * @typedef {(arg: { scanner: ScannerInit, parser: ParserInit }) => void} Plugin
 */

/**
 * De-register all plugins and reset the internal state-machine. Used for
 * testing; not required in practice.
 * @private
 */
function reset() {
  State.groups = {};
  INIT.scanner = null;
  INIT.parser = null;
  INIT.tokenQueue = [];
  INIT.pluginQueue = [];
  INIT.customSchemes = [];
  INIT.initialized = false;
  return INIT;
}

/**
 * Register a token plugin to allow the scanner to recognize additional token
 * types before the parser state machine is constructed from the results.
 * @param {string} name of plugin to register
 * @param {TokenPlugin} plugin function that accepts the scanner state machine
 * and available scanner tokens and collections and extends the state machine to
 * recognize additional tokens or groups.
 */
function registerTokenPlugin(name, plugin) {
  if (typeof plugin !== 'function') {
    throw new Error(`linkifyjs: Invalid token plugin ${plugin} (expects function)`);
  }
  for (let i = 0; i < INIT.tokenQueue.length; i++) {
    if (name === INIT.tokenQueue[i][0]) {
      warn(`linkifyjs: token plugin "${name}" already registered - will be overwritten`);
      INIT.tokenQueue[i] = [name, plugin];
      return;
    }
  }
  INIT.tokenQueue.push([name, plugin]);
  if (INIT.initialized) {
    warn(`linkifyjs: already initialized - will not register token plugin "${name}" ${warnAdvice}`);
  }
}

/**
 * Register a linkify plugin
 * @param {string} name of plugin to register
 * @param {Plugin} plugin function that accepts the parser state machine and
 * extends the parser to recognize additional link types
 */
function registerPlugin(name, plugin) {
  if (typeof plugin !== 'function') {
    throw new Error(`linkifyjs: Invalid plugin ${plugin} (expects function)`);
  }
  for (let i = 0; i < INIT.pluginQueue.length; i++) {
    if (name === INIT.pluginQueue[i][0]) {
      warn(`linkifyjs: plugin "${name}" already registered - will be overwritten`);
      INIT.pluginQueue[i] = [name, plugin];
      return;
    }
  }
  INIT.pluginQueue.push([name, plugin]);
  if (INIT.initialized) {
    warn(`linkifyjs: already initialized - will not register plugin "${name}" ${warnAdvice}`);
  }
}

/**
 * Detect URLs with the following additional protocol. Anything with format
 * "protocol://..." will be considered a link. If `optionalSlashSlash` is set to
 * `true`, anything with format "protocol:..." will be considered a link.
 * @param {string} scheme
 * @param {boolean} [optionalSlashSlash]
 */
function registerCustomProtocol(scheme, optionalSlashSlash = false) {
  if (INIT.initialized) {
    warn(`linkifyjs: already initialized - will not register custom scheme "${scheme}" ${warnAdvice}`);
  }
  if (!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(scheme)) {
    throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);
  }
  INIT.customSchemes.push([scheme, optionalSlashSlash]);
}

/**
 * Initialize the linkify state machine. Called automatically the first time
 * linkify is called on a string, but may be called manually as well.
 */
function init() {
  // Initialize scanner state machine and plugins
  INIT.scanner = init$2(INIT.customSchemes);
  for (let i = 0; i < INIT.tokenQueue.length; i++) {
    INIT.tokenQueue[i][1]({
      scanner: INIT.scanner
    });
  }

  // Initialize parser state machine and plugins
  INIT.parser = init$1(INIT.scanner.tokens);
  for (let i = 0; i < INIT.pluginQueue.length; i++) {
    INIT.pluginQueue[i][1]({
      scanner: INIT.scanner,
      parser: INIT.parser
    });
  }
  INIT.initialized = true;
  return INIT;
}

/**
 * Parse a string into tokens that represent linkable and non-linkable sub-components
 * @param {string} str
 * @return {MultiToken[]} tokens
 */
function tokenize(str) {
  if (!INIT.initialized) {
    init();
  }
  return run(INIT.parser.start, str, run$1(INIT.scanner.start, str));
}
tokenize.scan = run$1; // for testing

/**
 * Find a list of linkable items in the given string.
 * @param {string} str string to find links in
 * @param {string | Opts} [type] either formatting options or specific type of
 * links to find, e.g., 'url' or 'email'
 * @param {Opts} [opts] formatting options for final output. Cannot be specified
 * if opts already provided in `type` argument
 */
function find(str, type = null, opts = null) {
  if (type && typeof type === 'object') {
    if (opts) {
      throw Error(`linkifyjs: Invalid link type ${type}; must be a string`);
    }
    opts = type;
    type = null;
  }
  const options = new Options(opts);
  const tokens = tokenize(str);
  const filtered = [];
  for (let i = 0; i < tokens.length; i++) {
    const token = tokens[i];
    if (token.isLink && (!type || token.t === type) && options.check(token)) {
      filtered.push(token.toFormattedObject(options));
    }
  }
  return filtered;
}

/**
 * Is the given string valid linkable text of some sort. Note that this does not
 * trim the text for you.
 *
 * Optionally pass in a second `type` param, which is the type of link to test
 * for.
 *
 * For example,
 *
 *     linkify.test(str, 'email');
 *
 * Returns `true` if str is a valid email.
 * @param {string} str string to test for links
 * @param {string} [type] optional specific link type to look for
 * @returns boolean true/false
 */
function test(str, type = null) {
  const tokens = tokenize(str);
  return tokens.length === 1 && tokens[0].isLink && (!type || tokens[0].t === type);
}




/***/ }),

/***/ "./node_modules/object-assign/index.js":
/*!*********************************************!*\
  !*** ./node_modules/object-assign/index.js ***!
  \*********************************************/
/***/ (function(module) {

"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/


/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;

function toObject(val) {
	if (val === null || val === undefined) {
		throw new TypeError('Object.assign cannot be called with null or undefined');
	}

	return Object(val);
}

function shouldUseNative() {
	try {
		if (!Object.assign) {
			return false;
		}

		// Detect buggy property enumeration order in older V8 versions.

		// https://bugs.chromium.org/p/v8/issues/detail?id=4118
		var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
		test1[5] = 'de';
		if (Object.getOwnPropertyNames(test1)[0] === '5') {
			return false;
		}

		// https://bugs.chromium.org/p/v8/issues/detail?id=3056
		var test2 = {};
		for (var i = 0; i < 10; i++) {
			test2['_' + String.fromCharCode(i)] = i;
		}
		var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
			return test2[n];
		});
		if (order2.join('') !== '0123456789') {
			return false;
		}

		// https://bugs.chromium.org/p/v8/issues/detail?id=3056
		var test3 = {};
		'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
			test3[letter] = letter;
		});
		if (Object.keys(Object.assign({}, test3)).join('') !==
				'abcdefghijklmnopqrst') {
			return false;
		}

		return true;
	} catch (err) {
		// We don't expect any of the above to throw, but better to be safe.
		return false;
	}
}

module.exports = shouldUseNative() ? Object.assign : function (target, source) {
	var from;
	var to = toObject(target);
	var symbols;

	for (var s = 1; s < arguments.length; s++) {
		from = Object(arguments[s]);

		for (var key in from) {
			if (hasOwnProperty.call(from, key)) {
				to[key] = from[key];
			}
		}

		if (getOwnPropertySymbols) {
			symbols = getOwnPropertySymbols(from);
			for (var i = 0; i < symbols.length; i++) {
				if (propIsEnumerable.call(from, symbols[i])) {
					to[symbols[i]] = from[symbols[i]];
				}
			}
		}
	}

	return to;
};


/***/ }),

/***/ "./node_modules/orderedmap/dist/index.js":
/*!***********************************************!*\
  !*** ./node_modules/orderedmap/dist/index.js ***!
  \***********************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
// ::- Persistent data structure representing an ordered mapping from
// strings to values, with some convenient update methods.
function OrderedMap(content) {
  this.content = content;
}

OrderedMap.prototype = {
  constructor: OrderedMap,

  find: function(key) {
    for (var i = 0; i < this.content.length; i += 2)
      if (this.content[i] === key) return i
    return -1
  },

  // :: (string) → ?any
  // Retrieve the value stored under `key`, or return undefined when
  // no such key exists.
  get: function(key) {
    var found = this.find(key);
    return found == -1 ? undefined : this.content[found + 1]
  },

  // :: (string, any, ?string) → OrderedMap
  // Create a new map by replacing the value of `key` with a new
  // value, or adding a binding to the end of the map. If `newKey` is
  // given, the key of the binding will be replaced with that key.
  update: function(key, value, newKey) {
    var self = newKey && newKey != key ? this.remove(newKey) : this;
    var found = self.find(key), content = self.content.slice();
    if (found == -1) {
      content.push(newKey || key, value);
    } else {
      content[found + 1] = value;
      if (newKey) content[found] = newKey;
    }
    return new OrderedMap(content)
  },

  // :: (string) → OrderedMap
  // Return a map with the given key removed, if it existed.
  remove: function(key) {
    var found = this.find(key);
    if (found == -1) return this
    var content = this.content.slice();
    content.splice(found, 2);
    return new OrderedMap(content)
  },

  // :: (string, any) → OrderedMap
  // Add a new key to the start of the map.
  addToStart: function(key, value) {
    return new OrderedMap([key, value].concat(this.remove(key).content))
  },

  // :: (string, any) → OrderedMap
  // Add a new key to the end of the map.
  addToEnd: function(key, value) {
    var content = this.remove(key).content.slice();
    content.push(key, value);
    return new OrderedMap(content)
  },

  // :: (string, string, any) → OrderedMap
  // Add a key after the given key. If `place` is not found, the new
  // key is added to the end.
  addBefore: function(place, key, value) {
    var without = this.remove(key), content = without.content.slice();
    var found = without.find(place);
    content.splice(found == -1 ? content.length : found, 0, key, value);
    return new OrderedMap(content)
  },

  // :: ((key: string, value: any))
  // Call the given function for each key/value pair in the map, in
  // order.
  forEach: function(f) {
    for (var i = 0; i < this.content.length; i += 2)
      f(this.content[i], this.content[i + 1]);
  },

  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a new map by prepending the keys in this map that don't
  // appear in `map` before the keys in `map`.
  prepend: function(map) {
    map = OrderedMap.from(map);
    if (!map.size) return this
    return new OrderedMap(map.content.concat(this.subtract(map).content))
  },

  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a new map by appending the keys in this map that don't
  // appear in `map` after the keys in `map`.
  append: function(map) {
    map = OrderedMap.from(map);
    if (!map.size) return this
    return new OrderedMap(this.subtract(map).content.concat(map.content))
  },

  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a map containing all the keys in this map that don't
  // appear in `map`.
  subtract: function(map) {
    var result = this;
    map = OrderedMap.from(map);
    for (var i = 0; i < map.content.length; i += 2)
      result = result.remove(map.content[i]);
    return result
  },

  // :: () → Object
  // Turn ordered map into a plain object.
  toObject: function() {
    var result = {};
    this.forEach(function(key, value) { result[key] = value; });
    return result
  },

  // :: number
  // The amount of keys in this map.
  get size() {
    return this.content.length >> 1
  }
};

// :: (?union<Object, OrderedMap>) → OrderedMap
// Return a map with the given content. If null, create an empty
// map. If given an ordered map, return that map itself. If given an
// object, create a map from the object's properties.
OrderedMap.from = function(value) {
  if (value instanceof OrderedMap) return value
  var content = [];
  if (value) for (var prop in value) content.push(prop, value[prop]);
  return new OrderedMap(content)
};

/* harmony default export */ __webpack_exports__["default"] = (OrderedMap);


/***/ }),

/***/ "./node_modules/primereact/api/api.esm.js":
/*!************************************************!*\
  !*** ./node_modules/primereact/api/api.esm.js ***!
  \************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterMatchMode: function() { return /* binding */ FilterMatchMode; },
/* harmony export */   FilterOperator: function() { return /* binding */ FilterOperator; },
/* harmony export */   FilterService: function() { return /* binding */ FilterService; },
/* harmony export */   MessageSeverity: function() { return /* binding */ MessageSeverity; },
/* harmony export */   PrimeIcons: function() { return /* binding */ PrimeIcons; },
/* harmony export */   PrimeReactContext: function() { return /* binding */ PrimeReactContext; },
/* harmony export */   PrimeReactProvider: function() { return /* binding */ PrimeReactProvider; },
/* harmony export */   SortOrder: function() { return /* binding */ SortOrder; },
/* harmony export */   addLocale: function() { return /* binding */ addLocale; },
/* harmony export */   ariaLabel: function() { return /* binding */ ariaLabel; },
/* harmony export */   "default": function() { return /* binding */ PrimeReact; },
/* harmony export */   locale: function() { return /* binding */ locale; },
/* harmony export */   localeOption: function() { return /* binding */ localeOption; },
/* harmony export */   localeOptions: function() { return /* binding */ localeOptions; },
/* harmony export */   updateLocaleOption: function() { return /* binding */ updateLocaleOption; },
/* harmony export */   updateLocaleOptions: function() { return /* binding */ updateLocaleOptions; }
/* harmony export */ });
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
'use client';



var FilterMatchMode = Object.freeze({
  STARTS_WITH: 'startsWith',
  CONTAINS: 'contains',
  NOT_CONTAINS: 'notContains',
  ENDS_WITH: 'endsWith',
  EQUALS: 'equals',
  NOT_EQUALS: 'notEquals',
  IN: 'in',
  NOT_IN: 'notIn',
  LESS_THAN: 'lt',
  LESS_THAN_OR_EQUAL_TO: 'lte',
  GREATER_THAN: 'gt',
  GREATER_THAN_OR_EQUAL_TO: 'gte',
  BETWEEN: 'between',
  DATE_IS: 'dateIs',
  DATE_IS_NOT: 'dateIsNot',
  DATE_BEFORE: 'dateBefore',
  DATE_AFTER: 'dateAfter',
  CUSTOM: 'custom'
});

var FilterOperator = Object.freeze({
  AND: 'and',
  OR: 'or'
});

function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
var FilterService = {
  filter: function filter(value, fields, filterValue, filterMatchMode, filterLocale) {
    var filteredItems = [];
    if (!value) {
      return filteredItems;
    }
    var _iterator = _createForOfIteratorHelper(value),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var item = _step.value;
        if (typeof item === 'string') {
          if (this.filters[filterMatchMode](item, filterValue, filterLocale)) {
            filteredItems.push(item);
            continue;
          }
        } else {
          var _iterator2 = _createForOfIteratorHelper(fields),
            _step2;
          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var field = _step2.value;
              var fieldValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.resolveFieldData(item, field);
              if (this.filters[filterMatchMode](fieldValue, filterValue, filterLocale)) {
                filteredItems.push(item);
                break;
              }
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    return filteredItems;
  },
  filters: {
    startsWith: function startsWith(value, filter, filterLocale) {
      if (filter === undefined || filter === null || filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      var filterValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
      var stringValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
      return stringValue.slice(0, filterValue.length) === filterValue;
    },
    contains: function contains(value, filter, filterLocale) {
      if (filter === undefined || filter === null || typeof filter === 'string' && filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      var filterValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
      var stringValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
      return stringValue.indexOf(filterValue) !== -1;
    },
    notContains: function notContains(value, filter, filterLocale) {
      if (filter === undefined || filter === null || typeof filter === 'string' && filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      var filterValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
      var stringValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
      return stringValue.indexOf(filterValue) === -1;
    },
    endsWith: function endsWith(value, filter, filterLocale) {
      if (filter === undefined || filter === null || filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      var filterValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
      var stringValue = primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
      return stringValue.indexOf(filterValue, stringValue.length - filterValue.length) !== -1;
    },
    equals: function equals(value, filter, filterLocale) {
      if (filter === undefined || filter === null || typeof filter === 'string' && filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() === filter.getTime();
      }
      return primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) === primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
    },
    notEquals: function notEquals(value, filter, filterLocale) {
      if (filter === undefined || filter === null || typeof filter === 'string' && filter.trim() === '') {
        return true;
      }
      if (value === undefined || value === null) {
        return true;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() !== filter.getTime();
      }
      return primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) !== primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
    },
    "in": function _in(value, filter) {
      if (filter === undefined || filter === null || filter.length === 0) {
        return true;
      }
      for (var i = 0; i < filter.length; i++) {
        if (primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.equals(value, filter[i])) {
          return true;
        }
      }
      return false;
    },
    notIn: function notIn(value, filter) {
      if (filter === undefined || filter === null || filter.length === 0) {
        return true;
      }
      for (var i = 0; i < filter.length; i++) {
        if (primereact_utils__WEBPACK_IMPORTED_MODULE_0__.ObjectUtils.equals(value, filter[i])) {
          return false;
        }
      }
      return true;
    },
    between: function between(value, filter) {
      if (filter == null || filter[0] == null || filter[1] == null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime) {
        return filter[0].getTime() <= value.getTime() && value.getTime() <= filter[1].getTime();
      }
      return filter[0] <= value && value <= filter[1];
    },
    lt: function lt(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() < filter.getTime();
      }
      return value < filter;
    },
    lte: function lte(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() <= filter.getTime();
      }
      return value <= filter;
    },
    gt: function gt(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() > filter.getTime();
      }
      return value > filter;
    },
    gte: function gte(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      if (value.getTime && filter.getTime) {
        return value.getTime() >= filter.getTime();
      }
      return value >= filter;
    },
    dateIs: function dateIs(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      return value.toDateString() === filter.toDateString();
    },
    dateIsNot: function dateIsNot(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      return value.toDateString() !== filter.toDateString();
    },
    dateBefore: function dateBefore(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      return value.getTime() < filter.getTime();
    },
    dateAfter: function dateAfter(value, filter) {
      if (filter === undefined || filter === null) {
        return true;
      }
      if (value === undefined || value === null) {
        return false;
      }
      return value.getTime() > filter.getTime();
    }
  },
  register: function register(rule, fn) {
    this.filters[rule] = fn;
  }
};

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function _defineProperties(e, r) {
  for (var t = 0; t < r.length; t++) {
    var o = r[t];
    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
  }
}
function _createClass(e, r, t) {
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}

function _classCallCheck(a, n) {
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}

/**
 * @deprecated please use PrimeReactContext
 */
var PrimeReact$1 = /*#__PURE__*/_createClass(function PrimeReact() {
  _classCallCheck(this, PrimeReact);
});
_defineProperty(PrimeReact$1, "ripple", false);
_defineProperty(PrimeReact$1, "inputStyle", 'outlined');
_defineProperty(PrimeReact$1, "locale", 'en');
_defineProperty(PrimeReact$1, "appendTo", null);
_defineProperty(PrimeReact$1, "cssTransition", true);
_defineProperty(PrimeReact$1, "autoZIndex", true);
_defineProperty(PrimeReact$1, "hideOverlaysOnDocumentScrolling", false);
_defineProperty(PrimeReact$1, "nonce", null);
_defineProperty(PrimeReact$1, "nullSortOrder", 1);
_defineProperty(PrimeReact$1, "zIndex", {
  modal: 1100,
  overlay: 1000,
  menu: 1000,
  tooltip: 1100,
  toast: 1200
});
_defineProperty(PrimeReact$1, "pt", undefined);
_defineProperty(PrimeReact$1, "filterMatchModeOptions", {
  text: [FilterMatchMode.STARTS_WITH, FilterMatchMode.CONTAINS, FilterMatchMode.NOT_CONTAINS, FilterMatchMode.ENDS_WITH, FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS],
  numeric: [FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS, FilterMatchMode.LESS_THAN, FilterMatchMode.LESS_THAN_OR_EQUAL_TO, FilterMatchMode.GREATER_THAN, FilterMatchMode.GREATER_THAN_OR_EQUAL_TO],
  date: [FilterMatchMode.DATE_IS, FilterMatchMode.DATE_IS_NOT, FilterMatchMode.DATE_BEFORE, FilterMatchMode.DATE_AFTER]
});
_defineProperty(PrimeReact$1, "changeTheme", function (currentTheme, newTheme, linkElementId, callback) {
  var _linkElement$parentNo;
  var linkElement = document.getElementById(linkElementId);
  if (!linkElement) {
    throw Error("Element with id ".concat(linkElementId, " not found."));
  }
  var newThemeUrl = linkElement.getAttribute('href').replace(currentTheme, newTheme);
  var newLinkElement = document.createElement('link');
  newLinkElement.setAttribute('rel', 'stylesheet');
  newLinkElement.setAttribute('id', linkElementId);
  newLinkElement.setAttribute('href', newThemeUrl);
  newLinkElement.addEventListener('load', function () {
    if (callback) {
      callback();
    }
  });
  (_linkElement$parentNo = linkElement.parentNode) === null || _linkElement$parentNo === void 0 || _linkElement$parentNo.replaceChild(newLinkElement, linkElement);
});

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var locales = {
  en: {
    accept: 'Yes',
    addRule: 'Add Rule',
    am: 'AM',
    apply: 'Apply',
    cancel: 'Cancel',
    choose: 'Choose',
    chooseDate: 'Choose Date',
    chooseMonth: 'Choose Month',
    chooseYear: 'Choose Year',
    clear: 'Clear',
    completed: 'Completed',
    contains: 'Contains',
    custom: 'Custom',
    dateAfter: 'Date is after',
    dateBefore: 'Date is before',
    dateFormat: 'mm/dd/yy',
    dateIs: 'Date is',
    dateIsNot: 'Date is not',
    dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
    dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
    dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
    emptyFilterMessage: 'No results found',
    emptyMessage: 'No available options',
    emptySearchMessage: 'No results found',
    emptySelectionMessage: 'No selected item',
    endsWith: 'Ends with',
    equals: 'Equals',
    fileChosenMessage: '{0} files',
    fileSizeTypes: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
    filter: 'Filter',
    firstDayOfWeek: 0,
    gt: 'Greater than',
    gte: 'Greater than or equal to',
    lt: 'Less than',
    lte: 'Less than or equal to',
    matchAll: 'Match All',
    matchAny: 'Match Any',
    medium: 'Medium',
    monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    nextDecade: 'Next Decade',
    nextHour: 'Next Hour',
    nextMinute: 'Next Minute',
    nextMonth: 'Next Month',
    nextSecond: 'Next Second',
    nextYear: 'Next Year',
    noFileChosenMessage: 'No file chosen',
    noFilter: 'No Filter',
    notContains: 'Not contains',
    notEquals: 'Not equals',
    now: 'Now',
    passwordPrompt: 'Enter a password',
    pending: 'Pending',
    pm: 'PM',
    prevDecade: 'Previous Decade',
    prevHour: 'Previous Hour',
    prevMinute: 'Previous Minute',
    prevMonth: 'Previous Month',
    prevSecond: 'Previous Second',
    prevYear: 'Previous Year',
    reject: 'No',
    removeRule: 'Remove Rule',
    searchMessage: '{0} results are available',
    selectionMessage: '{0} items selected',
    showMonthAfterYear: false,
    startsWith: 'Starts with',
    strong: 'Strong',
    today: 'Today',
    upload: 'Upload',
    weak: 'Weak',
    weekHeader: 'Wk',
    aria: {
      cancelEdit: 'Cancel Edit',
      close: 'Close',
      collapseLabel: 'Collapse',
      collapseRow: 'Row Collapsed',
      editRow: 'Edit Row',
      expandLabel: 'Expand',
      expandRow: 'Row Expanded',
      falseLabel: 'False',
      filterConstraint: 'Filter Constraint',
      filterOperator: 'Filter Operator',
      firstPageLabel: 'First Page',
      gridView: 'Grid View',
      hideFilterMenu: 'Hide Filter Menu',
      jumpToPageDropdownLabel: 'Jump to Page Dropdown',
      jumpToPageInputLabel: 'Jump to Page Input',
      lastPageLabel: 'Last Page',
      listLabel: 'Option List',
      listView: 'List View',
      moveAllToSource: 'Move All to Source',
      moveAllToTarget: 'Move All to Target',
      moveBottom: 'Move Bottom',
      moveDown: 'Move Down',
      moveToSource: 'Move to Source',
      moveToTarget: 'Move to Target',
      moveTop: 'Move Top',
      moveUp: 'Move Up',
      navigation: 'Navigation',
      next: 'Next',
      nextPageLabel: 'Next Page',
      nullLabel: 'Not Selected',
      otpLabel: 'Please enter one time password character {0}',
      pageLabel: 'Page {page}',
      passwordHide: 'Hide Password',
      passwordShow: 'Show Password',
      previous: 'Previous',
      prevPageLabel: 'Previous Page',
      removeLabel: 'Remove',
      rotateLeft: 'Rotate Left',
      rotateRight: 'Rotate Right',
      rowsPerPageLabel: 'Rows per page',
      saveEdit: 'Save Edit',
      scrollTop: 'Scroll Top',
      selectAll: 'All items selected',
      selectLabel: 'Select',
      selectRow: 'Row Selected',
      showFilterMenu: 'Show Filter Menu',
      slide: 'Slide',
      slideNumber: '{slideNumber}',
      star: '1 star',
      stars: '{star} stars',
      trueLabel: 'True',
      unselectAll: 'All items unselected',
      unselectLabel: 'Unselect',
      unselectRow: 'Row Unselected',
      zoomImage: 'Zoom Image',
      zoomIn: 'Zoom In',
      zoomOut: 'Zoom Out'
    }
  }
};
function locale(locale) {
  locale && (PrimeReact$1.locale = locale);
  return {
    locale: PrimeReact$1.locale,
    options: locales[PrimeReact$1.locale]
  };
}
function addLocale(locale, options) {
  if (locale.includes('__proto__') || locale.includes('prototype')) {
    throw new Error('Unsafe locale detected');
  }
  locales[locale] = _objectSpread(_objectSpread({}, locales.en), options);
}
function updateLocaleOption(key, value, locale) {
  if (key.includes('__proto__') || key.includes('prototype')) {
    throw new Error('Unsafe key detected');
  }
  localeOptions(locale)[key] = value;
}
function updateLocaleOptions(options, locale) {
  if (locale.includes('__proto__') || locale.includes('prototype')) {
    throw new Error('Unsafe locale detected');
  }
  var _locale = locale || PrimeReact$1.locale;
  locales[_locale] = _objectSpread(_objectSpread({}, locales[_locale]), options);
}
function localeOption(key, locale) {
  if (key.includes('__proto__') || key.includes('prototype')) {
    throw new Error('Unsafe key detected');
  }
  var _locale = locale || PrimeReact$1.locale;
  try {
    return localeOptions(_locale)[key];
  } catch (error) {
    throw new Error("The ".concat(key, " option is not found in the current locale('").concat(_locale, "')."));
  }
}

/**
 * Find an ARIA label in the locale by key.  If options are passed it will replace all options:
 * ```ts
 * const ariaValue = "Page {page}, User {user}, Role {role}";
 * const options = { page: 2, user: "John", role: "Admin" };
 * const result = ariaLabel('yourLabel', { page: 2, user: "John", role: "Admin" })
 * console.log(result); // Output: Page 2, User John, Role Admin
 * ```
 * @param {string} ariaKey key of the ARIA label to look up in locale.
 * @param {any} options JSON options like { page: 2, user: "John", role: "Admin" }
 * @returns the ARIA label with replaced values
 */
function ariaLabel(ariaKey, options) {
  if (ariaKey.includes('__proto__') || ariaKey.includes('prototype')) {
    throw new Error('Unsafe ariaKey detected');
  }
  var _locale = PrimeReact$1.locale;
  try {
    var _ariaLabel = localeOptions(_locale).aria[ariaKey];
    if (_ariaLabel) {
      for (var key in options) {
        if (options.hasOwnProperty(key)) {
          _ariaLabel = _ariaLabel.replace("{".concat(key, "}"), options[key]);
        }
      }
    }
    return _ariaLabel;
  } catch (error) {
    throw new Error("The ".concat(ariaKey, " option is not found in the current locale('").concat(_locale, "')."));
  }
}
function localeOptions(locale) {
  var _locale = locale || PrimeReact$1.locale;
  if (_locale.includes('__proto__') || _locale.includes('prototype')) {
    throw new Error('Unsafe locale detected');
  }
  return locales[_locale];
}

var MessageSeverity = Object.freeze({
  SUCCESS: 'success',
  INFO: 'info',
  WARN: 'warn',
  ERROR: 'error',
  SECONDARY: 'secondary',
  CONTRAST: 'contrast'
});

var PrimeIcons = Object.freeze({
  ADDRESS_BOOK: 'pi pi-address-book',
  ALIGN_CENTER: 'pi pi-align-center',
  ALIGN_JUSTIFY: 'pi pi-align-justify',
  ALIGN_LEFT: 'pi pi-align-left',
  ALIGN_RIGHT: 'pi pi-align-right',
  AMAZON: 'pi pi-amazon',
  ANDROID: 'pi pi-android',
  ANGLE_DOUBLE_DOWN: 'pi pi-angle-double-down',
  ANGLE_DOUBLE_LEFT: 'pi pi-angle-double-left',
  ANGLE_DOUBLE_RIGHT: 'pi pi-angle-double-right',
  ANGLE_DOUBLE_UP: 'pi pi-angle-double-up',
  ANGLE_DOWN: 'pi pi-angle-down',
  ANGLE_LEFT: 'pi pi-angle-left',
  ANGLE_RIGHT: 'pi pi-angle-right',
  ANGLE_UP: 'pi pi-angle-up',
  APPLE: 'pi pi-apple',
  ARROW_CIRCLE_DOWN: 'pi pi-arrow-circle-down',
  ARROW_CIRCLE_LEFT: 'pi pi-arrow-circle-left',
  ARROW_CIRCLE_RIGHT: 'pi pi-arrow-circle-right',
  ARROW_CIRCLE_UP: 'pi pi-arrow-circle-up',
  ARROW_DOWN_LEFT_AND_ARROW_UP_RIGHT_TO_CENTER: 'pi pi-arrow-down-left-and-arrow-up-right-to-center',
  ARROW_DOWN_LEFT: 'pi pi-arrow-down-left',
  ARROW_DOWN_RIGHT: 'pi pi-arrow-down-right',
  ARROW_DOWN: 'pi pi-arrow-down',
  ARROW_LEFT: 'pi pi-arrow-left',
  ARROW_RIGHT_ARROW_LEFT: 'pi pi-arrow-right-arrow-left',
  ARROW_RIGHT: 'pi pi-arrow-right',
  ARROW_UP_LEFT: 'pi pi-arrow-up-left',
  ARROW_UP_RIGHT_AND_ARROW_DOWN_LEFT_FROM_CENTER: 'pi pi-arrow-up-right-and-arrow-down-left-from-center',
  ARROW_UP_RIGHT: 'pi pi-arrow-up-right',
  ARROW_UP: 'pi pi-arrow-up',
  ARROWS_ALT: 'pi pi-arrows-alt',
  ARROWS_H: 'pi pi-arrows-h',
  ARROWS_V: 'pi pi-arrows-v',
  ASTERISK: 'pi pi-asterisk',
  AT: 'pi pi-at',
  BACKWARD: 'pi pi-backward',
  BAN: 'pi pi-ban',
  BARCODE: 'pi pi-barcode',
  BARS: 'pi pi-bars',
  BELL_SLASH: 'pi pi-bell-slash',
  BELL: 'pi pi-bell',
  BITCOIN: 'pi pi-bitcoin',
  BOLT: 'pi pi-bolt',
  BOOK: 'pi pi-book',
  BOOKMARK_FILL: 'pi pi-bookmark-fill',
  BOOKMARK: 'pi pi-bookmark',
  BOX: 'pi pi-box',
  BRIEFCASE: 'pi pi-briefcase',
  BUILDING_COLUMNS: 'pi pi-building-columns',
  BUILDING: 'pi pi-building',
  BULLSEYE: 'pi pi-bullseye',
  CALCULATOR: 'pi pi-calculator',
  CALENDAR_CLOCK: 'pi pi-calendar-clock',
  CALENDAR_MINUS: 'pi pi-calendar-minus',
  CALENDAR_PLUS: 'pi pi-calendar-plus',
  CALENDAR_TIMES: 'pi pi-calendar-times',
  CALENDAR: 'pi pi-calendar',
  CAMERA: 'pi pi-camera',
  CAR: 'pi pi-car',
  CARET_DOWN: 'pi pi-caret-down',
  CARET_LEFT: 'pi pi-caret-left',
  CARET_RIGHT: 'pi pi-caret-right',
  CARET_UP: 'pi pi-caret-up',
  CART_ARROW_DOWN: 'pi pi-cart-arrow-down',
  CART_MINUS: 'pi pi-cart-minus',
  CART_PLUS: 'pi pi-cart-plus',
  CHART_BAR: 'pi pi-chart-bar',
  CHART_LINE: 'pi pi-chart-line',
  CHART_PIE: 'pi pi-chart-pie',
  CHART_SCATTER: 'pi pi-chart-scatter',
  CHECK_CIRCLE: 'pi pi-check-circle',
  CHECK_SQUARE: 'pi pi-check-square',
  CHECK: 'pi pi-check',
  CHEVRON_CIRCLE_DOWN: 'pi pi-chevron-circle-down',
  CHEVRON_CIRCLE_LEFT: 'pi pi-chevron-circle-left',
  CHEVRON_CIRCLE_RIGHT: 'pi pi-chevron-circle-right',
  CHEVRON_CIRCLE_UP: 'pi pi-chevron-circle-up',
  CHEVRON_DOWN: 'pi pi-chevron-down',
  CHEVRON_LEFT: 'pi pi-chevron-left',
  CHEVRON_RIGHT: 'pi pi-chevron-right',
  CHEVRON_UP: 'pi pi-chevron-up',
  CIRCLE_FILL: 'pi pi-circle-fill',
  CIRCLE_OFF: 'pi pi-circle-off',
  CIRCLE_ON: 'pi pi-circle-on',
  CIRCLE: 'pi pi-circle',
  CLIPBOARD: 'pi pi-clipboard',
  CLOCK: 'pi pi-clock',
  CLONE: 'pi pi-clone',
  CLOUD_DOWNLOAD: 'pi pi-cloud-download',
  CLOUD_UPLOAD: 'pi pi-cloud-upload',
  CLOUD: 'pi pi-cloud',
  CODE: 'pi pi-code',
  COG: 'pi pi-cog',
  COMMENT: 'pi pi-comment',
  COMMENTS: 'pi pi-comments',
  COMPASS: 'pi pi-compass',
  COPY: 'pi pi-copy',
  CREDIT_CARD: 'pi pi-credit-card',
  CROWN: 'pi pi-crown',
  DATABASE: 'pi pi-database',
  DELETE_LEFT: 'pi pi-delete-left',
  DESKTOP: 'pi pi-desktop',
  DIRECTIONS_ALT: 'pi pi-directions-alt',
  DIRECTIONS: 'pi pi-directions',
  DISCORD: 'pi pi-discord',
  DOLLAR: 'pi pi-dollar',
  DOWNLOAD: 'pi pi-download',
  EJECT: 'pi pi-eject',
  ELLIPSIS_H: 'pi pi-ellipsis-h',
  ELLIPSIS_V: 'pi pi-ellipsis-v',
  ENVELOPE: 'pi pi-envelope',
  EQUALS: 'pi pi-equals',
  ERASER: 'pi pi-eraser',
  ETHEREUM: 'pi pi-ethereum',
  EURO: 'pi pi-euro',
  EXCLAMATION_CIRCLE: 'pi pi-exclamation-circle',
  EXCLAMATION_TRIANGLE: 'pi pi-exclamation-triangle',
  EXPAND: 'pi pi-expand',
  EXTERNAL_LINK: 'pi pi-external-link',
  EYE_SLASH: 'pi pi-eye-slash',
  EYE: 'pi pi-eye',
  FACE_SMILE: 'pi pi-face-smile',
  FACEBOOK: 'pi pi-facebook',
  FAST_BACKWARD: 'pi pi-fast-backward',
  FAST_FORWARD: 'pi pi-fast-forward',
  FILE_ARROW_UP: 'pi pi-file-arrow-up',
  FILE_CHECK: 'pi pi-file-check',
  FILE_EDIT: 'pi pi-file-edit',
  FILE_EXCEL: 'pi pi-file-excel',
  FILE_EXPORT: 'pi pi-file-export',
  FILE_IMPORT: 'pi pi-file-import',
  FILE_O: 'pi pi-file-o',
  FILE_PDF: 'pi pi-file-pdf',
  FILE_PLUS: 'pi pi-file-plus',
  FILE_WORD: 'pi pi-file-word',
  FILE: 'pi pi-file',
  FILTER_FILL: 'pi pi-filter-fill',
  FILTER_SLASH: 'pi pi-filter-slash',
  FILTER: 'pi pi-filter',
  FLAG_FILL: 'pi pi-flag-fill',
  FLAG: 'pi pi-flag',
  FOLDER_OPEN: 'pi pi-folder-open',
  FOLDER_PLUS: 'pi pi-folder-plus',
  FOLDER: 'pi pi-folder',
  FORWARD: 'pi pi-forward',
  GAUGE: 'pi pi-gauge',
  GIFT: 'pi pi-gift',
  GITHUB: 'pi pi-github',
  GLOBE: 'pi pi-globe',
  GOOGLE: 'pi pi-google',
  GRADUATION_CAP: 'pi pi-graduation-cap',
  HAMMER: 'pi pi-hammer',
  HASHTAG: 'pi pi-hashtag',
  HEADPHONES: 'pi pi-headphones',
  HEART_FILL: 'pi pi-heart-fill',
  HEART: 'pi pi-heart',
  HISTORY: 'pi pi-history',
  HOME: 'pi pi-home',
  HOURGLASS: 'pi pi-hourglass',
  ID_CARD: 'pi pi-id-card',
  IMAGE: 'pi pi-image',
  IMAGES: 'pi pi-images',
  INBOX: 'pi pi-inbox',
  INDIAN_RUPEE: 'pi pi-indian-rupee',
  INFO_CIRCLE: 'pi pi-info-circle',
  INFO: 'pi pi-info',
  INSTAGRAM: 'pi pi-instagram',
  KEY: 'pi pi-key',
  LANGUAGE: 'pi pi-language',
  LIGHTBULB: 'pi pi-lightbulb',
  LINK: 'pi pi-link',
  LINKEDIN: 'pi pi-linkedin',
  LIST_CHECK: 'pi pi-list-check',
  LIST: 'pi pi-list',
  LOCK_OPEN: 'pi pi-lock-open',
  LOCK: 'pi pi-lock',
  MAP_MARKER: 'pi pi-map-marker',
  MAP: 'pi pi-map',
  MARS: 'pi pi-mars',
  MEGAPHONE: 'pi pi-megaphone',
  MICROCHIP_AI: 'pi pi-microchip-ai',
  MICROCHIP: 'pi pi-microchip',
  MICROPHONE: 'pi pi-microphone',
  MICROSOFT: 'pi pi-microsoft',
  MINUS_CIRCLE: 'pi pi-minus-circle',
  MINUS: 'pi pi-minus',
  MOBILE: 'pi pi-mobile',
  MONEY_BILL: 'pi pi-money-bill',
  MOON: 'pi pi-moon',
  OBJECTS_COLUMN: 'pi pi-objects-column',
  PALETTE: 'pi pi-palette',
  PAPERCLIP: 'pi pi-paperclip',
  PAUSE_CIRCLE: 'pi pi-pause-circle',
  PAUSE: 'pi pi-pause',
  PAYPAL: 'pi pi-paypal',
  PEN_TO_SQUARE: 'pi pi-pen-to-square',
  PENCIL: 'pi pi-pencil',
  PERCENTAGE: 'pi pi-percentage',
  PHONE: 'pi pi-phone',
  PINTEREST: 'pi pi-pinterest',
  PLAY_CIRCLE: 'pi pi-play-circle',
  PLAY: 'pi pi-play',
  PLUS_CIRCLE: 'pi pi-plus-circle',
  PLUS: 'pi pi-plus',
  POUND: 'pi pi-pound',
  POWER_OFF: 'pi pi-power-off',
  PRIME: 'pi pi-prime',
  PRINT: 'pi pi-print',
  QRCODE: 'pi pi-qrcode',
  QUESTION_CIRCLE: 'pi pi-question-circle',
  QUESTION: 'pi pi-question',
  RECEIPT: 'pi pi-receipt',
  REDDIT: 'pi pi-reddit',
  REFRESH: 'pi pi-refresh',
  REPLAY: 'pi pi-replay',
  REPLY: 'pi pi-reply',
  SAVE: 'pi pi-save',
  SEARCH_MINUS: 'pi pi-search-minus',
  SEARCH_PLUS: 'pi pi-search-plus',
  SEARCH: 'pi pi-search',
  SEND: 'pi pi-send',
  SERVER: 'pi pi-server',
  SHARE_ALT: 'pi pi-share-alt',
  SHIELD: 'pi pi-shield',
  SHOP: 'pi pi-shop',
  SHOPPING_BAG: 'pi pi-shopping-bag',
  SHOPPING_CART: 'pi pi-shopping-cart',
  SIGN_IN: 'pi pi-sign-in',
  SIGN_OUT: 'pi pi-sign-out',
  SITEMAP: 'pi pi-sitemap',
  SLACK: 'pi pi-slack',
  SLIDERS_H: 'pi pi-sliders-h',
  SLIDERS_V: 'pi pi-sliders-v',
  SORT_ALPHA_DOWN_ALT: 'pi pi-sort-alpha-down-alt',
  SORT_ALPHA_DOWN: 'pi pi-sort-alpha-down',
  SORT_ALPHA_UP_ALT: 'pi pi-sort-alpha-up-alt',
  SORT_ALPHA_UP: 'pi pi-sort-alpha-up',
  SORT_ALT_SLASH: 'pi pi-sort-alt-slash',
  SORT_ALT: 'pi pi-sort-alt',
  SORT_AMOUNT_DOWN_ALT: 'pi pi-sort-amount-down-alt',
  SORT_AMOUNT_DOWN: 'pi pi-sort-amount-down',
  SORT_AMOUNT_UP_ALT: 'pi pi-sort-amount-up-alt',
  SORT_AMOUNT_UP: 'pi pi-sort-amount-up',
  SORT_DOWN_FILL: 'pi pi-sort-down-fill',
  SORT_DOWN: 'pi pi-sort-down',
  SORT_NUMERIC_DOWN_ALT: 'pi pi-sort-numeric-down-alt',
  SORT_NUMERIC_DOWN: 'pi pi-sort-numeric-down',
  SORT_NUMERIC_UP_ALT: 'pi pi-sort-numeric-up-alt',
  SORT_NUMERIC_UP: 'pi pi-sort-numeric-up',
  SORT_UP_FILL: 'pi pi-sort-up-fill',
  SORT_UP: 'pi pi-sort-up',
  SORT: 'pi pi-sort',
  SPARKLES: 'pi pi-sparkles',
  SPINNER_DOTTED: 'pi pi-spinner-dotted',
  SPINNER: 'pi pi-spinner',
  STAR_FILL: 'pi pi-star-fill',
  STAR_HALF_FILL: 'pi pi-star-half-fill',
  STAR_HALF: 'pi pi-star-half',
  STAR: 'pi pi-star',
  STEP_BACKWARD_ALT: 'pi pi-step-backward-alt',
  STEP_BACKWARD: 'pi pi-step-backward',
  STEP_FORWARD_ALT: 'pi pi-step-forward-alt',
  STEP_FORWARD: 'pi pi-step-forward',
  STOP_CIRCLE: 'pi pi-stop-circle',
  STOP: 'pi pi-stop',
  STOPWATCH: 'pi pi-stopwatch',
  SUN: 'pi pi-sun',
  SYNC: 'pi pi-sync',
  TABLE: 'pi pi-table',
  TABLET: 'pi pi-tablet',
  TAG: 'pi pi-tag',
  TAGS: 'pi pi-tags',
  TELEGRAM: 'pi pi-telegram',
  TH_LARGE: 'pi pi-th-large',
  THUMBS_DOWN_FILL: 'pi pi-thumbs-down-fill',
  THUMBS_DOWN: 'pi pi-thumbs-down',
  THUMBS_UP_FILL: 'pi pi-thumbs-up-fill',
  THUMBS_UP: 'pi pi-thumbs-up',
  THUMBTACK: 'pi pi-thumbtack',
  TICKET: 'pi pi-ticket',
  TIKTOK: 'pi pi-tiktok',
  TIMES_CIRCLE: 'pi pi-times-circle',
  TIMES: 'pi pi-times',
  TRASH: 'pi pi-trash',
  TROPHY: 'pi pi-trophy',
  TRUCK: 'pi pi-truck',
  TURKISH_LIRA: 'pi pi-turkish-lira',
  TWITCH: 'pi pi-twitch',
  TWITTER: 'pi pi-twitter',
  UNDO: 'pi pi-undo',
  UNLOCK: 'pi pi-unlock',
  UPLOAD: 'pi pi-upload',
  USER_EDIT: 'pi pi-user-edit',
  USER_MINUS: 'pi pi-user-minus',
  USER_PLUS: 'pi pi-user-plus',
  USER: 'pi pi-user',
  USERS: 'pi pi-users',
  VENUS: 'pi pi-venus',
  VERIFIED: 'pi pi-verified',
  VIDEO: 'pi pi-video',
  VIMEO: 'pi pi-vimeo',
  VOLUME_DOWN: 'pi pi-volume-down',
  VOLUME_OFF: 'pi pi-volume-off',
  VOLUME_UP: 'pi pi-volume-up',
  WALLET: 'pi pi-wallet',
  WAREHOUSE: 'pi pi-warehouse',
  WAVE_PULSE: 'pi pi-wave-pulse',
  WHATSAPP: 'pi pi-whatsapp',
  WIFI: 'pi pi-wifi',
  WINDOW_MAXIMIZE: 'pi pi-window-maximize',
  WINDOW_MINIMIZE: 'pi pi-window-minimize',
  WRENCH: 'pi pi-wrench',
  YOUTUBE: 'pi pi-youtube'
});

var SortOrder = Object.freeze({
  DESC: -1,
  UNSORTED: 0,
  ASC: 1
});

function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var PrimeReactContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createContext();
var PrimeReactProvider = function PrimeReactProvider(props) {
  var _props$value, _propsValue$ripple, _propsValue$inputStyl, _propsValue$locale, _propsValue$appendTo, _propsValue$styleCont, _propsValue$cssTransi, _propsValue$autoZInde, _propsValue$hideOverl, _propsValue$nonce, _propsValue$nullSortO, _propsValue$zIndex, _propsValue$ptOptions, _propsValue$pt, _propsValue$unstyled, _propsValue$filterMat;
  var propsValue = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : {};
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$ripple = propsValue.ripple) !== null && _propsValue$ripple !== void 0 ? _propsValue$ripple : false),
    _useState2 = _slicedToArray(_useState, 2),
    ripple = _useState2[0],
    setRipple = _useState2[1];
  var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$inputStyl = propsValue.inputStyle) !== null && _propsValue$inputStyl !== void 0 ? _propsValue$inputStyl : 'outlined'),
    _useState4 = _slicedToArray(_useState3, 2),
    inputStyle = _useState4[0],
    setInputStyle = _useState4[1];
  var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$locale = propsValue.locale) !== null && _propsValue$locale !== void 0 ? _propsValue$locale : 'en'),
    _useState6 = _slicedToArray(_useState5, 2),
    locale = _useState6[0],
    setLocale = _useState6[1];
  var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$appendTo = propsValue.appendTo) !== null && _propsValue$appendTo !== void 0 ? _propsValue$appendTo : null),
    _useState8 = _slicedToArray(_useState7, 2),
    appendTo = _useState8[0],
    setAppendTo = _useState8[1];
  var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$styleCont = propsValue.styleContainer) !== null && _propsValue$styleCont !== void 0 ? _propsValue$styleCont : null),
    _useState10 = _slicedToArray(_useState9, 2),
    styleContainer = _useState10[0],
    setStyleContainer = _useState10[1];
  var _useState11 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$cssTransi = propsValue.cssTransition) !== null && _propsValue$cssTransi !== void 0 ? _propsValue$cssTransi : true),
    _useState12 = _slicedToArray(_useState11, 2),
    cssTransition = _useState12[0],
    setCssTransition = _useState12[1];
  var _useState13 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$autoZInde = propsValue.autoZIndex) !== null && _propsValue$autoZInde !== void 0 ? _propsValue$autoZInde : true),
    _useState14 = _slicedToArray(_useState13, 2),
    autoZIndex = _useState14[0],
    setAutoZIndex = _useState14[1];
  var _useState15 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$hideOverl = propsValue.hideOverlaysOnDocumentScrolling) !== null && _propsValue$hideOverl !== void 0 ? _propsValue$hideOverl : false),
    _useState16 = _slicedToArray(_useState15, 2),
    hideOverlaysOnDocumentScrolling = _useState16[0],
    setHideOverlaysOnDocumentScrolling = _useState16[1];
  var _useState17 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$nonce = propsValue.nonce) !== null && _propsValue$nonce !== void 0 ? _propsValue$nonce : null),
    _useState18 = _slicedToArray(_useState17, 2),
    nonce = _useState18[0],
    setNonce = _useState18[1];
  var _useState19 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$nullSortO = propsValue.nullSortOrder) !== null && _propsValue$nullSortO !== void 0 ? _propsValue$nullSortO : 1),
    _useState20 = _slicedToArray(_useState19, 2),
    nullSortOrder = _useState20[0],
    setNullSortOrder = _useState20[1];
  var _useState21 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$zIndex = propsValue.zIndex) !== null && _propsValue$zIndex !== void 0 ? _propsValue$zIndex : {
      modal: 1100,
      overlay: 1000,
      menu: 1000,
      tooltip: 1100,
      toast: 1200
    }),
    _useState22 = _slicedToArray(_useState21, 2),
    zIndex = _useState22[0],
    setZIndex = _useState22[1];
  var _useState23 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$ptOptions = propsValue.ptOptions) !== null && _propsValue$ptOptions !== void 0 ? _propsValue$ptOptions : {
      mergeSections: true,
      mergeProps: true
    }),
    _useState24 = _slicedToArray(_useState23, 2),
    ptOptions = _useState24[0],
    setPtOptions = _useState24[1];
  var _useState25 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$pt = propsValue.pt) !== null && _propsValue$pt !== void 0 ? _propsValue$pt : undefined),
    _useState26 = _slicedToArray(_useState25, 2),
    pt = _useState26[0],
    setPt = _useState26[1];
  var _useState27 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$unstyled = propsValue.unstyled) !== null && _propsValue$unstyled !== void 0 ? _propsValue$unstyled : false),
    _useState28 = _slicedToArray(_useState27, 2),
    unstyled = _useState28[0],
    setUnstyled = _useState28[1];
  var _useState29 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)((_propsValue$filterMat = propsValue.filterMatchModeOptions) !== null && _propsValue$filterMat !== void 0 ? _propsValue$filterMat : {
      text: [FilterMatchMode.STARTS_WITH, FilterMatchMode.CONTAINS, FilterMatchMode.NOT_CONTAINS, FilterMatchMode.ENDS_WITH, FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS],
      numeric: [FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS, FilterMatchMode.LESS_THAN, FilterMatchMode.LESS_THAN_OR_EQUAL_TO, FilterMatchMode.GREATER_THAN, FilterMatchMode.GREATER_THAN_OR_EQUAL_TO],
      date: [FilterMatchMode.DATE_IS, FilterMatchMode.DATE_IS_NOT, FilterMatchMode.DATE_BEFORE, FilterMatchMode.DATE_AFTER]
    }),
    _useState30 = _slicedToArray(_useState29, 2),
    filterMatchModeOptions = _useState30[0],
    setFilterMatchModeOptions = _useState30[1];
  var changeTheme = function changeTheme(currentTheme, newTheme, linkElementId, callback) {
    var _linkElement$parentNo;
    var linkElement = document.getElementById(linkElementId);
    if (!linkElement) {
      throw Error("Element with id ".concat(linkElementId, " not found."));
    }
    var newThemeUrl = linkElement.getAttribute('href').replace(currentTheme, newTheme);
    var newLinkElement = document.createElement('link');
    newLinkElement.setAttribute('rel', 'stylesheet');
    newLinkElement.setAttribute('id', linkElementId);
    newLinkElement.setAttribute('href', newThemeUrl);
    newLinkElement.addEventListener('load', function () {
      if (callback) {
        callback();
      }
    });
    (_linkElement$parentNo = linkElement.parentNode) === null || _linkElement$parentNo === void 0 || _linkElement$parentNo.replaceChild(newLinkElement, linkElement);
  };

  /**
   * @deprecated
   */
  react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(function () {
    PrimeReact$1.ripple = ripple;
  }, [ripple]);

  /**
   * @deprecated
   */
  react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(function () {
    PrimeReact$1.inputStyle = inputStyle;
  }, [inputStyle]);

  /**
   * @deprecated
   */
  react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(function () {
    PrimeReact$1.locale = locale;
  }, [locale]);
  var value = {
    changeTheme: changeTheme,
    ripple: ripple,
    setRipple: setRipple,
    inputStyle: inputStyle,
    setInputStyle: setInputStyle,
    locale: locale,
    setLocale: setLocale,
    appendTo: appendTo,
    setAppendTo: setAppendTo,
    styleContainer: styleContainer,
    setStyleContainer: setStyleContainer,
    cssTransition: cssTransition,
    setCssTransition: setCssTransition,
    autoZIndex: autoZIndex,
    setAutoZIndex: setAutoZIndex,
    hideOverlaysOnDocumentScrolling: hideOverlaysOnDocumentScrolling,
    setHideOverlaysOnDocumentScrolling: setHideOverlaysOnDocumentScrolling,
    nonce: nonce,
    setNonce: setNonce,
    nullSortOrder: nullSortOrder,
    setNullSortOrder: setNullSortOrder,
    zIndex: zIndex,
    setZIndex: setZIndex,
    ptOptions: ptOptions,
    setPtOptions: setPtOptions,
    pt: pt,
    setPt: setPt,
    filterMatchModeOptions: filterMatchModeOptions,
    setFilterMatchModeOptions: setFilterMatchModeOptions,
    unstyled: unstyled,
    setUnstyled: setUnstyled
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(PrimeReactContext.Provider, {
    value: value
  }, props.children);
};

var PrimeReact = PrimeReact$1;




/***/ }),

/***/ "./node_modules/primereact/componentbase/componentbase.esm.js":
/*!********************************************************************!*\
  !*** ./node_modules/primereact/componentbase/componentbase.esm.js ***!
  \********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ComponentBase: function() { return /* binding */ ComponentBase; },
/* harmony export */   useHandleStyle: function() { return /* binding */ useHandleStyle; }
/* harmony export */ });
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
'use client';




function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var baseStyle = "\n.p-hidden-accessible {\n    border: 0;\n    clip: rect(0 0 0 0);\n    height: 1px;\n    margin: -1px;\n    opacity: 0;\n    overflow: hidden;\n    padding: 0;\n    pointer-events: none;\n    position: absolute;\n    white-space: nowrap;\n    width: 1px;\n}\n\n.p-overflow-hidden {\n    overflow: hidden;\n    padding-right: var(--scrollbar-width);\n}\n";
var buttonStyles = "\n.p-button {\n    margin: 0;\n    display: inline-flex;\n    cursor: pointer;\n    user-select: none;\n    align-items: center;\n    vertical-align: bottom;\n    text-align: center;\n    overflow: hidden;\n    position: relative;\n}\n\n.p-button-label {\n    flex: 1 1 auto;\n}\n\n.p-button-icon {\n    pointer-events: none;\n}\n\n.p-button-icon-right {\n    order: 1;\n}\n\n.p-button:disabled {\n    cursor: default;\n}\n\n.p-button-icon-only {\n    justify-content: center;\n}\n\n.p-button-icon-only .p-button-label {\n    visibility: hidden;\n    width: 0;\n    flex: 0 0 auto;\n}\n\n.p-button-vertical {\n    flex-direction: column;\n}\n\n.p-button-icon-bottom {\n    order: 2;\n}\n\n.p-button-group .p-button {\n    margin: 0;\n}\n\n.p-button-group .p-button:not(:last-child) {\n    border-right: 0 none;\n}\n\n.p-button-group .p-button:not(:first-of-type):not(:last-of-type) {\n    border-radius: 0;\n}\n\n.p-button-group .p-button:first-of-type {\n    border-top-right-radius: 0;\n    border-bottom-right-radius: 0;\n}\n\n.p-button-group .p-button:last-of-type {\n    border-top-left-radius: 0;\n    border-bottom-left-radius: 0;\n}\n\n.p-button-group .p-button:focus {\n    position: relative;\n    z-index: 1;\n}\n\n.p-button-group-single .p-button:first-of-type {\n    border-top-right-radius: var(--border-radius) !important;\n    border-bottom-right-radius: var(--border-radius) !important;\n}\n\n.p-button-group-single .p-button:last-of-type {\n    border-top-left-radius: var(--border-radius) !important;\n    border-bottom-left-radius: var(--border-radius) !important;\n}\n";
var inputTextStyles = "\n.p-inputtext {\n    margin: 0;\n}\n\n.p-fluid .p-inputtext {\n    width: 100%;\n}\n\n/* InputGroup */\n.p-inputgroup {\n    display: flex;\n    align-items: stretch;\n    width: 100%;\n}\n\n.p-inputgroup-addon {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.p-inputgroup .p-float-label {\n    display: flex;\n    align-items: stretch;\n    width: 100%;\n}\n\n.p-inputgroup .p-inputtext,\n.p-fluid .p-inputgroup .p-inputtext,\n.p-inputgroup .p-inputwrapper,\n.p-fluid .p-inputgroup .p-input {\n    flex: 1 1 auto;\n    width: 1%;\n}\n\n/* Floating Label */\n.p-float-label {\n    display: block;\n    position: relative;\n}\n\n.p-float-label label {\n    position: absolute;\n    pointer-events: none;\n    top: 50%;\n    margin-top: -0.5rem;\n    transition-property: all;\n    transition-timing-function: ease;\n    line-height: 1;\n}\n\n.p-float-label textarea ~ label,\n.p-float-label .p-mention ~ label {\n    top: 1rem;\n}\n\n.p-float-label input:focus ~ label,\n.p-float-label input:-webkit-autofill ~ label,\n.p-float-label input.p-filled ~ label,\n.p-float-label textarea:focus ~ label,\n.p-float-label textarea.p-filled ~ label,\n.p-float-label .p-inputwrapper-focus ~ label,\n.p-float-label .p-inputwrapper-filled ~ label,\n.p-float-label .p-tooltip-target-wrapper ~ label {\n    top: -0.75rem;\n    font-size: 12px;\n}\n\n.p-float-label .p-placeholder,\n.p-float-label input::placeholder,\n.p-float-label .p-inputtext::placeholder {\n    opacity: 0;\n    transition-property: all;\n    transition-timing-function: ease;\n}\n\n.p-float-label .p-focus .p-placeholder,\n.p-float-label input:focus::placeholder,\n.p-float-label .p-inputtext:focus::placeholder {\n    opacity: 1;\n    transition-property: all;\n    transition-timing-function: ease;\n}\n\n.p-input-icon-left,\n.p-input-icon-right {\n    position: relative;\n    display: inline-block;\n}\n\n.p-input-icon-left > i,\n.p-input-icon-right > i,\n.p-input-icon-left > svg,\n.p-input-icon-right > svg,\n.p-input-icon-left > .p-input-prefix,\n.p-input-icon-right > .p-input-suffix {\n    position: absolute;\n    top: 50%;\n    margin-top: -0.5rem;\n}\n\n.p-fluid .p-input-icon-left,\n.p-fluid .p-input-icon-right {\n    display: block;\n    width: 100%;\n}\n";
var iconStyles = "\n.p-icon {\n    display: inline-block;\n}\n\n.p-icon-spin {\n    -webkit-animation: p-icon-spin 2s infinite linear;\n    animation: p-icon-spin 2s infinite linear;\n}\n\nsvg.p-icon {\n    pointer-events: auto;\n}\n\nsvg.p-icon g,\n.p-disabled svg.p-icon {\n    pointer-events: none;\n}\n\n@-webkit-keyframes p-icon-spin {\n    0% {\n        -webkit-transform: rotate(0deg);\n        transform: rotate(0deg);\n    }\n    100% {\n        -webkit-transform: rotate(359deg);\n        transform: rotate(359deg);\n    }\n}\n\n@keyframes p-icon-spin {\n    0% {\n        -webkit-transform: rotate(0deg);\n        transform: rotate(0deg);\n    }\n    100% {\n        -webkit-transform: rotate(359deg);\n        transform: rotate(359deg);\n    }\n}\n";
var commonStyle = "\n@layer primereact {\n    .p-component, .p-component * {\n        box-sizing: border-box;\n    }\n\n    .p-hidden {\n        display: none;\n    }\n\n    .p-hidden-space {\n        visibility: hidden;\n    }\n\n    .p-reset {\n        margin: 0;\n        padding: 0;\n        border: 0;\n        outline: 0;\n        text-decoration: none;\n        font-size: 100%;\n        list-style: none;\n    }\n\n    .p-disabled, .p-disabled * {\n        cursor: default;\n        pointer-events: none;\n        user-select: none;\n    }\n\n    .p-component-overlay {\n        position: fixed;\n        top: 0;\n        left: 0;\n        width: 100%;\n        height: 100%;\n    }\n\n    .p-unselectable-text {\n        user-select: none;\n    }\n\n    .p-scrollbar-measure {\n        width: 100px;\n        height: 100px;\n        overflow: scroll;\n        position: absolute;\n        top: -9999px;\n    }\n\n    @-webkit-keyframes p-fadein {\n      0%   { opacity: 0; }\n      100% { opacity: 1; }\n    }\n    @keyframes p-fadein {\n      0%   { opacity: 0; }\n      100% { opacity: 1; }\n    }\n\n    .p-link {\n        text-align: left;\n        background-color: transparent;\n        margin: 0;\n        padding: 0;\n        border: none;\n        cursor: pointer;\n        user-select: none;\n    }\n\n    .p-link:disabled {\n        cursor: default;\n    }\n\n    /* Non react overlay animations */\n    .p-connected-overlay {\n        opacity: 0;\n        transform: scaleY(0.8);\n        transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n    }\n\n    .p-connected-overlay-visible {\n        opacity: 1;\n        transform: scaleY(1);\n    }\n\n    .p-connected-overlay-hidden {\n        opacity: 0;\n        transform: scaleY(1);\n        transition: opacity .1s linear;\n    }\n\n    /* React based overlay animations */\n    .p-connected-overlay-enter {\n        opacity: 0;\n        transform: scaleY(0.8);\n    }\n\n    .p-connected-overlay-enter-active {\n        opacity: 1;\n        transform: scaleY(1);\n        transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n    }\n\n    .p-connected-overlay-enter-done {\n        transform: none;\n    }\n\n    .p-connected-overlay-exit {\n        opacity: 1;\n    }\n\n    .p-connected-overlay-exit-active {\n        opacity: 0;\n        transition: opacity .1s linear;\n    }\n\n    /* Toggleable Content */\n    .p-toggleable-content-enter {\n        max-height: 0;\n    }\n\n    .p-toggleable-content-enter-active {\n        overflow: hidden;\n        max-height: 1000px;\n        transition: max-height 1s ease-in-out;\n    }\n\n    .p-toggleable-content-enter-done {\n        transform: none;\n    }\n\n    .p-toggleable-content-exit {\n        max-height: 1000px;\n    }\n\n    .p-toggleable-content-exit-active {\n        overflow: hidden;\n        max-height: 0;\n        transition: max-height 0.45s cubic-bezier(0, 1, 0, 1);\n    }\n\n    /* @todo Refactor */\n    .p-menu .p-menuitem-link {\n        cursor: pointer;\n        display: flex;\n        align-items: center;\n        text-decoration: none;\n        overflow: hidden;\n        position: relative;\n    }\n\n    ".concat(buttonStyles, "\n    ").concat(inputTextStyles, "\n    ").concat(iconStyles, "\n}\n");
var ComponentBase = {
  cProps: undefined,
  cParams: undefined,
  cName: undefined,
  defaultProps: {
    pt: undefined,
    ptOptions: undefined,
    unstyled: false
  },
  context: {},
  globalCSS: undefined,
  classes: {},
  styles: '',
  extend: function extend() {
    var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var css = props.css;
    var defaultProps = _objectSpread(_objectSpread({}, props.defaultProps), ComponentBase.defaultProps);
    var inlineStyles = {};
    var getProps = function getProps(props) {
      var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      ComponentBase.context = context;
      ComponentBase.cProps = props;
      return primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getMergedProps(props, defaultProps);
    };
    var getOtherProps = function getOtherProps(props) {
      return primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getDiffProps(props, defaultProps);
    };
    var getPTValue = function getPTValue() {
      var _ComponentBase$contex;
      var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var searchInDefaultPT = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
      // obj either is the passthrough options or has a .pt property.
      if (obj.hasOwnProperty('pt') && obj.pt !== undefined) {
        obj = obj.pt;
      }
      var originalkey = key;
      var isNestedParam = /./g.test(originalkey) && !!params[originalkey.split('.')[0]];
      var fkey = isNestedParam ? primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(originalkey.split('.')[1]) : primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(originalkey);
      var hostName = params.hostName && primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(params.hostName);
      var componentName = hostName || params.props && params.props.__TYPE && primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(params.props.__TYPE) || '';
      var isTransition = fkey === 'transition';
      var datasetPrefix = 'data-pc-';
      var _getHostInstance = function getHostInstance(params) {
        return params !== null && params !== void 0 && params.props ? params.hostName ? params.props.__TYPE === params.hostName ? params.props : _getHostInstance(params.parent) : params.parent : undefined;
      };
      var getPropValue = function getPropValue(name) {
        var _params$props, _getHostInstance2;
        return ((_params$props = params.props) === null || _params$props === void 0 ? void 0 : _params$props[name]) || ((_getHostInstance2 = _getHostInstance(params)) === null || _getHostInstance2 === void 0 ? void 0 : _getHostInstance2[name]);
      };
      ComponentBase.cParams = params;
      ComponentBase.cName = componentName;
      var _ref = getPropValue('ptOptions') || ComponentBase.context.ptOptions || {},
        _ref$mergeSections = _ref.mergeSections,
        mergeSections = _ref$mergeSections === void 0 ? true : _ref$mergeSections,
        _ref$mergeProps = _ref.mergeProps,
        useMergeProps = _ref$mergeProps === void 0 ? false : _ref$mergeProps;
      var getPTClassValue = function getPTClassValue() {
        var value = _getOptionValue.apply(void 0, arguments);
        if (Array.isArray(value)) {
          return {
            className: primereact_utils__WEBPACK_IMPORTED_MODULE_2__.classNames.apply(void 0, _toConsumableArray(value))
          };
        }
        if (primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isString(value)) {
          return {
            className: value
          };
        }
        if (value !== null && value !== void 0 && value.hasOwnProperty('className') && Array.isArray(value.className)) {
          return {
            className: primereact_utils__WEBPACK_IMPORTED_MODULE_2__.classNames.apply(void 0, _toConsumableArray(value.className))
          };
        }
        return value;
      };
      var globalPT = searchInDefaultPT ? isNestedParam ? _useGlobalPT(getPTClassValue, originalkey, params) : _useDefaultPT(getPTClassValue, originalkey, params) : undefined;
      var self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, originalkey, params);
      var datasetProps = !isTransition && _objectSpread(_objectSpread({}, fkey === 'root' && _defineProperty({}, "".concat(datasetPrefix, "name"), params.props && params.props.__parentMetadata ? primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(params.props.__TYPE) : componentName)), {}, _defineProperty({}, "".concat(datasetPrefix, "section"), fkey));
      return mergeSections || !mergeSections && self ? useMergeProps ? (0,primereact_utils__WEBPACK_IMPORTED_MODULE_2__.mergeProps)([globalPT, self, Object.keys(datasetProps).length ? datasetProps : {}], {
        classNameMergeFunction: (_ComponentBase$contex = ComponentBase.context.ptOptions) === null || _ComponentBase$contex === void 0 ? void 0 : _ComponentBase$contex.classNameMergeFunction
      }) : _objectSpread(_objectSpread(_objectSpread({}, globalPT), self), Object.keys(datasetProps).length ? datasetProps : {}) : _objectSpread(_objectSpread({}, self), Object.keys(datasetProps).length ? datasetProps : {});
    };
    var setMetaData = function setMetaData() {
      var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var props = metadata.props,
        state = metadata.state;
      var ptm = function ptm() {
        var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
        var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        return getPTValue((props || {}).pt, key, _objectSpread(_objectSpread({}, metadata), params));
      };
      var ptmo = function ptmo() {
        var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
        var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
        return getPTValue(obj, key, params, false);
      };
      var isUnstyled = function isUnstyled() {
        return ComponentBase.context.unstyled || primereact_api__WEBPACK_IMPORTED_MODULE_0__["default"].unstyled || props.unstyled;
      };
      var cx = function cx() {
        var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
        var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        return !isUnstyled() ? _getOptionValue(css && css.classes, key, _objectSpread({
          props: props,
          state: state
        }, params)) : undefined;
      };
      var sx = function sx() {
        var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
        var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var when = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
        if (when) {
          var _ComponentBase$contex2;
          var self = _getOptionValue(css && css.inlineStyles, key, _objectSpread({
            props: props,
            state: state
          }, params));
          var base = _getOptionValue(inlineStyles, key, _objectSpread({
            props: props,
            state: state
          }, params));
          return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_2__.mergeProps)([base, self], {
            classNameMergeFunction: (_ComponentBase$contex2 = ComponentBase.context.ptOptions) === null || _ComponentBase$contex2 === void 0 ? void 0 : _ComponentBase$contex2.classNameMergeFunction
          });
        }
        return undefined;
      };
      return {
        ptm: ptm,
        ptmo: ptmo,
        sx: sx,
        cx: cx,
        isUnstyled: isUnstyled
      };
    };
    return _objectSpread(_objectSpread({
      getProps: getProps,
      getOtherProps: getOtherProps,
      setMetaData: setMetaData
    }, props), {}, {
      defaultProps: defaultProps
    });
  }
};
var _getOptionValue = function getOptionValue(obj) {
  var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var fKeys = String(primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(key)).split('.');
  var fKey = fKeys.shift();
  var matchedPTOption = primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isNotEmpty(obj) ? Object.keys(obj).find(function (k) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(k) === fKey;
  }) : '';
  return fKey ? primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isObject(obj) ? _getOptionValue(primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getItemValue(obj[matchedPTOption], params), fKeys.join('.'), params) : undefined : primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getItemValue(obj, params);
};
var _getPT = function _getPT(pt) {
  var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  var callback = arguments.length > 2 ? arguments[2] : undefined;
  var _usept = pt === null || pt === void 0 ? void 0 : pt._usept;
  var getValue = function getValue(value) {
    var _ref3;
    var checkSameKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
    var _value = callback ? callback(value) : value;
    var _key = primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(key);
    return (_ref3 = checkSameKey ? _key !== ComponentBase.cName ? _value === null || _value === void 0 ? void 0 : _value[_key] : undefined : _value === null || _value === void 0 ? void 0 : _value[_key]) !== null && _ref3 !== void 0 ? _ref3 : _value;
  };
  return primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isNotEmpty(_usept) ? {
    _usept: _usept,
    originalValue: getValue(pt.originalValue),
    value: getValue(pt.value)
  } : getValue(pt, true);
};
var _usePT = function _usePT(pt, callback, key, params) {
  var fn = function fn(value) {
    return callback(value, key, params);
  };
  if (pt !== null && pt !== void 0 && pt.hasOwnProperty('_usept')) {
    var _ref4 = pt._usept || ComponentBase.context.ptOptions || {},
      _ref4$mergeSections = _ref4.mergeSections,
      mergeSections = _ref4$mergeSections === void 0 ? true : _ref4$mergeSections,
      _ref4$mergeProps = _ref4.mergeProps,
      useMergeProps = _ref4$mergeProps === void 0 ? false : _ref4$mergeProps,
      classNameMergeFunction = _ref4.classNameMergeFunction;
    var originalValue = fn(pt.originalValue);
    var value = fn(pt.value);
    if (originalValue === undefined && value === undefined) {
      return undefined;
    } else if (primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isString(value)) {
      return value;
    } else if (primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.isString(originalValue)) {
      return originalValue;
    }
    return mergeSections || !mergeSections && value ? useMergeProps ? (0,primereact_utils__WEBPACK_IMPORTED_MODULE_2__.mergeProps)([originalValue, value], {
      classNameMergeFunction: classNameMergeFunction
    }) : _objectSpread(_objectSpread({}, originalValue), value) : value;
  }
  return fn(pt);
};
var getGlobalPT = function getGlobalPT() {
  return _getPT(ComponentBase.context.pt || primereact_api__WEBPACK_IMPORTED_MODULE_0__["default"].pt, undefined, function (value) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getItemValue(value, ComponentBase.cParams);
  });
};
var getDefaultPT = function getDefaultPT() {
  return _getPT(ComponentBase.context.pt || primereact_api__WEBPACK_IMPORTED_MODULE_0__["default"].pt, undefined, function (value) {
    return _getOptionValue(value, ComponentBase.cName, ComponentBase.cParams) || primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.getItemValue(value, ComponentBase.cParams);
  });
};
var _useGlobalPT = function _useGlobalPT(callback, key, params) {
  return _usePT(getGlobalPT(), callback, key, params);
};
var _useDefaultPT = function _useDefaultPT(callback, key, params) {
  return _usePT(getDefaultPT(), callback, key, params);
};
var useHandleStyle = function useHandleStyle(styles) {
  var _isUnstyled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  var config = arguments.length > 2 ? arguments[2] : undefined;
  var name = config.name,
    _config$styled = config.styled,
    styled = _config$styled === void 0 ? false : _config$styled,
    _config$hostName = config.hostName,
    hostName = _config$hostName === void 0 ? '' : _config$hostName;
  var globalCSS = _useGlobalPT(_getOptionValue, 'global.css', ComponentBase.cParams);
  var componentName = primereact_utils__WEBPACK_IMPORTED_MODULE_2__.ObjectUtils.toFlatCase(name);
  var _useStyle = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useStyle)(baseStyle, {
      name: 'base',
      manual: true
    }),
    loadBaseStyle = _useStyle.load;
  var _useStyle2 = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useStyle)(commonStyle, {
      name: 'common',
      manual: true
    }),
    loadCommonStyle = _useStyle2.load;
  var _useStyle3 = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useStyle)(globalCSS, {
      name: 'global',
      manual: true
    }),
    loadGlobalStyle = _useStyle3.load;
  var _useStyle4 = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useStyle)(styles, {
      name: name,
      manual: true
    }),
    loadComponentStyle = _useStyle4.load;
  var hook = function hook(hookName) {
    if (!hostName) {
      var selfHook = _usePT(_getPT((ComponentBase.cProps || {}).pt, componentName), _getOptionValue, "hooks.".concat(hookName));
      var defaultHook = _useDefaultPT(_getOptionValue, "hooks.".concat(hookName));
      selfHook === null || selfHook === void 0 || selfHook();
      defaultHook === null || defaultHook === void 0 || defaultHook();
    }
  };
  hook('useMountEffect');
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useMountEffect)(function () {
    // Load base and global styles first as they are always needed
    loadBaseStyle();
    loadGlobalStyle();

    // Only load additional styles if component is styled
    if (!_isUnstyled()) {
      // Load common styles shared across components
      loadCommonStyle();

      // Load component-specific styles if not explicitly styled
      if (!styled) {
        loadComponentStyle();
      }
    }
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useUpdateEffect)(function () {
    hook('useUpdateEffect');
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_1__.useUnmountEffect)(function () {
    hook('useUnmountEffect');
  });
};




/***/ }),

/***/ "./node_modules/primereact/csstransition/csstransition.esm.js":
/*!********************************************************************!*\
  !*** ./node_modules/primereact/csstransition/csstransition.esm.js ***!
  \********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CSSTransition: function() { return /* binding */ CSSTransition; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_transition_group__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-transition-group */ "./node_modules/react-transition-group/esm/CSSTransition.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
'use client';






function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

var CSSTransitionBase = {
  defaultProps: {
    __TYPE: 'CSSTransition',
    children: undefined
  },
  getProps: function getProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_3__.ObjectUtils.getMergedProps(props, CSSTransitionBase.defaultProps);
  },
  getOtherProps: function getOtherProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_3__.ObjectUtils.getDiffProps(props, CSSTransitionBase.defaultProps);
  }
};

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var CSSTransition = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (inProps, ref) {
  var props = CSSTransitionBase.getProps(inProps);
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_4__.PrimeReactContext);
  var disabled = props.disabled || props.options && props.options.disabled || context && !context.cssTransition || !primereact_api__WEBPACK_IMPORTED_MODULE_4__["default"].cssTransition;
  var onEnter = function onEnter(node, isAppearing) {
    props.onEnter && props.onEnter(node, isAppearing); // component
    props.options && props.options.onEnter && props.options.onEnter(node, isAppearing); // user option
  };
  var onEntering = function onEntering(node, isAppearing) {
    props.onEntering && props.onEntering(node, isAppearing); // component
    props.options && props.options.onEntering && props.options.onEntering(node, isAppearing); // user option
  };
  var onEntered = function onEntered(node, isAppearing) {
    props.onEntered && props.onEntered(node, isAppearing); // component
    props.options && props.options.onEntered && props.options.onEntered(node, isAppearing); // user option
  };
  var onExit = function onExit(node) {
    props.onExit && props.onExit(node); // component
    props.options && props.options.onExit && props.options.onExit(node); // user option
  };
  var onExiting = function onExiting(node) {
    props.onExiting && props.onExiting(node); // component
    props.options && props.options.onExiting && props.options.onExiting(node); // user option
  };
  var onExited = function onExited(node) {
    props.onExited && props.onExited(node); // component
    props.options && props.options.onExited && props.options.onExited(node); // user option
  };
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useUpdateEffect)(function () {
    if (disabled) {
      // no animation
      var node = primereact_utils__WEBPACK_IMPORTED_MODULE_3__.ObjectUtils.getRefElement(props.nodeRef);
      if (props["in"]) {
        onEnter(node, true);
        onEntering(node, true);
        onEntered(node, true);
      } else {
        onExit(node);
        onExiting(node);
        onExited(node);
      }
    }
  }, [props["in"]]);
  if (disabled) {
    return props["in"] ? props.children : null;
  }
  var immutableProps = {
    nodeRef: props.nodeRef,
    "in": props["in"],
    appear: props.appear,
    onEnter: onEnter,
    onEntering: onEntering,
    onEntered: onEntered,
    onExit: onExit,
    onExiting: onExiting,
    onExited: onExited
  };
  var mutableProps = {
    classNames: props.classNames,
    timeout: props.timeout,
    unmountOnExit: props.unmountOnExit
  };
  var mergedProps = _objectSpread(_objectSpread(_objectSpread({}, mutableProps), props.options || {}), immutableProps);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_transition_group__WEBPACK_IMPORTED_MODULE_1__["default"], mergedProps, props.children);
});
CSSTransition.displayName = 'CSSTransition';




/***/ }),

/***/ "./node_modules/primereact/hooks/hooks.esm.js":
/*!****************************************************!*\
  !*** ./node_modules/primereact/hooks/hooks.esm.js ***!
  \****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ESC_KEY_HANDLING_PRIORITIES: function() { return /* binding */ ESC_KEY_HANDLING_PRIORITIES; },
/* harmony export */   useClickOutside: function() { return /* binding */ useClickOutside; },
/* harmony export */   useCounter: function() { return /* binding */ useCounter; },
/* harmony export */   useDebounce: function() { return /* binding */ useDebounce; },
/* harmony export */   useDisplayOrder: function() { return /* binding */ useDisplayOrder; },
/* harmony export */   useEventListener: function() { return /* binding */ useEventListener; },
/* harmony export */   useFavicon: function() { return /* binding */ useFavicon; },
/* harmony export */   useGlobalOnEscapeKey: function() { return /* binding */ useGlobalOnEscapeKey; },
/* harmony export */   useIntersectionObserver: function() { return /* binding */ useIntersectionObserver; },
/* harmony export */   useInterval: function() { return /* binding */ useInterval; },
/* harmony export */   useLocalStorage: function() { return /* binding */ useLocalStorage; },
/* harmony export */   useMatchMedia: function() { return /* binding */ useMatchMedia; },
/* harmony export */   useMergeProps: function() { return /* binding */ useMergeProps; },
/* harmony export */   useMountEffect: function() { return /* binding */ useMountEffect; },
/* harmony export */   useMouse: function() { return /* binding */ useMouse; },
/* harmony export */   useMove: function() { return /* binding */ useMove; },
/* harmony export */   useOverlayListener: function() { return /* binding */ useOverlayListener; },
/* harmony export */   useOverlayScrollListener: function() { return /* binding */ useOverlayScrollListener; },
/* harmony export */   usePrevious: function() { return /* binding */ usePrevious; },
/* harmony export */   useResizeListener: function() { return /* binding */ useResizeListener; },
/* harmony export */   useSessionStorage: function() { return /* binding */ useSessionStorage; },
/* harmony export */   useStorage: function() { return /* binding */ useStorage; },
/* harmony export */   useStyle: function() { return /* binding */ useStyle; },
/* harmony export */   useTimeout: function() { return /* binding */ useTimeout; },
/* harmony export */   useUnmountEffect: function() { return /* binding */ useUnmountEffect; },
/* harmony export */   useUpdateEffect: function() { return /* binding */ useUpdateEffect; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
'use client';





function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var usePrevious = function usePrevious(newValue) {
  var ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    ref.current = newValue;
    return function () {
      ref.current = null;
    };
  }, [newValue]);
  return ref.current;
};

/* eslint-disable */
var useUnmountEffect = function useUnmountEffect(fn) {
  return react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    return fn;
  }, []);
};
/* eslint-enable */

var useEventListener = function useEventListener(_ref) {
  var _ref$target = _ref.target,
    target = _ref$target === void 0 ? 'document' : _ref$target,
    type = _ref.type,
    listener = _ref.listener,
    options = _ref.options,
    _ref$when = _ref.when,
    when = _ref$when === void 0 ? true : _ref$when;
  var targetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var listenerRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var prevListener = usePrevious(listener);
  var prevOptions = usePrevious(options);
  var bind = function bind() {
    var bindOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var bindTarget = bindOptions.target;
    if (primereact_utils__WEBPACK_IMPORTED_MODULE_1__.ObjectUtils.isNotEmpty(bindTarget)) {
      unbind();
      (bindOptions.when || when) && (targetRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(bindTarget));
    }
    if (!listenerRef.current && targetRef.current) {
      listenerRef.current = function (event) {
        return listener && listener(event);
      };
      targetRef.current.addEventListener(type, listenerRef.current, options);
    }
  };
  var unbind = function unbind() {
    if (listenerRef.current) {
      targetRef.current.removeEventListener(type, listenerRef.current, options);
      listenerRef.current = null;
    }
  };
  var dispose = function dispose() {
    unbind();
    // Prevent memory leak by releasing
    prevListener = null;
    prevOptions = null;
  };
  var updateTarget = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function () {
    if (when) {
      targetRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(target);
    } else {
      unbind();
      targetRef.current = null;
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [target, when]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    updateTarget();
  }, [updateTarget]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    var listenerChanged = "".concat(prevListener) !== "".concat(listener);
    var optionsChanged = prevOptions !== options;
    var listenerExists = listenerRef.current;
    if (listenerExists && (listenerChanged || optionsChanged)) {
      unbind();
      when && bind();
    } else if (!listenerExists) {
      dispose();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [listener, options, when]);
  useUnmountEffect(function () {
    dispose();
  });
  return [bind, unbind];
};

var useClickOutside = function useClickOutside(ref, callback) {
  var isOutsideClicked = function isOutsideClicked(event) {
    if (!ref.current || ref.current.contains(event.target)) {
      return;
    }
    callback(event);
  };
  var _useEventListener = useEventListener({
      type: 'mousedown',
      listener: isOutsideClicked
    }),
    _useEventListener2 = _slicedToArray(_useEventListener, 2),
    bindMouseDownListener = _useEventListener2[0],
    unbindMouseDownListener = _useEventListener2[1];
  var _useEventListener3 = useEventListener({
      type: 'touchstart',
      listener: isOutsideClicked
    }),
    _useEventListener4 = _slicedToArray(_useEventListener3, 2),
    bindTouchStartListener = _useEventListener4[0],
    unbindTouchStartListener = _useEventListener4[1];
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!ref.current) {
      return;
    }
    bindMouseDownListener();
    bindTouchStartListener();
    return function () {
      unbindMouseDownListener();
      unbindTouchStartListener();
    };
  });
  return [ref, callback];
};

var useCounter = function useCounter() {
  var initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
    step: 1
  };
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialValue),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    count = _React$useState2[0],
    setCount = _React$useState2[1];
  var increment = function increment() {
    if (options.max && count >= options.max) {
      return;
    }
    setCount(count + options.step);
  };
  var decrement = function decrement() {
    if (options.min || options.min === 0 && count <= options.min) {
      return null;
    }
    setCount(count - options.step);
  };
  var reset = function reset() {
    setCount(0);
  };
  return {
    count: count,
    increment: increment,
    decrement: decrement,
    reset: reset
  };
};

var useDebounce = function useDebounce(initialValue, delay) {
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialValue),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    inputValue = _React$useState2[0],
    setInputValue = _React$useState2[1];
  var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialValue),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    debouncedValue = _React$useState4[0],
    setDebouncedValue = _React$useState4[1];
  var mountedRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
  var timeoutRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var cancelTimer = function cancelTimer() {
    return window.clearTimeout(timeoutRef.current);
  };
  useMountEffect(function () {
    mountedRef.current = true;
  });
  useUnmountEffect(function () {
    cancelTimer();
  });
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!mountedRef.current) {
      return;
    }
    cancelTimer();
    timeoutRef.current = window.setTimeout(function () {
      setDebouncedValue(inputValue);
    }, delay);
  }, [inputValue, delay]);
  return [inputValue, debouncedValue, setInputValue];
};

var groupToDisplayedElements = {};
var useDisplayOrder = function useDisplayOrder(group) {
  var isVisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(function () {
      return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_1__.UniqueComponentId)();
    }),
    _React$useState2 = _slicedToArray(_React$useState, 1),
    uid = _React$useState2[0];
  var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(0),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    displayOrder = _React$useState4[0],
    setDisplayOrder = _React$useState4[1];
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (isVisible) {
      if (!groupToDisplayedElements[group]) {
        groupToDisplayedElements[group] = [];
      }
      var newDisplayOrder = groupToDisplayedElements[group].push(uid);
      setDisplayOrder(newDisplayOrder);
      return function () {
        delete groupToDisplayedElements[group][newDisplayOrder - 1];

        // Reduce array length, by removing undefined elements at the end of array:
        var lastIndex = groupToDisplayedElements[group].length - 1;
        var lastOrder = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.ObjectUtils.findLastIndex(groupToDisplayedElements[group], function (el) {
          return el !== undefined;
        });
        if (lastOrder !== lastIndex) {
          groupToDisplayedElements[group].splice(lastOrder + 1);
        }
        setDisplayOrder(undefined);
      };
    }
  }, [group, uid, isVisible]);
  return displayOrder;
};

var TYPE_MAP = {
  ico: 'image/x-icon',
  png: 'image/png',
  svg: 'image/svg+xml',
  gif: 'image/gif'
};
var useFavicon = function useFavicon() {
  var newIcon = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var rel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'shortcut icon';
  react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(function () {
    if (newIcon) {
      var linkElements = document.querySelectorAll("link[rel*='icon']");
      linkElements.forEach(function (linkEl) {
        document.head.removeChild(linkEl);
      });
      var link = document.createElement('link');
      link.setAttribute('type', TYPE_MAP[newIcon.split('.').pop()]);
      link.setAttribute('rel', rel);
      link.setAttribute('href', newIcon);
      document.head.appendChild(link);
    }
  }, [newIcon, rel]);
};

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

/**
 * Priorities of different components (bigger number handled first)
 */
var ESC_KEY_HANDLING_PRIORITIES = {
  SIDEBAR: 100,
  SLIDE_MENU: 200,
  DIALOG: 300,
  IMAGE: 400,
  MENU: 500,
  OVERLAY_PANEL: 600,
  PASSWORD: 700,
  CASCADE_SELECT: 800,
  SPLIT_BUTTON: 900,
  SPEED_DIAL: 1000,
  TOOLTIP: 1200
};

/**
 * Object, that manages global escape key handling logic
 */
var globalEscKeyHandlingLogic = {
  /**
   * Mapping from ESC_KEY_HANDLING_PRIORITY to array of related listeners, grouped by priority
   * @example
   * Map<{
   *     [ESC_KEY_HANDLING_PRIORITIES.SIDEBAR]: Map<{
   *         1: () => {...},
   *         2: () => {...}
   *     }>,
   *     [ESC_KEY_HANDLING_PRIORITIES.DIALOG]: Map<{
   *         1: () => {...},
   *         2: () => {...}
   *     }>
   * }>;
   */
  escKeyListeners: new Map(),
  /**
   * Keydown handler (attached to any keydown)
   */
  onGlobalKeyDown: function onGlobalKeyDown(event) {
    // Do nothing if not an "esc" key is pressed:
    if (event.code !== 'Escape') {
      return;
    }
    var escKeyListeners = globalEscKeyHandlingLogic.escKeyListeners;
    var maxPrimaryPriority = Math.max.apply(Math, _toConsumableArray(escKeyListeners.keys()));
    var theMostImportantEscHandlersSet = escKeyListeners.get(maxPrimaryPriority);
    var maxSecondaryPriority = Math.max.apply(Math, _toConsumableArray(theMostImportantEscHandlersSet.keys()));
    var theMostImportantEscHandler = theMostImportantEscHandlersSet.get(maxSecondaryPriority);
    theMostImportantEscHandler(event);
  },
  /**
   * Attach global keydown listener if there are any "esc" key handlers assigned,
   * otherwise detach.
   */
  refreshGlobalKeyDownListener: function refreshGlobalKeyDownListener() {
    var document = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement('document');
    if (this.escKeyListeners.size > 0) {
      document.addEventListener('keydown', this.onGlobalKeyDown);
    } else {
      document.removeEventListener('keydown', this.onGlobalKeyDown);
    }
  },
  /**
   * Add "Esc" key handler
   */
  addListener: function addListener(callback, _ref) {
    var _this = this;
    var _ref2 = _slicedToArray(_ref, 2),
      primaryPriority = _ref2[0],
      secondaryPriority = _ref2[1];
    var escKeyListeners = this.escKeyListeners;
    if (!escKeyListeners.has(primaryPriority)) {
      escKeyListeners.set(primaryPriority, new Map());
    }
    var primaryPriorityListeners = escKeyListeners.get(primaryPriority);

    // To prevent unexpected override of callback:
    if (primaryPriorityListeners.has(secondaryPriority)) {
      throw new Error("Unexpected: global esc key listener with priority [".concat(primaryPriority, ", ").concat(secondaryPriority, "] already exists."));
    }
    primaryPriorityListeners.set(secondaryPriority, callback);
    this.refreshGlobalKeyDownListener();
    return function () {
      primaryPriorityListeners["delete"](secondaryPriority);
      if (primaryPriorityListeners.size === 0) {
        escKeyListeners["delete"](primaryPriority);
      }
      _this.refreshGlobalKeyDownListener();
    };
  }
};
var useGlobalOnEscapeKey = function useGlobalOnEscapeKey(_ref3) {
  var callback = _ref3.callback,
    when = _ref3.when,
    priority = _ref3.priority;
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
    if (!when) {
      return;
    }
    return globalEscKeyHandlingLogic.addListener(callback, priority);
  }, [callback, when, priority]);
};

var useIntersectionObserver = function useIntersectionObserver(ref) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    isElementVisible = _React$useState2[0],
    setIsElementVisible = _React$useState2[1];
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!ref.current) {
      return;
    }
    var observer = new IntersectionObserver(function (_ref) {
      var _ref2 = _slicedToArray(_ref, 1),
        entry = _ref2[0];
      setIsElementVisible(entry.isIntersecting);
    }, options);
    observer.observe(ref.current);
    return function () {
      observer.disconnect();
    };
  }, [options, ref]);
  return isElementVisible;
};

/* eslint-disable */
var useInterval = function useInterval(fn) {
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  var when = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  var timeout = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var savedCallback = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var clear = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function () {
    return clearInterval(timeout.current);
  }, [timeout.current]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    savedCallback.current = fn;
  });
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    function callback() {
      savedCallback.current();
    }
    if (when) {
      timeout.current = setInterval(callback, delay);
      return clear;
    } else {
      clear();
    }
  }, [delay, when]);
  useUnmountEffect(function () {
    clear();
  });
  return [clear];
};
/* eslint-enable */

var useMatchMedia = function useMatchMedia(query) {
  var when = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    matches = _React$useState2[0],
    setMatches = _React$useState2[1];
  var matchMedia = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var handleChange = function handleChange(e) {
    return setMatches(e.matches);
  };
  var bind = function bind() {
    return matchMedia.current && matchMedia.current.addEventListener('change', handleChange);
  };
  var unbind = function unbind() {
    return matchMedia.current && matchMedia.current.removeEventListener('change', handleChange) && (matchMedia.current = null);
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (when) {
      matchMedia.current = window.matchMedia(query);
      setMatches(matchMedia.current.matches);
      bind();
    }
    return unbind;
  }, [query, when]);
  return matches;
};
/* eslint-enable */

/**
 * Hook to merge properties including custom merge function for things like Tailwind merge.
 */
var useMergeProps = function useMergeProps() {
  var context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(primereact_api__WEBPACK_IMPORTED_MODULE_2__.PrimeReactContext);
  return function () {
    for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) {
      props[_key] = arguments[_key];
    }
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_1__.mergeProps)(props, context === null || context === void 0 ? void 0 : context.ptOptions);
  };
};

/* eslint-disable */

/**
 * Custom hook to run a mount effect only once.
 * @param {*} fn the callback function
 * @returns the hook
 */
var useMountEffect = function useMountEffect(fn) {
  var mounted = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
  return react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!mounted.current) {
      mounted.current = true;
      return fn && fn();
    }
  }, []);
};
/* eslint-enable */

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var useMouse = function useMouse() {
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState({
      x: 0,
      y: 0
    }),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    position = _React$useState2[0],
    setPosition = _React$useState2[1];
  var ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var handleMouseMove = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function (event) {
    var x;
    var y;
    if (ref.current) {
      var rect = event.currentTarget.getBoundingClientRect();
      x = event.pageX - rect.left - (window.pageXOffset || window.scrollX);
      y = event.pageY - rect.top - (window.pageYOffset || window.scrollY);
    } else {
      x = event.clientX;
      y = event.clientY;
    }
    setPosition({
      x: Math.max(0, Math.round(x)),
      y: Math.max(0, Math.round(y))
    });
  }, []);
  var _useEventListener = useEventListener({
      target: ref,
      type: 'mousemove',
      listener: handleMouseMove
    }),
    _useEventListener2 = _slicedToArray(_useEventListener, 2),
    bindMouseMoveEventListener = _useEventListener2[0],
    unbindMouseMoveEventListener = _useEventListener2[1];
  var _useEventListener3 = useEventListener({
      type: 'mousemove',
      listener: handleMouseMove
    }),
    _useEventListener4 = _slicedToArray(_useEventListener3, 2),
    bindDocumentMoveEventListener = _useEventListener4[0],
    unbindDocumentMoveEventListener = _useEventListener4[1];
  var reset = function reset() {
    return setPosition({
      x: 0,
      y: 0
    });
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    bindMouseMoveEventListener();
    if (!ref.current) {
      bindDocumentMoveEventListener();
    }
    return function () {
      unbindMouseMoveEventListener();

      // eslint-disable-next-line react-hooks/exhaustive-deps
      if (!ref.current) {
        unbindDocumentMoveEventListener();
      }
    };
  }, [bindDocumentMoveEventListener, bindMouseMoveEventListener, unbindDocumentMoveEventListener, unbindMouseMoveEventListener]);
  return _objectSpread$1(_objectSpread$1({
    ref: ref
  }, position), {}, {
    reset: reset
  });
};

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useMove(_ref) {
  var _ref$mode = _ref.mode,
    mode = _ref$mode === void 0 ? 'both' : _ref$mode,
    _ref$initialValue = _ref.initialValue,
    initialValue = _ref$initialValue === void 0 ? {
      x: 0,
      y: 0
    } : _ref$initialValue;
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialValue),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    positions = _React$useState2[0],
    setPositions = _React$useState2[1];
  var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    active = _React$useState4[0],
    setActive = _React$useState4[1];
  var isMounted = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
  var isSliding = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
  var ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var onMouseMove = function onMouseMove(event) {
    return updateMousePosition({
      x: event.clientX,
      y: event.clientY
    });
  };
  var handlePositionChange = function handlePositionChange(_ref2) {
    var clampedX = _ref2.clampedX,
      clampedY = _ref2.clampedY;
    if (mode === 'vertical') {
      setPositions({
        y: 1 - clampedY
      });
    } else if (mode === 'horizontal') {
      setPositions({
        x: clampedX
      });
    } else if (mode === 'both') {
      setPositions({
        x: clampedX,
        y: clampedY
      });
    }
  };
  var onMouseDown = function onMouseDown(event) {
    startScrubbing();
    event.preventDefault();
    onMouseMove(event);
  };
  var stopScrubbing = function stopScrubbing() {
    if (isSliding.current && isMounted.current) {
      isSliding.current = false;
      setActive(false);
      unbindListeners();
    }
  };
  var onTouchMove = function onTouchMove(event) {
    if (event.cancelable) {
      event.preventDefault();
    }
    updateMousePosition({
      x: event.changedTouches[0].clientX,
      y: event.changedTouches[0].clientY
    });
  };
  var onTouchStart = function onTouchStart(event) {
    if (event.cancelable) {
      event.preventDefault();
    }
    startScrubbing();
    onTouchMove(event);
  };
  var _useEventListener = useEventListener({
      type: 'mousemove',
      listener: onMouseMove
    }),
    _useEventListener2 = _slicedToArray(_useEventListener, 2),
    bindDocumentMouseMoveListener = _useEventListener2[0],
    unbindDocumentMouseMoveListener = _useEventListener2[1];
  var _useEventListener3 = useEventListener({
      type: 'mouseup',
      listener: stopScrubbing
    }),
    _useEventListener4 = _slicedToArray(_useEventListener3, 2),
    bindDocumentMouseUpListener = _useEventListener4[0],
    unbindDocumentMouseUpListener = _useEventListener4[1];
  var _useEventListener5 = useEventListener({
      type: 'touchmove',
      listener: onTouchMove
    }),
    _useEventListener6 = _slicedToArray(_useEventListener5, 2),
    bindDocumentTouchMoveListener = _useEventListener6[0],
    unbindDocumentTouchMoveListener = _useEventListener6[1];
  var _useEventListener7 = useEventListener({
      type: 'touchend',
      listener: stopScrubbing
    }),
    _useEventListener8 = _slicedToArray(_useEventListener7, 2),
    bindDocumentTouchEndListener = _useEventListener8[0],
    unbindDocumentTouchEndListener = _useEventListener8[1];
  var _useEventListener9 = useEventListener({
      target: ref,
      type: 'mousedown',
      listener: onMouseDown
    }),
    _useEventListener10 = _slicedToArray(_useEventListener9, 2),
    bindMouseDownListener = _useEventListener10[0],
    unbindMouseDownListener = _useEventListener10[1];
  var _useEventListener11 = useEventListener({
      target: ref,
      type: 'touchstart',
      listener: onTouchStart,
      options: {
        passive: false
      }
    }),
    _useEventListener12 = _slicedToArray(_useEventListener11, 2),
    bindTouchStartListener = _useEventListener12[0],
    unbindTouchStartListener = _useEventListener12[1];
  var clamp = function clamp(value, min, max) {
    return Math.min(Math.max(value, min), max);
  };
  var clampPositions = function clampPositions(_ref3) {
    var x = _ref3.x,
      y = _ref3.y;
    return {
      clampedX: clamp(x, 0, 1),
      clampedY: clamp(y, 0, 1)
    };
  };
  var bindListeners = function bindListeners() {
    bindDocumentMouseMoveListener();
    bindDocumentMouseUpListener();
    bindDocumentTouchMoveListener();
    bindDocumentTouchEndListener();
  };
  var unbindListeners = function unbindListeners() {
    unbindDocumentMouseMoveListener();
    unbindDocumentMouseUpListener();
    unbindDocumentTouchMoveListener();
    unbindDocumentTouchEndListener();
  };
  var reset = function reset() {
    setPositions(initialValue);
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    isMounted.current = true;
  }, []);
  var startScrubbing = function startScrubbing() {
    if (!isSliding.current && isMounted.current) {
      isSliding.current = true;
      setActive(true);
      bindListeners();
    }
  };
  var updateMousePosition = function updateMousePosition(_ref4) {
    var x = _ref4.x,
      y = _ref4.y;
    if (isSliding.current) {
      var rect = ref.current.getBoundingClientRect();
      var _clampPositions = clampPositions({
          x: (x - rect.left) / rect.width,
          y: (y - rect.top) / rect.height
        }),
        clampedX = _clampPositions.clampedX,
        clampedY = _clampPositions.clampedY;
      handlePositionChange({
        clampedX: clampedX,
        clampedY: clampedY
      });
    }
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (ref.current) {
      bindMouseDownListener();
      bindTouchStartListener();
    }
    return function () {
      if (ref.current) {
        unbindMouseDownListener();
        unbindTouchStartListener();
      }
    };
  }, [bindMouseDownListener, bindTouchStartListener, positions, unbindMouseDownListener, unbindTouchStartListener]);
  return _objectSpread(_objectSpread({
    ref: ref
  }, positions), {}, {
    active: active,
    reset: reset
  });
}

var useOverlayScrollListener = function useOverlayScrollListener(_ref) {
  var target = _ref.target,
    listener = _ref.listener,
    options = _ref.options,
    _ref$when = _ref.when,
    when = _ref$when === void 0 ? true : _ref$when;
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_2__.PrimeReactContext);
  var targetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var listenerRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var scrollableParentsRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef([]);
  var prevListener = usePrevious(listener);
  var prevOptions = usePrevious(options);
  var bind = function bind() {
    var bindOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    if (primereact_utils__WEBPACK_IMPORTED_MODULE_1__.ObjectUtils.isNotEmpty(bindOptions.target)) {
      unbind();
      (bindOptions.when || when) && (targetRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(bindOptions.target));
    }
    if (!listenerRef.current && targetRef.current) {
      var hideOnScroll = context ? context.hideOverlaysOnDocumentScrolling : primereact_api__WEBPACK_IMPORTED_MODULE_2__["default"].hideOverlaysOnDocumentScrolling;
      var nodes = scrollableParentsRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getScrollableParents(targetRef.current);

      // Ensure window/body is always included as fallback
      if (!nodes.some(function (node) {
        return node === document.body || node === window;
      })) {
        nodes.push(hideOnScroll ? window : document.body);
      }
      listenerRef.current = function (event) {
        return listener && listener(event);
      };
      nodes.forEach(function (node) {
        return node.addEventListener('scroll', listenerRef.current, options);
      });
    }
  };
  var unbind = function unbind() {
    if (listenerRef.current) {
      var nodes = scrollableParentsRef.current;
      nodes.forEach(function (node) {
        return node.removeEventListener('scroll', listenerRef.current, options);
      });
      listenerRef.current = null;
    }
  };
  var dispose = function dispose() {
    unbind();
    // #5927 prevent memory leak by releasing
    scrollableParentsRef.current = null;
    prevListener = null;
    prevOptions = null;
  };
  var updateTarget = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function () {
    if (when) {
      targetRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(target);
    } else {
      unbind();
      targetRef.current = null;
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [target, when]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    updateTarget();
  }, [updateTarget]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    var listenerChanged = "".concat(prevListener) !== "".concat(listener);
    var optionsChanged = prevOptions !== options;
    var listenerExists = listenerRef.current;
    if (listenerExists && (listenerChanged || optionsChanged)) {
      unbind();
      when && bind();
    } else if (!listenerExists) {
      dispose();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [listener, options, when]);
  useUnmountEffect(function () {
    dispose();
  });
  return [bind, unbind];
};

var useResizeListener = function useResizeListener(_ref) {
  var listener = _ref.listener,
    _ref$when = _ref.when,
    when = _ref$when === void 0 ? true : _ref$when;
  return useEventListener({
    target: 'window',
    type: 'resize',
    listener: listener,
    when: when
  });
};

var useOverlayListener = function useOverlayListener(_ref) {
  var target = _ref.target,
    overlay = _ref.overlay,
    _listener = _ref.listener,
    _ref$when = _ref.when,
    when = _ref$when === void 0 ? true : _ref$when,
    _ref$type = _ref.type,
    type = _ref$type === void 0 ? 'click' : _ref$type;
  var targetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var overlayRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);

  /**
   * The parameters of the 'listener' method in the following event handlers;
   * @param {Event} event A click event of the document.
   * @param {string} options.type The custom type to detect event.
   * @param {boolean} options.valid It is controlled by PrimeReact. It is determined whether it is valid or not according to some custom validation.
   */
  var _useEventListener = useEventListener({
      target: 'window',
      type: type,
      listener: function listener(event) {
        _listener && _listener(event, {
          type: 'outside',
          valid: event.which !== 3 && isOutsideClicked(event)
        });
      },
      when: when
    }),
    _useEventListener2 = _slicedToArray(_useEventListener, 2),
    bindDocumentClickListener = _useEventListener2[0],
    unbindDocumentClickListener = _useEventListener2[1];
  var _useResizeListener = useResizeListener({
      listener: function listener(event) {
        _listener && _listener(event, {
          type: 'resize',
          valid: !primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.isTouchDevice()
        });
      },
      when: when
    }),
    _useResizeListener2 = _slicedToArray(_useResizeListener, 2),
    bindWindowResizeListener = _useResizeListener2[0],
    unbindWindowResizeListener = _useResizeListener2[1];
  var _useEventListener3 = useEventListener({
      target: 'window',
      type: 'orientationchange',
      listener: function listener(event) {
        _listener && _listener(event, {
          type: 'orientationchange',
          valid: true
        });
      },
      when: when
    }),
    _useEventListener4 = _slicedToArray(_useEventListener3, 2),
    bindWindowOrientationChangeListener = _useEventListener4[0],
    unbindWindowOrientationChangeListener = _useEventListener4[1];
  var _useOverlayScrollList = useOverlayScrollListener({
      target: target,
      listener: function listener(event) {
        _listener && _listener(event, {
          type: 'scroll',
          valid: true
        });
      },
      when: when
    }),
    _useOverlayScrollList2 = _slicedToArray(_useOverlayScrollList, 2),
    bindOverlayScrollListener = _useOverlayScrollList2[0],
    unbindOverlayScrollListener = _useOverlayScrollList2[1];
  var isOutsideClicked = function isOutsideClicked(event) {
    return targetRef.current && !(targetRef.current.isSameNode(event.target) || targetRef.current.contains(event.target) || overlayRef.current && overlayRef.current.contains(event.target));
  };
  var bind = function bind() {
    bindDocumentClickListener();
    bindWindowResizeListener();
    bindWindowOrientationChangeListener();
    bindOverlayScrollListener();
  };
  var unbind = function unbind() {
    unbindDocumentClickListener();
    unbindWindowResizeListener();
    unbindWindowOrientationChangeListener();
    unbindOverlayScrollListener();
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (when) {
      targetRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(target);
      overlayRef.current = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.getTargetElement(overlay);
    } else {
      unbind();
      targetRef.current = overlayRef.current = null;
    }
  }, [target, overlay, when]);
  useUnmountEffect(function () {
    unbind();
  });
  return [bind, unbind];
};
/* eslint-enable */

/**
 * Hook to wrap around useState that stores the value in the browser local/session storage.
 *
 * @param {any} initialValue the initial value to store
 * @param {string} key the key to store the value in local/session storage
 * @param {string} storage either 'local' or 'session' for what type of storage
 * @returns a stateful value, and a function to update it.
 */
var useStorage = function useStorage(initialValue, key) {
  var storage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
  // Since the local storage API isn't available in server-rendering environments,
  // we check that typeof window !== 'undefined' to make SSR and SSG work properly.
  var storageAvailable = typeof window !== 'undefined';

  // subscribe to window storage event so changes in one tab to a stored value
  // are properly reflected in all tabs
  var _useEventListener = useEventListener({
      target: 'window',
      type: 'storage',
      listener: function listener(event) {
        var area = storage === 'local' ? window.localStorage : window.sessionStorage;
        if (event.storageArea === area && event.key === key) {
          var newValue = event.newValue ? JSON.parse(event.newValue) : undefined;
          setStoredValue(newValue);
        }
      }
    }),
    _useEventListener2 = _slicedToArray(_useEventListener, 2),
    bindWindowStorageListener = _useEventListener2[0],
    unbindWindowStorageListener = _useEventListener2[1];
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialValue),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    storedValue = _React$useState2[0],
    setStoredValue = _React$useState2[1];
  var setValue = function setValue(value) {
    try {
      // Allow value to be a function so we have same API as useState
      var valueToStore = value instanceof Function ? value(storedValue) : value;
      setStoredValue(valueToStore);
      if (storageAvailable) {
        var serializedValue = JSON.stringify(valueToStore);
        storage === 'local' ? window.localStorage.setItem(key, serializedValue) : window.sessionStorage.setItem(key, serializedValue);
      }
    } catch (error) {
      throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(key));
    }
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!storageAvailable) {
      setStoredValue(initialValue);
    }
    try {
      var item = storage === 'local' ? window.localStorage.getItem(key) : window.sessionStorage.getItem(key);
      setStoredValue(item ? JSON.parse(item) : initialValue);
    } catch (error) {
      // If error also return initialValue
      setStoredValue(initialValue);
    }
    bindWindowStorageListener();
    return function () {
      return unbindWindowStorageListener();
    };
  }, []);
  return [storedValue, setValue];
};

/**
 * Hook to wrap around useState that stores the value in the browser local storage.
 *
 * @param {any} initialValue the initial value to store
 * @param {string} key the key to store the value in local storage
 * @returns a stateful value, and a function to update it.
 */
var useLocalStorage = function useLocalStorage(initialValue, key) {
  return useStorage(initialValue, key, 'local');
};

/**
 * Hook to wrap around useState that stores the value in the browser session storage.
 *
 * @param {any} initialValue the initial value to store
 * @param {string} key the key to store the value in session storage
 * @returns a stateful value, and a function to update it.
 */
var useSessionStorage = function useSessionStorage(initialValue, key) {
  return useStorage(initialValue, key, 'session');
};
/* eslint-enable */

var _id = 0;
var useStyle = function useStyle(css) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
    _useState2 = _slicedToArray(_useState, 2),
    isLoaded = _useState2[0],
    setIsLoaded = _useState2[1];
  var styleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  var context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(primereact_api__WEBPACK_IMPORTED_MODULE_2__.PrimeReactContext);
  var defaultDocument = primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.isClient() ? window.document : undefined;
  var _options$document = options.document,
    document = _options$document === void 0 ? defaultDocument : _options$document,
    _options$manual = options.manual,
    manual = _options$manual === void 0 ? false : _options$manual,
    _options$name = options.name,
    name = _options$name === void 0 ? "style_".concat(++_id) : _options$name,
    _options$id = options.id,
    id = _options$id === void 0 ? undefined : _options$id,
    _options$media = options.media,
    media = _options$media === void 0 ? undefined : _options$media;
  var getCurrentStyleRef = function getCurrentStyleRef(styleContainer) {
    var existingStyle = styleContainer.querySelector("style[data-primereact-style-id=\"".concat(name, "\"]"));
    if (existingStyle) {
      return existingStyle;
    }
    if (id !== undefined) {
      var existingElement = document.getElementById(id);
      if (existingElement) {
        return existingElement;
      }
    }

    // finally if not found create the new style
    return document.createElement('style');
  };
  var update = function update(newCSS) {
    isLoaded && css !== newCSS && (styleRef.current.textContent = newCSS);
  };
  var load = function load() {
    if (!document || isLoaded) {
      return;
    }
    var styleContainer = (context === null || context === void 0 ? void 0 : context.styleContainer) || document.head;
    styleRef.current = getCurrentStyleRef(styleContainer);
    if (!styleRef.current.isConnected) {
      styleRef.current.type = 'text/css';
      if (id) {
        styleRef.current.id = id;
      }
      if (media) {
        styleRef.current.media = media;
      }
      primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.addNonce(styleRef.current, context && context.nonce || primereact_api__WEBPACK_IMPORTED_MODULE_2__["default"].nonce);
      styleContainer.appendChild(styleRef.current);
      if (name) {
        styleRef.current.setAttribute('data-primereact-style-id', name);
      }
    }
    styleRef.current.textContent = css;
    setIsLoaded(true);
  };
  var unload = function unload() {
    if (!document || !styleRef.current) {
      return;
    }
    primereact_utils__WEBPACK_IMPORTED_MODULE_1__.DomHandler.removeInlineStyle(styleRef.current);
    setIsLoaded(false);
  };
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
    if (!manual) {
      load();
    }

    // return () => {if (!manual) unload()}; /* @todo */
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [manual]);
  return {
    id: id,
    name: name,
    update: update,
    unload: unload,
    load: load,
    isLoaded: isLoaded
  };
};

/* eslint-disable */
var useTimeout = function useTimeout(fn) {
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  var when = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  var timeout = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var savedCallback = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var clear = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function () {
    return clearTimeout(timeout.current);
  }, [timeout.current]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    savedCallback.current = fn;
  });
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    function callback() {
      savedCallback.current();
    }
    if (when) {
      timeout.current = setTimeout(callback, delay);
      return clear;
    } else {
      clear();
    }
  }, [delay, when]);
  useUnmountEffect(function () {
    clear();
  });
  return [clear];
};
/* eslint-enable */

/* eslint-disable */
var useUpdateEffect = function useUpdateEffect(fn, deps) {
  var mounted = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
  return react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (!mounted.current) {
      mounted.current = true;
      return;
    }
    return fn && fn();
  }, deps);
};
/* eslint-enable */




/***/ }),

/***/ "./node_modules/primereact/keyfilter/keyfilter.esm.js":
/*!************************************************************!*\
  !*** ./node_modules/primereact/keyfilter/keyfilter.esm.js ***!
  \************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   KeyFilter: function() { return /* binding */ KeyFilter; }
/* harmony export */ });
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
'use client';


function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

var KeyFilter = {
  /* eslint-disable */
  DEFAULT_MASKS: {
    pint: /[\d]/,
    "int": /[\d\-]/,
    pnum: /[\d\.]/,
    money: /[\d\.\s,]/,
    num: /[\d\-\.]/,
    hex: /[0-9a-f]/i,
    email: /[a-z0-9_\.\-@]/i,
    alpha: /[a-z_]/i,
    alphanum: /[a-z0-9_]/i
  },
  /* eslint-enable */getRegex: function getRegex(keyfilter) {
    return KeyFilter.DEFAULT_MASKS[keyfilter] ? KeyFilter.DEFAULT_MASKS[keyfilter] : keyfilter;
  },
  onBeforeInput: function onBeforeInput(e, keyfilter, validateOnly) {
    // android devices must use beforeinput https://stackoverflow.com/questions/36753548/keycode-on-android-is-always-229
    if (validateOnly || !primereact_utils__WEBPACK_IMPORTED_MODULE_0__.DomHandler.isAndroid()) {
      return;
    }
    this.validateKey(e, e.data, keyfilter);
  },
  onKeyPress: function onKeyPress(e, keyfilter, validateOnly) {
    // non android devices use keydown
    if (validateOnly || primereact_utils__WEBPACK_IMPORTED_MODULE_0__.DomHandler.isAndroid()) {
      return;
    }
    if (e.ctrlKey || e.altKey || e.metaKey) {
      return;
    }
    this.validateKey(e, e.key, keyfilter);
  },
  onPaste: function onPaste(e, keyfilter, validateOnly) {
    if (validateOnly) {
      return;
    }
    var regex = this.getRegex(keyfilter);
    var clipboard = e.clipboardData.getData('text');

    // loop over each letter pasted and if any fail prevent the paste
    _toConsumableArray(clipboard).forEach(function (c) {
      if (!regex.test(c)) {
        e.preventDefault();
        return false;
      }
    });
  },
  validateKey: function validateKey(e, key, keyfilter) {
    if (key === null || key === undefined) {
      return;
    }

    // some AZERTY keys come in with 2 chars like ´ç if Dead key is pressed first
    var isPrintableKey = key.length <= 2;
    if (!isPrintableKey) {
      return;
    }
    var regex = this.getRegex(keyfilter);
    if (!regex.test(key)) {
      e.preventDefault();
    }
  },
  validate: function validate(e, keyfilter) {
    var value = e.target.value;
    var validatePattern = true;
    var regex = this.getRegex(keyfilter);
    if (value && !regex.test(value)) {
      validatePattern = false;
    }
    return validatePattern;
  }
};




/***/ }),

/***/ "./node_modules/primereact/mention/mention.esm.js":
/*!********************************************************!*\
  !*** ./node_modules/primereact/mention/mention.esm.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Mention: function() { return /* binding */ Mention; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
/* harmony import */ var primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/componentbase */ "./node_modules/primereact/componentbase/componentbase.esm.js");
/* harmony import */ var primereact_csstransition__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! primereact/csstransition */ "./node_modules/primereact/csstransition/csstransition.esm.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_keyfilter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! primereact/keyfilter */ "./node_modules/primereact/keyfilter/keyfilter.esm.js");
/* harmony import */ var primereact_tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! primereact/tooltip */ "./node_modules/primereact/tooltip/tooltip.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
/* harmony import */ var primereact_overlayservice__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! primereact/overlayservice */ "./node_modules/primereact/overlayservice/overlayservice.esm.js");
/* harmony import */ var primereact_portal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! primereact/portal */ "./node_modules/primereact/portal/portal.esm.js");
/* harmony import */ var primereact_ripple__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! primereact/ripple */ "./node_modules/primereact/ripple/ripple.esm.js");
'use client';












function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var classes$1 = {
  root: function root(_ref) {
    var props = _ref.props,
      context = _ref.context,
      isFilled = _ref.isFilled;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)('p-inputtextarea p-inputtext p-component', {
      'p-disabled': props.disabled,
      'p-filled': isFilled,
      'p-inputtextarea-resizable': props.autoResize,
      'p-invalid': props.invalid,
      'p-variant-filled': props.variant ? props.variant === 'filled' : context && context.inputStyle === 'filled'
    });
  }
};
var styles$1 = "\n@layer primereact {\n    .p-inputtextarea-resizable {\n        overflow: hidden;\n        resize: none;\n    }\n    \n    .p-fluid .p-inputtextarea {\n        width: 100%;\n    }\n}\n";
var InputTextareaBase = primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.ComponentBase.extend({
  defaultProps: {
    __TYPE: 'InputTextarea',
    __parentMetadata: null,
    autoResize: false,
    invalid: false,
    variant: null,
    keyfilter: null,
    onBlur: null,
    onFocus: null,
    onBeforeInput: null,
    onInput: null,
    onKeyDown: null,
    onKeyUp: null,
    onPaste: null,
    tooltip: null,
    tooltipOptions: null,
    validateOnly: false,
    children: undefined,
    className: null
  },
  css: {
    classes: classes$1,
    styles: styles$1
  }
});

function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var InputTextarea = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (inProps, ref) {
  var mergeProps = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useMergeProps)();
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_1__.PrimeReactContext);
  var props = InputTextareaBase.getProps(inProps, context);
  var elementRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(ref);
  var cachedScrollHeight = react__WEBPACK_IMPORTED_MODULE_0__.useRef(0);
  var _InputTextareaBase$se = InputTextareaBase.setMetaData(_objectSpread$1(_objectSpread$1({
      props: props
    }, props.__parentMetadata), {}, {
      context: {
        disabled: props.disabled
      }
    })),
    ptm = _InputTextareaBase$se.ptm,
    cx = _InputTextareaBase$se.cx,
    isUnstyled = _InputTextareaBase$se.isUnstyled;
  (0,primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.useHandleStyle)(InputTextareaBase.css.styles, isUnstyled, {
    name: 'inputtextarea'
  });
  var onFocus = function onFocus(event) {
    if (props.autoResize) {
      resize();
    }
    props.onFocus && props.onFocus(event);
  };
  var onBlur = function onBlur(event) {
    if (props.autoResize) {
      resize();
    }
    props.onBlur && props.onBlur(event);
  };
  var onKeyUp = function onKeyUp(event) {
    if (props.autoResize) {
      resize();
    }
    props.onKeyUp && props.onKeyUp(event);
  };
  var onKeyDown = function onKeyDown(event) {
    props.onKeyDown && props.onKeyDown(event);
    if (props.keyfilter) {
      primereact_keyfilter__WEBPACK_IMPORTED_MODULE_5__.KeyFilter.onKeyPress(event, props.keyfilter, props.validateOnly);
    }
  };
  var onBeforeInput = function onBeforeInput(event) {
    props.onBeforeInput && props.onBeforeInput(event);
    if (props.keyfilter) {
      primereact_keyfilter__WEBPACK_IMPORTED_MODULE_5__.KeyFilter.onBeforeInput(event, props.keyfilter, props.validateOnly);
    }
  };
  var onPaste = function onPaste(event) {
    props.onPaste && props.onPaste(event);
    if (props.keyfilter) {
      primereact_keyfilter__WEBPACK_IMPORTED_MODULE_5__.KeyFilter.onPaste(event, props.keyfilter, props.validateOnly);
    }
  };
  var onInput = function onInput(event) {
    var target = event.target;
    if (props.autoResize) {
      resize(primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isEmpty(target.value));
    }
    props.onInput && props.onInput(event);
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(target.value) ? primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.addClass(target, 'p-filled') : primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.removeClass(target, 'p-filled');
  };
  var resize = function resize(initial) {
    var inputEl = elementRef.current;
    if (inputEl && isVisible()) {
      if (!cachedScrollHeight.current) {
        cachedScrollHeight.current = inputEl.scrollHeight;
        inputEl.style.overflow = 'hidden';
      }
      if (cachedScrollHeight.current !== inputEl.scrollHeight || initial) {
        inputEl.style.height = '';
        inputEl.style.height = inputEl.scrollHeight + 'px';
        if (parseFloat(inputEl.style.height) >= parseFloat(inputEl.style.maxHeight)) {
          inputEl.style.overflowY = 'scroll';
          inputEl.style.height = inputEl.style.maxHeight;
        } else {
          inputEl.style.overflow = 'hidden';
        }
        cachedScrollHeight.current = inputEl.scrollHeight;
      }
    }
  };
  var isVisible = function isVisible() {
    if (primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.isVisible(elementRef.current)) {
      var rect = elementRef.current.getBoundingClientRect();
      return rect.width > 0 && rect.height > 0;
    }
    return false;
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.combinedRefs(elementRef, ref);
  }, [elementRef, ref]);
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    if (props.autoResize) {
      resize(true);
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [props.autoResize, props.value]);
  var isFilled = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(function () {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(props.value) || primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(props.defaultValue);
  }, [props.value, props.defaultValue]);
  var hasTooltip = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(props.tooltip);
  var rootProps = mergeProps({
    ref: elementRef,
    className: (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)(props.className, cx('root', {
      context: context,
      isFilled: isFilled
    })),
    onFocus: onFocus,
    onBlur: onBlur,
    onKeyUp: onKeyUp,
    onKeyDown: onKeyDown,
    onBeforeInput: onBeforeInput,
    onInput: onInput,
    onPaste: onPaste
  }, InputTextareaBase.getOtherProps(props), ptm('root'));
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("textarea", rootProps), hasTooltip && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_tooltip__WEBPACK_IMPORTED_MODULE_6__.Tooltip, _extends({
    target: elementRef,
    content: props.tooltip,
    pt: ptm('tooltip')
  }, props.tooltipOptions)));
}));
InputTextarea.displayName = 'InputTextarea';

var classes = {
  item: function item(_ref) {
    var isSelected = _ref.isSelected;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)('p-mention-item', {
      'p-highlight': isSelected
    });
  },
  items: 'p-mention-items',
  panel: function panel(_ref2) {
    var props = _ref2.props;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)('p-mention-panel p-component', props.panelClassName);
  },
  input: function input(_ref3) {
    var props = _ref3.props;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)('p-mention-input', props.inputClassName);
  },
  root: function root(_ref4) {
    _ref4.props;
      var isFilled = _ref4.isFilled,
      focusedState = _ref4.focusedState;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)('p-mention p-component p-inputwrapper', {
      'p-inputwrapper-filled': isFilled,
      'p-inputwrapper-focus': focusedState
    });
  },
  transition: 'p-connected-overlay'
};
var styles = "\n@layer primereact {\n    .p-mention {\n        display: inline-flex;\n        position: relative;\n    }\n    \n    .p-autocomplete-loader {\n        position: absolute;\n        top: 50%;\n        margin-top: -.5rem;\n    }\n    \n    .p-mention .p-mention-panel {\n        min-width: 100%;\n    }\n    \n    .p-mention-panel {\n        position: absolute;\n        top: 0;\n        left: 0;\n        overflow: auto;\n    }\n    \n    .p-mention-items {\n        margin: 0;\n        padding: 0;\n        list-style-type: none;\n    }\n    \n    .p-mention-item {\n        cursor: pointer;\n        white-space: nowrap;\n        position: relative;\n        overflow: hidden;\n    }\n    \n    .p-fluid .p-mention {\n        display: flex;\n    }\n}\n";
var MentionBase = primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.ComponentBase.extend({
  defaultProps: {
    __TYPE: 'Mention',
    autoHighlight: true,
    autoResize: false,
    className: null,
    delay: 0,
    field: null,
    footerTemplate: null,
    headerTemplate: null,
    id: null,
    inputClassName: null,
    inputId: null,
    inputRef: null,
    inputStyle: null,
    itemTemplate: null,
    onBlur: null,
    onChange: null,
    onFocus: null,
    onHide: null,
    onInput: null,
    onSearch: null,
    onSelect: null,
    onShow: null,
    panelClassName: null,
    panelStyle: null,
    scrollHeight: '200px',
    style: null,
    suggestions: null,
    transitionOptions: null,
    trigger: '@',
    variant: null,
    children: undefined
  },
  css: {
    classes: classes,
    styles: styles
  }
});

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Mention = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (inProps, ref) {
  var mergeProps = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useMergeProps)();
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_1__.PrimeReactContext);
  var props = MentionBase.getProps(inProps, context);
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    overlayVisibleState = _React$useState2[0],
    setOverlayVisibleState = _React$useState2[1];
  var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    focusedState = _React$useState4[0],
    setFocusedState = _React$useState4[1];
  var _React$useState5 = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState6 = _slicedToArray(_React$useState5, 2),
    searchingState = _React$useState6[0],
    setSearchingState = _React$useState6[1];
  var _React$useState7 = react__WEBPACK_IMPORTED_MODULE_0__.useState(null),
    _React$useState8 = _slicedToArray(_React$useState7, 2),
    triggerState = _React$useState8[0],
    setTriggerState = _React$useState8[1];
  var _React$useState9 = react__WEBPACK_IMPORTED_MODULE_0__.useState([]),
    _React$useState10 = _slicedToArray(_React$useState9, 2),
    highlightState = _React$useState10[0],
    setHighlightState = _React$useState10[1];
  var elementRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var overlayRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var inputRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(props.inputRef);
  var listRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var timeout = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var metaData = {
    props: props,
    state: {
      overlayVisible: overlayVisibleState,
      focused: focusedState,
      searching: searchingState,
      trigger: triggerState
    }
  };
  var _MentionBase$setMetaD = MentionBase.setMetaData(metaData),
    ptm = _MentionBase$setMetaD.ptm,
    cx = _MentionBase$setMetaD.cx;
    _MentionBase$setMetaD.sx;
    var isUnstyled = _MentionBase$setMetaD.isUnstyled;
  (0,primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.useHandleStyle)(MentionBase.css.styles, isUnstyled, {
    name: 'mention'
  });
  var getPTOptions = function getPTOptions(item, suggestion, options) {
    return ptm(suggestion, {
      context: {
        trigger: triggerState ? triggerState.key : ''
      },
      state: _objectSpread({}, options)
    });
  };
  var _useOverlayListener = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useOverlayListener)({
      target: elementRef,
      overlay: overlayRef,
      listener: function listener(event, _ref) {
        var valid = _ref.valid,
          type = _ref.type;
        if (valid) {
          if (context.hideOverlaysOnDocumentScrolling || type === 'outside') {
            hide();
          } else if (!primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.isDocument(event.target)) {
            alignOverlay();
          }
        }
      },
      when: overlayVisibleState
    }),
    _useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
    bindOverlayListener = _useOverlayListener2[0],
    unbindOverlayListener = _useOverlayListener2[1];
  var show = function show() {
    setOverlayVisibleState(true);
  };
  var hide = function hide() {
    setOverlayVisibleState(false);
    setSearchingState(false);
    setTriggerState(null);
  };
  var onOverlayEnter = function onOverlayEnter() {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ZIndexUtils.set('overlay', overlayRef.current, context && context.autoZIndex || primereact_api__WEBPACK_IMPORTED_MODULE_1__["default"].autoZIndex, context && context.zIndex.overlay || primereact_api__WEBPACK_IMPORTED_MODULE_1__["default"].zIndex.overlay);
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.addStyles(overlayRef.current, {
      position: 'absolute',
      top: '0',
      left: '0'
    });
    alignOverlay();
  };
  var onOverlayEntering = function onOverlayEntering() {
    if (props.autoHighlight && props.suggestions && props.suggestions.length) {
      setHighlightState(function (prevState) {
        var newState = _toConsumableArray(prevState);
        newState[0] = true;
        return newState;
      });
    }
  };
  var onOverlayEntered = function onOverlayEntered() {
    bindOverlayListener();
    props.onShow && props.onShow();
  };
  var onOverlayExit = function onOverlayExit() {
    unbindOverlayListener();
  };
  var onOverlayExited = function onOverlayExited() {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ZIndexUtils.clear(overlayRef.current);
    props.onHide && props.onHide();
  };
  var alignOverlay = function alignOverlay() {
    if (triggerState) {
      var key = triggerState.key,
        index = triggerState.index;
      var value = inputRef.current.value;
      var position = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.getCursorOffset(inputRef.current, value.substring(0, index - 1), value.substring(index), key);
      overlayRef.current.style.transformOrigin = 'top';
      overlayRef.current.style.left = "calc(".concat(position.left, "px + 1rem)");
      overlayRef.current.style.top = "calc(".concat(position.top, "px + 1.2rem)");
    }
  };
  var onPanelClick = function onPanelClick(event) {
    primereact_overlayservice__WEBPACK_IMPORTED_MODULE_8__.OverlayService.emit('overlay-click', {
      originalEvent: event,
      target: elementRef.current
    });
  };
  var getTrigger = function getTrigger(value, key, start) {
    if (!triggerState) {
      var triggerKey = Array.isArray(props.trigger) ? props.trigger.find(function (t) {
        return t === key;
      }) : props.trigger === key ? props.trigger : null;
      if (triggerKey) {
        return {
          key: triggerKey,
          index: start
        };
      }
      var latestSpaceIndex = value.substring(0, start).lastIndexOf(' ');
      var latestTrigger = getLatestTrigger(value, start);
      if (latestTrigger.index > latestSpaceIndex) {
        return latestTrigger;
      }
    }
    return triggerState;
  };
  var getLatestTrigger = function getLatestTrigger(value, start) {
    if (Array.isArray(props.trigger)) {
      var latestTrigger = {};
      props.trigger.forEach(function (t) {
        var index = value.substring(0, start).lastIndexOf(t);
        if (index !== -1 && (index > latestTrigger.index || !latestTrigger.index)) {
          latestTrigger = {
            key: t,
            index: index !== -1 ? index + 1 : -1
          };
        }
      });
      return latestTrigger;
    }
    var index = value.substring(0, start).lastIndexOf(props.trigger);
    return {
      key: props.trigger,
      index: index !== -1 ? index + 1 : -1
    };
  };
  var onSearch = function onSearch(event) {
    if (timeout.current) {
      clearTimeout(timeout.current);
    }
    var _event$target = event.target,
      value = _event$target.value,
      selectionStart = _event$target.selectionStart;
    var key = value.substring(selectionStart - 1, selectionStart);
    if (key === ' ') {
      hide();
      return;
    }
    var currentTrigger = getTrigger(value, key, selectionStart);
    if (currentTrigger && currentTrigger.index > -1) {
      var query = value.substring(currentTrigger.index, selectionStart);
      timeout.current = setTimeout(function () {
        search(event, query, currentTrigger);
      }, props.delay);
    }
  };
  var search = function search(event, query, trigger) {
    if (props.onSearch) {
      setSearchingState(true);
      setTriggerState(trigger);
      props.onSearch({
        originalEvent: event,
        trigger: trigger.key,
        query: query
      });
    }
  };
  var selectItem = function selectItem(event, suggestion) {
    var input = inputRef.current;
    var value = input.value;
    var selectionStart = input.selectionStart;
    var spaceIndex = value.indexOf(' ', triggerState.index);
    var currentText = value.substring(triggerState.index, spaceIndex > -1 ? spaceIndex : selectionStart);
    var selectedText = formatValue(suggestion).replace(/\s+/g, '');
    if (currentText.trim() !== selectedText) {
      var prevText = value.substring(0, triggerState.index);
      var nextText = value.substring(spaceIndex > -1 ? selectionStart : triggerState.index + currentText.length);
      inputRef.current.value = nextText[0] === ' ' ? "".concat(prevText).concat(selectedText).concat(nextText) : "".concat(prevText).concat(selectedText, " ").concat(nextText);
      event.target = inputRef.current;
      props.onChange && props.onChange(event);
    }
    var cursorStart = triggerState.index + selectedText.length + 1;
    inputRef.current.setSelectionRange(cursorStart, cursorStart);
    hide();
    props.onSelect && props.onSelect({
      originalEvent: event,
      suggestion: suggestion
    });
  };
  var formatValue = function formatValue(value) {
    if (value) {
      var field = Array.isArray(props.field) ? props.field[props.trigger.findIndex(function (f) {
        return f === triggerState.key;
      })] : props.field;
      return field ? primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.resolveFieldData(value, field) : value;
    }
    return '';
  };
  var onItemClick = function onItemClick(event, suggestion) {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.focus(inputRef.current);
    selectItem(event, suggestion);
  };
  var onFocus = function onFocus(event) {
    setFocusedState(true);
    props.onFocus && props.onFocus(event);
  };
  var onBlur = function onBlur(event) {
    setFocusedState(false);
    props.onBlur && props.onBlur(event);
  };
  var onInput = function onInput(event) {
    props.onInput && props.onInput(event);
    var isFilled = event.target.value.length > 0;
    if (isUnstyled()) {
      primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.setAttributes(elementRef.current, {
        'data-p-inputwrapper-filled': isFilled
      });
    } else if (isFilled) {
      primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.addClass(elementRef.current, 'p-inputwrapper-filled');
    } else {
      primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.removeClass(elementRef.current, 'p-inputwrapper-filled');
    }
  };
  var onKeyUp = function onKeyUp(event) {
    if (event.which === 37 || event.which === 39) {
      onSearch(event);
    }
  };
  var onChange = function onChange(event) {
    props.onChange && props.onChange(event);
    onSearch(event);
  };
  var onKeyDown = function onKeyDown(event) {
    if (overlayVisibleState) {
      var highlightItem = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.findSingle(overlayRef.current, 'li[data-p-highlight="true"]');
      switch (event.which) {
        //down
        case 40:
          if (highlightItem) {
            var nextElement = highlightItem.nextElementSibling;
            if (nextElement) {
              var nextElementIndex = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(nextElement);
              var highlightItemIndex = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(highlightItem);
              setHighlightState(function (prevState) {
                var newState = _toConsumableArray(prevState);
                newState[nextElementIndex] = true;
                newState[highlightItemIndex] = false;
                return newState;
              });
              primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.scrollInView(overlayRef.current, nextElement);
            }
          } else {
            highlightItem = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.findSingle(overlayRef.current, 'li');
            if (highlightItem) {
              var _highlightItemIndex = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(highlightItem);
              setHighlightState(function (prevState) {
                var newState = _toConsumableArray(prevState);
                newState[_highlightItemIndex] = true;
                return newState;
              });
            }
          }
          event.preventDefault();
          break;

        //up
        case 38:
          if (highlightItem) {
            var previousElement = highlightItem.previousElementSibling;
            if (previousElement) {
              var previousElementIndex = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(previousElement);
              var _highlightItemIndex2 = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(highlightItem);
              setHighlightState(function (prevState) {
                var newState = _toConsumableArray(prevState);
                newState[previousElementIndex] = true;
                newState[_highlightItemIndex2] = false;
                return newState;
              });
              primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.scrollInView(overlayRef.current, previousElement);
            }
          }
          event.preventDefault();
          break;

        //backspace
        case 8:
          var _event$target2 = event.target,
            value = _event$target2.value,
            selectionStart = _event$target2.selectionStart;
          var key = value.substring(selectionStart - 1, selectionStart);
          if (key === triggerState.key) {
            hide();
          }
          break;

        //enter
        case 13:
          if (highlightItem) {
            selectItem(event, props.suggestions[primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.index(highlightItem)]);
          }
          event.preventDefault();
          break;

        //escape
        case 27:
          hide();
          event.preventDefault();
          break;
      }
    }
  };
  var currentValue = inputRef.current && inputRef.current.value;
  var isFilled = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(function () {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(props.value) || primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(props.defaultValue) || primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.isNotEmpty(currentValue);
  }, [props.value, props.defaultValue, currentValue]);
  react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle(ref, function () {
    return {
      props: props,
      show: show,
      hide: hide,
      focus: function focus() {
        return primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.focus(inputRef.current);
      },
      getElement: function getElement() {
        return elementRef.current;
      },
      getOverlay: function getOverlay() {
        return overlayRef.current;
      },
      getInput: function getInput() {
        return inputRef.current;
      }
    };
  });
  react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.combinedRefs(inputRef, props.inputRef);
  }, [inputRef, props.inputRef]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useUpdateEffect)(function () {
    var hasSuggestions = props.suggestions && props.suggestions.length;
    if (hasSuggestions) {
      var newState = props.suggestions.map(function () {
        return false;
      });
      setHighlightState(newState);
    }
    if (searchingState) {
      hasSuggestions ? show() : hide();
      overlayVisibleState && alignOverlay();
      setSearchingState(false);
    }
  }, [props.suggestions]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useUpdateEffect)(function () {
    var _isUnstyled = isUnstyled();
    var isInputWrapperFilled = _isUnstyled ? primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.isAttributeEquals(elementRef.current, 'data-p-inputwrapper-filled', true) : primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.hasClass(elementRef.current, 'p-inputwrapper-filled');
    if (!isFilled && isInputWrapperFilled) {
      _isUnstyled ? primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.setAttributes(elementRef.current, {
        'data-p-inputwrapper-filled': false
      }) : primereact_utils__WEBPACK_IMPORTED_MODULE_7__.DomHandler.removeClass(elementRef.current, 'p-inputwrapper-filled');
    }
  }, [isFilled]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_4__.useUnmountEffect)(function () {
    primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ZIndexUtils.clear(overlayRef.current);
  });
  var createItem = function createItem(suggestion, index) {
    var key = index + '_item';
    var content = props.itemTemplate ? primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.getJSXElement(props.itemTemplate, suggestion, {
      trigger: triggerState ? triggerState.key : '',
      index: index
    }) : formatValue(suggestion);
    var isSelected = highlightState[index];
    var itemProps = mergeProps({
      className: cx('item', {
        isSelected: isSelected
      }),
      onClick: function onClick(e) {
        return onItemClick(e, suggestion);
      },
      'data-p-highlight': isSelected
    }, getPTOptions(suggestion, 'item', {
      selected: isSelected
    }));
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("li", _extends({}, itemProps, {
      key: key
    }), content, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_ripple__WEBPACK_IMPORTED_MODULE_10__.Ripple, null));
  };
  var createList = function createList() {
    var itemsProps = mergeProps({
      ref: listRef,
      className: cx('items')
    }, ptm('items'));
    if (props.suggestions) {
      var items = props.suggestions.map(createItem);
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("ul", itemsProps, items);
    }
    return null;
  };
  var createPanel = function createPanel() {
    var header = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.getJSXElement(props.headerTemplate, props);
    var footer = primereact_utils__WEBPACK_IMPORTED_MODULE_7__.ObjectUtils.getJSXElement(props.footerTemplate, props);
    var list = createList();
    var panelProps = mergeProps({
      ref: overlayRef,
      className: cx('panel'),
      style: _objectSpread({
        maxHeight: props.scrollHeight
      }, props.panelStyle),
      onClick: onPanelClick
    }, ptm('panel'));
    var transitionProps = mergeProps({
      classNames: cx('transition'),
      "in": overlayVisibleState,
      timeout: {
        enter: 120,
        exit: 100
      },
      options: props.transitionOptions,
      unmountOnExit: true,
      onEnter: onOverlayEnter,
      onEntering: onOverlayEntering,
      onEntered: onOverlayEntered,
      onExit: onOverlayExit,
      onExited: onOverlayExited
    }, ptm('transition'));
    var panel = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_csstransition__WEBPACK_IMPORTED_MODULE_3__.CSSTransition, _extends({
      nodeRef: overlayRef
    }, transitionProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", panelProps, header, list, footer));
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_portal__WEBPACK_IMPORTED_MODULE_9__.Portal, {
      element: panel,
      appendTo: "self"
    });
  };
  var inputProps = MentionBase.getOtherProps(props);
  var panel = createPanel();
  var inputMentionProps = mergeProps(_objectSpread(_objectSpread({
    ref: inputRef,
    id: props.inputId,
    className: cx('input'),
    style: props.inputStyle
  }, inputProps), {}, {
    unstyled: props.unstyled,
    variant: props.variant,
    autoResize: props.autoResize,
    onFocus: onFocus,
    onBlur: onBlur,
    onKeyDown: onKeyDown,
    onInput: onInput,
    onKeyUp: onKeyUp,
    onChange: onChange,
    __parentMetadata: {
      parent: metaData
    }
  }), ptm('input'));
  var rootProps = mergeProps({
    ref: elementRef,
    id: props.id,
    className: (0,primereact_utils__WEBPACK_IMPORTED_MODULE_7__.classNames)(props.className, cx('root', {
      focusedState: focusedState,
      isFilled: isFilled
    })),
    style: props.style
  }, MentionBase.getOtherProps(props), ptm('root'));
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", rootProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(InputTextarea, inputMentionProps), panel);
}));
Mention.displayName = 'Mention';




/***/ }),

/***/ "./node_modules/primereact/overlayservice/overlayservice.esm.js":
/*!**********************************************************************!*\
  !*** ./node_modules/primereact/overlayservice/overlayservice.esm.js ***!
  \**********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   OverlayService: function() { return /* binding */ OverlayService; }
/* harmony export */ });
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
'use client';


var OverlayService = (0,primereact_utils__WEBPACK_IMPORTED_MODULE_0__.EventBus)();




/***/ }),

/***/ "./node_modules/primereact/portal/portal.esm.js":
/*!******************************************************!*\
  !*** ./node_modules/primereact/portal/portal.esm.js ***!
  \******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Portal: function() { return /* binding */ Portal; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "react-dom");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
'use client';






function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var PortalBase = {
  defaultProps: {
    __TYPE: 'Portal',
    element: null,
    appendTo: null,
    visible: false,
    onMounted: null,
    onUnmounted: null,
    children: undefined
  },
  getProps: function getProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_4__.ObjectUtils.getMergedProps(props, PortalBase.defaultProps);
  },
  getOtherProps: function getOtherProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_4__.ObjectUtils.getDiffProps(props, PortalBase.defaultProps);
  }
};

var Portal = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(function (inProps) {
  var props = PortalBase.getProps(inProps);
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_2__.PrimeReactContext);
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(props.visible && primereact_utils__WEBPACK_IMPORTED_MODULE_4__.DomHandler.isClient()),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    mountedState = _React$useState2[0],
    setMountedState = _React$useState2[1];
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useMountEffect)(function () {
    if (primereact_utils__WEBPACK_IMPORTED_MODULE_4__.DomHandler.isClient() && !mountedState) {
      setMountedState(true);
      props.onMounted && props.onMounted();
    }
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUpdateEffect)(function () {
    props.onMounted && props.onMounted();
  }, [mountedState]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUnmountEffect)(function () {
    props.onUnmounted && props.onUnmounted();
  });
  var element = props.element || props.children;
  if (element && mountedState) {
    var appendTo = props.appendTo || context && context.appendTo || primereact_api__WEBPACK_IMPORTED_MODULE_2__["default"].appendTo;
    if (primereact_utils__WEBPACK_IMPORTED_MODULE_4__.ObjectUtils.isFunction(appendTo)) {
      appendTo = appendTo();
    }
    if (!appendTo) {
      appendTo = document.body;
    }
    return appendTo === 'self' ? element : /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_1___default().createPortal(element, appendTo);
  }
  return null;
});
Portal.displayName = 'Portal';




/***/ }),

/***/ "./node_modules/primereact/ripple/ripple.esm.js":
/*!******************************************************!*\
  !*** ./node_modules/primereact/ripple/ripple.esm.js ***!
  \******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Ripple: function() { return /* binding */ Ripple; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
/* harmony import */ var primereact_componentbase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primereact/componentbase */ "./node_modules/primereact/componentbase/componentbase.esm.js");
'use client';






function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var styles = "\n@layer primereact {\n    .p-ripple {\n        overflow: hidden;\n        position: relative;\n    }\n    \n    .p-ink {\n        display: block;\n        position: absolute;\n        background: rgba(255, 255, 255, 0.5);\n        border-radius: 100%;\n        transform: scale(0);\n    }\n    \n    .p-ink-active {\n        animation: ripple 0.4s linear;\n    }\n    \n    .p-ripple-disabled .p-ink {\n        display: none;\n    }\n}\n\n@keyframes ripple {\n    100% {\n        opacity: 0;\n        transform: scale(2.5);\n    }\n}\n\n";
var classes = {
  root: 'p-ink'
};
var RippleBase = primereact_componentbase__WEBPACK_IMPORTED_MODULE_4__.ComponentBase.extend({
  defaultProps: {
    __TYPE: 'Ripple',
    children: undefined
  },
  css: {
    styles: styles,
    classes: classes
  },
  getProps: function getProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_3__.ObjectUtils.getMergedProps(props, RippleBase.defaultProps);
  },
  getOtherProps: function getOtherProps(props) {
    return primereact_utils__WEBPACK_IMPORTED_MODULE_3__.ObjectUtils.getDiffProps(props, RippleBase.defaultProps);
  }
});

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Ripple = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (inProps, ref) {
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    isMounted = _React$useState2[0],
    setMounted = _React$useState2[1];
  var inkRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var targetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var mergeProps = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useMergeProps)();
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_1__.PrimeReactContext);
  var props = RippleBase.getProps(inProps, context);
  var isRippleActive = context && context.ripple || primereact_api__WEBPACK_IMPORTED_MODULE_1__["default"].ripple;
  var metaData = {
    props: props
  };
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useStyle)(RippleBase.css.styles, {
    name: 'ripple',
    manual: !isRippleActive
  });
  var _RippleBase$setMetaDa = RippleBase.setMetaData(_objectSpread({}, metaData)),
    ptm = _RippleBase$setMetaDa.ptm,
    cx = _RippleBase$setMetaDa.cx;
  var getTarget = function getTarget() {
    return inkRef.current && inkRef.current.parentElement;
  };
  var bindEvents = function bindEvents() {
    if (targetRef.current) {
      targetRef.current.addEventListener('pointerdown', onPointerDown);
    }
  };
  var unbindEvents = function unbindEvents() {
    if (targetRef.current) {
      targetRef.current.removeEventListener('pointerdown', onPointerDown);
    }
  };
  var onPointerDown = function onPointerDown(event) {
    var offset = primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getOffset(targetRef.current);
    var offsetX = event.pageX - offset.left + document.body.scrollTop - primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getWidth(inkRef.current) / 2;
    var offsetY = event.pageY - offset.top + document.body.scrollLeft - primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getHeight(inkRef.current) / 2;
    activateRipple(offsetX, offsetY);
  };
  var activateRipple = function activateRipple(offsetX, offsetY) {
    if (!inkRef.current || getComputedStyle(inkRef.current, null).display === 'none') {
      return;
    }
    primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.removeClass(inkRef.current, 'p-ink-active');
    setDimensions();
    inkRef.current.style.top = offsetY + 'px';
    inkRef.current.style.left = offsetX + 'px';
    primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.addClass(inkRef.current, 'p-ink-active');
  };
  var onAnimationEnd = function onAnimationEnd(event) {
    primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.removeClass(event.currentTarget, 'p-ink-active');
  };
  var setDimensions = function setDimensions() {
    if (inkRef.current && !primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getHeight(inkRef.current) && !primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getWidth(inkRef.current)) {
      var d = Math.max(primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getOuterWidth(targetRef.current), primereact_utils__WEBPACK_IMPORTED_MODULE_3__.DomHandler.getOuterHeight(targetRef.current));
      inkRef.current.style.height = d + 'px';
      inkRef.current.style.width = d + 'px';
    }
  };
  react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle(ref, function () {
    return {
      props: props,
      getInk: function getInk() {
        return inkRef.current;
      },
      getTarget: function getTarget() {
        return targetRef.current;
      }
    };
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useMountEffect)(function () {
    // for App Router in Next.js ^14
    setMounted(true);
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useUpdateEffect)(function () {
    if (isMounted && inkRef.current) {
      targetRef.current = getTarget();
      setDimensions();
      bindEvents();
    }
  }, [isMounted]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useUpdateEffect)(function () {
    if (inkRef.current && !targetRef.current) {
      targetRef.current = getTarget();
      setDimensions();
      bindEvents();
    }
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_2__.useUnmountEffect)(function () {
    if (inkRef.current) {
      targetRef.current = null;
      unbindEvents();
    }
  });
  if (!isRippleActive) {
    return null;
  }
  var rootProps = mergeProps({
    'aria-hidden': true,
    className: (0,primereact_utils__WEBPACK_IMPORTED_MODULE_3__.classNames)(cx('root'))
  }, RippleBase.getOtherProps(props), ptm('root'));
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", _extends({
    role: "presentation",
    ref: inkRef
  }, rootProps, {
    onAnimationEnd: onAnimationEnd
  }));
}));
Ripple.displayName = 'Ripple';




/***/ }),

/***/ "./node_modules/primereact/tooltip/tooltip.esm.js":
/*!********************************************************!*\
  !*** ./node_modules/primereact/tooltip/tooltip.esm.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Tooltip: function() { return /* binding */ Tooltip; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var primereact_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/api */ "./node_modules/primereact/api/api.esm.js");
/* harmony import */ var primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! primereact/componentbase */ "./node_modules/primereact/componentbase/componentbase.esm.js");
/* harmony import */ var primereact_hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! primereact/hooks */ "./node_modules/primereact/hooks/hooks.esm.js");
/* harmony import */ var primereact_portal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! primereact/portal */ "./node_modules/primereact/portal/portal.esm.js");
/* harmony import */ var primereact_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! primereact/utils */ "./node_modules/primereact/utils/utils.esm.js");
'use client';







function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}

var classes = {
  root: function root(_ref) {
    var positionState = _ref.positionState,
      classNameState = _ref.classNameState;
    return (0,primereact_utils__WEBPACK_IMPORTED_MODULE_5__.classNames)('p-tooltip p-component', _defineProperty({}, "p-tooltip-".concat(positionState), true), classNameState);
  },
  arrow: 'p-tooltip-arrow',
  text: 'p-tooltip-text'
};
var inlineStyles = {
  arrow: function arrow(_ref2) {
    var context = _ref2.context;
    return {
      top: context.bottom ? '0' : context.right || context.left || !context.right && !context.left && !context.top && !context.bottom ? '50%' : null,
      bottom: context.top ? '0' : null,
      left: context.right || !context.right && !context.left && !context.top && !context.bottom ? '0' : context.top || context.bottom ? '50%' : null,
      right: context.left ? '0' : null
    };
  }
};
var styles = "\n@layer primereact {\n    .p-tooltip {\n        position: absolute;\n        padding: .25em .5rem;\n        /* #3687: Tooltip prevent scrollbar flickering */\n        top: -9999px;\n        left: -9999px;\n    }\n    \n    .p-tooltip.p-tooltip-right,\n    .p-tooltip.p-tooltip-left {\n        padding: 0 .25rem;\n    }\n    \n    .p-tooltip.p-tooltip-top,\n    .p-tooltip.p-tooltip-bottom {\n        padding:.25em 0;\n    }\n    \n    .p-tooltip .p-tooltip-text {\n       white-space: pre-line;\n       word-break: break-word;\n    }\n    \n    .p-tooltip-arrow {\n        position: absolute;\n        width: 0;\n        height: 0;\n        border-color: transparent;\n        border-style: solid;\n    }\n    \n    .p-tooltip-right .p-tooltip-arrow {\n        top: 50%;\n        left: 0;\n        margin-top: -.25rem;\n        border-width: .25em .25em .25em 0;\n    }\n    \n    .p-tooltip-left .p-tooltip-arrow {\n        top: 50%;\n        right: 0;\n        margin-top: -.25rem;\n        border-width: .25em 0 .25em .25rem;\n    }\n    \n    .p-tooltip.p-tooltip-top {\n        padding: .25em 0;\n    }\n    \n    .p-tooltip-top .p-tooltip-arrow {\n        bottom: 0;\n        left: 50%;\n        margin-left: -.25rem;\n        border-width: .25em .25em 0;\n    }\n    \n    .p-tooltip-bottom .p-tooltip-arrow {\n        top: 0;\n        left: 50%;\n        margin-left: -.25rem;\n        border-width: 0 .25em .25rem;\n    }\n\n    .p-tooltip-target-wrapper {\n        display: inline-flex;\n    }\n}\n";
var TooltipBase = primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.ComponentBase.extend({
  defaultProps: {
    __TYPE: 'Tooltip',
    appendTo: null,
    at: null,
    autoHide: true,
    autoZIndex: true,
    baseZIndex: 0,
    className: null,
    closeOnEscape: false,
    content: null,
    disabled: false,
    event: null,
    hideDelay: 0,
    hideEvent: 'mouseleave',
    id: null,
    mouseTrack: false,
    mouseTrackLeft: 5,
    mouseTrackTop: 5,
    my: null,
    onBeforeHide: null,
    onBeforeShow: null,
    onHide: null,
    onShow: null,
    position: 'right',
    showDelay: 0,
    showEvent: 'mouseenter',
    showOnDisabled: false,
    style: null,
    target: null,
    updateDelay: 0,
    children: undefined
  },
  css: {
    classes: classes,
    styles: styles,
    inlineStyles: inlineStyles
  }
});

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Tooltip = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function (inProps, ref) {
  var mergeProps = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useMergeProps)();
  var context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(primereact_api__WEBPACK_IMPORTED_MODULE_1__.PrimeReactContext);
  var props = TooltipBase.getProps(inProps, context);
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    visibleState = _React$useState2[0],
    setVisibleState = _React$useState2[1];
  var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_0__.useState(props.position || 'right'),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    positionState = _React$useState4[0],
    setPositionState = _React$useState4[1];
  var _React$useState5 = react__WEBPACK_IMPORTED_MODULE_0__.useState(''),
    _React$useState6 = _slicedToArray(_React$useState5, 2),
    classNameState = _React$useState6[0],
    setClassNameState = _React$useState6[1];
  var _React$useState7 = react__WEBPACK_IMPORTED_MODULE_0__.useState(false),
    _React$useState8 = _slicedToArray(_React$useState7, 2),
    multipleFocusEvents = _React$useState8[0],
    setMultipleFocusEvents = _React$useState8[1];
  var isCloseOnEscape = visibleState && props.closeOnEscape;
  var overlayDisplayOrder = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useDisplayOrder)('tooltip', isCloseOnEscape);
  var metaData = {
    props: props,
    state: {
      visible: visibleState,
      position: positionState,
      className: classNameState
    },
    context: {
      right: positionState === 'right',
      left: positionState === 'left',
      top: positionState === 'top',
      bottom: positionState === 'bottom'
    }
  };
  var _TooltipBase$setMetaD = TooltipBase.setMetaData(metaData),
    ptm = _TooltipBase$setMetaD.ptm,
    cx = _TooltipBase$setMetaD.cx,
    sx = _TooltipBase$setMetaD.sx,
    isUnstyled = _TooltipBase$setMetaD.isUnstyled;
  (0,primereact_componentbase__WEBPACK_IMPORTED_MODULE_2__.useHandleStyle)(TooltipBase.css.styles, isUnstyled, {
    name: 'tooltip'
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useGlobalOnEscapeKey)({
    callback: function callback() {
      hide();
    },
    when: isCloseOnEscape,
    priority: [primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.ESC_KEY_HANDLING_PRIORITIES.TOOLTIP, overlayDisplayOrder]
  });
  var elementRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var textRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var currentTargetRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var containerSize = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var allowHide = react__WEBPACK_IMPORTED_MODULE_0__.useRef(true);
  var timeouts = react__WEBPACK_IMPORTED_MODULE_0__.useRef({});
  var currentMouseEvent = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);
  var _useResizeListener = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useResizeListener)({
      listener: function listener(event) {
        !primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.isTouchDevice() && hide(event);
      }
    }),
    _useResizeListener2 = _slicedToArray(_useResizeListener, 2),
    bindWindowResizeListener = _useResizeListener2[0],
    unbindWindowResizeListener = _useResizeListener2[1];
  var _useOverlayScrollList = (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useOverlayScrollListener)({
      target: currentTargetRef.current,
      listener: function listener(event) {
        hide(event);
      },
      when: visibleState
    }),
    _useOverlayScrollList2 = _slicedToArray(_useOverlayScrollList, 2),
    bindOverlayScrollListener = _useOverlayScrollList2[0],
    unbindOverlayScrollListener = _useOverlayScrollList2[1];
  var isTargetContentEmpty = function isTargetContentEmpty(target) {
    return !(props.content || getTargetOption(target, 'tooltip'));
  };
  var isContentEmpty = function isContentEmpty(target) {
    return !(props.content || getTargetOption(target, 'tooltip') || props.children);
  };
  var isMouseTrack = function isMouseTrack(target) {
    return getTargetOption(target, 'mousetrack') || props.mouseTrack;
  };
  var isDisabled = function isDisabled(target) {
    return getTargetOption(target, 'disabled') === 'true' || hasTargetOption(target, 'disabled') || props.disabled;
  };
  var isShowOnDisabled = function isShowOnDisabled(target) {
    return getTargetOption(target, 'showondisabled') || props.showOnDisabled;
  };
  var isAutoHide = function isAutoHide() {
    return getTargetOption(currentTargetRef.current, 'autohide') || props.autoHide;
  };
  var getTargetOption = function getTargetOption(target, option) {
    return hasTargetOption(target, "data-pr-".concat(option)) ? target.getAttribute("data-pr-".concat(option)) : null;
  };
  var hasTargetOption = function hasTargetOption(target, option) {
    return target && target.hasAttribute(option);
  };
  var getEvents = function getEvents(target) {
    var showEvents = [getTargetOption(target, 'showevent') || props.showEvent];
    var hideEvents = [getTargetOption(target, 'hideevent') || props.hideEvent];
    if (isMouseTrack(target)) {
      showEvents = ['mousemove'];
      hideEvents = ['mouseleave'];
    } else {
      var event = getTargetOption(target, 'event') || props.event;
      if (event === 'focus') {
        showEvents = ['focus'];
        hideEvents = ['blur'];
      }
      if (event === 'both') {
        showEvents = ['focus', 'mouseenter'];
        hideEvents = multipleFocusEvents ? ['blur'] : ['mouseleave', 'blur'];
      }
    }
    return {
      showEvents: showEvents,
      hideEvents: hideEvents
    };
  };
  var getPosition = function getPosition(target) {
    return getTargetOption(target, 'position') || positionState;
  };
  var getMouseTrackPosition = function getMouseTrackPosition(target) {
    var top = getTargetOption(target, 'mousetracktop') || props.mouseTrackTop;
    var left = getTargetOption(target, 'mousetrackleft') || props.mouseTrackLeft;
    return {
      top: top,
      left: left
    };
  };
  var updateText = function updateText(target, callback) {
    if (textRef.current) {
      var content = getTargetOption(target, 'tooltip') || props.content;
      if (content) {
        textRef.current.innerHTML = ''; // remove children
        textRef.current.appendChild(document.createTextNode(content));
        callback();
      } else if (props.children) {
        callback();
      }
    }
  };
  var updateTooltipState = function updateTooltipState(position) {
    updateText(currentTargetRef.current, function () {
      var _currentMouseEvent$cu = currentMouseEvent.current,
        x = _currentMouseEvent$cu.pageX,
        y = _currentMouseEvent$cu.pageY;
      if (props.autoZIndex && !primereact_utils__WEBPACK_IMPORTED_MODULE_5__.ZIndexUtils.get(elementRef.current)) {
        primereact_utils__WEBPACK_IMPORTED_MODULE_5__.ZIndexUtils.set('tooltip', elementRef.current, context && context.autoZIndex || primereact_api__WEBPACK_IMPORTED_MODULE_1__["default"].autoZIndex, props.baseZIndex || context && context.zIndex.tooltip || primereact_api__WEBPACK_IMPORTED_MODULE_1__["default"].zIndex.tooltip);
      }
      elementRef.current.style.left = '';
      elementRef.current.style.top = '';

      // GitHub #2695 disable pointer events when autohiding
      if (isAutoHide()) {
        elementRef.current.style.pointerEvents = 'none';
      }
      var mouseTrackCheck = isMouseTrack(currentTargetRef.current) || position === 'mouse';
      if (mouseTrackCheck && !containerSize.current || mouseTrackCheck) {
        containerSize.current = {
          width: primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.getOuterWidth(elementRef.current),
          height: primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.getOuterHeight(elementRef.current)
        };
      }
      align(currentTargetRef.current, {
        x: x,
        y: y
      }, position);
    });
  };
  var show = function show(e) {
    if (e.type && e.type === 'focus') setMultipleFocusEvents(true);
    currentTargetRef.current = e.currentTarget;
    var disabled = isDisabled(currentTargetRef.current);
    var empty = isContentEmpty(isShowOnDisabled(currentTargetRef.current) && disabled ? currentTargetRef.current.firstChild : currentTargetRef.current);
    if (empty || disabled) {
      return;
    }
    currentMouseEvent.current = e;
    if (visibleState) {
      applyDelay('updateDelay', updateTooltipState);
    } else {
      // #2653 give the callback a chance to return false and not continue with display
      var success = sendCallback(props.onBeforeShow, {
        originalEvent: e,
        target: currentTargetRef.current
      });
      if (success) {
        applyDelay('showDelay', function () {
          setVisibleState(true);
          sendCallback(props.onShow, {
            originalEvent: e,
            target: currentTargetRef.current
          });
        });
      }
    }
  };
  var hide = function hide(e) {
    if (e && e.type === 'blur') setMultipleFocusEvents(false);
    clearTimeouts();
    if (visibleState) {
      var success = sendCallback(props.onBeforeHide, {
        originalEvent: e,
        target: currentTargetRef.current
      });
      if (success) {
        applyDelay('hideDelay', function () {
          if (!isAutoHide() && allowHide.current === false) {
            return;
          }
          primereact_utils__WEBPACK_IMPORTED_MODULE_5__.ZIndexUtils.clear(elementRef.current);
          primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.removeClass(elementRef.current, 'p-tooltip-active');
          setVisibleState(false);
          sendCallback(props.onHide, {
            originalEvent: e,
            target: currentTargetRef.current
          });
        });
      }
    } else if (!props.onBeforeHide && !getDelay('hideDelay')) {
      // handles the case when visibleState change from mouseenter was queued and mouseleave handler was called earlier than queued re-render
      setVisibleState(false);
    }
  };
  var align = function align(target, coordinate, position) {
    var left = 0;
    var top = 0;
    var currentPosition = position || positionState;
    if ((isMouseTrack(target) || currentPosition == 'mouse') && coordinate) {
      var _containerSize = {
        width: primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.getOuterWidth(elementRef.current),
        height: primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.getOuterHeight(elementRef.current)
      };
      left = coordinate.x;
      top = coordinate.y;
      var _getMouseTrackPositio = getMouseTrackPosition(target),
        mouseTrackTop = _getMouseTrackPositio.top,
        mouseTrackLeft = _getMouseTrackPositio.left;
      switch (currentPosition) {
        case 'left':
          left = left - (_containerSize.width + mouseTrackLeft);
          top = top - (_containerSize.height / 2 - mouseTrackTop);
          break;
        case 'right':
        case 'mouse':
          left = left + mouseTrackLeft;
          top = top - (_containerSize.height / 2 - mouseTrackTop);
          break;
        case 'top':
          left = left - (_containerSize.width / 2 - mouseTrackLeft);
          top = top - (_containerSize.height + mouseTrackTop);
          break;
        case 'bottom':
          left = left - (_containerSize.width / 2 - mouseTrackLeft);
          top = top + mouseTrackTop;
          break;
      }
      if (left <= 0 || containerSize.current.width > _containerSize.width) {
        elementRef.current.style.left = '0px';
        elementRef.current.style.right = window.innerWidth - _containerSize.width - left + 'px';
      } else {
        elementRef.current.style.right = '';
        elementRef.current.style.left = left + 'px';
      }
      elementRef.current.style.top = top + 'px';
      primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.addClass(elementRef.current, 'p-tooltip-active');
    } else {
      var pos = primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.findCollisionPosition(currentPosition);
      var my = getTargetOption(target, 'my') || props.my || pos.my;
      var at = getTargetOption(target, 'at') || props.at || pos.at;
      elementRef.current.style.padding = '0px';
      primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.flipfitCollision(elementRef.current, target, my, at, function (calculatedPosition) {
        var _calculatedPosition$a = calculatedPosition.at,
          atX = _calculatedPosition$a.x,
          atY = _calculatedPosition$a.y;
        var myX = calculatedPosition.my.x;
        var newPosition = props.at ? atX !== 'center' && atX !== myX ? atX : atY : calculatedPosition.at["".concat(pos.axis)];
        elementRef.current.style.padding = '';
        setPositionState(newPosition);
        updateContainerPosition(newPosition);
        primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.addClass(elementRef.current, 'p-tooltip-active');
      });
    }
  };
  var updateContainerPosition = function updateContainerPosition(position) {
    if (elementRef.current) {
      var style = getComputedStyle(elementRef.current);
      if (position === 'left') {
        elementRef.current.style.left = parseFloat(style.left) - parseFloat(style.paddingLeft) * 2 + 'px';
      } else if (position === 'top') {
        elementRef.current.style.top = parseFloat(style.top) - parseFloat(style.paddingTop) * 2 + 'px';
      }
    }
  };
  var _onMouseEnter = function onMouseEnter() {
    if (!isAutoHide()) {
      allowHide.current = false;
    }
  };
  var _onMouseLeave = function onMouseLeave(e) {
    if (!isAutoHide()) {
      allowHide.current = true;
      hide(e);
    }
  };
  var bindTargetEvent = function bindTargetEvent(target) {
    if (target) {
      var _getEvents = getEvents(target),
        showEvents = _getEvents.showEvents,
        hideEvents = _getEvents.hideEvents;
      var currentTarget = getTarget(target);
      showEvents.forEach(function (event) {
        return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.addEventListener(event, show);
      });
      hideEvents.forEach(function (event) {
        return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.addEventListener(event, hide);
      });
    }
  };
  var unbindTargetEvent = function unbindTargetEvent(target) {
    if (target) {
      var _getEvents2 = getEvents(target),
        showEvents = _getEvents2.showEvents,
        hideEvents = _getEvents2.hideEvents;
      var currentTarget = getTarget(target);
      showEvents.forEach(function (event) {
        return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.removeEventListener(event, show);
      });
      hideEvents.forEach(function (event) {
        return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.removeEventListener(event, hide);
      });
    }
  };
  var getDelay = function getDelay(delayProp) {
    return getTargetOption(currentTargetRef.current, delayProp.toLowerCase()) || props[delayProp];
  };
  var applyDelay = function applyDelay(delayProp, callback) {
    clearTimeouts();
    var delay = getDelay(delayProp);
    delay ? timeouts.current["".concat(delayProp)] = setTimeout(function () {
      return callback();
    }, delay) : callback();
  };
  var sendCallback = function sendCallback(callback) {
    if (callback) {
      for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        params[_key - 1] = arguments[_key];
      }
      var result = callback.apply(void 0, params);
      if (result === undefined) {
        result = true;
      }
      return result;
    }
    return true;
  };
  var clearTimeouts = function clearTimeouts() {
    Object.values(timeouts.current).forEach(function (t) {
      return clearTimeout(t);
    });
  };
  var getTarget = function getTarget(target) {
    if (target) {
      if (isShowOnDisabled(target)) {
        if (!target.hasWrapper) {
          var wrapper = document.createElement('div');
          var isInputElement = target.nodeName === 'INPUT';
          if (isInputElement) {
            primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.addMultipleClasses(wrapper, 'p-tooltip-target-wrapper p-inputwrapper');
          } else {
            primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.addClass(wrapper, 'p-tooltip-target-wrapper');
          }
          target.parentNode.insertBefore(wrapper, target);
          wrapper.appendChild(target);
          target.hasWrapper = true;
          return wrapper;
        }
        return target.parentElement;
      } else if (target.hasWrapper) {
        var _target$parentElement;
        (_target$parentElement = target.parentElement).replaceWith.apply(_target$parentElement, _toConsumableArray(target.parentElement.childNodes));
        delete target.hasWrapper;
      }
      return target;
    }
    return null;
  };
  var updateTargetEvents = function updateTargetEvents(target) {
    unloadTargetEvents(target);
    loadTargetEvents(target);
  };
  var loadTargetEvents = function loadTargetEvents(target) {
    setTargetEventOperations(target || props.target, bindTargetEvent);
  };
  var unloadTargetEvents = function unloadTargetEvents(target) {
    setTargetEventOperations(target || props.target, unbindTargetEvent);
  };
  var setTargetEventOperations = function setTargetEventOperations(target, operation) {
    target = primereact_utils__WEBPACK_IMPORTED_MODULE_5__.ObjectUtils.getRefElement(target);
    if (target) {
      if (primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.isElement(target)) {
        operation(target);
      } else {
        var setEvent = function setEvent(target) {
          var element = primereact_utils__WEBPACK_IMPORTED_MODULE_5__.DomHandler.find(document, target);
          element.forEach(function (el) {
            operation(el);
          });
        };
        if (target instanceof Array) {
          target.forEach(function (t) {
            setEvent(t);
          });
        } else {
          setEvent(target);
        }
      }
    }
  };
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useMountEffect)(function () {
    if (visibleState && currentTargetRef.current && isDisabled(currentTargetRef.current)) {
      hide();
    }
  });
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUpdateEffect)(function () {
    loadTargetEvents();
    return function () {
      unloadTargetEvents();
    };
  }, [show, hide, props.target]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUpdateEffect)(function () {
    if (visibleState) {
      var position = getPosition(currentTargetRef.current);
      var classname = getTargetOption(currentTargetRef.current, 'classname');
      setPositionState(position);
      setClassNameState(classname);
      updateTooltipState(position);
      bindWindowResizeListener();
      bindOverlayScrollListener();
    } else {
      setPositionState(props.position || 'right');
      setClassNameState('');
      currentTargetRef.current = null;
      containerSize.current = null;
      allowHide.current = true;
    }
    return function () {
      unbindWindowResizeListener();
      unbindOverlayScrollListener();
    };
  }, [visibleState]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUpdateEffect)(function () {
    var position = getPosition(currentTargetRef.current);
    if (visibleState && position !== 'mouse') {
      applyDelay('updateDelay', function () {
        updateText(currentTargetRef.current, function () {
          align(currentTargetRef.current);
        });
      });
    }
  }, [props.content]);
  (0,primereact_hooks__WEBPACK_IMPORTED_MODULE_3__.useUnmountEffect)(function () {
    hide();
    primereact_utils__WEBPACK_IMPORTED_MODULE_5__.ZIndexUtils.clear(elementRef.current);
  });
  react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle(ref, function () {
    return {
      props: props,
      updateTargetEvents: updateTargetEvents,
      loadTargetEvents: loadTargetEvents,
      unloadTargetEvents: unloadTargetEvents,
      show: show,
      hide: hide,
      getElement: function getElement() {
        return elementRef.current;
      },
      getTarget: function getTarget() {
        return currentTargetRef.current;
      }
    };
  });
  var createElement = function createElement() {
    var empty = isTargetContentEmpty(currentTargetRef.current);
    var rootProps = mergeProps({
      id: props.id,
      className: (0,primereact_utils__WEBPACK_IMPORTED_MODULE_5__.classNames)(props.className, cx('root', {
        positionState: positionState,
        classNameState: classNameState
      })),
      style: props.style,
      role: 'tooltip',
      'aria-hidden': visibleState,
      onMouseEnter: function onMouseEnter(e) {
        return _onMouseEnter();
      },
      onMouseLeave: function onMouseLeave(e) {
        return _onMouseLeave(e);
      }
    }, TooltipBase.getOtherProps(props), ptm('root'));
    var arrowProps = mergeProps({
      className: cx('arrow'),
      style: sx('arrow', _objectSpread({}, metaData))
    }, ptm('arrow'));
    var textProps = mergeProps({
      className: cx('text')
    }, ptm('text'));
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", _extends({
      ref: elementRef
    }, rootProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", arrowProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", _extends({
      ref: textRef
    }, textProps), empty && props.children));
  };
  if (visibleState) {
    var element = createElement();
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_portal__WEBPACK_IMPORTED_MODULE_4__.Portal, {
      element: element,
      appendTo: props.appendTo,
      visible: true
    });
  }
  return null;
}));
Tooltip.displayName = 'Tooltip';




/***/ }),

/***/ "./node_modules/primereact/utils/utils.esm.js":
/*!****************************************************!*\
  !*** ./node_modules/primereact/utils/utils.esm.js ***!
  \****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DomHandler: function() { return /* binding */ DomHandler; },
/* harmony export */   EventBus: function() { return /* binding */ EventBus; },
/* harmony export */   IconUtils: function() { return /* binding */ IconUtils; },
/* harmony export */   ObjectUtils: function() { return /* binding */ ObjectUtils; },
/* harmony export */   UniqueComponentId: function() { return /* binding */ UniqueComponentId; },
/* harmony export */   ZIndexUtils: function() { return /* binding */ ZIndexUtils; },
/* harmony export */   classNames: function() { return /* binding */ classNames; },
/* harmony export */   mask: function() { return /* binding */ mask; },
/* harmony export */   mergeProps: function() { return /* binding */ mergeProps; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
'use client';


function _arrayWithHoles(r) {
  if (Array.isArray(r)) return r;
}

function _iterableToArrayLimit(r, l) {
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (null != t) {
    var e,
      n,
      i,
      u,
      a = [],
      f = !0,
      o = !1;
    try {
      if (i = (t = t.call(r)).next, 0 === l) {
        if (Object(t) !== t) return;
        f = !1;
      } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
    } catch (r) {
      o = !0, n = r;
    } finally {
      try {
        if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
      } finally {
        if (o) throw n;
      }
    }
    return a;
  }
}

function _arrayLikeToArray$2(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

function _unsupportedIterableToArray$2(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
  }
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _slicedToArray(r, e) {
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest();
}

function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

function classNames() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  if (args) {
    var classes = [];
    for (var i = 0; i < args.length; i++) {
      var className = args[i];
      if (!className) {
        continue;
      }
      var type = _typeof(className);
      if (type === 'string' || type === 'number') {
        classes.push(className);
      } else if (type === 'object') {
        var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
          var _ref2 = _slicedToArray(_ref, 2),
            key = _ref2[0],
            value = _ref2[1];
          return value ? key : null;
        });
        classes = _classes.length ? classes.concat(_classes.filter(function (c) {
          return !!c;
        })) : classes;
      }
    }
    return classes.join(' ').trim();
  }
  return undefined;
}

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray$2(r);
}

function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
}

function _classCallCheck(a, n) {
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

function _defineProperties(e, r) {
  for (var t = 0; t < r.length; t++) {
    var o = r[t];
    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
  }
}
function _createClass(e, r, t) {
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
var DomHandler = /*#__PURE__*/function () {
  function DomHandler() {
    _classCallCheck(this, DomHandler);
  }
  return _createClass(DomHandler, null, [{
    key: "innerWidth",
    value: function innerWidth(el) {
      if (el) {
        var width = el.offsetWidth;
        var style = getComputedStyle(el);
        width = width + (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight));
        return width;
      }
      return 0;
    }
  }, {
    key: "width",
    value: function width(el) {
      if (el) {
        var _width = el.offsetWidth;
        var style = getComputedStyle(el);
        _width = _width - (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight));
        return _width;
      }
      return 0;
    }
  }, {
    key: "getBrowserLanguage",
    value: function getBrowserLanguage() {
      return navigator.userLanguage || navigator.languages && navigator.languages.length && navigator.languages[0] || navigator.language || navigator.browserLanguage || navigator.systemLanguage || 'en';
    }
  }, {
    key: "getWindowScrollTop",
    value: function getWindowScrollTop() {
      var doc = document.documentElement;
      return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
    }
  }, {
    key: "getWindowScrollLeft",
    value: function getWindowScrollLeft() {
      var doc = document.documentElement;
      return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
    }
  }, {
    key: "getOuterWidth",
    value: function getOuterWidth(el, margin) {
      if (el) {
        var width = el.getBoundingClientRect().width || el.offsetWidth;
        if (margin) {
          var style = getComputedStyle(el);
          width = width + (parseFloat(style.marginLeft) + parseFloat(style.marginRight));
        }
        return width;
      }
      return 0;
    }
  }, {
    key: "getOuterHeight",
    value: function getOuterHeight(el, margin) {
      if (el) {
        var height = el.getBoundingClientRect().height || el.offsetHeight;
        if (margin) {
          var style = getComputedStyle(el);
          height = height + (parseFloat(style.marginTop) + parseFloat(style.marginBottom));
        }
        return height;
      }
      return 0;
    }
  }, {
    key: "getClientHeight",
    value: function getClientHeight(el, margin) {
      if (el) {
        var height = el.clientHeight;
        if (margin) {
          var style = getComputedStyle(el);
          height = height + (parseFloat(style.marginTop) + parseFloat(style.marginBottom));
        }
        return height;
      }
      return 0;
    }
  }, {
    key: "getClientWidth",
    value: function getClientWidth(el, margin) {
      if (el) {
        var width = el.clientWidth;
        if (margin) {
          var style = getComputedStyle(el);
          width = width + (parseFloat(style.marginLeft) + parseFloat(style.marginRight));
        }
        return width;
      }
      return 0;
    }
  }, {
    key: "getViewport",
    value: function getViewport() {
      var win = window;
      var d = document;
      var e = d.documentElement;
      var g = d.getElementsByTagName('body')[0];
      var w = win.innerWidth || e.clientWidth || g.clientWidth;
      var h = win.innerHeight || e.clientHeight || g.clientHeight;
      return {
        width: w,
        height: h
      };
    }
  }, {
    key: "getOffset",
    value: function getOffset(el) {
      if (el) {
        var rect = el.getBoundingClientRect();
        return {
          top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
          left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0)
        };
      }
      return {
        top: 'auto',
        left: 'auto'
      };
    }
  }, {
    key: "index",
    value: function index(element) {
      if (element) {
        var children = element.parentNode.childNodes;
        var num = 0;
        for (var i = 0; i < children.length; i++) {
          if (children[i] === element) {
            return num;
          }
          if (children[i].nodeType === 1) {
            num++;
          }
        }
      }
      return -1;
    }
  }, {
    key: "addMultipleClasses",
    value: function addMultipleClasses(element, className) {
      if (element && className) {
        if (element.classList) {
          var styles = className.split(' ');
          for (var i = 0; i < styles.length; i++) {
            element.classList.add(styles[i]);
          }
        } else {
          var _styles = className.split(' ');
          for (var _i = 0; _i < _styles.length; _i++) {
            element.className = element.className + (' ' + _styles[_i]);
          }
        }
      }
    }
  }, {
    key: "removeMultipleClasses",
    value: function removeMultipleClasses(element, className) {
      if (element && className) {
        if (element.classList) {
          var styles = className.split(' ');
          for (var i = 0; i < styles.length; i++) {
            element.classList.remove(styles[i]);
          }
        } else {
          var _styles2 = className.split(' ');
          for (var _i2 = 0; _i2 < _styles2.length; _i2++) {
            element.className = element.className.replace(new RegExp('(^|\\b)' + _styles2[_i2].split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
          }
        }
      }
    }
  }, {
    key: "addClass",
    value: function addClass(element, className) {
      if (element && className) {
        if (element.classList) {
          element.classList.add(className);
        } else {
          element.className = element.className + (' ' + className);
        }
      }
    }
  }, {
    key: "removeClass",
    value: function removeClass(element, className) {
      if (element && className) {
        if (element.classList) {
          element.classList.remove(className);
        } else {
          element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
        }
      }
    }
  }, {
    key: "hasClass",
    value: function hasClass(element, className) {
      if (element) {
        if (element.classList) {
          return element.classList.contains(className);
        }
        return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
      }
      return false;
    }
  }, {
    key: "addStyles",
    value: function addStyles(element) {
      var styles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      if (element) {
        Object.entries(styles).forEach(function (_ref) {
          var _ref2 = _slicedToArray(_ref, 2),
            key = _ref2[0],
            value = _ref2[1];
          return element.style[key] = value;
        });
      }
    }
  }, {
    key: "find",
    value: function find(element, selector) {
      return element ? Array.from(element.querySelectorAll(selector)) : [];
    }
  }, {
    key: "findSingle",
    value: function findSingle(element, selector) {
      if (element) {
        return element.querySelector(selector);
      }
      return null;
    }
  }, {
    key: "setAttributes",
    value: function setAttributes(element) {
      var _this = this;
      var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      if (element) {
        var _computedStyles = function computedStyles(rule, value) {
          var _element$$attrs, _element$$attrs2;
          var styles = element !== null && element !== void 0 && (_element$$attrs = element.$attrs) !== null && _element$$attrs !== void 0 && _element$$attrs[rule] ? [element === null || element === void 0 || (_element$$attrs2 = element.$attrs) === null || _element$$attrs2 === void 0 ? void 0 : _element$$attrs2[rule]] : [];
          return [value].flat().reduce(function (cv, v) {
            if (v !== null && v !== undefined) {
              var type = _typeof(v);
              if (type === 'string' || type === 'number') {
                cv.push(v);
              } else if (type === 'object') {
                var _cv = Array.isArray(v) ? _computedStyles(rule, v) : Object.entries(v).map(function (_ref3) {
                  var _ref4 = _slicedToArray(_ref3, 2),
                    _k = _ref4[0],
                    _v = _ref4[1];
                  return rule === 'style' && (!!_v || _v === 0) ? "".concat(_k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(), ":").concat(_v) : _v ? _k : undefined;
                });
                cv = _cv.length ? cv.concat(_cv.filter(function (c) {
                  return !!c;
                })) : cv;
              }
            }
            return cv;
          }, styles);
        };
        Object.entries(attributes).forEach(function (_ref5) {
          var _ref6 = _slicedToArray(_ref5, 2),
            key = _ref6[0],
            value = _ref6[1];
          if (value !== undefined && value !== null) {
            var matchedEvent = key.match(/^on(.+)/);
            if (matchedEvent) {
              element.addEventListener(matchedEvent[1].toLowerCase(), value);
            } else if (key === 'p-bind') {
              _this.setAttributes(element, value);
            } else {
              value = key === 'class' ? _toConsumableArray(new Set(_computedStyles('class', value))).join(' ').trim() : key === 'style' ? _computedStyles('style', value).join(';').trim() : value;
              (element.$attrs = element.$attrs || {}) && (element.$attrs[key] = value);
              element.setAttribute(key, value);
            }
          }
        });
      }
    }
  }, {
    key: "getAttribute",
    value: function getAttribute(element, name) {
      if (element) {
        var value = element.getAttribute(name);
        if (!isNaN(value)) {
          return +value;
        }
        if (value === 'true' || value === 'false') {
          return value === 'true';
        }
        return value;
      }
      return undefined;
    }
  }, {
    key: "isAttributeEquals",
    value: function isAttributeEquals(element, name, value) {
      return element ? this.getAttribute(element, name) === value : false;
    }
  }, {
    key: "isAttributeNotEquals",
    value: function isAttributeNotEquals(element, name, value) {
      return !this.isAttributeEquals(element, name, value);
    }
  }, {
    key: "getHeight",
    value: function getHeight(el) {
      if (el) {
        var height = el.offsetHeight;
        var style = getComputedStyle(el);
        height = height - (parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth));
        return height;
      }
      return 0;
    }
  }, {
    key: "getWidth",
    value: function getWidth(el) {
      if (el) {
        var width = el.offsetWidth;
        var style = getComputedStyle(el);
        width = width - (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth));
        return width;
      }
      return 0;
    }
  }, {
    key: "alignOverlay",
    value: function alignOverlay(overlay, target, appendTo) {
      var calculateMinWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
      if (overlay && target) {
        if (appendTo === 'self') {
          this.relativePosition(overlay, target);
        } else {
          calculateMinWidth && (overlay.style.minWidth = DomHandler.getOuterWidth(target) + 'px');
          this.absolutePosition(overlay, target);
        }
      }
    }
  }, {
    key: "absolutePosition",
    value: function absolutePosition(element, target) {
      var align = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'left';
      if (element && target) {
        var elementDimensions = element.offsetParent ? {
          width: element.offsetWidth,
          height: element.offsetHeight
        } : this.getHiddenElementDimensions(element);
        var elementOuterHeight = elementDimensions.height;
        var elementOuterWidth = elementDimensions.width;
        var targetOuterHeight = target.offsetHeight;
        var targetOuterWidth = target.offsetWidth;
        var targetOffset = target.getBoundingClientRect();
        var windowScrollTop = this.getWindowScrollTop();
        var windowScrollLeft = this.getWindowScrollLeft();
        var viewport = this.getViewport();
        var top;
        var left;
        if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) {
          top = targetOffset.top + windowScrollTop - elementOuterHeight;
          if (top < 0) {
            top = windowScrollTop;
          }
          element.style.transformOrigin = 'bottom';
        } else {
          top = targetOuterHeight + targetOffset.top + windowScrollTop;
          element.style.transformOrigin = 'top';
        }
        var targetOffsetPx = targetOffset.left;
        if (align === 'left') {
          if (targetOffsetPx + elementOuterWidth > viewport.width) {
            left = Math.max(0, targetOffsetPx + windowScrollLeft + targetOuterWidth - elementOuterWidth);
          } else {
            left = targetOffsetPx + windowScrollLeft;
          }
        } else {
          if (targetOffsetPx + targetOuterWidth - elementOuterWidth < 0) {
            left = windowScrollLeft;
          } else {
            left = targetOffsetPx + targetOuterWidth - elementOuterWidth + windowScrollLeft;
          }
        }
        element.style.top = top + 'px';
        element.style.left = left + 'px';
      }
    }
  }, {
    key: "relativePosition",
    value: function relativePosition(element, target) {
      if (element && target) {
        var elementDimensions = element.offsetParent ? {
          width: element.offsetWidth,
          height: element.offsetHeight
        } : this.getHiddenElementDimensions(element);
        var targetHeight = target.offsetHeight;
        var targetOffset = target.getBoundingClientRect();
        var viewport = this.getViewport();
        var top;
        var left;
        if (targetOffset.top + targetHeight + elementDimensions.height > viewport.height) {
          top = -1 * elementDimensions.height;
          if (targetOffset.top + top < 0) {
            top = -1 * targetOffset.top;
          }
          element.style.transformOrigin = 'bottom';
        } else {
          top = targetHeight;
          element.style.transformOrigin = 'top';
        }
        if (elementDimensions.width > viewport.width) {
          // element wider then viewport and cannot fit on screen (align at left side of viewport)
          left = targetOffset.left * -1;
        } else if (targetOffset.left + elementDimensions.width > viewport.width) {
          // element wider then viewport but can be fit on screen (align at right side of viewport)
          left = (targetOffset.left + elementDimensions.width - viewport.width) * -1;
        } else {
          // element fits on screen (align with target)
          left = 0;
        }
        element.style.top = top + 'px';
        element.style.left = left + 'px';
      }
    }
  }, {
    key: "flipfitCollision",
    value: function flipfitCollision(element, target) {
      var _this2 = this;
      var my = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'left top';
      var at = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'left bottom';
      var callback = arguments.length > 4 ? arguments[4] : undefined;
      if (element && target) {
        var targetOffset = target.getBoundingClientRect();
        var viewport = this.getViewport();
        var myArr = my.split(' ');
        var atArr = at.split(' ');
        var getPositionValue = function getPositionValue(arr, isOffset) {
          return isOffset ? +arr.substring(arr.search(/(\+|-)/g)) || 0 : arr.substring(0, arr.search(/(\+|-)/g)) || arr;
        };
        var position = {
          my: {
            x: getPositionValue(myArr[0]),
            y: getPositionValue(myArr[1] || myArr[0]),
            offsetX: getPositionValue(myArr[0], true),
            offsetY: getPositionValue(myArr[1] || myArr[0], true)
          },
          at: {
            x: getPositionValue(atArr[0]),
            y: getPositionValue(atArr[1] || atArr[0]),
            offsetX: getPositionValue(atArr[0], true),
            offsetY: getPositionValue(atArr[1] || atArr[0], true)
          }
        };
        var myOffset = {
          left: function left() {
            var totalOffset = position.my.offsetX + position.at.offsetX;
            return totalOffset + targetOffset.left + (position.my.x === 'left' ? 0 : -1 * (position.my.x === 'center' ? _this2.getOuterWidth(element) / 2 : _this2.getOuterWidth(element)));
          },
          top: function top() {
            var totalOffset = position.my.offsetY + position.at.offsetY;
            return totalOffset + targetOffset.top + (position.my.y === 'top' ? 0 : -1 * (position.my.y === 'center' ? _this2.getOuterHeight(element) / 2 : _this2.getOuterHeight(element)));
          }
        };
        var alignWithAt = {
          count: {
            x: 0,
            y: 0
          },
          left: function left() {
            var left = myOffset.left();
            var scrollLeft = DomHandler.getWindowScrollLeft();
            element.style.left = left + scrollLeft + 'px';
            if (this.count.x === 2) {
              element.style.left = scrollLeft + 'px';
              this.count.x = 0;
            } else if (left < 0) {
              this.count.x++;
              position.my.x = 'left';
              position.at.x = 'right';
              position.my.offsetX *= -1;
              position.at.offsetX *= -1;
              this.right();
            }
          },
          right: function right() {
            var left = myOffset.left() + DomHandler.getOuterWidth(target);
            var scrollLeft = DomHandler.getWindowScrollLeft();
            element.style.left = left + scrollLeft + 'px';
            if (this.count.x === 2) {
              element.style.left = viewport.width - DomHandler.getOuterWidth(element) + scrollLeft + 'px';
              this.count.x = 0;
            } else if (left + DomHandler.getOuterWidth(element) > viewport.width) {
              this.count.x++;
              position.my.x = 'right';
              position.at.x = 'left';
              position.my.offsetX *= -1;
              position.at.offsetX *= -1;
              this.left();
            }
          },
          top: function top() {
            var top = myOffset.top();
            var scrollTop = DomHandler.getWindowScrollTop();
            element.style.top = top + scrollTop + 'px';
            if (this.count.y === 2) {
              element.style.left = scrollTop + 'px';
              this.count.y = 0;
            } else if (top < 0) {
              this.count.y++;
              position.my.y = 'top';
              position.at.y = 'bottom';
              position.my.offsetY *= -1;
              position.at.offsetY *= -1;
              this.bottom();
            }
          },
          bottom: function bottom() {
            var top = myOffset.top() + DomHandler.getOuterHeight(target);
            var scrollTop = DomHandler.getWindowScrollTop();
            element.style.top = top + scrollTop + 'px';
            if (this.count.y === 2) {
              element.style.left = viewport.height - DomHandler.getOuterHeight(element) + scrollTop + 'px';
              this.count.y = 0;
            } else if (top + DomHandler.getOuterHeight(target) > viewport.height) {
              this.count.y++;
              position.my.y = 'bottom';
              position.at.y = 'top';
              position.my.offsetY *= -1;
              position.at.offsetY *= -1;
              this.top();
            }
          },
          center: function center(axis) {
            if (axis === 'y') {
              var top = myOffset.top() + DomHandler.getOuterHeight(target) / 2;
              element.style.top = top + DomHandler.getWindowScrollTop() + 'px';
              if (top < 0) {
                this.bottom();
              } else if (top + DomHandler.getOuterHeight(target) > viewport.height) {
                this.top();
              }
            } else {
              var left = myOffset.left() + DomHandler.getOuterWidth(target) / 2;
              element.style.left = left + DomHandler.getWindowScrollLeft() + 'px';
              if (left < 0) {
                this.left();
              } else if (left + DomHandler.getOuterWidth(element) > viewport.width) {
                this.right();
              }
            }
          }
        };
        alignWithAt[position.at.x]('x');
        alignWithAt[position.at.y]('y');
        if (this.isFunction(callback)) {
          callback(position);
        }
      }
    }
  }, {
    key: "findCollisionPosition",
    value: function findCollisionPosition(position) {
      if (position) {
        var isAxisY = position === 'top' || position === 'bottom';
        var myXPosition = position === 'left' ? 'right' : 'left';
        var myYPosition = position === 'top' ? 'bottom' : 'top';
        if (isAxisY) {
          return {
            axis: 'y',
            my: "center ".concat(myYPosition),
            at: "center ".concat(position)
          };
        }
        return {
          axis: 'x',
          my: "".concat(myXPosition, " center"),
          at: "".concat(position, " center")
        };
      }
    }
  }, {
    key: "getParents",
    value: function getParents(element) {
      var parents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      return element.parentNode === null ? parents : this.getParents(element.parentNode, parents.concat([element.parentNode]));
    }

    /**
     * Gets all scrollable parent elements of a given element
     * @param {HTMLElement} element - The element to find scrollable parents for
     * @returns {Array} Array of scrollable parent elements
     */
  }, {
    key: "getScrollableParents",
    value: function getScrollableParents(element) {
      var _this3 = this;
      var scrollableParents = [];
      if (element) {
        // Get all parent elements
        var parents = this.getParents(element);
        // Regex to match auto or scroll overflow values
        var overflowRegex = /(auto|scroll)/;

        /**
         * Checks if an element has overflow scroll/auto in any direction
         * @param {HTMLElement} node - Element to check
         * @returns {boolean} True if element has overflow scroll/auto
         */
        var overflowCheck = function overflowCheck(node) {
          var styleDeclaration = node ? getComputedStyle(node) : null;
          return styleDeclaration && (overflowRegex.test(styleDeclaration.getPropertyValue('overflow')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflow-x')) || overflowRegex.test(styleDeclaration.getPropertyValue('overflow-y')));
        };

        /**
         * Adds a scrollable parent element to the collection
         * @param {HTMLElement} node - Element to add
         */
        var addScrollableParent = function addScrollableParent(node) {
          // For document/body/html elements, add window instead
          scrollableParents.push(node.nodeName === 'BODY' || node.nodeName === 'HTML' || _this3.isDocument(node) ? window : node);
        };

        // Iterate through all parent elements
        var _iterator = _createForOfIteratorHelper$1(parents),
          _step;
        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var _parent$dataset;
            var parent = _step.value;
            // Check for custom scroll selectors in data attribute
            var scrollSelectors = parent.nodeType === 1 && ((_parent$dataset = parent.dataset) === null || _parent$dataset === void 0 ? void 0 : _parent$dataset.scrollselectors);
            if (scrollSelectors) {
              var selectors = scrollSelectors.split(',');

              // Check each selector
              var _iterator2 = _createForOfIteratorHelper$1(selectors),
                _step2;
              try {
                for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
                  var selector = _step2.value;
                  var el = this.findSingle(parent, selector);
                  if (el && overflowCheck(el)) {
                    addScrollableParent(el);
                  }
                }
              } catch (err) {
                _iterator2.e(err);
              } finally {
                _iterator2.f();
              }
            }

            // Check if the parent itself is scrollable
            if (parent.nodeType === 1 && overflowCheck(parent)) {
              addScrollableParent(parent);
            }
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
      }
      return scrollableParents;
    }
  }, {
    key: "getHiddenElementOuterHeight",
    value: function getHiddenElementOuterHeight(element) {
      if (element) {
        element.style.visibility = 'hidden';
        element.style.display = 'block';
        var elementHeight = element.offsetHeight;
        element.style.display = 'none';
        element.style.visibility = 'visible';
        return elementHeight;
      }
      return 0;
    }
  }, {
    key: "getHiddenElementOuterWidth",
    value: function getHiddenElementOuterWidth(element) {
      if (element) {
        element.style.visibility = 'hidden';
        element.style.display = 'block';
        var elementWidth = element.offsetWidth;
        element.style.display = 'none';
        element.style.visibility = 'visible';
        return elementWidth;
      }
      return 0;
    }
  }, {
    key: "getHiddenElementDimensions",
    value: function getHiddenElementDimensions(element) {
      var dimensions = {};
      if (element) {
        element.style.visibility = 'hidden';
        element.style.display = 'block';
        dimensions.width = element.offsetWidth;
        dimensions.height = element.offsetHeight;
        element.style.display = 'none';
        element.style.visibility = 'visible';
      }
      return dimensions;
    }
  }, {
    key: "fadeIn",
    value: function fadeIn(element, duration) {
      if (element) {
        element.style.opacity = 0;
        var last = +new Date();
        var opacity = 0;
        var _tick = function tick() {
          opacity = +element.style.opacity + (new Date().getTime() - last) / duration;
          element.style.opacity = opacity;
          last = +new Date();
          if (+opacity < 1) {
            window.requestAnimationFrame && requestAnimationFrame(_tick) || setTimeout(_tick, 16);
          }
        };
        _tick();
      }
    }
  }, {
    key: "fadeOut",
    value: function fadeOut(element, duration) {
      if (element) {
        var opacity = 1;
        var interval = 50;
        var gap = interval / duration;
        var fading = setInterval(function () {
          opacity = opacity - gap;
          if (opacity <= 0) {
            opacity = 0;
            clearInterval(fading);
          }
          element.style.opacity = opacity;
        }, interval);
      }
    }
  }, {
    key: "getUserAgent",
    value: function getUserAgent() {
      return navigator.userAgent;
    }
  }, {
    key: "isIOS",
    value: function isIOS() {
      return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
    }
  }, {
    key: "isAndroid",
    value: function isAndroid() {
      return /(android)/i.test(navigator.userAgent);
    }
  }, {
    key: "isChrome",
    value: function isChrome() {
      return /(chrome)/i.test(navigator.userAgent);
    }
  }, {
    key: "isClient",
    value: function isClient() {
      return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
    }
  }, {
    key: "isTouchDevice",
    value: function isTouchDevice() {
      return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
    }
  }, {
    key: "isFunction",
    value: function isFunction(obj) {
      return !!(obj && obj.constructor && obj.call && obj.apply);
    }
  }, {
    key: "appendChild",
    value: function appendChild(element, target) {
      if (this.isElement(target)) {
        target.appendChild(element);
      } else if (target.el && target.el.nativeElement) {
        target.el.nativeElement.appendChild(element);
      } else {
        throw new Error('Cannot append ' + target + ' to ' + element);
      }
    }
  }, {
    key: "removeChild",
    value: function removeChild(element, target) {
      if (this.isElement(target)) {
        target.removeChild(element);
      } else if (target.el && target.el.nativeElement) {
        target.el.nativeElement.removeChild(element);
      } else {
        throw new Error('Cannot remove ' + element + ' from ' + target);
      }
    }
  }, {
    key: "isElement",
    value: function isElement(obj) {
      return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? obj instanceof HTMLElement : obj && _typeof(obj) === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
    }
  }, {
    key: "isDocument",
    value: function isDocument(obj) {
      return (typeof Document === "undefined" ? "undefined" : _typeof(Document)) === 'object' ? obj instanceof Document : obj && _typeof(obj) === 'object' && obj !== null && obj.nodeType === 9;
    }
  }, {
    key: "scrollInView",
    value: function scrollInView(container, item) {
      var borderTopValue = getComputedStyle(container).getPropertyValue('border-top-width');
      var borderTop = borderTopValue ? parseFloat(borderTopValue) : 0;
      var paddingTopValue = getComputedStyle(container).getPropertyValue('padding-top');
      var paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0;
      var containerRect = container.getBoundingClientRect();
      var itemRect = item.getBoundingClientRect();
      var offset = itemRect.top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop;
      var scroll = container.scrollTop;
      var elementHeight = container.clientHeight;
      var itemHeight = this.getOuterHeight(item);
      if (offset < 0) {
        container.scrollTop = scroll + offset;
      } else if (offset + itemHeight > elementHeight) {
        container.scrollTop = scroll + offset - elementHeight + itemHeight;
      }
    }
  }, {
    key: "clearSelection",
    value: function clearSelection() {
      if (window.getSelection) {
        if (window.getSelection().empty) {
          window.getSelection().empty();
        } else if (window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) {
          window.getSelection().removeAllRanges();
        }
      } else if (document.selection && document.selection.empty) {
        try {
          document.selection.empty();
        } catch (error) {
          //ignore IE bug
        }
      }
    }
  }, {
    key: "calculateScrollbarWidth",
    value: function calculateScrollbarWidth(el) {
      if (el) {
        var style = getComputedStyle(el);
        return el.offsetWidth - el.clientWidth - parseFloat(style.borderLeftWidth) - parseFloat(style.borderRightWidth);
      }
      if (this.calculatedScrollbarWidth != null) {
        return this.calculatedScrollbarWidth;
      }
      var scrollDiv = document.createElement('div');
      scrollDiv.className = 'p-scrollbar-measure';
      document.body.appendChild(scrollDiv);
      var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
      this.calculatedScrollbarWidth = scrollbarWidth;
      return scrollbarWidth;
    }
  }, {
    key: "calculateBodyScrollbarWidth",
    value: function calculateBodyScrollbarWidth() {
      return window.innerWidth - document.documentElement.offsetWidth;
    }
  }, {
    key: "getBrowser",
    value: function getBrowser() {
      if (!this.browser) {
        var matched = this.resolveUserAgent();
        this.browser = {};
        if (matched.browser) {
          this.browser[matched.browser] = true;
          this.browser.version = matched.version;
        }
        if (this.browser.chrome) {
          this.browser.webkit = true;
        } else if (this.browser.webkit) {
          this.browser.safari = true;
        }
      }
      return this.browser;
    }
  }, {
    key: "resolveUserAgent",
    value: function resolveUserAgent() {
      var ua = navigator.userAgent.toLowerCase();
      var match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
      return {
        browser: match[1] || '',
        version: match[2] || '0'
      };
    }
  }, {
    key: "blockBodyScroll",
    value: function blockBodyScroll() {
      var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'p-overflow-hidden';
      /* PR Ref: https://github.com/primefaces/primereact/pull/4976
       * @todo This method is called several times after this PR. Refactors will be made to prevent this in future releases.
       */
      var hasScrollbarWidth = !!document.body.style.getPropertyValue('--scrollbar-width');
      !hasScrollbarWidth && document.body.style.setProperty('--scrollbar-width', this.calculateBodyScrollbarWidth() + 'px');
      this.addClass(document.body, className);
    }
  }, {
    key: "unblockBodyScroll",
    value: function unblockBodyScroll() {
      var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'p-overflow-hidden';
      document.body.style.removeProperty('--scrollbar-width');
      this.removeClass(document.body, className);
    }
  }, {
    key: "isVisible",
    value: function isVisible(element) {
      // https://stackoverflow.com/a/59096915/502366 (in future use IntersectionObserver)
      return element && (element.clientHeight !== 0 || element.getClientRects().length !== 0 || getComputedStyle(element).display !== 'none');
    }
  }, {
    key: "isExist",
    value: function isExist(element) {
      return !!(element !== null && typeof element !== 'undefined' && element.nodeName && element.parentNode);
    }
  }, {
    key: "getFocusableElements",
    value: function getFocusableElements(element) {
      var selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var focusableElements = DomHandler.find(element, "button:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])".concat(selector, ",\n                [href][clientHeight][clientWidth]:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n                input:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n                select:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n                textarea:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n                [tabIndex]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n                [contenteditable]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector));
      var visibleFocusableElements = [];
      var _iterator3 = _createForOfIteratorHelper$1(focusableElements),
        _step3;
      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var focusableElement = _step3.value;
          if (getComputedStyle(focusableElement).display !== 'none' && getComputedStyle(focusableElement).visibility !== 'hidden') {
            visibleFocusableElements.push(focusableElement);
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
      return visibleFocusableElements;
    }
  }, {
    key: "getFirstFocusableElement",
    value: function getFirstFocusableElement(element, selector) {
      var focusableElements = DomHandler.getFocusableElements(element, selector);
      return focusableElements.length > 0 ? focusableElements[0] : null;
    }
  }, {
    key: "getLastFocusableElement",
    value: function getLastFocusableElement(element, selector) {
      var focusableElements = DomHandler.getFocusableElements(element, selector);
      return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null;
    }

    /**
     * Focus an input element if it does not already have focus.
     *
     * @param {HTMLElement} el a HTML element
     * @param {boolean} scrollTo flag to control whether to scroll to the element, false by default
     */
  }, {
    key: "focus",
    value: function focus(el, scrollTo) {
      var preventScroll = scrollTo === undefined ? true : !scrollTo;
      el && document.activeElement !== el && el.focus({
        preventScroll: preventScroll
      });
    }

    /**
     * Focus the first focusable element if it does not already have focus.
     *
     * @param {HTMLElement} el a HTML element
     * @param {boolean} scrollTo flag to control whether to scroll to the element, false by default
     * @return {HTMLElement | undefined} the first focusable HTML element found
     */
  }, {
    key: "focusFirstElement",
    value: function focusFirstElement(el, scrollTo) {
      if (!el) {
        return;
      }
      var firstFocusableElement = DomHandler.getFirstFocusableElement(el);
      firstFocusableElement && DomHandler.focus(firstFocusableElement, scrollTo);
      return firstFocusableElement;
    }
  }, {
    key: "getCursorOffset",
    value: function getCursorOffset(el, prevText, nextText, currentText) {
      if (el) {
        var style = getComputedStyle(el);
        var ghostDiv = document.createElement('div');
        ghostDiv.style.position = 'absolute';
        ghostDiv.style.top = '0px';
        ghostDiv.style.left = '0px';
        ghostDiv.style.visibility = 'hidden';
        ghostDiv.style.pointerEvents = 'none';
        ghostDiv.style.overflow = style.overflow;
        ghostDiv.style.width = style.width;
        ghostDiv.style.height = style.height;
        ghostDiv.style.padding = style.padding;
        ghostDiv.style.border = style.border;
        ghostDiv.style.overflowWrap = style.overflowWrap;
        ghostDiv.style.whiteSpace = style.whiteSpace;
        ghostDiv.style.lineHeight = style.lineHeight;
        ghostDiv.innerHTML = prevText.replace(/\r\n|\r|\n/g, '<br />');
        var ghostSpan = document.createElement('span');
        ghostSpan.textContent = currentText;
        ghostDiv.appendChild(ghostSpan);
        var text = document.createTextNode(nextText);
        ghostDiv.appendChild(text);
        document.body.appendChild(ghostDiv);
        var offsetLeft = ghostSpan.offsetLeft,
          offsetTop = ghostSpan.offsetTop,
          clientHeight = ghostSpan.clientHeight;
        document.body.removeChild(ghostDiv);
        return {
          left: Math.abs(offsetLeft - el.scrollLeft),
          top: Math.abs(offsetTop - el.scrollTop) + clientHeight
        };
      }
      return {
        top: 'auto',
        left: 'auto'
      };
    }
  }, {
    key: "invokeElementMethod",
    value: function invokeElementMethod(element, methodName, args) {
      element[methodName].apply(element, args);
    }
  }, {
    key: "isClickable",
    value: function isClickable(element) {
      var targetNode = element.nodeName;
      var parentNode = element.parentElement && element.parentElement.nodeName;
      return targetNode === 'INPUT' || targetNode === 'TEXTAREA' || targetNode === 'BUTTON' || targetNode === 'A' || parentNode === 'INPUT' || parentNode === 'TEXTAREA' || parentNode === 'BUTTON' || parentNode === 'A' || this.hasClass(element, 'p-button') || this.hasClass(element.parentElement, 'p-button') || this.hasClass(element.parentElement, 'p-checkbox') || this.hasClass(element.parentElement, 'p-radiobutton');
    }
  }, {
    key: "applyStyle",
    value: function applyStyle(element, style) {
      if (typeof style === 'string') {
        element.style.cssText = style;
      } else {
        for (var prop in style) {
          element.style[prop] = style[prop];
        }
      }
    }
  }, {
    key: "exportCSV",
    value: function exportCSV(csv, filename) {
      var blob = new Blob([csv], {
        type: 'application/csv;charset=utf-8;'
      });
      if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveOrOpenBlob(blob, filename + '.csv');
      } else {
        var isDownloaded = DomHandler.saveAs({
          name: filename + '.csv',
          src: URL.createObjectURL(blob)
        });
        if (!isDownloaded) {
          csv = 'data:text/csv;charset=utf-8,' + csv;
          window.open(encodeURI(csv));
        }
      }
    }
  }, {
    key: "saveAs",
    value: function saveAs(file) {
      if (file) {
        var link = document.createElement('a');
        if (link.download !== undefined) {
          var name = file.name,
            src = file.src;
          link.setAttribute('href', src);
          link.setAttribute('download', name);
          link.style.display = 'none';
          document.body.appendChild(link);
          link.click();
          document.body.removeChild(link);
          return true;
        }
      }
      return false;
    }
  }, {
    key: "createInlineStyle",
    value: function createInlineStyle(nonce, styleContainer) {
      var styleElement = document.createElement('style');
      DomHandler.addNonce(styleElement, nonce);
      if (!styleContainer) {
        styleContainer = document.head;
      }
      styleContainer.appendChild(styleElement);
      return styleElement;
    }
  }, {
    key: "removeInlineStyle",
    value: function removeInlineStyle(styleElement) {
      if (this.isExist(styleElement)) {
        try {
          styleElement.parentNode.removeChild(styleElement);
        } catch (error) {
          // style element may have already been removed in a fast refresh
        }
        styleElement = null;
      }
      return styleElement;
    }
  }, {
    key: "addNonce",
    value: function addNonce(styleElement, nonce) {
      try {
        if (!nonce) {
          nonce = process.env.REACT_APP_CSS_NONCE;
        }
      } catch (error) {
        // NOOP
      }
      nonce && styleElement.setAttribute('nonce', nonce);
    }
  }, {
    key: "getTargetElement",
    value: function getTargetElement(target) {
      if (!target) {
        return null;
      }
      if (target === 'document') {
        return document;
      } else if (target === 'window') {
        return window;
      } else if (_typeof(target) === 'object' && target.hasOwnProperty('current')) {
        return this.isExist(target.current) ? target.current : null;
      }
      var isFunction = function isFunction(obj) {
        return !!(obj && obj.constructor && obj.call && obj.apply);
      };
      var element = isFunction(target) ? target() : target;
      return this.isDocument(element) || this.isExist(element) ? element : null;
    }

    /**
     * Get the attribute names for an element and sorts them alpha for comparison
     */
  }, {
    key: "getAttributeNames",
    value: function getAttributeNames(node) {
      var index;
      var rv;
      var attrs;
      rv = [];
      attrs = node.attributes;
      for (index = 0; index < attrs.length; ++index) {
        rv.push(attrs[index].nodeName);
      }
      rv.sort();
      return rv;
    }

    /**
     * Compare two elements for equality.  Even will compare if the style element
     * is out of order for example:
     *
     * elem1 = style="color: red; font-size: 28px"
     * elem2 = style="font-size: 28px; color: red"
     */
  }, {
    key: "isEqualElement",
    value: function isEqualElement(elm1, elm2) {
      var attrs1;
      var attrs2;
      var name;
      var node1;
      var node2;

      // Compare attributes without order sensitivity
      attrs1 = DomHandler.getAttributeNames(elm1);
      attrs2 = DomHandler.getAttributeNames(elm2);
      if (attrs1.join(',') !== attrs2.join(',')) {
        // console.log("Found nodes with different sets of attributes; not equiv");
        return false;
      }

      // ...and values
      // unless you want to compare DOM0 event handlers
      // (onclick="...")
      for (var index = 0; index < attrs1.length; ++index) {
        name = attrs1[index];
        if (name === 'style') {
          var astyle = elm1.style;
          var bstyle = elm2.style;
          var rexDigitsOnly = /^\d+$/;
          for (var _i3 = 0, _Object$keys = Object.keys(astyle); _i3 < _Object$keys.length; _i3++) {
            var key = _Object$keys[_i3];
            if (!rexDigitsOnly.test(key) && astyle[key] !== bstyle[key]) {
              // Not equivalent, stop
              //console.log("Found nodes with mis-matched values for attribute '" + name + "'; not equiv");
              return false;
            }
          }
        } else if (elm1.getAttribute(name) !== elm2.getAttribute(name)) {
          // console.log("Found nodes with mis-matched values for attribute '" + name + "'; not equiv");
          return false;
        }
      }

      // Walk the children
      for (node1 = elm1.firstChild, node2 = elm2.firstChild; node1 && node2; node1 = node1.nextSibling, node2 = node2.nextSibling) {
        if (node1.nodeType !== node2.nodeType) {
          // display("Found nodes of different types; not equiv");
          return false;
        }
        if (node1.nodeType === 1) {
          // Element
          if (!DomHandler.isEqualElement(node1, node2)) {
            return false;
          }
        } else if (node1.nodeValue !== node2.nodeValue) {
          // console.log("Found nodes with mis-matched nodeValues; not equiv");
          return false;
        }
      }
      if (node1 || node2) {
        // One of the elements had more nodes than the other
        // console.log("Found more children of one element than the other; not equivalent");
        return false;
      }

      // Seem the same
      return true;
    }
  }, {
    key: "hasCSSAnimation",
    value: function hasCSSAnimation(element) {
      if (element) {
        var style = getComputedStyle(element);
        var animationDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
        return animationDuration > 0;
      }
      return false;
    }
  }, {
    key: "hasCSSTransition",
    value: function hasCSSTransition(element) {
      if (element) {
        var style = getComputedStyle(element);
        var transitionDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
        return transitionDuration > 0;
      }
      return false;
    }
  }]);
}();
/**
 * All data- properties like data-test-id
 */
_defineProperty(DomHandler, "DATA_PROPS", ['data-']);
/**
 * All ARIA properties like aria-label and focus-target for https://www.npmjs.com/package/@q42/floating-focus-a11y
 */
_defineProperty(DomHandler, "ARIA_PROPS", ['aria', 'focus-target']);

function EventBus() {
  var allHandlers = new Map();
  return {
    on: function on(type, handler) {
      var handlers = allHandlers.get(type);
      if (!handlers) {
        handlers = [handler];
      } else {
        handlers.push(handler);
      }
      allHandlers.set(type, handlers);
    },
    off: function off(type, handler) {
      var handlers = allHandlers.get(type);
      handlers && handlers.splice(handlers.indexOf(handler) >>> 0, 1);
    },
    emit: function emit(type, evt) {
      var handlers = allHandlers.get(type);
      handlers && handlers.slice().forEach(function (handler) {
        return handler(evt);
      });
    }
  };
}

function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}

function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
var ObjectUtils = /*#__PURE__*/function () {
  function ObjectUtils() {
    _classCallCheck(this, ObjectUtils);
  }
  return _createClass(ObjectUtils, null, [{
    key: "equals",
    value: function equals(obj1, obj2, field) {
      if (field && obj1 && _typeof(obj1) === 'object' && obj2 && _typeof(obj2) === 'object') {
        return this.deepEquals(this.resolveFieldData(obj1, field), this.resolveFieldData(obj2, field));
      }
      return this.deepEquals(obj1, obj2);
    }

    /**
     * Compares two JSON objects for deep equality recursively comparing both objects.
     * @param {*} a the first JSON object
     * @param {*} b the second JSON object
     * @returns true if equals, false it not
     */
  }, {
    key: "deepEquals",
    value: function deepEquals(a, b) {
      if (a === b) {
        return true;
      }
      if (a && b && _typeof(a) === 'object' && _typeof(b) === 'object') {
        var arrA = Array.isArray(a);
        var arrB = Array.isArray(b);
        var i;
        var length;
        var key;
        if (arrA && arrB) {
          length = a.length;
          if (length !== b.length) {
            return false;
          }
          for (i = length; i-- !== 0;) {
            if (!this.deepEquals(a[i], b[i])) {
              return false;
            }
          }
          return true;
        }
        if (arrA !== arrB) {
          return false;
        }
        var dateA = a instanceof Date;
        var dateB = b instanceof Date;
        if (dateA !== dateB) {
          return false;
        }
        if (dateA && dateB) {
          return a.getTime() === b.getTime();
        }
        var regexpA = a instanceof RegExp;
        var regexpB = b instanceof RegExp;
        if (regexpA !== regexpB) {
          return false;
        }
        if (regexpA && regexpB) {
          return a.toString() === b.toString();
        }
        var keys = Object.keys(a);
        length = keys.length;
        if (length !== Object.keys(b).length) {
          return false;
        }
        for (i = length; i-- !== 0;) {
          if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
            return false;
          }
        }
        for (i = length; i-- !== 0;) {
          key = keys[i];
          if (!this.deepEquals(a[key], b[key])) {
            return false;
          }
        }
        return true;
      }

      /*eslint no-self-compare: "off"*/
      return a !== a && b !== b;
    }
  }, {
    key: "resolveFieldData",
    value: function resolveFieldData(data, field) {
      if (!data || !field) {
        // short circuit if there is nothing to resolve
        return null;
      }
      try {
        var value = data[field];
        if (this.isNotEmpty(value)) {
          return value;
        }
      } catch (_unused) {
        // Performance optimization: https://github.com/primefaces/primereact/issues/4797
        // do nothing and continue to other methods to resolve field data
      }
      if (Object.keys(data).length) {
        if (this.isFunction(field)) {
          return field(data);
        } else if (this.isNotEmpty(data[field])) {
          return data[field];
        } else if (field.indexOf('.') === -1) {
          return data[field];
        }
        var fields = field.split('.');
        var _value = data;
        for (var i = 0, len = fields.length; i < len; ++i) {
          if (_value == null) {
            return null;
          }
          _value = _value[fields[i]];
        }
        return _value;
      }
      return null;
    }
  }, {
    key: "findDiffKeys",
    value: function findDiffKeys(obj1, obj2) {
      if (!obj1 || !obj2) {
        return {};
      }
      return Object.keys(obj1).filter(function (key) {
        return !obj2.hasOwnProperty(key);
      }).reduce(function (result, current) {
        result[current] = obj1[current];
        return result;
      }, {});
    }

    /**
     * Removes keys from a JSON object that start with a string such as "data" to get all "data-id" type properties.
     *
     * @param {any} obj the JSON object to reduce
     * @param {string[]} startsWiths the string(s) to check if the property starts with this key
     * @returns the JSON object containing only the key/values that match the startsWith string
     */
  }, {
    key: "reduceKeys",
    value: function reduceKeys(obj, startsWiths) {
      var result = {};
      if (!obj || !startsWiths || startsWiths.length === 0) {
        return result;
      }
      Object.keys(obj).filter(function (key) {
        return startsWiths.some(function (value) {
          return key.startsWith(value);
        });
      }).forEach(function (key) {
        result[key] = obj[key];
        delete obj[key];
      });
      return result;
    }
  }, {
    key: "reorderArray",
    value: function reorderArray(value, from, to) {
      if (value && from !== to) {
        if (to >= value.length) {
          to = to % value.length;
          from = from % value.length;
        }
        value.splice(to, 0, value.splice(from, 1)[0]);
      }
    }
  }, {
    key: "findIndexInList",
    value: function findIndexInList(value, list, dataKey) {
      var _this = this;
      if (list) {
        return dataKey ? list.findIndex(function (item) {
          return _this.equals(item, value, dataKey);
        }) : list.findIndex(function (item) {
          return item === value;
        });
      }
      return -1;
    }
  }, {
    key: "getJSXElement",
    value: function getJSXElement(obj) {
      for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        params[_key - 1] = arguments[_key];
      }
      return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
    }
  }, {
    key: "getItemValue",
    value: function getItemValue(obj) {
      for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        params[_key2 - 1] = arguments[_key2];
      }
      return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
    }
  }, {
    key: "getProp",
    value: function getProp(props) {
      var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var value = props ? props[prop] : undefined;
      return value === undefined ? defaultProps[prop] : value;
    }
  }, {
    key: "getPropCaseInsensitive",
    value: function getPropCaseInsensitive(props, prop) {
      var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var fkey = this.toFlatCase(prop);
      for (var key in props) {
        if (props.hasOwnProperty(key) && this.toFlatCase(key) === fkey) {
          return props[key];
        }
      }
      for (var _key3 in defaultProps) {
        if (defaultProps.hasOwnProperty(_key3) && this.toFlatCase(_key3) === fkey) {
          return defaultProps[_key3];
        }
      }
      return undefined; // Property not found
    }
  }, {
    key: "getMergedProps",
    value: function getMergedProps(props, defaultProps) {
      return Object.assign({}, defaultProps, props);
    }
  }, {
    key: "getDiffProps",
    value: function getDiffProps(props, defaultProps) {
      return this.findDiffKeys(props, defaultProps);
    }

    /**
     * Gets the value of a property which can be a function or a direct value.
     * If the property is a function, it will be invoked with the provided parameters.
     * @param {*} obj - The object to get the value from
     * @param {...*} params - Parameters to pass to the function if obj is a function
     * @returns {*} The resolved value
     */
  }, {
    key: "getPropValue",
    value: function getPropValue(obj) {
      // If obj is not a function, return it directly
      if (!this.isFunction(obj)) {
        return obj;
      }

      // Handle function invocation
      for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
        params[_key4 - 1] = arguments[_key4];
      }
      if (params.length === 1) {
        // For single parameter case, unwrap array if needed to avoid extra nesting
        var param = params[0];
        return obj(Array.isArray(param) ? param[0] : param);
      }

      // Pass all parameters to function
      return obj.apply(void 0, params);
    }
  }, {
    key: "getComponentProp",
    value: function getComponentProp(component) {
      var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var defaultProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      return this.isNotEmpty(component) ? this.getProp(component.props, prop, defaultProps) : undefined;
    }
  }, {
    key: "getComponentProps",
    value: function getComponentProps(component, defaultProps) {
      return this.isNotEmpty(component) ? this.getMergedProps(component.props, defaultProps) : undefined;
    }
  }, {
    key: "getComponentDiffProps",
    value: function getComponentDiffProps(component, defaultProps) {
      return this.isNotEmpty(component) ? this.getDiffProps(component.props, defaultProps) : undefined;
    }
  }, {
    key: "isValidChild",
    value: function isValidChild(child, type, validTypes) {
      /* eslint-disable */
      if (child) {
        var _child$type;
        var childType = this.getComponentProp(child, '__TYPE') || (child.type ? child.type.displayName : undefined);

        // for App Router in Next.js ^14,
        if (!childType && child !== null && child !== void 0 && (_child$type = child.type) !== null && _child$type !== void 0 && (_child$type = _child$type._payload) !== null && _child$type !== void 0 && _child$type.value) {
          childType = child.type._payload.value.find(function (v) {
            return v === type;
          });
        }
        var isValid = childType === type;
        try {
          var messageTypes; if (false) // removed by dead control flow
{}
        } catch (error) {
          // NOOP
        }
        return isValid;
      }
      return false;
      /* eslint-enable */
    }
  }, {
    key: "getRefElement",
    value: function getRefElement(ref) {
      if (ref) {
        return _typeof(ref) === 'object' && ref.hasOwnProperty('current') ? ref.current : ref;
      }
      return null;
    }
  }, {
    key: "combinedRefs",
    value: function combinedRefs(innerRef, forwardRef) {
      if (innerRef && forwardRef) {
        if (typeof forwardRef === 'function') {
          forwardRef(innerRef.current);
        } else {
          forwardRef.current = innerRef.current;
        }
      }
    }
  }, {
    key: "removeAccents",
    value: function removeAccents(str) {
      if (str && str.search(/[\xC0-\xFF]/g) > -1) {
        str = str.replace(/[\xC0-\xC5]/g, 'A').replace(/[\xC6]/g, 'AE').replace(/[\xC7]/g, 'C').replace(/[\xC8-\xCB]/g, 'E').replace(/[\xCC-\xCF]/g, 'I').replace(/[\xD0]/g, 'D').replace(/[\xD1]/g, 'N').replace(/[\xD2-\xD6\xD8]/g, 'O').replace(/[\xD9-\xDC]/g, 'U').replace(/[\xDD]/g, 'Y').replace(/[\xDE]/g, 'P').replace(/[\xE0-\xE5]/g, 'a').replace(/[\xE6]/g, 'ae').replace(/[\xE7]/g, 'c').replace(/[\xE8-\xEB]/g, 'e').replace(/[\xEC-\xEF]/g, 'i').replace(/[\xF1]/g, 'n').replace(/[\xF2-\xF6\xF8]/g, 'o').replace(/[\xF9-\xFC]/g, 'u').replace(/[\xFE]/g, 'p').replace(/[\xFD\xFF]/g, 'y');
      }
      return str;
    }
  }, {
    key: "toFlatCase",
    value: function toFlatCase(str) {
      // convert snake, kebab, camel and pascal cases to flat case
      return this.isNotEmpty(str) && this.isString(str) ? str.replace(/(-|_)/g, '').toLowerCase() : str;
    }
  }, {
    key: "toCapitalCase",
    value: function toCapitalCase(str) {
      return this.isNotEmpty(str) && this.isString(str) ? str[0].toUpperCase() + str.slice(1) : str;
    }
  }, {
    key: "trim",
    value: function trim(value) {
      // trim only if the value is actually a string
      return this.isNotEmpty(value) && this.isString(value) ? value.trim() : value;
    }
  }, {
    key: "isEmpty",
    value: function isEmpty(value) {
      return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof(value) === 'object' && Object.keys(value).length === 0;
    }
  }, {
    key: "isNotEmpty",
    value: function isNotEmpty(value) {
      return !this.isEmpty(value);
    }
  }, {
    key: "isFunction",
    value: function isFunction(value) {
      return !!(value && value.constructor && value.call && value.apply);
    }
  }, {
    key: "isObject",
    value: function isObject(value) {
      return value !== null && value instanceof Object && value.constructor === Object;
    }
  }, {
    key: "isDate",
    value: function isDate(value) {
      return value !== null && value instanceof Date && value.constructor === Date;
    }
  }, {
    key: "isArray",
    value: function isArray(value) {
      return value !== null && Array.isArray(value);
    }
  }, {
    key: "isString",
    value: function isString(value) {
      return value !== null && typeof value === 'string';
    }
  }, {
    key: "isPrintableCharacter",
    value: function isPrintableCharacter() {
      var _char = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      return this.isNotEmpty(_char) && _char.length === 1 && _char.match(/\S| /);
    }
  }, {
    key: "isLetter",
    value: function isLetter(_char2) {
      return /^[a-zA-Z\u00C0-\u017F]$/.test(_char2);
    }
  }, {
    key: "isScalar",
    value: function isScalar(value) {
      return value != null && (typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean');
    }

    /**
     * Firefox-v103 does not currently support the "findLast" method. It is stated that this method will be supported with Firefox-v104.
     * https://caniuse.com/mdn-javascript_builtins_array_findlast
     */
  }, {
    key: "findLast",
    value: function findLast(arr, callback) {
      var item;
      if (this.isNotEmpty(arr)) {
        try {
          item = arr.findLast(callback);
        } catch (_unused2) {
          item = _toConsumableArray(arr).reverse().find(callback);
        }
      }
      return item;
    }

    /**
     * Firefox-v103 does not currently support the "findLastIndex" method. It is stated that this method will be supported with Firefox-v104.
     * https://caniuse.com/mdn-javascript_builtins_array_findlastindex
     */
  }, {
    key: "findLastIndex",
    value: function findLastIndex(arr, callback) {
      var index = -1;
      if (this.isNotEmpty(arr)) {
        try {
          index = arr.findLastIndex(callback);
        } catch (_unused3) {
          index = arr.lastIndexOf(_toConsumableArray(arr).reverse().find(callback));
        }
      }
      return index;
    }
  }, {
    key: "sort",
    value: function sort(value1, value2) {
      var order = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
      var comparator = arguments.length > 3 ? arguments[3] : undefined;
      var nullSortOrder = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
      var result = this.compare(value1, value2, comparator, order);
      var finalSortOrder = order;

      // nullSortOrder == 1 means Excel like sort nulls at bottom
      if (this.isEmpty(value1) || this.isEmpty(value2)) {
        finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder;
      }
      return finalSortOrder * result;
    }
  }, {
    key: "compare",
    value: function compare(value1, value2, comparator) {
      var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
      var result = -1;
      var emptyValue1 = this.isEmpty(value1);
      var emptyValue2 = this.isEmpty(value2);
      if (emptyValue1 && emptyValue2) {
        result = 0;
      } else if (emptyValue1) {
        result = order;
      } else if (emptyValue2) {
        result = -order;
      } else if (typeof value1 === 'string' && typeof value2 === 'string') {
        result = comparator(value1, value2);
      } else {
        result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
      }
      return result;
    }
  }, {
    key: "localeComparator",
    value: function localeComparator(locale) {
      //performance gain using Int.Collator. It is not recommended to use localeCompare against large arrays.
      return new Intl.Collator(locale, {
        numeric: true
      }).compare;
    }
  }, {
    key: "findChildrenByKey",
    value: function findChildrenByKey(data, key) {
      var _iterator = _createForOfIteratorHelper(data),
        _step;
      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var item = _step.value;
          if (item.key === key) {
            return item.children || [];
          } else if (item.children) {
            var result = this.findChildrenByKey(item.children, key);
            if (result.length > 0) {
              return result;
            }
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }
      return [];
    }

    /**
     * This function takes mutates and object with a new value given
     * a specific field. This will handle deeply nested fields that
     * need to be modified or created.
     *
     * e.g:
     * data = {
     *  nested: {
     *      foo: "bar"
     *  }
     * }
     *
     * field = "nested.foo"
     * value = "baz"
     *
     * The function will mutate data to be
     * e.g:
     * data = {
     *  nested: {
     *      foo: "baz"
     *  }
     * }
     *
     * @param {object} data the object to be modified
     * @param {string} field the field in the object to replace
     * @param {any} value the value to have replaced in the field
     */
  }, {
    key: "mutateFieldData",
    value: function mutateFieldData(data, field, value) {
      if (_typeof(data) !== 'object' || typeof field !== 'string') {
        // short circuit if there is nothing to resolve
        return;
      }
      var fields = field.split('.');
      var obj = data;
      for (var i = 0, len = fields.length; i < len; ++i) {
        // Check if we are on the last field
        if (i + 1 - len === 0) {
          obj[fields[i]] = value;
          break;
        }
        if (!obj[fields[i]]) {
          obj[fields[i]] = {};
        }
        obj = obj[fields[i]];
      }
    }

    /**
     * This helper function takes an object and a dot-separated key path. It traverses the object based on the path,
     * returning the value at the specified depth. If any part of the path is missing or undefined, it returns undefined.
     *
     * Example:
     * const obj = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
     * const path = 'address.city';
     * const result = ObjectUtils.getNestedValue(obj, path);
     * console.log(result); // Output: "Wonderland"
     *
     * @param {object} obj - The object to traverse.
     * @param {string} path - The dot-separated key path.
     * @returns {*} The value at the specified depth, or undefined if any part of the path is missing or undefined.
     */
  }, {
    key: "getNestedValue",
    value: function getNestedValue(obj, path) {
      return path.split('.').reduce(function (acc, part) {
        return acc && acc[part] !== undefined ? acc[part] : undefined;
      }, obj);
    }

    /**
     * This function takes an object and a dot-separated key path. It traverses the object based on the path,
     * returning the value at the specified depth. If any part of the path is missing or undefined, it returns undefined.
     *
     * Example:
     * const objA = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
     * const objB = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
     * const result = ObjectUtils.absoluteCompare(objA, objB);
     * console.log(result); // Output: true
     *
     * const objC = { name: 'Alice', address: { city: 'Wonderland', zip: 12346 } };
     * const result2 = ObjectUtils.absoluteCompare(objA, objC);
     * console.log(result2); // Output: false
     *
     * @param {object} objA - The first object to compare.
     * @param {object} objB - The second object to compare.
     * @param {number} [maxDepth=1] - The maximum depth to compare.
     * @param {number} [currentDepth=0] - The current depth (used internally for recursion).
     * @returns {boolean} True if the objects are equal within the specified depth, false otherwise.
     *
     */
  }, {
    key: "absoluteCompare",
    value: function absoluteCompare(objA, objB) {
      var maxDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
      var currentDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      if (!objA || !objB) return true;
      if (currentDepth > maxDepth) return true;
      if (_typeof(objA) !== _typeof(objB)) return false;
      var aKeys = Object.keys(objA);
      var bKeys = Object.keys(objB);
      if (aKeys.length !== bKeys.length) return false;
      for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
        var key = _aKeys[_i];
        var aValue = objA[key];
        var bValue = objB[key];

        // Skip comparison if values are objects
        var isObject = ObjectUtils.isObject(aValue) && ObjectUtils.isObject(bValue);
        var isFunction = ObjectUtils.isFunction(aValue) && ObjectUtils.isFunction(bValue);
        if ((isObject || isFunction) && !this.absoluteCompare(aValue, bValue, maxDepth, currentDepth + 1)) return false;
        if (!isObject && aValue !== bValue) return false;
      }
      return true;
    }

    /**
     * This helper function takes two objects and a list of keys to compare. It compares the values of the specified keys
     * in both objects. If any comparison fails, it returns false. If all specified properties are equal, it returns true.
     * It performs a shallow comparison using absoluteCompare if no keys are provided.
     *
     * Example:
     * const objA = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
     * const objB = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
     * const keysToCompare = ['name', 'address.city', 'address.zip'];
     * const result = ObjectUtils.selectiveCompare(objA, objB, keysToCompare);
     * console.log(result); // Output: true
     *
     * const objC = { name: 'Alice', address: { city: 'Wonderland', zip: 12346 } };
     * const result2 = ObjectUtils.selectiveCompare(objA, objC, keysToCompare);
     * console.log(result2); // Output: false
     *
     * @param {object} a - The first object to compare.
     * @param {object} b - The second object to compare.
     * @param {string[]} [keysToCompare] - The keys to compare. If not provided, performs a shallow comparison using absoluteCompare.
     * @param {number} [maxDepth=1] - The maximum depth to compare if the variables are objects.
     * @returns {boolean} True if all specified properties are equal, false otherwise.
     */
  }, {
    key: "selectiveCompare",
    value: function selectiveCompare(a, b, keysToCompare) {
      var maxDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
      if (a === b) return true;
      if (!a || !b || _typeof(a) !== 'object' || _typeof(b) !== 'object') return false;
      if (!keysToCompare) return this.absoluteCompare(a, b, 1); // If no keys are provided, the comparison is limited to one depth level.
      var _iterator2 = _createForOfIteratorHelper(keysToCompare),
        _step2;
      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var key = _step2.value;
          var aValue = this.getNestedValue(a, key);
          var bValue = this.getNestedValue(b, key);
          var isObject = _typeof(aValue) === 'object' && aValue !== null && _typeof(bValue) === 'object' && bValue !== null;

          // If the current key is an object, they are compared in one further level only.
          if (isObject && !this.absoluteCompare(aValue, bValue, maxDepth)) return false;
          if (!isObject && aValue !== bValue) return false;
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
      return true;
    }
  }]);
}();

var lastId = 0;
function UniqueComponentId() {
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'pr_id_';
  lastId++;
  return "".concat(prefix).concat(lastId);
}

function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var IconUtils = /*#__PURE__*/function () {
  function IconUtils() {
    _classCallCheck(this, IconUtils);
  }
  return _createClass(IconUtils, null, [{
    key: "getJSXIcon",
    value: function getJSXIcon(icon) {
      var iconProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var content = null;
      if (icon !== null) {
        var iconType = _typeof(icon);
        var className = classNames(iconProps.className, iconType === 'string' && icon);
        content = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", _extends({}, iconProps, {
          className: className,
          key: UniqueComponentId('icon')
        }));
        if (iconType !== 'string') {
          var defaultContentOptions = _objectSpread$2({
            iconProps: iconProps,
            element: content
          }, options);
          return ObjectUtils.getJSXElement(icon, defaultContentOptions);
        }
      }
      return content;
    }
  }]);
}();

function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function mask(el, options) {
  var defaultOptions = {
    mask: null,
    slotChar: '_',
    autoClear: true,
    unmask: false,
    readOnly: false,
    onComplete: null,
    onChange: null,
    onFocus: null,
    onBlur: null
  };
  options = _objectSpread$1(_objectSpread$1({}, defaultOptions), options);
  var tests;
  var partialPosition;
  var len;
  var firstNonMaskPos;
  var defs;
  var androidChrome;
  var lastRequiredNonMaskPos;
  var oldVal;
  var focusText;
  var caretTimeoutId;
  var buffer;
  var defaultBuffer;
  var caret = function caret(first, last) {
    var range;
    var begin;
    var end;
    if (!el.offsetParent || el !== document.activeElement) {
      return;
    }
    if (typeof first === 'number') {
      begin = first;
      end = typeof last === 'number' ? last : begin;
      if (el.setSelectionRange) {
        el.setSelectionRange(begin, end);
      } else if (el.createTextRange) {
        range = el.createTextRange();
        range.collapse(true);
        range.moveEnd('character', end);
        range.moveStart('character', begin);
        range.select();
      }
    } else {
      if (el.setSelectionRange) {
        begin = el.selectionStart;
        end = el.selectionEnd;
      } else if (document.selection && document.selection.createRange) {
        range = document.selection.createRange();
        begin = 0 - range.duplicate().moveStart('character', -100000);
        end = begin + range.text.length;
      }
      return {
        begin: begin,
        end: end
      };
    }
  };
  var isCompleted = function isCompleted() {
    for (var i = firstNonMaskPos; i <= lastRequiredNonMaskPos; i++) {
      if (tests[i] && buffer[i] === getPlaceholder(i)) {
        return false;
      }
    }
    return true;
  };
  var getPlaceholder = function getPlaceholder(i) {
    if (i < options.slotChar.length) {
      return options.slotChar.charAt(i);
    }
    return options.slotChar.charAt(0);
  };
  var getValue = function getValue() {
    return options.unmask ? getUnmaskedValue() : el && el.value;
  };
  var seekNext = function seekNext(pos) {
    while (++pos < len && !tests[pos]) {}
    return pos;
  };
  var seekPrev = function seekPrev(pos) {
    while (--pos >= 0 && !tests[pos]) {}
    return pos;
  };
  var shiftL = function shiftL(begin, end) {
    var i;
    var j;
    if (begin < 0) {
      return;
    }
    for (i = begin, j = seekNext(end); i < len; i++) {
      if (tests[i]) {
        if (j < len && tests[i].test(buffer[j])) {
          buffer[i] = buffer[j];
          buffer[j] = getPlaceholder(j);
        } else {
          break;
        }
        j = seekNext(j);
      }
    }
    writeBuffer();
    caret(Math.max(firstNonMaskPos, begin));
  };
  var shiftR = function shiftR(pos) {
    var i;
    var c;
    var j;
    var t;
    for (i = pos, c = getPlaceholder(pos); i < len; i++) {
      if (tests[i]) {
        j = seekNext(i);
        t = buffer[i];
        buffer[i] = c;
        if (j < len && tests[j].test(t)) {
          c = t;
        } else {
          break;
        }
      }
    }
  };
  var handleAndroidInput = function handleAndroidInput(e) {
    var curVal = el.value;
    var pos = caret();
    if (oldVal && oldVal.length && oldVal.length > curVal.length) {
      // a deletion or backspace happened
      checkVal(true);
      while (pos.begin > 0 && !tests[pos.begin - 1]) {
        pos.begin--;
      }
      if (pos.begin === 0) {
        while (pos.begin < firstNonMaskPos && !tests[pos.begin]) {
          pos.begin++;
        }
      }
      caret(pos.begin, pos.begin);
    } else {
      checkVal(true);
      while (pos.begin < len && !tests[pos.begin]) {
        pos.begin++;
      }
      caret(pos.begin, pos.begin);
    }
    if (options.onComplete && isCompleted()) {
      options.onComplete({
        originalEvent: e,
        value: getValue()
      });
    }
  };
  var onBlur = function onBlur(e) {
    checkVal();
    options.onBlur && options.onBlur(e);
    updateModel(e);
    if (el.value !== focusText) {
      var event = document.createEvent('HTMLEvents');
      event.initEvent('change', true, false);
      el.dispatchEvent(event);
    }
  };
  var onKeyDown = function onKeyDown(e) {
    if (options.readOnly) {
      return;
    }
    var k = e.which || e.keyCode;
    var pos;
    var begin;
    var end;
    oldVal = el.value;

    //backspace, delete, and escape get special treatment
    if (k === 8 || k === 46 || DomHandler.isIOS() && k === 127) {
      pos = caret();
      begin = pos.begin;
      end = pos.end;
      if (end - begin === 0) {
        begin = k !== 46 ? seekPrev(begin) : end = seekNext(begin - 1);
        end = k === 46 ? seekNext(end) : end;
      }
      clearBuffer(begin, end);
      shiftL(begin, end - 1);
      updateModel(e);
      e.preventDefault();
    } else if (k === 13) {
      // enter
      onBlur(e);
      updateModel(e);
    } else if (k === 27) {
      // escape
      el.value = focusText;
      caret(0, checkVal());
      updateModel(e);
      e.preventDefault();
    }
  };
  var onKeyPress = function onKeyPress(e) {
    if (options.readOnly) {
      return;
    }
    var k = e.which || e.keyCode;
    var pos = caret();
    var p;
    var c;
    var next;
    var completed;
    if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {
      //Ignore
      return;
    } else if (k && k !== 13) {
      if (pos.end - pos.begin !== 0) {
        clearBuffer(pos.begin, pos.end);
        shiftL(pos.begin, pos.end - 1);
      }
      p = seekNext(pos.begin - 1);
      if (p < len) {
        c = String.fromCharCode(k);
        if (tests[p].test(c)) {
          shiftR(p);
          buffer[p] = c;
          writeBuffer();
          next = seekNext(p);
          if (DomHandler.isAndroid()) {
            //Path for CSP Violation on FireFox OS 1.1
            var proxy = function proxy() {
              caret(next);
            };
            setTimeout(proxy, 0);
          } else {
            caret(next);
          }
          if (pos.begin <= lastRequiredNonMaskPos) {
            completed = isCompleted();
          }
        }
      }
      e.preventDefault();
    }
    updateModel(e);
    if (options.onComplete && completed) {
      options.onComplete({
        originalEvent: e,
        value: getValue()
      });
    }
  };
  var clearBuffer = function clearBuffer(start, end) {
    var i;
    for (i = start; i < end && i < len; i++) {
      if (tests[i]) {
        buffer[i] = getPlaceholder(i);
      }
    }
  };
  var writeBuffer = function writeBuffer() {
    el.value = buffer.join('');
  };
  var checkVal = function checkVal(allow) {
    //try to place characters where they belong
    var test = el.value;
    var lastMatch = -1;
    var i;
    var c;
    var pos;
    for (i = 0, pos = 0; i < len; i++) {
      if (tests[i]) {
        buffer[i] = getPlaceholder(i);
        while (pos++ < test.length) {
          c = test.charAt(pos - 1);
          if (tests[i].test(c)) {
            buffer[i] = c;
            lastMatch = i;
            break;
          }
        }
        if (pos > test.length) {
          clearBuffer(i + 1, len);
          break;
        }
      } else {
        if (buffer[i] === test.charAt(pos)) {
          pos++;
        }
        if (i < partialPosition) {
          lastMatch = i;
        }
      }
    }
    if (allow) {
      writeBuffer();
    } else if (lastMatch + 1 < partialPosition) {
      if (options.autoClear || buffer.join('') === defaultBuffer) {
        // Invalid value. Remove it and replace it with the
        // mask, which is the default behavior.
        if (el.value) {
          el.value = '';
        }
        clearBuffer(0, len);
      } else {
        // Invalid value, but we opt to show the value to the
        // user and allow them to correct their mistake.
        writeBuffer();
      }
    } else {
      writeBuffer();
      el.value = el.value.substring(0, lastMatch + 1);
    }
    return partialPosition ? i : firstNonMaskPos;
  };
  var onFocus = function onFocus(e) {
    if (options.readOnly) {
      return;
    }
    clearTimeout(caretTimeoutId);
    var pos;
    focusText = el.value;
    pos = checkVal();
    caretTimeoutId = setTimeout(function () {
      if (el !== document.activeElement) {
        return;
      }
      writeBuffer();
      if (pos === options.mask.replace('?', '').length) {
        caret(0, pos);
      } else {
        caret(pos);
      }
    }, 100);
    if (options.onFocus) {
      options.onFocus(e);
    }
  };
  var onInput = function onInput(event) {
    if (androidChrome) {
      handleAndroidInput(event);
    } else {
      handleInputChange(event);
    }
  };
  var handleInputChange = function handleInputChange(e) {
    if (options.readOnly) {
      return;
    }
    var pos = checkVal(true);
    caret(pos);
    updateModel(e);
    if (options.onComplete && isCompleted()) {
      options.onComplete({
        originalEvent: e,
        value: getValue()
      });
    }
  };
  var getUnmaskedValue = function getUnmaskedValue() {
    var unmaskedBuffer = [];
    for (var i = 0; i < buffer.length; i++) {
      var c = buffer[i];
      if (tests[i] && c !== getPlaceholder(i)) {
        unmaskedBuffer.push(c);
      }
    }
    return unmaskedBuffer.join('');
  };
  var updateModel = function updateModel(e) {
    if (options.onChange) {
      var val = getValue();
      options.onChange({
        originalEvent: e,
        value: defaultBuffer !== val ? val : '',
        stopPropagation: function stopPropagation() {
          e.stopPropagation();
        },
        preventDefault: function preventDefault() {
          e.preventDefault();
        },
        target: {
          value: defaultBuffer !== val ? val : ''
        }
      });
    }
  };
  var bindEvents = function bindEvents() {
    el.addEventListener('focus', onFocus);
    el.addEventListener('blur', onBlur);
    el.addEventListener('keydown', onKeyDown);
    el.addEventListener('keypress', onKeyPress);
    el.addEventListener('input', onInput);
    el.addEventListener('paste', handleInputChange);
  };
  var unbindEvents = function unbindEvents() {
    el.removeEventListener('focus', onFocus);
    el.removeEventListener('blur', onBlur);
    el.removeEventListener('keydown', onKeyDown);
    el.removeEventListener('keypress', onKeyPress);
    el.removeEventListener('input', onInput);
    el.removeEventListener('paste', handleInputChange);
  };
  var init = function init() {
    tests = [];
    partialPosition = options.mask.length;
    len = options.mask.length;
    firstNonMaskPos = null;
    defs = {
      9: '[0-9]',
      a: '[A-Za-z]',
      '*': '[A-Za-z0-9]'
    };
    androidChrome = DomHandler.isChrome() && DomHandler.isAndroid();
    var maskTokens = options.mask.split('');
    for (var i = 0; i < maskTokens.length; i++) {
      var c = maskTokens[i];
      if (c === '?') {
        len--;
        partialPosition = i;
      } else if (defs[c]) {
        tests.push(new RegExp(defs[c]));
        if (firstNonMaskPos === null) {
          firstNonMaskPos = tests.length - 1;
        }
        if (i < partialPosition) {
          lastRequiredNonMaskPos = tests.length - 1;
        }
      } else {
        tests.push(null);
      }
    }
    buffer = [];
    for (var _i = 0; _i < maskTokens.length; _i++) {
      var _c = maskTokens[_i];
      if (_c !== '?') {
        if (defs[_c]) {
          buffer.push(getPlaceholder(_i));
        } else {
          buffer.push(_c);
        }
      }
    }
    defaultBuffer = buffer.join('');
  };
  if (el && options.mask) {
    init();
    bindEvents();
  }
  return {
    init: init,
    bindEvents: bindEvents,
    unbindEvents: unbindEvents,
    updateModel: updateModel,
    getValue: getValue
  };
}

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/**
 * Merges properties together taking an Array of props and merging into one single set of
 * properties. The options can contain a "classNameMergeFunction" which can be something
 * like Tailwind Merge for properly merging Tailwind classes.
 *
 * @param {object[]} props the array of object properties to merge
 * @param {*} options either empty or could contain a custom merge function like TailwindMerge
 * @returns the single properties value after merging
 */
function mergeProps(props) {
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  if (!props) {
    return undefined;
  }
  var isFunction = function isFunction(obj) {
    return typeof obj === 'function';
  };
  var classNameMergeFunction = options.classNameMergeFunction;
  var hasMergeFunction = isFunction(classNameMergeFunction);
  return props.reduce(function (merged, ps) {
    if (!ps) {
      return merged;
    }
    var _loop = function _loop() {
      var value = ps[key];
      if (key === 'style') {
        merged.style = _objectSpread(_objectSpread({}, merged.style), ps.style);
      } else if (key === 'className') {
        var newClassName = '';
        if (hasMergeFunction) {
          newClassName = classNameMergeFunction(merged.className, ps.className);
        } else {
          newClassName = [merged.className, ps.className].join(' ').trim();
        }
        merged.className = newClassName || undefined;
      } else if (isFunction(value)) {
        var existingFn = merged[key];
        merged[key] = existingFn ? function () {
          existingFn.apply(void 0, arguments);
          value.apply(void 0, arguments);
        } : value;
      } else {
        merged[key] = value;
      }
    };
    for (var key in ps) {
      _loop();
    }
    return merged;
  }, {});
}

function handler() {
  var zIndexes = [];
  var generateZIndex = function generateZIndex(key, autoZIndex) {
    var baseZIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 999;
    var lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
    var newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
    zIndexes.push({
      key: key,
      value: newZIndex
    });
    return newZIndex;
  };
  var revertZIndex = function revertZIndex(zIndex) {
    zIndexes = zIndexes.filter(function (obj) {
      return obj.value !== zIndex;
    });
  };
  var getCurrentZIndex = function getCurrentZIndex(key, autoZIndex) {
    return getLastZIndex(key, autoZIndex).value;
  };
  var getLastZIndex = function getLastZIndex(key, autoZIndex) {
    var baseZIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    return _toConsumableArray(zIndexes).reverse().find(function (obj) {
      return autoZIndex ? true : obj.key === key;
    }) || {
      key: key,
      value: baseZIndex
    };
  };
  var getZIndex = function getZIndex(el) {
    return el ? parseInt(el.style.zIndex, 10) || 0 : 0;
  };
  return {
    get: getZIndex,
    set: function set(key, el, autoZIndex, baseZIndex) {
      if (el) {
        el.style.zIndex = String(generateZIndex(key, autoZIndex, baseZIndex));
      }
    },
    clear: function clear(el) {
      if (el) {
        revertZIndex(ZIndexUtils.get(el));
        el.style.zIndex = '';
      }
    },
    getCurrent: function getCurrent(key, autoZIndex) {
      return getCurrentZIndex(key, autoZIndex);
    }
  };
}
var ZIndexUtils = handler();




/***/ }),

/***/ "./node_modules/prop-types/checkPropTypes.js":
/*!***************************************************!*\
  !*** ./node_modules/prop-types/checkPropTypes.js ***!
  \***************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



var printWarning = function() {};

if (true) {
  var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
  var loggedTypeFailures = {};
  var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js");

  printWarning = function(text) {
    var message = 'Warning: ' + text;
    if (typeof console !== 'undefined') {
      console.error(message);
    }
    try {
      // --- Welcome to debugging React ---
      // This error was thrown as a convenience so that you can use this stack
      // to find the callsite that caused this warning to fire.
      throw new Error(message);
    } catch (x) { /**/ }
  };
}

/**
 * Assert that the values match with the type specs.
 * Error messages are memorized and will only be shown once.
 *
 * @param {object} typeSpecs Map of name to a ReactPropType
 * @param {object} values Runtime values that need to be type-checked
 * @param {string} location e.g. "prop", "context", "child context"
 * @param {string} componentName Name of the component for error messages.
 * @param {?Function} getStack Returns the component stack.
 * @private
 */
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  if (true) {
    for (var typeSpecName in typeSpecs) {
      if (has(typeSpecs, typeSpecName)) {
        var error;
        // Prop type validation may throw. In case they do, we don't want to
        // fail the render phase where it didn't fail before. So we log it.
        // After these have been cleaned up, we'll let them throw.
        try {
          // This is intentionally an invariant that gets caught. It's the same
          // behavior as without this statement except with a better message.
          if (typeof typeSpecs[typeSpecName] !== 'function') {
            var err = Error(
              (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
              'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
              'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
            );
            err.name = 'Invariant Violation';
            throw err;
          }
          error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
        } catch (ex) {
          error = ex;
        }
        if (error && !(error instanceof Error)) {
          printWarning(
            (componentName || 'React class') + ': type specification of ' +
            location + ' `' + typeSpecName + '` is invalid; the type checker ' +
            'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
            'You may have forgotten to pass an argument to the type checker ' +
            'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
            'shape all require an argument).'
          );
        }
        if (error instanceof Error && !(error.message in loggedTypeFailures)) {
          // Only monitor this failure once because there tends to be a lot of the
          // same error.
          loggedTypeFailures[error.message] = true;

          var stack = getStack ? getStack() : '';

          printWarning(
            'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
          );
        }
      }
    }
  }
}

/**
 * Resets warning cache when testing.
 *
 * @private
 */
checkPropTypes.resetWarningCache = function() {
  if (true) {
    loggedTypeFailures = {};
  }
}

module.exports = checkPropTypes;


/***/ }),

/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
/*!************************************************************!*\
  !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
  \************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/prop-types/node_modules/react-is/index.js");
var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");

var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js");
var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");

var printWarning = function() {};

if (true) {
  printWarning = function(text) {
    var message = 'Warning: ' + text;
    if (typeof console !== 'undefined') {
      console.error(message);
    }
    try {
      // --- Welcome to debugging React ---
      // This error was thrown as a convenience so that you can use this stack
      // to find the callsite that caused this warning to fire.
      throw new Error(message);
    } catch (x) {}
  };
}

function emptyFunctionThatReturnsNull() {
  return null;
}

module.exports = function(isValidElement, throwOnDirectAccess) {
  /* global Symbol */
  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.

  /**
   * Returns the iterator method function contained on the iterable object.
   *
   * Be sure to invoke the function with the iterable as context:
   *
   *     var iteratorFn = getIteratorFn(myIterable);
   *     if (iteratorFn) {
   *       var iterator = iteratorFn.call(myIterable);
   *       ...
   *     }
   *
   * @param {?object} maybeIterable
   * @return {?function}
   */
  function getIteratorFn(maybeIterable) {
    var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
    if (typeof iteratorFn === 'function') {
      return iteratorFn;
    }
  }

  /**
   * Collection of methods that allow declaration and validation of props that are
   * supplied to React components. Example usage:
   *
   *   var Props = require('ReactPropTypes');
   *   var MyArticle = React.createClass({
   *     propTypes: {
   *       // An optional string prop named "description".
   *       description: Props.string,
   *
   *       // A required enum prop named "category".
   *       category: Props.oneOf(['News','Photos']).isRequired,
   *
   *       // A prop named "dialog" that requires an instance of Dialog.
   *       dialog: Props.instanceOf(Dialog).isRequired
   *     },
   *     render: function() { ... }
   *   });
   *
   * A more formal specification of how these methods are used:
   *
   *   type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
   *   decl := ReactPropTypes.{type}(.isRequired)?
   *
   * Each and every declaration produces a function with the same signature. This
   * allows the creation of custom validation functions. For example:
   *
   *  var MyLink = React.createClass({
   *    propTypes: {
   *      // An optional string or URI prop named "href".
   *      href: function(props, propName, componentName) {
   *        var propValue = props[propName];
   *        if (propValue != null && typeof propValue !== 'string' &&
   *            !(propValue instanceof URI)) {
   *          return new Error(
   *            'Expected a string or an URI for ' + propName + ' in ' +
   *            componentName
   *          );
   *        }
   *      }
   *    },
   *    render: function() {...}
   *  });
   *
   * @internal
   */

  var ANONYMOUS = '<<anonymous>>';

  // Important!
  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  var ReactPropTypes = {
    array: createPrimitiveTypeChecker('array'),
    bigint: createPrimitiveTypeChecker('bigint'),
    bool: createPrimitiveTypeChecker('boolean'),
    func: createPrimitiveTypeChecker('function'),
    number: createPrimitiveTypeChecker('number'),
    object: createPrimitiveTypeChecker('object'),
    string: createPrimitiveTypeChecker('string'),
    symbol: createPrimitiveTypeChecker('symbol'),

    any: createAnyTypeChecker(),
    arrayOf: createArrayOfTypeChecker,
    element: createElementTypeChecker(),
    elementType: createElementTypeTypeChecker(),
    instanceOf: createInstanceTypeChecker,
    node: createNodeChecker(),
    objectOf: createObjectOfTypeChecker,
    oneOf: createEnumTypeChecker,
    oneOfType: createUnionTypeChecker,
    shape: createShapeTypeChecker,
    exact: createStrictShapeTypeChecker,
  };

  /**
   * inlined Object.is polyfill to avoid requiring consumers ship their own
   * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
   */
  /*eslint-disable no-self-compare*/
  function is(x, y) {
    // SameValue algorithm
    if (x === y) {
      // Steps 1-5, 7-10
      // Steps 6.b-6.e: +0 != -0
      return x !== 0 || 1 / x === 1 / y;
    } else {
      // Step 6.a: NaN == NaN
      return x !== x && y !== y;
    }
  }
  /*eslint-enable no-self-compare*/

  /**
   * We use an Error-like object for backward compatibility as people may call
   * PropTypes directly and inspect their output. However, we don't use real
   * Errors anymore. We don't inspect their stack anyway, and creating them
   * is prohibitively expensive if they are created too often, such as what
   * happens in oneOfType() for any type before the one that matched.
   */
  function PropTypeError(message, data) {
    this.message = message;
    this.data = data && typeof data === 'object' ? data: {};
    this.stack = '';
  }
  // Make `instanceof Error` still work for returned errors.
  PropTypeError.prototype = Error.prototype;

  function createChainableTypeChecker(validate) {
    if (true) {
      var manualPropTypeCallCache = {};
      var manualPropTypeWarningCount = 0;
    }
    function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
      componentName = componentName || ANONYMOUS;
      propFullName = propFullName || propName;

      if (secret !== ReactPropTypesSecret) {
        if (throwOnDirectAccess) {
          // New behavior only for users of `prop-types` package
          var err = new Error(
            'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
            'Use `PropTypes.checkPropTypes()` to call them. ' +
            'Read more at http://fb.me/use-check-prop-types'
          );
          err.name = 'Invariant Violation';
          throw err;
        } else if ( true && typeof console !== 'undefined') {
          // Old behavior for people using React.PropTypes
          var cacheKey = componentName + ':' + propName;
          if (
            !manualPropTypeCallCache[cacheKey] &&
            // Avoid spamming the console because they are often not actionable except for lib authors
            manualPropTypeWarningCount < 3
          ) {
            printWarning(
              'You are manually calling a React.PropTypes validation ' +
              'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
              'and will throw in the standalone `prop-types` package. ' +
              'You may be seeing this warning due to a third-party PropTypes ' +
              'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
            );
            manualPropTypeCallCache[cacheKey] = true;
            manualPropTypeWarningCount++;
          }
        }
      }
      if (props[propName] == null) {
        if (isRequired) {
          if (props[propName] === null) {
            return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
          }
          return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
        }
        return null;
      } else {
        return validate(props, propName, componentName, location, propFullName);
      }
    }

    var chainedCheckType = checkType.bind(null, false);
    chainedCheckType.isRequired = checkType.bind(null, true);

    return chainedCheckType;
  }

  function createPrimitiveTypeChecker(expectedType) {
    function validate(props, propName, componentName, location, propFullName, secret) {
      var propValue = props[propName];
      var propType = getPropType(propValue);
      if (propType !== expectedType) {
        // `propValue` being instance of, say, date/regexp, pass the 'object'
        // check, but we can offer a more precise error message here rather than
        // 'of type `object`'.
        var preciseType = getPreciseType(propValue);

        return new PropTypeError(
          'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
          {expectedType: expectedType}
        );
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createAnyTypeChecker() {
    return createChainableTypeChecker(emptyFunctionThatReturnsNull);
  }

  function createArrayOfTypeChecker(typeChecker) {
    function validate(props, propName, componentName, location, propFullName) {
      if (typeof typeChecker !== 'function') {
        return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
      }
      var propValue = props[propName];
      if (!Array.isArray(propValue)) {
        var propType = getPropType(propValue);
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
      }
      for (var i = 0; i < propValue.length; i++) {
        var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
        if (error instanceof Error) {
          return error;
        }
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createElementTypeChecker() {
    function validate(props, propName, componentName, location, propFullName) {
      var propValue = props[propName];
      if (!isValidElement(propValue)) {
        var propType = getPropType(propValue);
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createElementTypeTypeChecker() {
    function validate(props, propName, componentName, location, propFullName) {
      var propValue = props[propName];
      if (!ReactIs.isValidElementType(propValue)) {
        var propType = getPropType(propValue);
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createInstanceTypeChecker(expectedClass) {
    function validate(props, propName, componentName, location, propFullName) {
      if (!(props[propName] instanceof expectedClass)) {
        var expectedClassName = expectedClass.name || ANONYMOUS;
        var actualClassName = getClassName(props[propName]);
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createEnumTypeChecker(expectedValues) {
    if (!Array.isArray(expectedValues)) {
      if (true) {
        if (arguments.length > 1) {
          printWarning(
            'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
            'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
          );
        } else {
          printWarning('Invalid argument supplied to oneOf, expected an array.');
        }
      }
      return emptyFunctionThatReturnsNull;
    }

    function validate(props, propName, componentName, location, propFullName) {
      var propValue = props[propName];
      for (var i = 0; i < expectedValues.length; i++) {
        if (is(propValue, expectedValues[i])) {
          return null;
        }
      }

      var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
        var type = getPreciseType(value);
        if (type === 'symbol') {
          return String(value);
        }
        return value;
      });
      return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
    }
    return createChainableTypeChecker(validate);
  }

  function createObjectOfTypeChecker(typeChecker) {
    function validate(props, propName, componentName, location, propFullName) {
      if (typeof typeChecker !== 'function') {
        return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
      }
      var propValue = props[propName];
      var propType = getPropType(propValue);
      if (propType !== 'object') {
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
      }
      for (var key in propValue) {
        if (has(propValue, key)) {
          var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
          if (error instanceof Error) {
            return error;
          }
        }
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createUnionTypeChecker(arrayOfTypeCheckers) {
    if (!Array.isArray(arrayOfTypeCheckers)) {
       true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : 0;
      return emptyFunctionThatReturnsNull;
    }

    for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
      var checker = arrayOfTypeCheckers[i];
      if (typeof checker !== 'function') {
        printWarning(
          'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
          'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
        );
        return emptyFunctionThatReturnsNull;
      }
    }

    function validate(props, propName, componentName, location, propFullName) {
      var expectedTypes = [];
      for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
        var checker = arrayOfTypeCheckers[i];
        var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
        if (checkerResult == null) {
          return null;
        }
        if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
          expectedTypes.push(checkerResult.data.expectedType);
        }
      }
      var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
      return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
    }
    return createChainableTypeChecker(validate);
  }

  function createNodeChecker() {
    function validate(props, propName, componentName, location, propFullName) {
      if (!isNode(props[propName])) {
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function invalidValidatorError(componentName, location, propFullName, key, type) {
    return new PropTypeError(
      (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
      'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
    );
  }

  function createShapeTypeChecker(shapeTypes) {
    function validate(props, propName, componentName, location, propFullName) {
      var propValue = props[propName];
      var propType = getPropType(propValue);
      if (propType !== 'object') {
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
      }
      for (var key in shapeTypes) {
        var checker = shapeTypes[key];
        if (typeof checker !== 'function') {
          return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
        }
        var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
        if (error) {
          return error;
        }
      }
      return null;
    }
    return createChainableTypeChecker(validate);
  }

  function createStrictShapeTypeChecker(shapeTypes) {
    function validate(props, propName, componentName, location, propFullName) {
      var propValue = props[propName];
      var propType = getPropType(propValue);
      if (propType !== 'object') {
        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
      }
      // We need to check all keys in case some are required but missing from props.
      var allKeys = assign({}, props[propName], shapeTypes);
      for (var key in allKeys) {
        var checker = shapeTypes[key];
        if (has(shapeTypes, key) && typeof checker !== 'function') {
          return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
        }
        if (!checker) {
          return new PropTypeError(
            'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
            '\nBad object: ' + JSON.stringify(props[propName], null, '  ') +
            '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, '  ')
          );
        }
        var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
        if (error) {
          return error;
        }
      }
      return null;
    }

    return createChainableTypeChecker(validate);
  }

  function isNode(propValue) {
    switch (typeof propValue) {
      case 'number':
      case 'string':
      case 'undefined':
        return true;
      case 'boolean':
        return !propValue;
      case 'object':
        if (Array.isArray(propValue)) {
          return propValue.every(isNode);
        }
        if (propValue === null || isValidElement(propValue)) {
          return true;
        }

        var iteratorFn = getIteratorFn(propValue);
        if (iteratorFn) {
          var iterator = iteratorFn.call(propValue);
          var step;
          if (iteratorFn !== propValue.entries) {
            while (!(step = iterator.next()).done) {
              if (!isNode(step.value)) {
                return false;
              }
            }
          } else {
            // Iterator will provide entry [k,v] tuples rather than values.
            while (!(step = iterator.next()).done) {
              var entry = step.value;
              if (entry) {
                if (!isNode(entry[1])) {
                  return false;
                }
              }
            }
          }
        } else {
          return false;
        }

        return true;
      default:
        return false;
    }
  }

  function isSymbol(propType, propValue) {
    // Native Symbol.
    if (propType === 'symbol') {
      return true;
    }

    // falsy value can't be a Symbol
    if (!propValue) {
      return false;
    }

    // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
    if (propValue['@@toStringTag'] === 'Symbol') {
      return true;
    }

    // Fallback for non-spec compliant Symbols which are polyfilled.
    if (typeof Symbol === 'function' && propValue instanceof Symbol) {
      return true;
    }

    return false;
  }

  // Equivalent of `typeof` but with special handling for array and regexp.
  function getPropType(propValue) {
    var propType = typeof propValue;
    if (Array.isArray(propValue)) {
      return 'array';
    }
    if (propValue instanceof RegExp) {
      // Old webkits (at least until Android 4.0) return 'function' rather than
      // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
      // passes PropTypes.object.
      return 'object';
    }
    if (isSymbol(propType, propValue)) {
      return 'symbol';
    }
    return propType;
  }

  // This handles more types than `getPropType`. Only used for error messages.
  // See `createPrimitiveTypeChecker`.
  function getPreciseType(propValue) {
    if (typeof propValue === 'undefined' || propValue === null) {
      return '' + propValue;
    }
    var propType = getPropType(propValue);
    if (propType === 'object') {
      if (propValue instanceof Date) {
        return 'date';
      } else if (propValue instanceof RegExp) {
        return 'regexp';
      }
    }
    return propType;
  }

  // Returns a string that is postfixed to a warning about an invalid type.
  // For example, "undefined" or "of type array"
  function getPostfixForTypeWarning(value) {
    var type = getPreciseType(value);
    switch (type) {
      case 'array':
      case 'object':
        return 'an ' + type;
      case 'boolean':
      case 'date':
      case 'regexp':
        return 'a ' + type;
      default:
        return type;
    }
  }

  // Returns class name of the object, if any.
  function getClassName(propValue) {
    if (!propValue.constructor || !propValue.constructor.name) {
      return ANONYMOUS;
    }
    return propValue.constructor.name;
  }

  ReactPropTypes.checkPropTypes = checkPropTypes;
  ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
  ReactPropTypes.PropTypes = ReactPropTypes;

  return ReactPropTypes;
};


/***/ }),

/***/ "./node_modules/prop-types/index.js":
/*!******************************************!*\
  !*** ./node_modules/prop-types/index.js ***!
  \******************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

if (true) {
  var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/prop-types/node_modules/react-is/index.js");

  // By explicitly using `prop-types` you are opting into new development behavior.
  // http://fb.me/prop-types-in-prod
  var throwOnDirectAccess = true;
  module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess);
} else // removed by dead control flow
{}


/***/ }),

/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
/*!*************************************************************!*\
  !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
  \*************************************************************/
/***/ (function(module) {

"use strict";
/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

module.exports = ReactPropTypesSecret;


/***/ }),

/***/ "./node_modules/prop-types/lib/has.js":
/*!********************************************!*\
  !*** ./node_modules/prop-types/lib/has.js ***!
  \********************************************/
/***/ (function(module) {

module.exports = Function.call.bind(Object.prototype.hasOwnProperty);


/***/ }),

/***/ "./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js":
/*!***********************************************************************************!*\
  !*** ./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, exports) {

"use strict";
/** @license React v16.13.1
 * react-is.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */





if (true) {
  (function() {
'use strict';

// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
// (unstable) APIs that have been removed. Can we remove the symbols?

var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;

function isValidElementType(type) {
  return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
}

function typeOf(object) {
  if (typeof object === 'object' && object !== null) {
    var $$typeof = object.$$typeof;

    switch ($$typeof) {
      case REACT_ELEMENT_TYPE:
        var type = object.type;

        switch (type) {
          case REACT_ASYNC_MODE_TYPE:
          case REACT_CONCURRENT_MODE_TYPE:
          case REACT_FRAGMENT_TYPE:
          case REACT_PROFILER_TYPE:
          case REACT_STRICT_MODE_TYPE:
          case REACT_SUSPENSE_TYPE:
            return type;

          default:
            var $$typeofType = type && type.$$typeof;

            switch ($$typeofType) {
              case REACT_CONTEXT_TYPE:
              case REACT_FORWARD_REF_TYPE:
              case REACT_LAZY_TYPE:
              case REACT_MEMO_TYPE:
              case REACT_PROVIDER_TYPE:
                return $$typeofType;

              default:
                return $$typeof;
            }

        }

      case REACT_PORTAL_TYPE:
        return $$typeof;
    }
  }

  return undefined;
} // AsyncMode is deprecated along with isAsyncMode

var AsyncMode = REACT_ASYNC_MODE_TYPE;
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated

function isAsyncMode(object) {
  {
    if (!hasWarnedAboutDeprecatedIsAsyncMode) {
      hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint

      console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
    }
  }

  return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
}
function isConcurrentMode(object) {
  return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
}
function isContextConsumer(object) {
  return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
  return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
  return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
  return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
  return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
  return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
  return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
  return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
  return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
  return typeOf(object) === REACT_SUSPENSE_TYPE;
}

exports.AsyncMode = AsyncMode;
exports.ConcurrentMode = ConcurrentMode;
exports.ContextConsumer = ContextConsumer;
exports.ContextProvider = ContextProvider;
exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Lazy = Lazy;
exports.Memo = Memo;
exports.Portal = Portal;
exports.Profiler = Profiler;
exports.StrictMode = StrictMode;
exports.Suspense = Suspense;
exports.isAsyncMode = isAsyncMode;
exports.isConcurrentMode = isConcurrentMode;
exports.isContextConsumer = isContextConsumer;
exports.isContextProvider = isContextProvider;
exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isLazy = isLazy;
exports.isMemo = isMemo;
exports.isPortal = isPortal;
exports.isProfiler = isProfiler;
exports.isStrictMode = isStrictMode;
exports.isSuspense = isSuspense;
exports.isValidElementType = isValidElementType;
exports.typeOf = typeOf;
  })();
}


/***/ }),

/***/ "./node_modules/prop-types/node_modules/react-is/index.js":
/*!****************************************************************!*\
  !*** ./node_modules/prop-types/node_modules/react-is/index.js ***!
  \****************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";


if (false) // removed by dead control flow
{} else {
  module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js");
}


/***/ }),

/***/ "./node_modules/prosemirror-commands/dist/index.js":
/*!*********************************************************!*\
  !*** ./node_modules/prosemirror-commands/dist/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   autoJoin: function() { return /* binding */ autoJoin; },
/* harmony export */   baseKeymap: function() { return /* binding */ baseKeymap; },
/* harmony export */   chainCommands: function() { return /* binding */ chainCommands; },
/* harmony export */   createParagraphNear: function() { return /* binding */ createParagraphNear; },
/* harmony export */   deleteSelection: function() { return /* binding */ deleteSelection; },
/* harmony export */   exitCode: function() { return /* binding */ exitCode; },
/* harmony export */   joinBackward: function() { return /* binding */ joinBackward; },
/* harmony export */   joinDown: function() { return /* binding */ joinDown; },
/* harmony export */   joinForward: function() { return /* binding */ joinForward; },
/* harmony export */   joinTextblockBackward: function() { return /* binding */ joinTextblockBackward; },
/* harmony export */   joinTextblockForward: function() { return /* binding */ joinTextblockForward; },
/* harmony export */   joinUp: function() { return /* binding */ joinUp; },
/* harmony export */   lift: function() { return /* binding */ lift; },
/* harmony export */   liftEmptyBlock: function() { return /* binding */ liftEmptyBlock; },
/* harmony export */   macBaseKeymap: function() { return /* binding */ macBaseKeymap; },
/* harmony export */   newlineInCode: function() { return /* binding */ newlineInCode; },
/* harmony export */   pcBaseKeymap: function() { return /* binding */ pcBaseKeymap; },
/* harmony export */   selectAll: function() { return /* binding */ selectAll; },
/* harmony export */   selectNodeBackward: function() { return /* binding */ selectNodeBackward; },
/* harmony export */   selectNodeForward: function() { return /* binding */ selectNodeForward; },
/* harmony export */   selectParentNode: function() { return /* binding */ selectParentNode; },
/* harmony export */   selectTextblockEnd: function() { return /* binding */ selectTextblockEnd; },
/* harmony export */   selectTextblockStart: function() { return /* binding */ selectTextblockStart; },
/* harmony export */   setBlockType: function() { return /* binding */ setBlockType; },
/* harmony export */   splitBlock: function() { return /* binding */ splitBlock; },
/* harmony export */   splitBlockAs: function() { return /* binding */ splitBlockAs; },
/* harmony export */   splitBlockKeepMarks: function() { return /* binding */ splitBlockKeepMarks; },
/* harmony export */   toggleMark: function() { return /* binding */ toggleMark; },
/* harmony export */   wrapIn: function() { return /* binding */ wrapIn; }
/* harmony export */ });
/* harmony import */ var prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-transform */ "./node_modules/prosemirror-transform/dist/index.js");
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");
/* harmony import */ var prosemirror_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prosemirror-state */ "./node_modules/prosemirror-state/dist/index.js");




/**
Delete the selection, if there is one.
*/
const deleteSelection = (state, dispatch) => {
    if (state.selection.empty)
        return false;
    if (dispatch)
        dispatch(state.tr.deleteSelection().scrollIntoView());
    return true;
};
function atBlockStart(state, view) {
    let { $cursor } = state.selection;
    if (!$cursor || (view ? !view.endOfTextblock("backward", state)
        : $cursor.parentOffset > 0))
        return null;
    return $cursor;
}
/**
If the selection is empty and at the start of a textblock, try to
reduce the distance between that block and the one before it—if
there's a block directly before it that can be joined, join them.
If not, try to move the selected block closer to the next one in
the document structure by lifting it out of its parent or moving it
into a parent of the previous block. Will use the view for accurate
(bidi-aware) start-of-textblock detection if given.
*/
const joinBackward = (state, dispatch, view) => {
    let $cursor = atBlockStart(state, view);
    if (!$cursor)
        return false;
    let $cut = findCutBefore($cursor);
    // If there is no node before this, try to lift
    if (!$cut) {
        let range = $cursor.blockRange(), target = range && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(range);
        if (target == null)
            return false;
        if (dispatch)
            dispatch(state.tr.lift(range, target).scrollIntoView());
        return true;
    }
    let before = $cut.nodeBefore;
    // Apply the joining algorithm
    if (deleteBarrier(state, $cut, dispatch, -1))
        return true;
    // If the node below has no content and the node above is
    // selectable, delete the node below and select the one above.
    if ($cursor.parent.content.size == 0 &&
        (textblockAt(before, "end") || prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.isSelectable(before))) {
        for (let depth = $cursor.depth;; depth--) {
            let delStep = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.replaceStep)(state.doc, $cursor.before(depth), $cursor.after(depth), prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.empty);
            if (delStep && delStep.slice.size < delStep.to - delStep.from) {
                if (dispatch) {
                    let tr = state.tr.step(delStep);
                    tr.setSelection(textblockAt(before, "end")
                        ? prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1)
                        : prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));
                    dispatch(tr.scrollIntoView());
                }
                return true;
            }
            if (depth == 1 || $cursor.node(depth - 1).childCount > 1)
                break;
        }
    }
    // If the node before is an atom, delete it
    if (before.isAtom && $cut.depth == $cursor.depth - 1) {
        if (dispatch)
            dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());
        return true;
    }
    return false;
};
/**
A more limited form of [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward)
that only tries to join the current textblock to the one before
it, if the cursor is at the start of a textblock.
*/
const joinTextblockBackward = (state, dispatch, view) => {
    let $cursor = atBlockStart(state, view);
    if (!$cursor)
        return false;
    let $cut = findCutBefore($cursor);
    return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
};
/**
A more limited form of [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward)
that only tries to join the current textblock to the one after
it, if the cursor is at the end of a textblock.
*/
const joinTextblockForward = (state, dispatch, view) => {
    let $cursor = atBlockEnd(state, view);
    if (!$cursor)
        return false;
    let $cut = findCutAfter($cursor);
    return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
};
function joinTextblocksAround(state, $cut, dispatch) {
    let before = $cut.nodeBefore, beforeText = before, beforePos = $cut.pos - 1;
    for (; !beforeText.isTextblock; beforePos--) {
        if (beforeText.type.spec.isolating)
            return false;
        let child = beforeText.lastChild;
        if (!child)
            return false;
        beforeText = child;
    }
    let after = $cut.nodeAfter, afterText = after, afterPos = $cut.pos + 1;
    for (; !afterText.isTextblock; afterPos++) {
        if (afterText.type.spec.isolating)
            return false;
        let child = afterText.firstChild;
        if (!child)
            return false;
        afterText = child;
    }
    let step = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.replaceStep)(state.doc, beforePos, afterPos, prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.empty);
    if (!step || step.from != beforePos ||
        step instanceof prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceStep && step.slice.size >= afterPos - beforePos)
        return false;
    if (dispatch) {
        let tr = state.tr.step(step);
        tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(tr.doc, beforePos));
        dispatch(tr.scrollIntoView());
    }
    return true;
}
function textblockAt(node, side, only = false) {
    for (let scan = node; scan; scan = (side == "start" ? scan.firstChild : scan.lastChild)) {
        if (scan.isTextblock)
            return true;
        if (only && scan.childCount != 1)
            return false;
    }
    return false;
}
/**
When the selection is empty and at the start of a textblock, select
the node before that textblock, if possible. This is intended to be
bound to keys like backspace, after
[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting
commands, as a fall-back behavior when the schema doesn't allow
deletion at the selected point.
*/
const selectNodeBackward = (state, dispatch, view) => {
    let { $head, empty } = state.selection, $cut = $head;
    if (!empty)
        return false;
    if ($head.parent.isTextblock) {
        if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0)
            return false;
        $cut = findCutBefore($head);
    }
    let node = $cut && $cut.nodeBefore;
    if (!node || !prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.isSelectable(node))
        return false;
    if (dispatch)
        dispatch(state.tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());
    return true;
};
function findCutBefore($pos) {
    if (!$pos.parent.type.spec.isolating)
        for (let i = $pos.depth - 1; i >= 0; i--) {
            if ($pos.index(i) > 0)
                return $pos.doc.resolve($pos.before(i + 1));
            if ($pos.node(i).type.spec.isolating)
                break;
        }
    return null;
}
function atBlockEnd(state, view) {
    let { $cursor } = state.selection;
    if (!$cursor || (view ? !view.endOfTextblock("forward", state)
        : $cursor.parentOffset < $cursor.parent.content.size))
        return null;
    return $cursor;
}
/**
If the selection is empty and the cursor is at the end of a
textblock, try to reduce or remove the boundary between that block
and the one after it, either by joining them or by moving the other
block closer to this one in the tree structure. Will use the view
for accurate start-of-textblock detection if given.
*/
const joinForward = (state, dispatch, view) => {
    let $cursor = atBlockEnd(state, view);
    if (!$cursor)
        return false;
    let $cut = findCutAfter($cursor);
    // If there is no node after this, there's nothing to do
    if (!$cut)
        return false;
    let after = $cut.nodeAfter;
    // Try the joining algorithm
    if (deleteBarrier(state, $cut, dispatch, 1))
        return true;
    // If the node above has no content and the node below is
    // selectable, delete the node above and select the one below.
    if ($cursor.parent.content.size == 0 &&
        (textblockAt(after, "start") || prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.isSelectable(after))) {
        let delStep = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.replaceStep)(state.doc, $cursor.before(), $cursor.after(), prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.empty);
        if (delStep && delStep.slice.size < delStep.to - delStep.from) {
            if (dispatch) {
                let tr = state.tr.step(delStep);
                tr.setSelection(textblockAt(after, "start") ? prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1)
                    : prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));
                dispatch(tr.scrollIntoView());
            }
            return true;
        }
    }
    // If the next node is an atom, delete it
    if (after.isAtom && $cut.depth == $cursor.depth - 1) {
        if (dispatch)
            dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());
        return true;
    }
    return false;
};
/**
When the selection is empty and at the end of a textblock, select
the node coming after that textblock, if possible. This is intended
to be bound to keys like delete, after
[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting
commands, to provide a fall-back behavior when the schema doesn't
allow deletion at the selected point.
*/
const selectNodeForward = (state, dispatch, view) => {
    let { $head, empty } = state.selection, $cut = $head;
    if (!empty)
        return false;
    if ($head.parent.isTextblock) {
        if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size)
            return false;
        $cut = findCutAfter($head);
    }
    let node = $cut && $cut.nodeAfter;
    if (!node || !prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.isSelectable(node))
        return false;
    if (dispatch)
        dispatch(state.tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());
    return true;
};
function findCutAfter($pos) {
    if (!$pos.parent.type.spec.isolating)
        for (let i = $pos.depth - 1; i >= 0; i--) {
            let parent = $pos.node(i);
            if ($pos.index(i) + 1 < parent.childCount)
                return $pos.doc.resolve($pos.after(i + 1));
            if (parent.type.spec.isolating)
                break;
        }
    return null;
}
/**
Join the selected block or, if there is a text selection, the
closest ancestor block of the selection that can be joined, with
the sibling above it.
*/
const joinUp = (state, dispatch) => {
    let sel = state.selection, nodeSel = sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection, point;
    if (nodeSel) {
        if (sel.node.isTextblock || !(0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(state.doc, sel.from))
            return false;
        point = sel.from;
    }
    else {
        point = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.joinPoint)(state.doc, sel.from, -1);
        if (point == null)
            return false;
    }
    if (dispatch) {
        let tr = state.tr.join(point);
        if (nodeSel)
            tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));
        dispatch(tr.scrollIntoView());
    }
    return true;
};
/**
Join the selected block, or the closest ancestor of the selection
that can be joined, with the sibling after it.
*/
const joinDown = (state, dispatch) => {
    let sel = state.selection, point;
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection) {
        if (sel.node.isTextblock || !(0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(state.doc, sel.to))
            return false;
        point = sel.to;
    }
    else {
        point = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.joinPoint)(state.doc, sel.to, 1);
        if (point == null)
            return false;
    }
    if (dispatch)
        dispatch(state.tr.join(point).scrollIntoView());
    return true;
};
/**
Lift the selected block, or the closest ancestor block of the
selection that can be lifted, out of its parent node.
*/
const lift = (state, dispatch) => {
    let { $from, $to } = state.selection;
    let range = $from.blockRange($to), target = range && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(range);
    if (target == null)
        return false;
    if (dispatch)
        dispatch(state.tr.lift(range, target).scrollIntoView());
    return true;
};
/**
If the selection is in a node whose type has a truthy
[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the
selection with a newline character.
*/
const newlineInCode = (state, dispatch) => {
    let { $head, $anchor } = state.selection;
    if (!$head.parent.type.spec.code || !$head.sameParent($anchor))
        return false;
    if (dispatch)
        dispatch(state.tr.insertText("\n").scrollIntoView());
    return true;
};
function defaultBlockAt(match) {
    for (let i = 0; i < match.edgeCount; i++) {
        let { type } = match.edge(i);
        if (type.isTextblock && !type.hasRequiredAttrs())
            return type;
    }
    return null;
}
/**
When the selection is in a node with a truthy
[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a
default block after the code block, and move the cursor there.
*/
const exitCode = (state, dispatch) => {
    let { $head, $anchor } = state.selection;
    if (!$head.parent.type.spec.code || !$head.sameParent($anchor))
        return false;
    let above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt(above.contentMatchAt(after));
    if (!type || !above.canReplaceWith(after, after, type))
        return false;
    if (dispatch) {
        let pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());
        tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.Selection.near(tr.doc.resolve(pos), 1));
        dispatch(tr.scrollIntoView());
    }
    return true;
};
/**
If a block node is selected, create an empty paragraph before (if
it is its parent's first child) or after it.
*/
const createParagraphNear = (state, dispatch) => {
    let sel = state.selection, { $from, $to } = sel;
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.AllSelection || $from.parent.inlineContent || $to.parent.inlineContent)
        return false;
    let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));
    if (!type || !type.isTextblock)
        return false;
    if (dispatch) {
        let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;
        let tr = state.tr.insert(side, type.createAndFill());
        tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(tr.doc, side + 1));
        dispatch(tr.scrollIntoView());
    }
    return true;
};
/**
If the cursor is in an empty textblock that can be lifted, lift the
block.
*/
const liftEmptyBlock = (state, dispatch) => {
    let { $cursor } = state.selection;
    if (!$cursor || $cursor.parent.content.size)
        return false;
    if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {
        let before = $cursor.before();
        if ((0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(state.doc, before)) {
            if (dispatch)
                dispatch(state.tr.split(before).scrollIntoView());
            return true;
        }
    }
    let range = $cursor.blockRange(), target = range && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(range);
    if (target == null)
        return false;
    if (dispatch)
        dispatch(state.tr.lift(range, target).scrollIntoView());
    return true;
};
/**
Create a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses
a custom function to determine the type of the newly split off block.
*/
function splitBlockAs(splitNode) {
    return (state, dispatch) => {
        let { $from, $to } = state.selection;
        if (state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection && state.selection.node.isBlock) {
            if (!$from.parentOffset || !(0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(state.doc, $from.pos))
                return false;
            if (dispatch)
                dispatch(state.tr.split($from.pos).scrollIntoView());
            return true;
        }
        if (!$from.depth)
            return false;
        let types = [];
        let splitDepth, deflt, atEnd = false, atStart = false;
        for (let d = $from.depth;; d--) {
            let node = $from.node(d);
            if (node.isBlock) {
                atEnd = $from.end(d) == $from.pos + ($from.depth - d);
                atStart = $from.start(d) == $from.pos - ($from.depth - d);
                deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
                let splitType = splitNode && splitNode($to.parent, atEnd, $from);
                types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));
                splitDepth = d;
                break;
            }
            else {
                if (d == 1)
                    return false;
                types.unshift(null);
            }
        }
        let tr = state.tr;
        if (state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection || state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.AllSelection)
            tr.deleteSelection();
        let splitPos = tr.mapping.map($from.pos);
        let can = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, splitPos, types.length, types);
        if (!can) {
            types[0] = deflt ? { type: deflt } : null;
            can = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, splitPos, types.length, types);
        }
        if (!can)
            return false;
        tr.split(splitPos, types.length, types);
        if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
            let first = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);
            if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt))
                tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
        }
        if (dispatch)
            dispatch(tr.scrollIntoView());
        return true;
    };
}
/**
Split the parent block of the selection. If the selection is a text
selection, also delete its content.
*/
const splitBlock = splitBlockAs();
/**
Acts like [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock), but without
resetting the set of active marks at the cursor.
*/
const splitBlockKeepMarks = (state, dispatch) => {
    return splitBlock(state, dispatch && (tr => {
        let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
        if (marks)
            tr.ensureMarks(marks);
        dispatch(tr);
    }));
};
/**
Move the selection to the node wrapping the current selection, if
any. (Will not select the document node.)
*/
const selectParentNode = (state, dispatch) => {
    let { $from, to } = state.selection, pos;
    let same = $from.sharedDepth(to);
    if (same == 0)
        return false;
    pos = $from.before(same);
    if (dispatch)
        dispatch(state.tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.NodeSelection.create(state.doc, pos)));
    return true;
};
/**
Select the whole document.
*/
const selectAll = (state, dispatch) => {
    if (dispatch)
        dispatch(state.tr.setSelection(new prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.AllSelection(state.doc)));
    return true;
};
function joinMaybeClear(state, $pos, dispatch) {
    let before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();
    if (!before || !after || !before.type.compatibleContent(after.type))
        return false;
    if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {
        if (dispatch)
            dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());
        return true;
    }
    if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(state.doc, $pos.pos)))
        return false;
    if (dispatch)
        dispatch(state.tr.join($pos.pos).scrollIntoView());
    return true;
}
function deleteBarrier(state, $cut, dispatch, dir) {
    let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;
    let isolated = before.type.spec.isolating || after.type.spec.isolating;
    if (!isolated && joinMaybeClear(state, $cut, dispatch))
        return true;
    let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
    if (canDelAfter &&
        (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) &&
        match.matchType(conn[0] || after.type).validEnd) {
        if (dispatch) {
            let end = $cut.pos + after.nodeSize, wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty;
            for (let i = conn.length - 1; i >= 0; i--)
                wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(conn[i].create(null, wrap));
            wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(before.copy(wrap));
            let tr = state.tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(wrap, 1, 0), conn.length, true));
            let $joinAt = tr.doc.resolve(end + 2 * conn.length);
            if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type &&
                (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, $joinAt.pos))
                tr.join($joinAt.pos);
            dispatch(tr.scrollIntoView());
        }
        return true;
    }
    let selAfter = after.type.spec.isolating || (dir > 0 && isolated) ? null : prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.Selection.findFrom($cut, 1);
    let range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(range);
    if (target != null && target >= $cut.depth) {
        if (dispatch)
            dispatch(state.tr.lift(range, target).scrollIntoView());
        return true;
    }
    if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) {
        let at = before, wrap = [];
        for (;;) {
            wrap.push(at);
            if (at.isTextblock)
                break;
            at = at.lastChild;
        }
        let afterText = after, afterDepth = 1;
        for (; !afterText.isTextblock; afterText = afterText.firstChild)
            afterDepth++;
        if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
            if (dispatch) {
                let end = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty;
                for (let i = wrap.length - 1; i >= 0; i--)
                    end = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(wrap[i].copy(end));
                let tr = state.tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(end, wrap.length, 0), 0, true));
                dispatch(tr.scrollIntoView());
            }
            return true;
        }
    }
    return false;
}
function selectTextblockSide(side) {
    return function (state, dispatch) {
        let sel = state.selection, $pos = side < 0 ? sel.$from : sel.$to;
        let depth = $pos.depth;
        while ($pos.node(depth).isInline) {
            if (!depth)
                return false;
            depth--;
        }
        if (!$pos.node(depth).isTextblock)
            return false;
        if (dispatch)
            dispatch(state.tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));
        return true;
    };
}
/**
Moves the cursor to the start of current text block.
*/
const selectTextblockStart = selectTextblockSide(-1);
/**
Moves the cursor to the end of current text block.
*/
const selectTextblockEnd = selectTextblockSide(1);
// Parameterized commands
/**
Wrap the selection in a node of the given type with the given
attributes.
*/
function wrapIn(nodeType, attrs = null) {
    return function (state, dispatch) {
        let { $from, $to } = state.selection;
        let range = $from.blockRange($to), wrapping = range && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.findWrapping)(range, nodeType, attrs);
        if (!wrapping)
            return false;
        if (dispatch)
            dispatch(state.tr.wrap(range, wrapping).scrollIntoView());
        return true;
    };
}
/**
Returns a command that tries to set the selected textblocks to the
given node type with the given attributes.
*/
function setBlockType(nodeType, attrs = null) {
    return function (state, dispatch) {
        let applicable = false;
        for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {
            let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
            state.doc.nodesBetween(from, to, (node, pos) => {
                if (applicable)
                    return false;
                if (!node.isTextblock || node.hasMarkup(nodeType, attrs))
                    return;
                if (node.type == nodeType) {
                    applicable = true;
                }
                else {
                    let $pos = state.doc.resolve(pos), index = $pos.index();
                    applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);
                }
            });
        }
        if (!applicable)
            return false;
        if (dispatch) {
            let tr = state.tr;
            for (let i = 0; i < state.selection.ranges.length; i++) {
                let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
                tr.setBlockType(from, to, nodeType, attrs);
            }
            dispatch(tr.scrollIntoView());
        }
        return true;
    };
}
function markApplies(doc, ranges, type, enterAtoms) {
    for (let i = 0; i < ranges.length; i++) {
        let { $from, $to } = ranges[i];
        let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;
        doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
            if (can || !enterAtoms && node.isAtom && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos)
                return false;
            can = node.inlineContent && node.type.allowsMarkType(type);
        });
        if (can)
            return true;
    }
    return false;
}
function removeInlineAtoms(ranges) {
    let result = [];
    for (let i = 0; i < ranges.length; i++) {
        let { $from, $to } = ranges[i];
        $from.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
            if (node.isAtom && node.content.size && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) {
                if (pos + 1 > $from.pos)
                    result.push(new prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.SelectionRange($from, $from.doc.resolve(pos + 1)));
                $from = $from.doc.resolve(pos + 1 + node.content.size);
                return false;
            }
        });
        if ($from.pos < $to.pos)
            result.push(new prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.SelectionRange($from, $to));
    }
    return result;
}
/**
Create a command function that toggles the given mark with the
given attributes. Will return `false` when the current selection
doesn't support that mark. This will remove the mark if any marks
of that type exist in the selection, or add it otherwise. If the
selection is empty, this applies to the [stored
marks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the
document.
*/
function toggleMark(markType, attrs = null, options) {
    let removeWhenPresent = (options && options.removeWhenPresent) !== false;
    let enterAtoms = (options && options.enterInlineAtoms) !== false;
    let dropSpace = !(options && options.includeWhitespace);
    return function (state, dispatch) {
        let { empty, $cursor, ranges } = state.selection;
        if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType, enterAtoms))
            return false;
        if (dispatch) {
            if ($cursor) {
                if (markType.isInSet(state.storedMarks || $cursor.marks()))
                    dispatch(state.tr.removeStoredMark(markType));
                else
                    dispatch(state.tr.addStoredMark(markType.create(attrs)));
            }
            else {
                let add, tr = state.tr;
                if (!enterAtoms)
                    ranges = removeInlineAtoms(ranges);
                if (removeWhenPresent) {
                    add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));
                }
                else {
                    add = !ranges.every(r => {
                        let missing = false;
                        tr.doc.nodesBetween(r.$from.pos, r.$to.pos, (node, pos, parent) => {
                            if (missing)
                                return false;
                            missing = !markType.isInSet(node.marks) && !!parent && parent.type.allowsMarkType(markType) &&
                                !(node.isText && /^\s*$/.test(node.textBetween(Math.max(0, r.$from.pos - pos), Math.min(node.nodeSize, r.$to.pos - pos))));
                        });
                        return !missing;
                    });
                }
                for (let i = 0; i < ranges.length; i++) {
                    let { $from, $to } = ranges[i];
                    if (!add) {
                        tr.removeMark($from.pos, $to.pos, markType);
                    }
                    else {
                        let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;
                        let spaceStart = dropSpace && start && start.isText ? /^\s*/.exec(start.text)[0].length : 0;
                        let spaceEnd = dropSpace && end && end.isText ? /\s*$/.exec(end.text)[0].length : 0;
                        if (from + spaceStart < to) {
                            from += spaceStart;
                            to -= spaceEnd;
                        }
                        tr.addMark(from, to, markType.create(attrs));
                    }
                }
                dispatch(tr.scrollIntoView());
            }
        }
        return true;
    };
}
function wrapDispatchForJoin(dispatch, isJoinable) {
    return (tr) => {
        if (!tr.isGeneric)
            return dispatch(tr);
        let ranges = [];
        for (let i = 0; i < tr.mapping.maps.length; i++) {
            let map = tr.mapping.maps[i];
            for (let j = 0; j < ranges.length; j++)
                ranges[j] = map.map(ranges[j]);
            map.forEach((_s, _e, from, to) => ranges.push(from, to));
        }
        // Figure out which joinable points exist inside those ranges,
        // by checking all node boundaries in their parent nodes.
        let joinable = [];
        for (let i = 0; i < ranges.length; i += 2) {
            let from = ranges[i], to = ranges[i + 1];
            let $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);
            for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
                let after = parent.maybeChild(index);
                if (!after)
                    break;
                if (index && joinable.indexOf(pos) == -1) {
                    let before = parent.child(index - 1);
                    if (before.type == after.type && isJoinable(before, after))
                        joinable.push(pos);
                }
                pos += after.nodeSize;
            }
        }
        // Join the joinable points
        joinable.sort((a, b) => a - b);
        for (let i = joinable.length - 1; i >= 0; i--) {
            if ((0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, joinable[i]))
                tr.join(joinable[i]);
        }
        dispatch(tr);
    };
}
/**
Wrap a command so that, when it produces a transform that causes
two joinable nodes to end up next to each other, those are joined.
Nodes are considered joinable when they are of the same type and
when the `isJoinable` predicate returns true for them or, if an
array of strings was passed, if their node type name is in that
array.
*/
function autoJoin(command, isJoinable) {
    let canJoin = Array.isArray(isJoinable) ? (node) => isJoinable.indexOf(node.type.name) > -1
        : isJoinable;
    return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);
}
/**
Combine a number of command functions into a single function (which
calls them one by one until one returns true).
*/
function chainCommands(...commands) {
    return function (state, dispatch, view) {
        for (let i = 0; i < commands.length; i++)
            if (commands[i](state, dispatch, view))
                return true;
        return false;
    };
}
let backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);
let del = chainCommands(deleteSelection, joinForward, selectNodeForward);
/**
A basic keymap containing bindings not specific to any schema.
Binds the following keys (when multiple commands are listed, they
are chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):

* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`
* **Mod-Enter** to `exitCode`
* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`
* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
* **Mod-a** to `selectAll`
*/
const pcBaseKeymap = {
    "Enter": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),
    "Mod-Enter": exitCode,
    "Backspace": backspace,
    "Mod-Backspace": backspace,
    "Shift-Backspace": backspace,
    "Delete": del,
    "Mod-Delete": del,
    "Mod-a": selectAll
};
/**
A copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,
**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and
**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like
Ctrl-Delete.
*/
const macBaseKeymap = {
    "Ctrl-h": pcBaseKeymap["Backspace"],
    "Alt-Backspace": pcBaseKeymap["Mod-Backspace"],
    "Ctrl-d": pcBaseKeymap["Delete"],
    "Ctrl-Alt-Backspace": pcBaseKeymap["Mod-Delete"],
    "Alt-Delete": pcBaseKeymap["Mod-Delete"],
    "Alt-d": pcBaseKeymap["Mod-Delete"],
    "Ctrl-a": selectTextblockStart,
    "Ctrl-e": selectTextblockEnd
};
for (let key in pcBaseKeymap)
    macBaseKeymap[key] = pcBaseKeymap[key];
const mac = typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform)
    // @ts-ignore
    : typeof os != "undefined" && os.platform ? os.platform() == "darwin" : false;
/**
Depending on the detected platform, this will hold
[`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or
[`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).
*/
const baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;




/***/ }),

/***/ "./node_modules/prosemirror-keymap/dist/index.js":
/*!*******************************************************!*\
  !*** ./node_modules/prosemirror-keymap/dist/index.js ***!
  \*******************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   keydownHandler: function() { return /* binding */ keydownHandler; },
/* harmony export */   keymap: function() { return /* binding */ keymap; }
/* harmony export */ });
/* harmony import */ var w3c_keyname__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! w3c-keyname */ "./node_modules/w3c-keyname/index.js");
/* harmony import */ var prosemirror_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prosemirror-state */ "./node_modules/prosemirror-state/dist/index.js");



const mac = typeof navigator != "undefined" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
const windows = typeof navigator != "undefined" && /Win/.test(navigator.platform);
function normalizeKeyName(name) {
    let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];
    if (result == "Space")
        result = " ";
    let alt, ctrl, shift, meta;
    for (let i = 0; i < parts.length - 1; i++) {
        let mod = parts[i];
        if (/^(cmd|meta|m)$/i.test(mod))
            meta = true;
        else if (/^a(lt)?$/i.test(mod))
            alt = true;
        else if (/^(c|ctrl|control)$/i.test(mod))
            ctrl = true;
        else if (/^s(hift)?$/i.test(mod))
            shift = true;
        else if (/^mod$/i.test(mod)) {
            if (mac)
                meta = true;
            else
                ctrl = true;
        }
        else
            throw new Error("Unrecognized modifier name: " + mod);
    }
    if (alt)
        result = "Alt-" + result;
    if (ctrl)
        result = "Ctrl-" + result;
    if (meta)
        result = "Meta-" + result;
    if (shift)
        result = "Shift-" + result;
    return result;
}
function normalize(map) {
    let copy = Object.create(null);
    for (let prop in map)
        copy[normalizeKeyName(prop)] = map[prop];
    return copy;
}
function modifiers(name, event, shift = true) {
    if (event.altKey)
        name = "Alt-" + name;
    if (event.ctrlKey)
        name = "Ctrl-" + name;
    if (event.metaKey)
        name = "Meta-" + name;
    if (shift && event.shiftKey)
        name = "Shift-" + name;
    return name;
}
/**
Create a keymap plugin for the given set of bindings.

Bindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style
functions, which will be called with `(EditorState, dispatch,
EditorView)` arguments, and should return true when they've handled
the key. Note that the view argument isn't part of the command
protocol, but can be used as an escape hatch if a binding needs to
directly interact with the UI.

Key names may be strings like `"Shift-Ctrl-Enter"`—a key
identifier prefixed with zero or more modifiers. Key identifiers
are based on the strings that can appear in
[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
Use lowercase letters to refer to letter keys (or uppercase letters
if you want shift to be held). You may use `"Space"` as an alias
for the `" "` name.

Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or
`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or
`Meta-`) are recognized. For characters that are created by holding
shift, the `Shift-` prefix is implied, and should not be added
explicitly.

You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on
other platforms.

You can add multiple keymap plugins to an editor. The order in
which they appear determines their precedence (the ones early in
the array get to dispatch first).
*/
function keymap(bindings) {
    return new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
}
/**
Given a set of bindings (using the same format as
[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown
handler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.
*/
function keydownHandler(bindings) {
    let map = normalize(bindings);
    return function (view, event) {
        let name = (0,w3c_keyname__WEBPACK_IMPORTED_MODULE_0__.keyName)(event), baseName, direct = map[modifiers(name, event)];
        if (direct && direct(view.state, view.dispatch, view))
            return true;
        // A character key
        if (name.length == 1 && name != " ") {
            if (event.shiftKey) {
                // In case the name was already modified by shift, try looking
                // it up without its shift modifier
                let noShift = map[modifiers(name, event, false)];
                if (noShift && noShift(view.state, view.dispatch, view))
                    return true;
            }
            if ((event.altKey || event.metaKey || event.ctrlKey) &&
                // Ctrl-Alt may be used for AltGr on Windows
                !(windows && event.ctrlKey && event.altKey) &&
                (baseName = w3c_keyname__WEBPACK_IMPORTED_MODULE_0__.base[event.keyCode]) && baseName != name) {
                // Try falling back to the keyCode when there's a modifier
                // active or the character produced isn't ASCII, and our table
                // produces a different name from the the keyCode. See #668,
                // #1060, #1529.
                let fromCode = map[modifiers(baseName, event)];
                if (fromCode && fromCode(view.state, view.dispatch, view))
                    return true;
            }
        }
        return false;
    };
}




/***/ }),

/***/ "./node_modules/prosemirror-model/dist/index.js":
/*!******************************************************!*\
  !*** ./node_modules/prosemirror-model/dist/index.js ***!
  \******************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ContentMatch: function() { return /* binding */ ContentMatch; },
/* harmony export */   DOMParser: function() { return /* binding */ DOMParser; },
/* harmony export */   DOMSerializer: function() { return /* binding */ DOMSerializer; },
/* harmony export */   Fragment: function() { return /* binding */ Fragment; },
/* harmony export */   Mark: function() { return /* binding */ Mark; },
/* harmony export */   MarkType: function() { return /* binding */ MarkType; },
/* harmony export */   Node: function() { return /* binding */ Node; },
/* harmony export */   NodeRange: function() { return /* binding */ NodeRange; },
/* harmony export */   NodeType: function() { return /* binding */ NodeType; },
/* harmony export */   ReplaceError: function() { return /* binding */ ReplaceError; },
/* harmony export */   ResolvedPos: function() { return /* binding */ ResolvedPos; },
/* harmony export */   Schema: function() { return /* binding */ Schema; },
/* harmony export */   Slice: function() { return /* binding */ Slice; }
/* harmony export */ });
/* harmony import */ var orderedmap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! orderedmap */ "./node_modules/orderedmap/dist/index.js");


function findDiffStart(a, b, pos) {
    for (let i = 0;; i++) {
        if (i == a.childCount || i == b.childCount)
            return a.childCount == b.childCount ? null : pos;
        let childA = a.child(i), childB = b.child(i);
        if (childA == childB) {
            pos += childA.nodeSize;
            continue;
        }
        if (!childA.sameMarkup(childB))
            return pos;
        if (childA.isText && childA.text != childB.text) {
            for (let j = 0; childA.text[j] == childB.text[j]; j++)
                pos++;
            return pos;
        }
        if (childA.content.size || childB.content.size) {
            let inner = findDiffStart(childA.content, childB.content, pos + 1);
            if (inner != null)
                return inner;
        }
        pos += childA.nodeSize;
    }
}
function findDiffEnd(a, b, posA, posB) {
    for (let iA = a.childCount, iB = b.childCount;;) {
        if (iA == 0 || iB == 0)
            return iA == iB ? null : { a: posA, b: posB };
        let childA = a.child(--iA), childB = b.child(--iB), size = childA.nodeSize;
        if (childA == childB) {
            posA -= size;
            posB -= size;
            continue;
        }
        if (!childA.sameMarkup(childB))
            return { a: posA, b: posB };
        if (childA.isText && childA.text != childB.text) {
            let same = 0, minSize = Math.min(childA.text.length, childB.text.length);
            while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
                same++;
                posA--;
                posB--;
            }
            return { a: posA, b: posB };
        }
        if (childA.content.size || childB.content.size) {
            let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);
            if (inner)
                return inner;
        }
        posA -= size;
        posB -= size;
    }
}

/**
A fragment represents a node's collection of child nodes.

Like nodes, fragments are persistent data structures, and you
should not mutate them or their content. Rather, you create new
instances whenever needed. The API tries to make this easy.
*/
class Fragment {
    /**
    @internal
    */
    constructor(
    /**
    The child nodes in this fragment.
    */
    content, size) {
        this.content = content;
        this.size = size || 0;
        if (size == null)
            for (let i = 0; i < content.length; i++)
                this.size += content[i].nodeSize;
    }
    /**
    Invoke a callback for all descendant nodes between the given two
    positions (relative to start of this fragment). Doesn't descend
    into a node when the callback returns `false`.
    */
    nodesBetween(from, to, f, nodeStart = 0, parent) {
        for (let i = 0, pos = 0; pos < to; i++) {
            let child = this.content[i], end = pos + child.nodeSize;
            if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
                let start = pos + 1;
                child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
            }
            pos = end;
        }
    }
    /**
    Call the given callback for every descendant node. `pos` will be
    relative to the start of the fragment. The callback may return
    `false` to prevent traversal of a given node's children.
    */
    descendants(f) {
        this.nodesBetween(0, this.size, f);
    }
    /**
    Extract the text between `from` and `to`. See the same method on
    [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
    */
    textBetween(from, to, blockSeparator, leafText) {
        let text = "", first = true;
        this.nodesBetween(from, to, (node, pos) => {
            let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos)
                : !node.isLeaf ? ""
                    : leafText ? (typeof leafText === "function" ? leafText(node) : leafText)
                        : node.type.spec.leafText ? node.type.spec.leafText(node)
                            : "";
            if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {
                if (first)
                    first = false;
                else
                    text += blockSeparator;
            }
            text += nodeText;
        }, 0);
        return text;
    }
    /**
    Create a new fragment containing the combined content of this
    fragment and the other.
    */
    append(other) {
        if (!other.size)
            return this;
        if (!this.size)
            return other;
        let last = this.lastChild, first = other.firstChild, content = this.content.slice(), i = 0;
        if (last.isText && last.sameMarkup(first)) {
            content[content.length - 1] = last.withText(last.text + first.text);
            i = 1;
        }
        for (; i < other.content.length; i++)
            content.push(other.content[i]);
        return new Fragment(content, this.size + other.size);
    }
    /**
    Cut out the sub-fragment between the two given positions.
    */
    cut(from, to = this.size) {
        if (from == 0 && to == this.size)
            return this;
        let result = [], size = 0;
        if (to > from)
            for (let i = 0, pos = 0; pos < to; i++) {
                let child = this.content[i], end = pos + child.nodeSize;
                if (end > from) {
                    if (pos < from || end > to) {
                        if (child.isText)
                            child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));
                        else
                            child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
                    }
                    result.push(child);
                    size += child.nodeSize;
                }
                pos = end;
            }
        return new Fragment(result, size);
    }
    /**
    @internal
    */
    cutByIndex(from, to) {
        if (from == to)
            return Fragment.empty;
        if (from == 0 && to == this.content.length)
            return this;
        return new Fragment(this.content.slice(from, to));
    }
    /**
    Create a new fragment in which the node at the given index is
    replaced by the given node.
    */
    replaceChild(index, node) {
        let current = this.content[index];
        if (current == node)
            return this;
        let copy = this.content.slice();
        let size = this.size + node.nodeSize - current.nodeSize;
        copy[index] = node;
        return new Fragment(copy, size);
    }
    /**
    Create a new fragment by prepending the given node to this
    fragment.
    */
    addToStart(node) {
        return new Fragment([node].concat(this.content), this.size + node.nodeSize);
    }
    /**
    Create a new fragment by appending the given node to this
    fragment.
    */
    addToEnd(node) {
        return new Fragment(this.content.concat(node), this.size + node.nodeSize);
    }
    /**
    Compare this fragment to another one.
    */
    eq(other) {
        if (this.content.length != other.content.length)
            return false;
        for (let i = 0; i < this.content.length; i++)
            if (!this.content[i].eq(other.content[i]))
                return false;
        return true;
    }
    /**
    The first child of the fragment, or `null` if it is empty.
    */
    get firstChild() { return this.content.length ? this.content[0] : null; }
    /**
    The last child of the fragment, or `null` if it is empty.
    */
    get lastChild() { return this.content.length ? this.content[this.content.length - 1] : null; }
    /**
    The number of child nodes in this fragment.
    */
    get childCount() { return this.content.length; }
    /**
    Get the child node at the given index. Raise an error when the
    index is out of range.
    */
    child(index) {
        let found = this.content[index];
        if (!found)
            throw new RangeError("Index " + index + " out of range for " + this);
        return found;
    }
    /**
    Get the child node at the given index, if it exists.
    */
    maybeChild(index) {
        return this.content[index] || null;
    }
    /**
    Call `f` for every child node, passing the node, its offset
    into this parent node, and its index.
    */
    forEach(f) {
        for (let i = 0, p = 0; i < this.content.length; i++) {
            let child = this.content[i];
            f(child, p, i);
            p += child.nodeSize;
        }
    }
    /**
    Find the first position at which this fragment and another
    fragment differ, or `null` if they are the same.
    */
    findDiffStart(other, pos = 0) {
        return findDiffStart(this, other, pos);
    }
    /**
    Find the first position, searching from the end, at which this
    fragment and the given fragment differ, or `null` if they are
    the same. Since this position will not be the same in both
    nodes, an object with two separate positions is returned.
    */
    findDiffEnd(other, pos = this.size, otherPos = other.size) {
        return findDiffEnd(this, other, pos, otherPos);
    }
    /**
    Find the index and inner offset corresponding to a given relative
    position in this fragment. The result object will be reused
    (overwritten) the next time the function is called. @internal
    */
    findIndex(pos) {
        if (pos == 0)
            return retIndex(0, pos);
        if (pos == this.size)
            return retIndex(this.content.length, pos);
        if (pos > this.size || pos < 0)
            throw new RangeError(`Position ${pos} outside of fragment (${this})`);
        for (let i = 0, curPos = 0;; i++) {
            let cur = this.child(i), end = curPos + cur.nodeSize;
            if (end >= pos) {
                if (end == pos)
                    return retIndex(i + 1, end);
                return retIndex(i, curPos);
            }
            curPos = end;
        }
    }
    /**
    Return a debugging string that describes this fragment.
    */
    toString() { return "<" + this.toStringInner() + ">"; }
    /**
    @internal
    */
    toStringInner() { return this.content.join(", "); }
    /**
    Create a JSON-serializeable representation of this fragment.
    */
    toJSON() {
        return this.content.length ? this.content.map(n => n.toJSON()) : null;
    }
    /**
    Deserialize a fragment from its JSON representation.
    */
    static fromJSON(schema, value) {
        if (!value)
            return Fragment.empty;
        if (!Array.isArray(value))
            throw new RangeError("Invalid input for Fragment.fromJSON");
        return new Fragment(value.map(schema.nodeFromJSON));
    }
    /**
    Build a fragment from an array of nodes. Ensures that adjacent
    text nodes with the same marks are joined together.
    */
    static fromArray(array) {
        if (!array.length)
            return Fragment.empty;
        let joined, size = 0;
        for (let i = 0; i < array.length; i++) {
            let node = array[i];
            size += node.nodeSize;
            if (i && node.isText && array[i - 1].sameMarkup(node)) {
                if (!joined)
                    joined = array.slice(0, i);
                joined[joined.length - 1] = node
                    .withText(joined[joined.length - 1].text + node.text);
            }
            else if (joined) {
                joined.push(node);
            }
        }
        return new Fragment(joined || array, size);
    }
    /**
    Create a fragment from something that can be interpreted as a
    set of nodes. For `null`, it returns the empty fragment. For a
    fragment, the fragment itself. For a node or array of nodes, a
    fragment containing those nodes.
    */
    static from(nodes) {
        if (!nodes)
            return Fragment.empty;
        if (nodes instanceof Fragment)
            return nodes;
        if (Array.isArray(nodes))
            return this.fromArray(nodes);
        if (nodes.attrs)
            return new Fragment([nodes], nodes.nodeSize);
        throw new RangeError("Can not convert " + nodes + " to a Fragment" +
            (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
    }
}
/**
An empty fragment. Intended to be reused whenever a node doesn't
contain anything (rather than allocating a new empty fragment for
each leaf node).
*/
Fragment.empty = new Fragment([], 0);
const found = { index: 0, offset: 0 };
function retIndex(index, offset) {
    found.index = index;
    found.offset = offset;
    return found;
}

function compareDeep(a, b) {
    if (a === b)
        return true;
    if (!(a && typeof a == "object") ||
        !(b && typeof b == "object"))
        return false;
    let array = Array.isArray(a);
    if (Array.isArray(b) != array)
        return false;
    if (array) {
        if (a.length != b.length)
            return false;
        for (let i = 0; i < a.length; i++)
            if (!compareDeep(a[i], b[i]))
                return false;
    }
    else {
        for (let p in a)
            if (!(p in b) || !compareDeep(a[p], b[p]))
                return false;
        for (let p in b)
            if (!(p in a))
                return false;
    }
    return true;
}

/**
A mark is a piece of information that can be attached to a node,
such as it being emphasized, in code font, or a link. It has a
type and optionally a set of attributes that provide further
information (such as the target of the link). Marks are created
through a `Schema`, which controls which types exist and which
attributes they have.
*/
class Mark {
    /**
    @internal
    */
    constructor(
    /**
    The type of this mark.
    */
    type, 
    /**
    The attributes associated with this mark.
    */
    attrs) {
        this.type = type;
        this.attrs = attrs;
    }
    /**
    Given a set of marks, create a new set which contains this one as
    well, in the right position. If this mark is already in the set,
    the set itself is returned. If any marks that are set to be
    [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
    those are replaced by this one.
    */
    addToSet(set) {
        let copy, placed = false;
        for (let i = 0; i < set.length; i++) {
            let other = set[i];
            if (this.eq(other))
                return set;
            if (this.type.excludes(other.type)) {
                if (!copy)
                    copy = set.slice(0, i);
            }
            else if (other.type.excludes(this.type)) {
                return set;
            }
            else {
                if (!placed && other.type.rank > this.type.rank) {
                    if (!copy)
                        copy = set.slice(0, i);
                    copy.push(this);
                    placed = true;
                }
                if (copy)
                    copy.push(other);
            }
        }
        if (!copy)
            copy = set.slice();
        if (!placed)
            copy.push(this);
        return copy;
    }
    /**
    Remove this mark from the given set, returning a new set. If this
    mark is not in the set, the set itself is returned.
    */
    removeFromSet(set) {
        for (let i = 0; i < set.length; i++)
            if (this.eq(set[i]))
                return set.slice(0, i).concat(set.slice(i + 1));
        return set;
    }
    /**
    Test whether this mark is in the given set of marks.
    */
    isInSet(set) {
        for (let i = 0; i < set.length; i++)
            if (this.eq(set[i]))
                return true;
        return false;
    }
    /**
    Test whether this mark has the same type and attributes as
    another mark.
    */
    eq(other) {
        return this == other ||
            (this.type == other.type && compareDeep(this.attrs, other.attrs));
    }
    /**
    Convert this mark to a JSON-serializeable representation.
    */
    toJSON() {
        let obj = { type: this.type.name };
        for (let _ in this.attrs) {
            obj.attrs = this.attrs;
            break;
        }
        return obj;
    }
    /**
    Deserialize a mark from JSON.
    */
    static fromJSON(schema, json) {
        if (!json)
            throw new RangeError("Invalid input for Mark.fromJSON");
        let type = schema.marks[json.type];
        if (!type)
            throw new RangeError(`There is no mark type ${json.type} in this schema`);
        let mark = type.create(json.attrs);
        type.checkAttrs(mark.attrs);
        return mark;
    }
    /**
    Test whether two sets of marks are identical.
    */
    static sameSet(a, b) {
        if (a == b)
            return true;
        if (a.length != b.length)
            return false;
        for (let i = 0; i < a.length; i++)
            if (!a[i].eq(b[i]))
                return false;
        return true;
    }
    /**
    Create a properly sorted mark set from null, a single mark, or an
    unsorted array of marks.
    */
    static setFrom(marks) {
        if (!marks || Array.isArray(marks) && marks.length == 0)
            return Mark.none;
        if (marks instanceof Mark)
            return [marks];
        let copy = marks.slice();
        copy.sort((a, b) => a.type.rank - b.type.rank);
        return copy;
    }
}
/**
The empty set of marks.
*/
Mark.none = [];

/**
Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when
given an invalid replacement.
*/
class ReplaceError extends Error {
}
/*
ReplaceError = function(this: any, message: string) {
  let err = Error.call(this, message)
  ;(err as any).__proto__ = ReplaceError.prototype
  return err
} as any

ReplaceError.prototype = Object.create(Error.prototype)
ReplaceError.prototype.constructor = ReplaceError
ReplaceError.prototype.name = "ReplaceError"
*/
/**
A slice represents a piece cut out of a larger document. It
stores not only a fragment, but also the depth up to which nodes on
both side are ‘open’ (cut through).
*/
class Slice {
    /**
    Create a slice. When specifying a non-zero open depth, you must
    make sure that there are nodes of at least that depth at the
    appropriate side of the fragment—i.e. if the fragment is an
    empty paragraph node, `openStart` and `openEnd` can't be greater
    than 1.
    
    It is not necessary for the content of open nodes to conform to
    the schema's content constraints, though it should be a valid
    start/end/middle for such a node, depending on which sides are
    open.
    */
    constructor(
    /**
    The slice's content.
    */
    content, 
    /**
    The open depth at the start of the fragment.
    */
    openStart, 
    /**
    The open depth at the end.
    */
    openEnd) {
        this.content = content;
        this.openStart = openStart;
        this.openEnd = openEnd;
    }
    /**
    The size this slice would add when inserted into a document.
    */
    get size() {
        return this.content.size - this.openStart - this.openEnd;
    }
    /**
    @internal
    */
    insertAt(pos, fragment) {
        let content = insertInto(this.content, pos + this.openStart, fragment);
        return content && new Slice(content, this.openStart, this.openEnd);
    }
    /**
    @internal
    */
    removeBetween(from, to) {
        return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
    }
    /**
    Tests whether this slice is equal to another slice.
    */
    eq(other) {
        return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;
    }
    /**
    @internal
    */
    toString() {
        return this.content + "(" + this.openStart + "," + this.openEnd + ")";
    }
    /**
    Convert a slice to a JSON-serializable representation.
    */
    toJSON() {
        if (!this.content.size)
            return null;
        let json = { content: this.content.toJSON() };
        if (this.openStart > 0)
            json.openStart = this.openStart;
        if (this.openEnd > 0)
            json.openEnd = this.openEnd;
        return json;
    }
    /**
    Deserialize a slice from its JSON representation.
    */
    static fromJSON(schema, json) {
        if (!json)
            return Slice.empty;
        let openStart = json.openStart || 0, openEnd = json.openEnd || 0;
        if (typeof openStart != "number" || typeof openEnd != "number")
            throw new RangeError("Invalid input for Slice.fromJSON");
        return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);
    }
    /**
    Create a slice from a fragment by taking the maximum possible
    open value on both side of the fragment.
    */
    static maxOpen(fragment, openIsolating = true) {
        let openStart = 0, openEnd = 0;
        for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild)
            openStart++;
        for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild)
            openEnd++;
        return new Slice(fragment, openStart, openEnd);
    }
}
/**
The empty slice.
*/
Slice.empty = new Slice(Fragment.empty, 0, 0);
function removeRange(content, from, to) {
    let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
    let { index: indexTo, offset: offsetTo } = content.findIndex(to);
    if (offset == from || child.isText) {
        if (offsetTo != to && !content.child(indexTo).isText)
            throw new RangeError("Removing non-flat range");
        return content.cut(0, from).append(content.cut(to));
    }
    if (index != indexTo)
        throw new RangeError("Removing non-flat range");
    return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
}
function insertInto(content, dist, insert, parent) {
    let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
    if (offset == dist || child.isText) {
        if (parent && !parent.canReplace(index, index, insert))
            return null;
        return content.cut(0, dist).append(insert).append(content.cut(dist));
    }
    let inner = insertInto(child.content, dist - offset - 1, insert, child);
    return inner && content.replaceChild(index, child.copy(inner));
}
function replace($from, $to, slice) {
    if (slice.openStart > $from.depth)
        throw new ReplaceError("Inserted content deeper than insertion position");
    if ($from.depth - slice.openStart != $to.depth - slice.openEnd)
        throw new ReplaceError("Inconsistent open depths");
    return replaceOuter($from, $to, slice, 0);
}
function replaceOuter($from, $to, slice, depth) {
    let index = $from.index(depth), node = $from.node(depth);
    if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
        let inner = replaceOuter($from, $to, slice, depth + 1);
        return node.copy(node.content.replaceChild(index, inner));
    }
    else if (!slice.content.size) {
        return close(node, replaceTwoWay($from, $to, depth));
    }
    else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) { // Simple, flat case
        let parent = $from.parent, content = parent.content;
        return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
    }
    else {
        let { start, end } = prepareSliceForReplace(slice, $from);
        return close(node, replaceThreeWay($from, start, end, $to, depth));
    }
}
function checkJoin(main, sub) {
    if (!sub.type.compatibleContent(main.type))
        throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name);
}
function joinable($before, $after, depth) {
    let node = $before.node(depth);
    checkJoin(node, $after.node(depth));
    return node;
}
function addNode(child, target) {
    let last = target.length - 1;
    if (last >= 0 && child.isText && child.sameMarkup(target[last]))
        target[last] = child.withText(target[last].text + child.text);
    else
        target.push(child);
}
function addRange($start, $end, depth, target) {
    let node = ($end || $start).node(depth);
    let startIndex = 0, endIndex = $end ? $end.index(depth) : node.childCount;
    if ($start) {
        startIndex = $start.index(depth);
        if ($start.depth > depth) {
            startIndex++;
        }
        else if ($start.textOffset) {
            addNode($start.nodeAfter, target);
            startIndex++;
        }
    }
    for (let i = startIndex; i < endIndex; i++)
        addNode(node.child(i), target);
    if ($end && $end.depth == depth && $end.textOffset)
        addNode($end.nodeBefore, target);
}
function close(node, content) {
    node.type.checkContent(content);
    return node.copy(content);
}
function replaceThreeWay($from, $start, $end, $to, depth) {
    let openStart = $from.depth > depth && joinable($from, $start, depth + 1);
    let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);
    let content = [];
    addRange(null, $from, depth, content);
    if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {
        checkJoin(openStart, openEnd);
        addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);
    }
    else {
        if (openStart)
            addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);
        addRange($start, $end, depth, content);
        if (openEnd)
            addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
    }
    addRange($to, null, depth, content);
    return new Fragment(content);
}
function replaceTwoWay($from, $to, depth) {
    let content = [];
    addRange(null, $from, depth, content);
    if ($from.depth > depth) {
        let type = joinable($from, $to, depth + 1);
        addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
    }
    addRange($to, null, depth, content);
    return new Fragment(content);
}
function prepareSliceForReplace(slice, $along) {
    let extra = $along.depth - slice.openStart, parent = $along.node(extra);
    let node = parent.copy(slice.content);
    for (let i = extra - 1; i >= 0; i--)
        node = $along.node(i).copy(Fragment.from(node));
    return { start: node.resolveNoCache(slice.openStart + extra),
        end: node.resolveNoCache(node.content.size - slice.openEnd - extra) };
}

/**
You can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more
information about it. Objects of this class represent such a
resolved position, providing various pieces of context
information, and some helper methods.

Throughout this interface, methods that take an optional `depth`
parameter will interpret undefined as `this.depth` and negative
numbers as `this.depth + value`.
*/
class ResolvedPos {
    /**
    @internal
    */
    constructor(
    /**
    The position that was resolved.
    */
    pos, 
    /**
    @internal
    */
    path, 
    /**
    The offset this position has into its parent node.
    */
    parentOffset) {
        this.pos = pos;
        this.path = path;
        this.parentOffset = parentOffset;
        this.depth = path.length / 3 - 1;
    }
    /**
    @internal
    */
    resolveDepth(val) {
        if (val == null)
            return this.depth;
        if (val < 0)
            return this.depth + val;
        return val;
    }
    /**
    The parent node that the position points into. Note that even if
    a position points into a text node, that node is not considered
    the parent—text nodes are ‘flat’ in this model, and have no content.
    */
    get parent() { return this.node(this.depth); }
    /**
    The root node in which the position was resolved.
    */
    get doc() { return this.node(0); }
    /**
    The ancestor node at the given level. `p.node(p.depth)` is the
    same as `p.parent`.
    */
    node(depth) { return this.path[this.resolveDepth(depth) * 3]; }
    /**
    The index into the ancestor at the given level. If this points
    at the 3rd node in the 2nd paragraph on the top level, for
    example, `p.index(0)` is 1 and `p.index(1)` is 2.
    */
    index(depth) { return this.path[this.resolveDepth(depth) * 3 + 1]; }
    /**
    The index pointing after this position into the ancestor at the
    given level.
    */
    indexAfter(depth) {
        depth = this.resolveDepth(depth);
        return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);
    }
    /**
    The (absolute) position at the start of the node at the given
    level.
    */
    start(depth) {
        depth = this.resolveDepth(depth);
        return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
    }
    /**
    The (absolute) position at the end of the node at the given
    level.
    */
    end(depth) {
        depth = this.resolveDepth(depth);
        return this.start(depth) + this.node(depth).content.size;
    }
    /**
    The (absolute) position directly before the wrapping node at the
    given level, or, when `depth` is `this.depth + 1`, the original
    position.
    */
    before(depth) {
        depth = this.resolveDepth(depth);
        if (!depth)
            throw new RangeError("There is no position before the top-level node");
        return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];
    }
    /**
    The (absolute) position directly after the wrapping node at the
    given level, or the original position when `depth` is `this.depth + 1`.
    */
    after(depth) {
        depth = this.resolveDepth(depth);
        if (!depth)
            throw new RangeError("There is no position after the top-level node");
        return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;
    }
    /**
    When this position points into a text node, this returns the
    distance between the position and the start of the text node.
    Will be zero for positions that point between nodes.
    */
    get textOffset() { return this.pos - this.path[this.path.length - 1]; }
    /**
    Get the node directly after the position, if any. If the position
    points into a text node, only the part of that node after the
    position is returned.
    */
    get nodeAfter() {
        let parent = this.parent, index = this.index(this.depth);
        if (index == parent.childCount)
            return null;
        let dOff = this.pos - this.path[this.path.length - 1], child = parent.child(index);
        return dOff ? parent.child(index).cut(dOff) : child;
    }
    /**
    Get the node directly before the position, if any. If the
    position points into a text node, only the part of that node
    before the position is returned.
    */
    get nodeBefore() {
        let index = this.index(this.depth);
        let dOff = this.pos - this.path[this.path.length - 1];
        if (dOff)
            return this.parent.child(index).cut(0, dOff);
        return index == 0 ? null : this.parent.child(index - 1);
    }
    /**
    Get the position at the given index in the parent node at the
    given depth (which defaults to `this.depth`).
    */
    posAtIndex(index, depth) {
        depth = this.resolveDepth(depth);
        let node = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
        for (let i = 0; i < index; i++)
            pos += node.child(i).nodeSize;
        return pos;
    }
    /**
    Get the marks at this position, factoring in the surrounding
    marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
    position is at the start of a non-empty node, the marks of the
    node after it (if any) are returned.
    */
    marks() {
        let parent = this.parent, index = this.index();
        // In an empty parent, return the empty array
        if (parent.content.size == 0)
            return Mark.none;
        // When inside a text node, just return the text node's marks
        if (this.textOffset)
            return parent.child(index).marks;
        let main = parent.maybeChild(index - 1), other = parent.maybeChild(index);
        // If the `after` flag is true of there is no node before, make
        // the node after this position the main reference.
        if (!main) {
            let tmp = main;
            main = other;
            other = tmp;
        }
        // Use all marks in the main node, except those that have
        // `inclusive` set to false and are not present in the other node.
        let marks = main.marks;
        for (var i = 0; i < marks.length; i++)
            if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks)))
                marks = marks[i--].removeFromSet(marks);
        return marks;
    }
    /**
    Get the marks after the current position, if any, except those
    that are non-inclusive and not present at position `$end`. This
    is mostly useful for getting the set of marks to preserve after a
    deletion. Will return `null` if this position is at the end of
    its parent node or its parent node isn't a textblock (in which
    case no marks should be preserved).
    */
    marksAcross($end) {
        let after = this.parent.maybeChild(this.index());
        if (!after || !after.isInline)
            return null;
        let marks = after.marks, next = $end.parent.maybeChild($end.index());
        for (var i = 0; i < marks.length; i++)
            if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks)))
                marks = marks[i--].removeFromSet(marks);
        return marks;
    }
    /**
    The depth up to which this position and the given (non-resolved)
    position share the same parent nodes.
    */
    sharedDepth(pos) {
        for (let depth = this.depth; depth > 0; depth--)
            if (this.start(depth) <= pos && this.end(depth) >= pos)
                return depth;
        return 0;
    }
    /**
    Returns a range based on the place where this position and the
    given position diverge around block content. If both point into
    the same textblock, for example, a range around that textblock
    will be returned. If they point into different blocks, the range
    around those blocks in their shared ancestor is returned. You can
    pass in an optional predicate that will be called with a parent
    node to see if a range into that parent is acceptable.
    */
    blockRange(other = this, pred) {
        if (other.pos < this.pos)
            return other.blockRange(this);
        for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)
            if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))
                return new NodeRange(this, other, d);
        return null;
    }
    /**
    Query whether the given position shares the same parent node.
    */
    sameParent(other) {
        return this.pos - this.parentOffset == other.pos - other.parentOffset;
    }
    /**
    Return the greater of this and the given position.
    */
    max(other) {
        return other.pos > this.pos ? other : this;
    }
    /**
    Return the smaller of this and the given position.
    */
    min(other) {
        return other.pos < this.pos ? other : this;
    }
    /**
    @internal
    */
    toString() {
        let str = "";
        for (let i = 1; i <= this.depth; i++)
            str += (str ? "/" : "") + this.node(i).type.name + "_" + this.index(i - 1);
        return str + ":" + this.parentOffset;
    }
    /**
    @internal
    */
    static resolve(doc, pos) {
        if (!(pos >= 0 && pos <= doc.content.size))
            throw new RangeError("Position " + pos + " out of range");
        let path = [];
        let start = 0, parentOffset = pos;
        for (let node = doc;;) {
            let { index, offset } = node.content.findIndex(parentOffset);
            let rem = parentOffset - offset;
            path.push(node, index, start + offset);
            if (!rem)
                break;
            node = node.child(index);
            if (node.isText)
                break;
            parentOffset = rem - 1;
            start += offset + 1;
        }
        return new ResolvedPos(pos, path, parentOffset);
    }
    /**
    @internal
    */
    static resolveCached(doc, pos) {
        let cache = resolveCache.get(doc);
        if (cache) {
            for (let i = 0; i < cache.elts.length; i++) {
                let elt = cache.elts[i];
                if (elt.pos == pos)
                    return elt;
            }
        }
        else {
            resolveCache.set(doc, cache = new ResolveCache);
        }
        let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);
        cache.i = (cache.i + 1) % resolveCacheSize;
        return result;
    }
}
class ResolveCache {
    constructor() {
        this.elts = [];
        this.i = 0;
    }
}
const resolveCacheSize = 12, resolveCache = new WeakMap();
/**
Represents a flat range of content, i.e. one that starts and
ends in the same node.
*/
class NodeRange {
    /**
    Construct a node range. `$from` and `$to` should point into the
    same node until at least the given `depth`, since a node range
    denotes an adjacent set of nodes in a single parent node.
    */
    constructor(
    /**
    A resolved position along the start of the content. May have a
    `depth` greater than this object's `depth` property, since
    these are the positions that were used to compute the range,
    not re-resolved positions directly at its boundaries.
    */
    $from, 
    /**
    A position along the end of the content. See
    caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).
    */
    $to, 
    /**
    The depth of the node that this range points into.
    */
    depth) {
        this.$from = $from;
        this.$to = $to;
        this.depth = depth;
    }
    /**
    The position at the start of the range.
    */
    get start() { return this.$from.before(this.depth + 1); }
    /**
    The position at the end of the range.
    */
    get end() { return this.$to.after(this.depth + 1); }
    /**
    The parent node that the range points into.
    */
    get parent() { return this.$from.node(this.depth); }
    /**
    The start index of the range in the parent node.
    */
    get startIndex() { return this.$from.index(this.depth); }
    /**
    The end index of the range in the parent node.
    */
    get endIndex() { return this.$to.indexAfter(this.depth); }
}

const emptyAttrs = Object.create(null);
/**
This class represents a node in the tree that makes up a
ProseMirror document. So a document is an instance of `Node`, with
children that are also instances of `Node`.

Nodes are persistent data structures. Instead of changing them, you
create new ones with the content you want. Old ones keep pointing
at the old document shape. This is made cheaper by sharing
structure between the old and new data as much as possible, which a
tree shape like this (without back pointers) makes easy.

**Do not** directly mutate the properties of a `Node` object. See
[the guide](https://prosemirror.net/docs/guide/#doc) for more information.
*/
class Node {
    /**
    @internal
    */
    constructor(
    /**
    The type of node that this is.
    */
    type, 
    /**
    An object mapping attribute names to values. The kind of
    attributes allowed and required are
    [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.
    */
    attrs, 
    // A fragment holding the node's children.
    content, 
    /**
    The marks (things like whether it is emphasized or part of a
    link) applied to this node.
    */
    marks = Mark.none) {
        this.type = type;
        this.attrs = attrs;
        this.marks = marks;
        this.content = content || Fragment.empty;
    }
    /**
    The array of this node's child nodes.
    */
    get children() { return this.content.content; }
    /**
    The size of this node, as defined by the integer-based [indexing
    scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
    amount of characters. For other leaf nodes, it is one. For
    non-leaf nodes, it is the size of the content plus two (the
    start and end token).
    */
    get nodeSize() { return this.isLeaf ? 1 : 2 + this.content.size; }
    /**
    The number of children that the node has.
    */
    get childCount() { return this.content.childCount; }
    /**
    Get the child node at the given index. Raises an error when the
    index is out of range.
    */
    child(index) { return this.content.child(index); }
    /**
    Get the child node at the given index, if it exists.
    */
    maybeChild(index) { return this.content.maybeChild(index); }
    /**
    Call `f` for every child node, passing the node, its offset
    into this parent node, and its index.
    */
    forEach(f) { this.content.forEach(f); }
    /**
    Invoke a callback for all descendant nodes recursively between
    the given two positions that are relative to start of this
    node's content. The callback is invoked with the node, its
    position relative to the original node (method receiver),
    its parent node, and its child index. When the callback returns
    false for a given node, that node's children will not be
    recursed over. The last parameter can be used to specify a
    starting position to count from.
    */
    nodesBetween(from, to, f, startPos = 0) {
        this.content.nodesBetween(from, to, f, startPos, this);
    }
    /**
    Call the given callback for every descendant node. Doesn't
    descend into a node when the callback returns `false`.
    */
    descendants(f) {
        this.nodesBetween(0, this.content.size, f);
    }
    /**
    Concatenates all the text nodes found in this fragment and its
    children.
    */
    get textContent() {
        return (this.isLeaf && this.type.spec.leafText)
            ? this.type.spec.leafText(this)
            : this.textBetween(0, this.content.size, "");
    }
    /**
    Get all text between positions `from` and `to`. When
    `blockSeparator` is given, it will be inserted to separate text
    from different block nodes. If `leafText` is given, it'll be
    inserted for every non-text leaf node encountered, otherwise
    [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
    */
    textBetween(from, to, blockSeparator, leafText) {
        return this.content.textBetween(from, to, blockSeparator, leafText);
    }
    /**
    Returns this node's first child, or `null` if there are no
    children.
    */
    get firstChild() { return this.content.firstChild; }
    /**
    Returns this node's last child, or `null` if there are no
    children.
    */
    get lastChild() { return this.content.lastChild; }
    /**
    Test whether two nodes represent the same piece of document.
    */
    eq(other) {
        return this == other || (this.sameMarkup(other) && this.content.eq(other.content));
    }
    /**
    Compare the markup (type, attributes, and marks) of this node to
    those of another. Returns `true` if both have the same markup.
    */
    sameMarkup(other) {
        return this.hasMarkup(other.type, other.attrs, other.marks);
    }
    /**
    Check whether this node's markup correspond to the given type,
    attributes, and marks.
    */
    hasMarkup(type, attrs, marks) {
        return this.type == type &&
            compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) &&
            Mark.sameSet(this.marks, marks || Mark.none);
    }
    /**
    Create a new node with the same markup as this node, containing
    the given content (or empty, if no content is given).
    */
    copy(content = null) {
        if (content == this.content)
            return this;
        return new Node(this.type, this.attrs, content, this.marks);
    }
    /**
    Create a copy of this node, with the given set of marks instead
    of the node's own marks.
    */
    mark(marks) {
        return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);
    }
    /**
    Create a copy of this node with only the content between the
    given positions. If `to` is not given, it defaults to the end of
    the node.
    */
    cut(from, to = this.content.size) {
        if (from == 0 && to == this.content.size)
            return this;
        return this.copy(this.content.cut(from, to));
    }
    /**
    Cut out the part of the document between the given positions, and
    return it as a `Slice` object.
    */
    slice(from, to = this.content.size, includeParents = false) {
        if (from == to)
            return Slice.empty;
        let $from = this.resolve(from), $to = this.resolve(to);
        let depth = includeParents ? 0 : $from.sharedDepth(to);
        let start = $from.start(depth), node = $from.node(depth);
        let content = node.content.cut($from.pos - start, $to.pos - start);
        return new Slice(content, $from.depth - depth, $to.depth - depth);
    }
    /**
    Replace the part of the document between the given positions with
    the given slice. The slice must 'fit', meaning its open sides
    must be able to connect to the surrounding content, and its
    content nodes must be valid children for the node they are placed
    into. If any of this is violated, an error of type
    [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
    */
    replace(from, to, slice) {
        return replace(this.resolve(from), this.resolve(to), slice);
    }
    /**
    Find the node directly after the given position.
    */
    nodeAt(pos) {
        for (let node = this;;) {
            let { index, offset } = node.content.findIndex(pos);
            node = node.maybeChild(index);
            if (!node)
                return null;
            if (offset == pos || node.isText)
                return node;
            pos -= offset + 1;
        }
    }
    /**
    Find the (direct) child node after the given offset, if any,
    and return it along with its index and offset relative to this
    node.
    */
    childAfter(pos) {
        let { index, offset } = this.content.findIndex(pos);
        return { node: this.content.maybeChild(index), index, offset };
    }
    /**
    Find the (direct) child node before the given offset, if any,
    and return it along with its index and offset relative to this
    node.
    */
    childBefore(pos) {
        if (pos == 0)
            return { node: null, index: 0, offset: 0 };
        let { index, offset } = this.content.findIndex(pos);
        if (offset < pos)
            return { node: this.content.child(index), index, offset };
        let node = this.content.child(index - 1);
        return { node, index: index - 1, offset: offset - node.nodeSize };
    }
    /**
    Resolve the given position in the document, returning an
    [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
    */
    resolve(pos) { return ResolvedPos.resolveCached(this, pos); }
    /**
    @internal
    */
    resolveNoCache(pos) { return ResolvedPos.resolve(this, pos); }
    /**
    Test whether a given mark or mark type occurs in this document
    between the two given positions.
    */
    rangeHasMark(from, to, type) {
        let found = false;
        if (to > from)
            this.nodesBetween(from, to, node => {
                if (type.isInSet(node.marks))
                    found = true;
                return !found;
            });
        return found;
    }
    /**
    True when this is a block (non-inline node)
    */
    get isBlock() { return this.type.isBlock; }
    /**
    True when this is a textblock node, a block node with inline
    content.
    */
    get isTextblock() { return this.type.isTextblock; }
    /**
    True when this node allows inline content.
    */
    get inlineContent() { return this.type.inlineContent; }
    /**
    True when this is an inline node (a text node or a node that can
    appear among text).
    */
    get isInline() { return this.type.isInline; }
    /**
    True when this is a text node.
    */
    get isText() { return this.type.isText; }
    /**
    True when this is a leaf node.
    */
    get isLeaf() { return this.type.isLeaf; }
    /**
    True when this is an atom, i.e. when it does not have directly
    editable content. This is usually the same as `isLeaf`, but can
    be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
    on a node's spec (typically used when the node is displayed as
    an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
    */
    get isAtom() { return this.type.isAtom; }
    /**
    Return a string representation of this node for debugging
    purposes.
    */
    toString() {
        if (this.type.spec.toDebugString)
            return this.type.spec.toDebugString(this);
        let name = this.type.name;
        if (this.content.size)
            name += "(" + this.content.toStringInner() + ")";
        return wrapMarks(this.marks, name);
    }
    /**
    Get the content match in this node at the given index.
    */
    contentMatchAt(index) {
        let match = this.type.contentMatch.matchFragment(this.content, 0, index);
        if (!match)
            throw new Error("Called contentMatchAt on a node with invalid content");
        return match;
    }
    /**
    Test whether replacing the range between `from` and `to` (by
    child index) with the given replacement fragment (which defaults
    to the empty fragment) would leave the node's content valid. You
    can optionally pass `start` and `end` indices into the
    replacement fragment.
    */
    canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {
        let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
        let two = one && one.matchFragment(this.content, to);
        if (!two || !two.validEnd)
            return false;
        for (let i = start; i < end; i++)
            if (!this.type.allowsMarks(replacement.child(i).marks))
                return false;
        return true;
    }
    /**
    Test whether replacing the range `from` to `to` (by index) with
    a node of the given type would leave the node's content valid.
    */
    canReplaceWith(from, to, type, marks) {
        if (marks && !this.type.allowsMarks(marks))
            return false;
        let start = this.contentMatchAt(from).matchType(type);
        let end = start && start.matchFragment(this.content, to);
        return end ? end.validEnd : false;
    }
    /**
    Test whether the given node's content could be appended to this
    node. If that node is empty, this will only return true if there
    is at least one node type that can appear in both nodes (to avoid
    merging completely incompatible nodes).
    */
    canAppend(other) {
        if (other.content.size)
            return this.canReplace(this.childCount, this.childCount, other.content);
        else
            return this.type.compatibleContent(other.type);
    }
    /**
    Check whether this node and its descendants conform to the
    schema, and raise an exception when they do not.
    */
    check() {
        this.type.checkContent(this.content);
        this.type.checkAttrs(this.attrs);
        let copy = Mark.none;
        for (let i = 0; i < this.marks.length; i++) {
            let mark = this.marks[i];
            mark.type.checkAttrs(mark.attrs);
            copy = mark.addToSet(copy);
        }
        if (!Mark.sameSet(copy, this.marks))
            throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);
        this.content.forEach(node => node.check());
    }
    /**
    Return a JSON-serializeable representation of this node.
    */
    toJSON() {
        let obj = { type: this.type.name };
        for (let _ in this.attrs) {
            obj.attrs = this.attrs;
            break;
        }
        if (this.content.size)
            obj.content = this.content.toJSON();
        if (this.marks.length)
            obj.marks = this.marks.map(n => n.toJSON());
        return obj;
    }
    /**
    Deserialize a node from its JSON representation.
    */
    static fromJSON(schema, json) {
        if (!json)
            throw new RangeError("Invalid input for Node.fromJSON");
        let marks = undefined;
        if (json.marks) {
            if (!Array.isArray(json.marks))
                throw new RangeError("Invalid mark data for Node.fromJSON");
            marks = json.marks.map(schema.markFromJSON);
        }
        if (json.type == "text") {
            if (typeof json.text != "string")
                throw new RangeError("Invalid text node in JSON");
            return schema.text(json.text, marks);
        }
        let content = Fragment.fromJSON(schema, json.content);
        let node = schema.nodeType(json.type).create(json.attrs, content, marks);
        node.type.checkAttrs(node.attrs);
        return node;
    }
}
Node.prototype.text = undefined;
class TextNode extends Node {
    /**
    @internal
    */
    constructor(type, attrs, content, marks) {
        super(type, attrs, null, marks);
        if (!content)
            throw new RangeError("Empty text nodes are not allowed");
        this.text = content;
    }
    toString() {
        if (this.type.spec.toDebugString)
            return this.type.spec.toDebugString(this);
        return wrapMarks(this.marks, JSON.stringify(this.text));
    }
    get textContent() { return this.text; }
    textBetween(from, to) { return this.text.slice(from, to); }
    get nodeSize() { return this.text.length; }
    mark(marks) {
        return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);
    }
    withText(text) {
        if (text == this.text)
            return this;
        return new TextNode(this.type, this.attrs, text, this.marks);
    }
    cut(from = 0, to = this.text.length) {
        if (from == 0 && to == this.text.length)
            return this;
        return this.withText(this.text.slice(from, to));
    }
    eq(other) {
        return this.sameMarkup(other) && this.text == other.text;
    }
    toJSON() {
        let base = super.toJSON();
        base.text = this.text;
        return base;
    }
}
function wrapMarks(marks, str) {
    for (let i = marks.length - 1; i >= 0; i--)
        str = marks[i].type.name + "(" + str + ")";
    return str;
}

/**
Instances of this class represent a match state of a node type's
[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
find out whether further content matches here, and whether a given
position is a valid end of the node.
*/
class ContentMatch {
    /**
    @internal
    */
    constructor(
    /**
    True when this match state represents a valid end of the node.
    */
    validEnd) {
        this.validEnd = validEnd;
        /**
        @internal
        */
        this.next = [];
        /**
        @internal
        */
        this.wrapCache = [];
    }
    /**
    @internal
    */
    static parse(string, nodeTypes) {
        let stream = new TokenStream(string, nodeTypes);
        if (stream.next == null)
            return ContentMatch.empty;
        let expr = parseExpr(stream);
        if (stream.next)
            stream.err("Unexpected trailing text");
        let match = dfa(nfa(expr));
        checkForDeadEnds(match, stream);
        return match;
    }
    /**
    Match a node type, returning a match after that node if
    successful.
    */
    matchType(type) {
        for (let i = 0; i < this.next.length; i++)
            if (this.next[i].type == type)
                return this.next[i].next;
        return null;
    }
    /**
    Try to match a fragment. Returns the resulting match when
    successful.
    */
    matchFragment(frag, start = 0, end = frag.childCount) {
        let cur = this;
        for (let i = start; cur && i < end; i++)
            cur = cur.matchType(frag.child(i).type);
        return cur;
    }
    /**
    @internal
    */
    get inlineContent() {
        return this.next.length != 0 && this.next[0].type.isInline;
    }
    /**
    Get the first matching node type at this match position that can
    be generated.
    */
    get defaultType() {
        for (let i = 0; i < this.next.length; i++) {
            let { type } = this.next[i];
            if (!(type.isText || type.hasRequiredAttrs()))
                return type;
        }
        return null;
    }
    /**
    @internal
    */
    compatible(other) {
        for (let i = 0; i < this.next.length; i++)
            for (let j = 0; j < other.next.length; j++)
                if (this.next[i].type == other.next[j].type)
                    return true;
        return false;
    }
    /**
    Try to match the given fragment, and if that fails, see if it can
    be made to match by inserting nodes in front of it. When
    successful, return a fragment of inserted nodes (which may be
    empty if nothing had to be inserted). When `toEnd` is true, only
    return a fragment if the resulting match goes to the end of the
    content expression.
    */
    fillBefore(after, toEnd = false, startIndex = 0) {
        let seen = [this];
        function search(match, types) {
            let finished = match.matchFragment(after, startIndex);
            if (finished && (!toEnd || finished.validEnd))
                return Fragment.from(types.map(tp => tp.createAndFill()));
            for (let i = 0; i < match.next.length; i++) {
                let { type, next } = match.next[i];
                if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
                    seen.push(next);
                    let found = search(next, types.concat(type));
                    if (found)
                        return found;
                }
            }
            return null;
        }
        return search(this, []);
    }
    /**
    Find a set of wrapping node types that would allow a node of the
    given type to appear at this position. The result may be empty
    (when it fits directly) and will be null when no such wrapping
    exists.
    */
    findWrapping(target) {
        for (let i = 0; i < this.wrapCache.length; i += 2)
            if (this.wrapCache[i] == target)
                return this.wrapCache[i + 1];
        let computed = this.computeWrapping(target);
        this.wrapCache.push(target, computed);
        return computed;
    }
    /**
    @internal
    */
    computeWrapping(target) {
        let seen = Object.create(null), active = [{ match: this, type: null, via: null }];
        while (active.length) {
            let current = active.shift(), match = current.match;
            if (match.matchType(target)) {
                let result = [];
                for (let obj = current; obj.type; obj = obj.via)
                    result.push(obj.type);
                return result.reverse();
            }
            for (let i = 0; i < match.next.length; i++) {
                let { type, next } = match.next[i];
                if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {
                    active.push({ match: type.contentMatch, type, via: current });
                    seen[type.name] = true;
                }
            }
        }
        return null;
    }
    /**
    The number of outgoing edges this node has in the finite
    automaton that describes the content expression.
    */
    get edgeCount() {
        return this.next.length;
    }
    /**
    Get the _n_​th outgoing edge from this node in the finite
    automaton that describes the content expression.
    */
    edge(n) {
        if (n >= this.next.length)
            throw new RangeError(`There's no ${n}th edge in this content match`);
        return this.next[n];
    }
    /**
    @internal
    */
    toString() {
        let seen = [];
        function scan(m) {
            seen.push(m);
            for (let i = 0; i < m.next.length; i++)
                if (seen.indexOf(m.next[i].next) == -1)
                    scan(m.next[i].next);
        }
        scan(this);
        return seen.map((m, i) => {
            let out = i + (m.validEnd ? "*" : " ") + " ";
            for (let i = 0; i < m.next.length; i++)
                out += (i ? ", " : "") + m.next[i].type.name + "->" + seen.indexOf(m.next[i].next);
            return out;
        }).join("\n");
    }
}
/**
@internal
*/
ContentMatch.empty = new ContentMatch(true);
class TokenStream {
    constructor(string, nodeTypes) {
        this.string = string;
        this.nodeTypes = nodeTypes;
        this.inline = null;
        this.pos = 0;
        this.tokens = string.split(/\s*(?=\b|\W|$)/);
        if (this.tokens[this.tokens.length - 1] == "")
            this.tokens.pop();
        if (this.tokens[0] == "")
            this.tokens.shift();
    }
    get next() { return this.tokens[this.pos]; }
    eat(tok) { return this.next == tok && (this.pos++ || true); }
    err(str) { throw new SyntaxError(str + " (in content expression '" + this.string + "')"); }
}
function parseExpr(stream) {
    let exprs = [];
    do {
        exprs.push(parseExprSeq(stream));
    } while (stream.eat("|"));
    return exprs.length == 1 ? exprs[0] : { type: "choice", exprs };
}
function parseExprSeq(stream) {
    let exprs = [];
    do {
        exprs.push(parseExprSubscript(stream));
    } while (stream.next && stream.next != ")" && stream.next != "|");
    return exprs.length == 1 ? exprs[0] : { type: "seq", exprs };
}
function parseExprSubscript(stream) {
    let expr = parseExprAtom(stream);
    for (;;) {
        if (stream.eat("+"))
            expr = { type: "plus", expr };
        else if (stream.eat("*"))
            expr = { type: "star", expr };
        else if (stream.eat("?"))
            expr = { type: "opt", expr };
        else if (stream.eat("{"))
            expr = parseExprRange(stream, expr);
        else
            break;
    }
    return expr;
}
function parseNum(stream) {
    if (/\D/.test(stream.next))
        stream.err("Expected number, got '" + stream.next + "'");
    let result = Number(stream.next);
    stream.pos++;
    return result;
}
function parseExprRange(stream, expr) {
    let min = parseNum(stream), max = min;
    if (stream.eat(",")) {
        if (stream.next != "}")
            max = parseNum(stream);
        else
            max = -1;
    }
    if (!stream.eat("}"))
        stream.err("Unclosed braced range");
    return { type: "range", min, max, expr };
}
function resolveName(stream, name) {
    let types = stream.nodeTypes, type = types[name];
    if (type)
        return [type];
    let result = [];
    for (let typeName in types) {
        let type = types[typeName];
        if (type.isInGroup(name))
            result.push(type);
    }
    if (result.length == 0)
        stream.err("No node type or group '" + name + "' found");
    return result;
}
function parseExprAtom(stream) {
    if (stream.eat("(")) {
        let expr = parseExpr(stream);
        if (!stream.eat(")"))
            stream.err("Missing closing paren");
        return expr;
    }
    else if (!/\W/.test(stream.next)) {
        let exprs = resolveName(stream, stream.next).map(type => {
            if (stream.inline == null)
                stream.inline = type.isInline;
            else if (stream.inline != type.isInline)
                stream.err("Mixing inline and block content");
            return { type: "name", value: type };
        });
        stream.pos++;
        return exprs.length == 1 ? exprs[0] : { type: "choice", exprs };
    }
    else {
        stream.err("Unexpected token '" + stream.next + "'");
    }
}
// Construct an NFA from an expression as returned by the parser. The
// NFA is represented as an array of states, which are themselves
// arrays of edges, which are `{term, to}` objects. The first state is
// the entry state and the last node is the success state.
//
// Note that unlike typical NFAs, the edge ordering in this one is
// significant, in that it is used to contruct filler content when
// necessary.
function nfa(expr) {
    let nfa = [[]];
    connect(compile(expr, 0), node());
    return nfa;
    function node() { return nfa.push([]) - 1; }
    function edge(from, to, term) {
        let edge = { term, to };
        nfa[from].push(edge);
        return edge;
    }
    function connect(edges, to) {
        edges.forEach(edge => edge.to = to);
    }
    function compile(expr, from) {
        if (expr.type == "choice") {
            return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);
        }
        else if (expr.type == "seq") {
            for (let i = 0;; i++) {
                let next = compile(expr.exprs[i], from);
                if (i == expr.exprs.length - 1)
                    return next;
                connect(next, from = node());
            }
        }
        else if (expr.type == "star") {
            let loop = node();
            edge(from, loop);
            connect(compile(expr.expr, loop), loop);
            return [edge(loop)];
        }
        else if (expr.type == "plus") {
            let loop = node();
            connect(compile(expr.expr, from), loop);
            connect(compile(expr.expr, loop), loop);
            return [edge(loop)];
        }
        else if (expr.type == "opt") {
            return [edge(from)].concat(compile(expr.expr, from));
        }
        else if (expr.type == "range") {
            let cur = from;
            for (let i = 0; i < expr.min; i++) {
                let next = node();
                connect(compile(expr.expr, cur), next);
                cur = next;
            }
            if (expr.max == -1) {
                connect(compile(expr.expr, cur), cur);
            }
            else {
                for (let i = expr.min; i < expr.max; i++) {
                    let next = node();
                    edge(cur, next);
                    connect(compile(expr.expr, cur), next);
                    cur = next;
                }
            }
            return [edge(cur)];
        }
        else if (expr.type == "name") {
            return [edge(from, undefined, expr.value)];
        }
        else {
            throw new Error("Unknown expr type");
        }
    }
}
function cmp(a, b) { return b - a; }
// Get the set of nodes reachable by null edges from `node`. Omit
// nodes with only a single null-out-edge, since they may lead to
// needless duplicated nodes.
function nullFrom(nfa, node) {
    let result = [];
    scan(node);
    return result.sort(cmp);
    function scan(node) {
        let edges = nfa[node];
        if (edges.length == 1 && !edges[0].term)
            return scan(edges[0].to);
        result.push(node);
        for (let i = 0; i < edges.length; i++) {
            let { term, to } = edges[i];
            if (!term && result.indexOf(to) == -1)
                scan(to);
        }
    }
}
// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set
// of state objects (`ContentMatch` instances) with transitions
// between them.
function dfa(nfa) {
    let labeled = Object.create(null);
    return explore(nullFrom(nfa, 0));
    function explore(states) {
        let out = [];
        states.forEach(node => {
            nfa[node].forEach(({ term, to }) => {
                if (!term)
                    return;
                let set;
                for (let i = 0; i < out.length; i++)
                    if (out[i][0] == term)
                        set = out[i][1];
                nullFrom(nfa, to).forEach(node => {
                    if (!set)
                        out.push([term, set = []]);
                    if (set.indexOf(node) == -1)
                        set.push(node);
                });
            });
        });
        let state = labeled[states.join(",")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);
        for (let i = 0; i < out.length; i++) {
            let states = out[i][1].sort(cmp);
            state.next.push({ type: out[i][0], next: labeled[states.join(",")] || explore(states) });
        }
        return state;
    }
}
function checkForDeadEnds(match, stream) {
    for (let i = 0, work = [match]; i < work.length; i++) {
        let state = work[i], dead = !state.validEnd, nodes = [];
        for (let j = 0; j < state.next.length; j++) {
            let { type, next } = state.next[j];
            nodes.push(type.name);
            if (dead && !(type.isText || type.hasRequiredAttrs()))
                dead = false;
            if (work.indexOf(next) == -1)
                work.push(next);
        }
        if (dead)
            stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
    }
}

// For node types where all attrs have a default value (or which don't
// have any attributes), build up a single reusable default attribute
// object, and use it for all nodes that don't specify specific
// attributes.
function defaultAttrs(attrs) {
    let defaults = Object.create(null);
    for (let attrName in attrs) {
        let attr = attrs[attrName];
        if (!attr.hasDefault)
            return null;
        defaults[attrName] = attr.default;
    }
    return defaults;
}
function computeAttrs(attrs, value) {
    let built = Object.create(null);
    for (let name in attrs) {
        let given = value && value[name];
        if (given === undefined) {
            let attr = attrs[name];
            if (attr.hasDefault)
                given = attr.default;
            else
                throw new RangeError("No value supplied for attribute " + name);
        }
        built[name] = given;
    }
    return built;
}
function checkAttrs(attrs, values, type, name) {
    for (let name in values)
        if (!(name in attrs))
            throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);
    for (let name in attrs) {
        let attr = attrs[name];
        if (attr.validate)
            attr.validate(values[name]);
    }
}
function initAttrs(typeName, attrs) {
    let result = Object.create(null);
    if (attrs)
        for (let name in attrs)
            result[name] = new Attribute(typeName, name, attrs[name]);
    return result;
}
/**
Node types are objects allocated once per `Schema` and used to
[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information
about the node type, such as its name and what kind of node it
represents.
*/
class NodeType {
    /**
    @internal
    */
    constructor(
    /**
    The name the node type has in this schema.
    */
    name, 
    /**
    A link back to the `Schema` the node type belongs to.
    */
    schema, 
    /**
    The spec that this type is based on
    */
    spec) {
        this.name = name;
        this.schema = schema;
        this.spec = spec;
        /**
        The set of marks allowed in this node. `null` means all marks
        are allowed.
        */
        this.markSet = null;
        this.groups = spec.group ? spec.group.split(" ") : [];
        this.attrs = initAttrs(name, spec.attrs);
        this.defaultAttrs = defaultAttrs(this.attrs);
        this.contentMatch = null;
        this.inlineContent = null;
        this.isBlock = !(spec.inline || name == "text");
        this.isText = name == "text";
    }
    /**
    True if this is an inline type.
    */
    get isInline() { return !this.isBlock; }
    /**
    True if this is a textblock type, a block that contains inline
    content.
    */
    get isTextblock() { return this.isBlock && this.inlineContent; }
    /**
    True for node types that allow no content.
    */
    get isLeaf() { return this.contentMatch == ContentMatch.empty; }
    /**
    True when this node is an atom, i.e. when it does not have
    directly editable content.
    */
    get isAtom() { return this.isLeaf || !!this.spec.atom; }
    /**
    Return true when this node type is part of the given
    [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
    */
    isInGroup(group) {
        return this.groups.indexOf(group) > -1;
    }
    /**
    The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
    */
    get whitespace() {
        return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
    }
    /**
    Tells you whether this node type has any required attributes.
    */
    hasRequiredAttrs() {
        for (let n in this.attrs)
            if (this.attrs[n].isRequired)
                return true;
        return false;
    }
    /**
    Indicates whether this node allows some of the same content as
    the given node type.
    */
    compatibleContent(other) {
        return this == other || this.contentMatch.compatible(other.contentMatch);
    }
    /**
    @internal
    */
    computeAttrs(attrs) {
        if (!attrs && this.defaultAttrs)
            return this.defaultAttrs;
        else
            return computeAttrs(this.attrs, attrs);
    }
    /**
    Create a `Node` of this type. The given attributes are
    checked and defaulted (you can pass `null` to use the type's
    defaults entirely, if no required attributes exist). `content`
    may be a `Fragment`, a node, an array of nodes, or
    `null`. Similarly `marks` may be `null` to default to the empty
    set of marks.
    */
    create(attrs = null, content, marks) {
        if (this.isText)
            throw new Error("NodeType.create can't construct text nodes");
        return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));
    }
    /**
    Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
    against the node type's content restrictions, and throw an error
    if it doesn't match.
    */
    createChecked(attrs = null, content, marks) {
        content = Fragment.from(content);
        this.checkContent(content);
        return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));
    }
    /**
    Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
    necessary to add nodes to the start or end of the given fragment
    to make it fit the node. If no fitting wrapping can be found,
    return null. Note that, due to the fact that required nodes can
    always be created, this will always succeed if you pass null or
    `Fragment.empty` as content.
    */
    createAndFill(attrs = null, content, marks) {
        attrs = this.computeAttrs(attrs);
        content = Fragment.from(content);
        if (content.size) {
            let before = this.contentMatch.fillBefore(content);
            if (!before)
                return null;
            content = before.append(content);
        }
        let matched = this.contentMatch.matchFragment(content);
        let after = matched && matched.fillBefore(Fragment.empty, true);
        if (!after)
            return null;
        return new Node(this, attrs, content.append(after), Mark.setFrom(marks));
    }
    /**
    Returns true if the given fragment is valid content for this node
    type.
    */
    validContent(content) {
        let result = this.contentMatch.matchFragment(content);
        if (!result || !result.validEnd)
            return false;
        for (let i = 0; i < content.childCount; i++)
            if (!this.allowsMarks(content.child(i).marks))
                return false;
        return true;
    }
    /**
    Throws a RangeError if the given fragment is not valid content for this
    node type.
    @internal
    */
    checkContent(content) {
        if (!this.validContent(content))
            throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
    }
    /**
    @internal
    */
    checkAttrs(attrs) {
        checkAttrs(this.attrs, attrs, "node", this.name);
    }
    /**
    Check whether the given mark type is allowed in this node.
    */
    allowsMarkType(markType) {
        return this.markSet == null || this.markSet.indexOf(markType) > -1;
    }
    /**
    Test whether the given set of marks are allowed in this node.
    */
    allowsMarks(marks) {
        if (this.markSet == null)
            return true;
        for (let i = 0; i < marks.length; i++)
            if (!this.allowsMarkType(marks[i].type))
                return false;
        return true;
    }
    /**
    Removes the marks that are not allowed in this node from the given set.
    */
    allowedMarks(marks) {
        if (this.markSet == null)
            return marks;
        let copy;
        for (let i = 0; i < marks.length; i++) {
            if (!this.allowsMarkType(marks[i].type)) {
                if (!copy)
                    copy = marks.slice(0, i);
            }
            else if (copy) {
                copy.push(marks[i]);
            }
        }
        return !copy ? marks : copy.length ? copy : Mark.none;
    }
    /**
    @internal
    */
    static compile(nodes, schema) {
        let result = Object.create(null);
        nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));
        let topType = schema.spec.topNode || "doc";
        if (!result[topType])
            throw new RangeError("Schema is missing its top node type ('" + topType + "')");
        if (!result.text)
            throw new RangeError("Every schema needs a 'text' type");
        for (let _ in result.text.attrs)
            throw new RangeError("The text node type should not have attributes");
        return result;
    }
}
function validateType(typeName, attrName, type) {
    let types = type.split("|");
    return (value) => {
        let name = value === null ? "null" : typeof value;
        if (types.indexOf(name) < 0)
            throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);
    };
}
// Attribute descriptors
class Attribute {
    constructor(typeName, attrName, options) {
        this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
        this.default = options.default;
        this.validate = typeof options.validate == "string" ? validateType(typeName, attrName, options.validate) : options.validate;
    }
    get isRequired() {
        return !this.hasDefault;
    }
}
// Marks
/**
Like nodes, marks (which are associated with nodes to signify
things like emphasis or being part of a link) are
[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are
instantiated once per `Schema`.
*/
class MarkType {
    /**
    @internal
    */
    constructor(
    /**
    The name of the mark type.
    */
    name, 
    /**
    @internal
    */
    rank, 
    /**
    The schema that this mark type instance is part of.
    */
    schema, 
    /**
    The spec on which the type is based.
    */
    spec) {
        this.name = name;
        this.rank = rank;
        this.schema = schema;
        this.spec = spec;
        this.attrs = initAttrs(name, spec.attrs);
        this.excluded = null;
        let defaults = defaultAttrs(this.attrs);
        this.instance = defaults ? new Mark(this, defaults) : null;
    }
    /**
    Create a mark of this type. `attrs` may be `null` or an object
    containing only some of the mark's attributes. The others, if
    they have defaults, will be added.
    */
    create(attrs = null) {
        if (!attrs && this.instance)
            return this.instance;
        return new Mark(this, computeAttrs(this.attrs, attrs));
    }
    /**
    @internal
    */
    static compile(marks, schema) {
        let result = Object.create(null), rank = 0;
        marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));
        return result;
    }
    /**
    When there is a mark of this type in the given set, a new set
    without it is returned. Otherwise, the input set is returned.
    */
    removeFromSet(set) {
        for (var i = 0; i < set.length; i++)
            if (set[i].type == this) {
                set = set.slice(0, i).concat(set.slice(i + 1));
                i--;
            }
        return set;
    }
    /**
    Tests whether there is a mark of this type in the given set.
    */
    isInSet(set) {
        for (let i = 0; i < set.length; i++)
            if (set[i].type == this)
                return set[i];
    }
    /**
    @internal
    */
    checkAttrs(attrs) {
        checkAttrs(this.attrs, attrs, "mark", this.name);
    }
    /**
    Queries whether a given mark type is
    [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
    */
    excludes(other) {
        return this.excluded.indexOf(other) > -1;
    }
}
/**
A document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark
type](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may
occur in conforming documents, and provides functionality for
creating and deserializing such documents.

When given, the type parameters provide the names of the nodes and
marks in this schema.
*/
class Schema {
    /**
    Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
    */
    constructor(spec) {
        /**
        The [linebreak
        replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
        in this schema, if any.
        */
        this.linebreakReplacement = null;
        /**
        An object for storing whatever values modules may want to
        compute and cache per schema. (If you want to store something
        in it, try to use property names unlikely to clash.)
        */
        this.cached = Object.create(null);
        let instanceSpec = this.spec = {};
        for (let prop in spec)
            instanceSpec[prop] = spec[prop];
        instanceSpec.nodes = orderedmap__WEBPACK_IMPORTED_MODULE_0__["default"].from(spec.nodes),
            instanceSpec.marks = orderedmap__WEBPACK_IMPORTED_MODULE_0__["default"].from(spec.marks || {}),
            this.nodes = NodeType.compile(this.spec.nodes, this);
        this.marks = MarkType.compile(this.spec.marks, this);
        let contentExprCache = Object.create(null);
        for (let prop in this.nodes) {
            if (prop in this.marks)
                throw new RangeError(prop + " can not be both a node and a mark");
            let type = this.nodes[prop], contentExpr = type.spec.content || "", markExpr = type.spec.marks;
            type.contentMatch = contentExprCache[contentExpr] ||
                (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
            type.inlineContent = type.contentMatch.inlineContent;
            if (type.spec.linebreakReplacement) {
                if (this.linebreakReplacement)
                    throw new RangeError("Multiple linebreak nodes defined");
                if (!type.isInline || !type.isLeaf)
                    throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
                this.linebreakReplacement = type;
            }
            type.markSet = markExpr == "_" ? null :
                markExpr ? gatherMarks(this, markExpr.split(" ")) :
                    markExpr == "" || !type.inlineContent ? [] : null;
        }
        for (let prop in this.marks) {
            let type = this.marks[prop], excl = type.spec.excludes;
            type.excluded = excl == null ? [type] : excl == "" ? [] : gatherMarks(this, excl.split(" "));
        }
        this.nodeFromJSON = json => Node.fromJSON(this, json);
        this.markFromJSON = json => Mark.fromJSON(this, json);
        this.topNodeType = this.nodes[this.spec.topNode || "doc"];
        this.cached.wrappings = Object.create(null);
    }
    /**
    Create a node in this schema. The `type` may be a string or a
    `NodeType` instance. Attributes will be extended with defaults,
    `content` may be a `Fragment`, `null`, a `Node`, or an array of
    nodes.
    */
    node(type, attrs = null, content, marks) {
        if (typeof type == "string")
            type = this.nodeType(type);
        else if (!(type instanceof NodeType))
            throw new RangeError("Invalid node type: " + type);
        else if (type.schema != this)
            throw new RangeError("Node type from different schema used (" + type.name + ")");
        return type.createChecked(attrs, content, marks);
    }
    /**
    Create a text node in the schema. Empty text nodes are not
    allowed.
    */
    text(text, marks) {
        let type = this.nodes.text;
        return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));
    }
    /**
    Create a mark with the given type and attributes.
    */
    mark(type, attrs) {
        if (typeof type == "string")
            type = this.marks[type];
        return type.create(attrs);
    }
    /**
    @internal
    */
    nodeType(name) {
        let found = this.nodes[name];
        if (!found)
            throw new RangeError("Unknown node type: " + name);
        return found;
    }
}
function gatherMarks(schema, marks) {
    let found = [];
    for (let i = 0; i < marks.length; i++) {
        let name = marks[i], mark = schema.marks[name], ok = mark;
        if (mark) {
            found.push(mark);
        }
        else {
            for (let prop in schema.marks) {
                let mark = schema.marks[prop];
                if (name == "_" || (mark.spec.group && mark.spec.group.split(" ").indexOf(name) > -1))
                    found.push(ok = mark);
            }
        }
        if (!ok)
            throw new SyntaxError("Unknown mark type: '" + marks[i] + "'");
    }
    return found;
}

function isTagRule(rule) { return rule.tag != null; }
function isStyleRule(rule) { return rule.style != null; }
/**
A DOM parser represents a strategy for parsing DOM content into a
ProseMirror document conforming to a given schema. Its behavior is
defined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).
*/
class DOMParser {
    /**
    Create a parser that targets the given schema, using the given
    parsing rules.
    */
    constructor(
    /**
    The schema into which the parser parses.
    */
    schema, 
    /**
    The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser
    uses, in order of precedence.
    */
    rules) {
        this.schema = schema;
        this.rules = rules;
        /**
        @internal
        */
        this.tags = [];
        /**
        @internal
        */
        this.styles = [];
        let matchedStyles = this.matchedStyles = [];
        rules.forEach(rule => {
            if (isTagRule(rule)) {
                this.tags.push(rule);
            }
            else if (isStyleRule(rule)) {
                let prop = /[^=]*/.exec(rule.style)[0];
                if (matchedStyles.indexOf(prop) < 0)
                    matchedStyles.push(prop);
                this.styles.push(rule);
            }
        });
        // Only normalize list elements when lists in the schema can't directly contain themselves
        this.normalizeLists = !this.tags.some(r => {
            if (!/^(ul|ol)\b/.test(r.tag) || !r.node)
                return false;
            let node = schema.nodes[r.node];
            return node.contentMatch.matchType(node);
        });
    }
    /**
    Parse a document from the content of a DOM node.
    */
    parse(dom, options = {}) {
        let context = new ParseContext(this, options, false);
        context.addAll(dom, Mark.none, options.from, options.to);
        return context.finish();
    }
    /**
    Parses the content of the given DOM node, like
    [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
    options. But unlike that method, which produces a whole node,
    this one returns a slice that is open at the sides, meaning that
    the schema constraints aren't applied to the start of nodes to
    the left of the input and the end of nodes at the end.
    */
    parseSlice(dom, options = {}) {
        let context = new ParseContext(this, options, true);
        context.addAll(dom, Mark.none, options.from, options.to);
        return Slice.maxOpen(context.finish());
    }
    /**
    @internal
    */
    matchTag(dom, context, after) {
        for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {
            let rule = this.tags[i];
            if (matches(dom, rule.tag) &&
                (rule.namespace === undefined || dom.namespaceURI == rule.namespace) &&
                (!rule.context || context.matchesContext(rule.context))) {
                if (rule.getAttrs) {
                    let result = rule.getAttrs(dom);
                    if (result === false)
                        continue;
                    rule.attrs = result || undefined;
                }
                return rule;
            }
        }
    }
    /**
    @internal
    */
    matchStyle(prop, value, context, after) {
        for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {
            let rule = this.styles[i], style = rule.style;
            if (style.indexOf(prop) != 0 ||
                rule.context && !context.matchesContext(rule.context) ||
                // Test that the style string either precisely matches the prop,
                // or has an '=' sign after the prop, followed by the given
                // value.
                style.length > prop.length &&
                    (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value))
                continue;
            if (rule.getAttrs) {
                let result = rule.getAttrs(value);
                if (result === false)
                    continue;
                rule.attrs = result || undefined;
            }
            return rule;
        }
    }
    /**
    @internal
    */
    static schemaRules(schema) {
        let result = [];
        function insert(rule) {
            let priority = rule.priority == null ? 50 : rule.priority, i = 0;
            for (; i < result.length; i++) {
                let next = result[i], nextPriority = next.priority == null ? 50 : next.priority;
                if (nextPriority < priority)
                    break;
            }
            result.splice(i, 0, rule);
        }
        for (let name in schema.marks) {
            let rules = schema.marks[name].spec.parseDOM;
            if (rules)
                rules.forEach(rule => {
                    insert(rule = copy(rule));
                    if (!(rule.mark || rule.ignore || rule.clearMark))
                        rule.mark = name;
                });
        }
        for (let name in schema.nodes) {
            let rules = schema.nodes[name].spec.parseDOM;
            if (rules)
                rules.forEach(rule => {
                    insert(rule = copy(rule));
                    if (!(rule.node || rule.ignore || rule.mark))
                        rule.node = name;
                });
        }
        return result;
    }
    /**
    Construct a DOM parser using the parsing rules listed in a
    schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
    [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
    */
    static fromSchema(schema) {
        return schema.cached.domParser ||
            (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));
    }
}
const blockTags = {
    address: true, article: true, aside: true, blockquote: true, canvas: true,
    dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,
    footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,
    h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,
    output: true, p: true, pre: true, section: true, table: true, tfoot: true, ul: true
};
const ignoreTags = {
    head: true, noscript: true, object: true, script: true, style: true, title: true
};
const listTags = { ol: true, ul: true };
// Using a bitfield for node context options
const OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
function wsOptionsFor(type, preserveWhitespace, base) {
    if (preserveWhitespace != null)
        return (preserveWhitespace ? OPT_PRESERVE_WS : 0) |
            (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
    return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;
}
class NodeContext {
    constructor(type, attrs, marks, solid, match, options) {
        this.type = type;
        this.attrs = attrs;
        this.marks = marks;
        this.solid = solid;
        this.options = options;
        this.content = [];
        // Marks applied to the node's children
        this.activeMarks = Mark.none;
        this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
    }
    findWrapping(node) {
        if (!this.match) {
            if (!this.type)
                return [];
            let fill = this.type.contentMatch.fillBefore(Fragment.from(node));
            if (fill) {
                this.match = this.type.contentMatch.matchFragment(fill);
            }
            else {
                let start = this.type.contentMatch, wrap;
                if (wrap = start.findWrapping(node.type)) {
                    this.match = start;
                    return wrap;
                }
                else {
                    return null;
                }
            }
        }
        return this.match.findWrapping(node.type);
    }
    finish(openEnd) {
        if (!(this.options & OPT_PRESERVE_WS)) { // Strip trailing whitespace
            let last = this.content[this.content.length - 1], m;
            if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
                let text = last;
                if (last.text.length == m[0].length)
                    this.content.pop();
                else
                    this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
            }
        }
        let content = Fragment.from(this.content);
        if (!openEnd && this.match)
            content = content.append(this.match.fillBefore(Fragment.empty, true));
        return this.type ? this.type.create(this.attrs, content, this.marks) : content;
    }
    inlineContext(node) {
        if (this.type)
            return this.type.inlineContent;
        if (this.content.length)
            return this.content[0].isInline;
        return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());
    }
}
class ParseContext {
    constructor(
    // The parser we are using.
    parser, 
    // The options passed to this parse.
    options, isOpen) {
        this.parser = parser;
        this.options = options;
        this.isOpen = isOpen;
        this.open = 0;
        this.localPreserveWS = false;
        let topNode = options.topNode, topContext;
        let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
        if (topNode)
            topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
        else if (isOpen)
            topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);
        else
            topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);
        this.nodes = [topContext];
        this.find = options.findPositions;
        this.needsBlock = false;
    }
    get top() {
        return this.nodes[this.open];
    }
    // Add a DOM node to the content. Text is inserted as text node,
    // otherwise, the node is passed to `addElement` or, if it has a
    // `style` attribute, `addElementWithStyles`.
    addDOM(dom, marks) {
        if (dom.nodeType == 3)
            this.addTextNode(dom, marks);
        else if (dom.nodeType == 1)
            this.addElement(dom, marks);
    }
    addTextNode(dom, marks) {
        let value = dom.nodeValue;
        let top = this.top, preserveWS = (top.options & OPT_PRESERVE_WS_FULL) ? "full"
            : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;
        let { schema } = this.parser;
        if (preserveWS === "full" ||
            top.inlineContext(dom) ||
            /[^ \t\r\n\u000c]/.test(value)) {
            if (!preserveWS) {
                value = value.replace(/[ \t\r\n\u000c]+/g, " ");
                // If this starts with whitespace, and there is no node before it, or
                // a hard break, or a text node that ends with whitespace, strip the
                // leading space.
                if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
                    let nodeBefore = top.content[top.content.length - 1];
                    let domNodeBefore = dom.previousSibling;
                    if (!nodeBefore ||
                        (domNodeBefore && domNodeBefore.nodeName == 'BR') ||
                        (nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text)))
                        value = value.slice(1);
                }
            }
            else if (preserveWS === "full") {
                value = value.replace(/\r\n?/g, "\n");
            }
            else if (schema.linebreakReplacement && /[\r\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {
                let lines = value.split(/\r?\n|\r/);
                for (let i = 0; i < lines.length; i++) {
                    if (i)
                        this.insertNode(schema.linebreakReplacement.create(), marks, true);
                    if (lines[i])
                        this.insertNode(schema.text(lines[i]), marks, !/\S/.test(lines[i]));
                }
                value = "";
            }
            else {
                value = value.replace(/\r?\n|\r/g, " ");
            }
            if (value)
                this.insertNode(schema.text(value), marks, !/\S/.test(value));
            this.findInText(dom);
        }
        else {
            this.findInside(dom);
        }
    }
    // Try to find a handler for the given tag and use that to parse. If
    // none is found, the element's content nodes are added directly.
    addElement(dom, marks, matchAfter) {
        let outerWS = this.localPreserveWS, top = this.top;
        if (dom.tagName == "PRE" || /pre/.test(dom.style && dom.style.whiteSpace))
            this.localPreserveWS = true;
        let name = dom.nodeName.toLowerCase(), ruleID;
        if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)
            normalizeList(dom);
        let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) ||
            (ruleID = this.parser.matchTag(dom, this, matchAfter));
        out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
            this.findInside(dom);
            this.ignoreFallback(dom, marks);
        }
        else if (!rule || rule.skip || rule.closeParent) {
            if (rule && rule.closeParent)
                this.open = Math.max(0, this.open - 1);
            else if (rule && rule.skip.nodeType)
                dom = rule.skip;
            let sync, oldNeedsBlock = this.needsBlock;
            if (blockTags.hasOwnProperty(name)) {
                if (top.content.length && top.content[0].isInline && this.open) {
                    this.open--;
                    top = this.top;
                }
                sync = true;
                if (!top.type)
                    this.needsBlock = true;
            }
            else if (!dom.firstChild) {
                this.leafFallback(dom, marks);
                break out;
            }
            let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
            if (innerMarks)
                this.addAll(dom, innerMarks);
            if (sync)
                this.sync(top);
            this.needsBlock = oldNeedsBlock;
        }
        else {
            let innerMarks = this.readStyles(dom, marks);
            if (innerMarks)
                this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);
        }
        this.localPreserveWS = outerWS;
    }
    // Called for leaf DOM nodes that would otherwise be ignored
    leafFallback(dom, marks) {
        if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent)
            this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
    }
    // Called for ignored nodes
    ignoreFallback(dom, marks) {
        // Ignored BR nodes should at least create an inline context
        if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
            this.findPlace(this.parser.schema.text("-"), marks, true);
    }
    // Run any style parser associated with the node's styles. Either
    // return an updated array of marks, or null to indicate some of the
    // styles had a rule with `ignore` set.
    readStyles(dom, marks) {
        let styles = dom.style;
        // Because many properties will only show up in 'normalized' form
        // in `style.item` (i.e. text-decoration becomes
        // text-decoration-line, text-decoration-color, etc), we directly
        // query the styles mentioned in our rules instead of iterating
        // over the items.
        if (styles && styles.length)
            for (let i = 0; i < this.parser.matchedStyles.length; i++) {
                let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);
                if (value)
                    for (let after = undefined;;) {
                        let rule = this.parser.matchStyle(name, value, this, after);
                        if (!rule)
                            break;
                        if (rule.ignore)
                            return null;
                        if (rule.clearMark)
                            marks = marks.filter(m => !rule.clearMark(m));
                        else
                            marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
                        if (rule.consuming === false)
                            after = rule;
                        else
                            break;
                    }
            }
        return marks;
    }
    // Look up a handler for the given node. If none are found, return
    // false. Otherwise, apply it, use its return value to drive the way
    // the node's content is wrapped, and return true.
    addElementByRule(dom, rule, marks, continueAfter) {
        let sync, nodeType;
        if (rule.node) {
            nodeType = this.parser.schema.nodes[rule.node];
            if (!nodeType.isLeaf) {
                let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
                if (inner) {
                    sync = true;
                    marks = inner;
                }
            }
            else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) {
                this.leafFallback(dom, marks);
            }
        }
        else {
            let markType = this.parser.schema.marks[rule.mark];
            marks = marks.concat(markType.create(rule.attrs));
        }
        let startIn = this.top;
        if (nodeType && nodeType.isLeaf) {
            this.findInside(dom);
        }
        else if (continueAfter) {
            this.addElement(dom, marks, continueAfter);
        }
        else if (rule.getContent) {
            this.findInside(dom);
            rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks, false));
        }
        else {
            let contentDOM = dom;
            if (typeof rule.contentElement == "string")
                contentDOM = dom.querySelector(rule.contentElement);
            else if (typeof rule.contentElement == "function")
                contentDOM = rule.contentElement(dom);
            else if (rule.contentElement)
                contentDOM = rule.contentElement;
            this.findAround(dom, contentDOM, true);
            this.addAll(contentDOM, marks);
            this.findAround(dom, contentDOM, false);
        }
        if (sync && this.sync(startIn))
            this.open--;
    }
    // Add all child nodes between `startIndex` and `endIndex` (or the
    // whole node, if not given). If `sync` is passed, use it to
    // synchronize after every block element.
    addAll(parent, marks, startIndex, endIndex) {
        let index = startIndex || 0;
        for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {
            this.findAtPoint(parent, index);
            this.addDOM(dom, marks);
        }
        this.findAtPoint(parent, index);
    }
    // Try to find a way to fit the given node type into the current
    // context. May add intermediate wrappers and/or leave non-solid
    // nodes that we're in.
    findPlace(node, marks, cautious) {
        let route, sync;
        for (let depth = this.open, penalty = 0; depth >= 0; depth--) {
            let cx = this.nodes[depth];
            let found = cx.findWrapping(node);
            if (found && (!route || route.length > found.length + penalty)) {
                route = found;
                sync = cx;
                if (!found.length)
                    break;
            }
            if (cx.solid) {
                if (cautious)
                    break;
                penalty += 2;
            }
        }
        if (!route)
            return null;
        this.sync(sync);
        for (let i = 0; i < route.length; i++)
            marks = this.enterInner(route[i], null, marks, false);
        return marks;
    }
    // Try to insert the given node, adjusting the context when needed.
    insertNode(node, marks, cautious) {
        if (node.isInline && this.needsBlock && !this.top.type) {
            let block = this.textblockFromContext();
            if (block)
                marks = this.enterInner(block, null, marks);
        }
        let innerMarks = this.findPlace(node, marks, cautious);
        if (innerMarks) {
            this.closeExtra();
            let top = this.top;
            if (top.match)
                top.match = top.match.matchType(node.type);
            let nodeMarks = Mark.none;
            for (let m of innerMarks.concat(node.marks))
                if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type))
                    nodeMarks = m.addToSet(nodeMarks);
            top.content.push(node.mark(nodeMarks));
            return true;
        }
        return false;
    }
    // Try to start a node of the given type, adjusting the context when
    // necessary.
    enter(type, attrs, marks, preserveWS) {
        let innerMarks = this.findPlace(type.create(attrs), marks, false);
        if (innerMarks)
            innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
        return innerMarks;
    }
    // Open a node of the given type
    enterInner(type, attrs, marks, solid = false, preserveWS) {
        this.closeExtra();
        let top = this.top;
        top.match = top.match && top.match.matchType(type);
        let options = wsOptionsFor(type, preserveWS, top.options);
        if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0)
            options |= OPT_OPEN_LEFT;
        let applyMarks = Mark.none;
        marks = marks.filter(m => {
            if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
                applyMarks = m.addToSet(applyMarks);
                return false;
            }
            return true;
        });
        this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
        this.open++;
        return marks;
    }
    // Make sure all nodes above this.open are finished and added to
    // their parents
    closeExtra(openEnd = false) {
        let i = this.nodes.length - 1;
        if (i > this.open) {
            for (; i > this.open; i--)
                this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));
            this.nodes.length = this.open + 1;
        }
    }
    finish() {
        this.open = 0;
        this.closeExtra(this.isOpen);
        return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
    }
    sync(to) {
        for (let i = this.open; i >= 0; i--) {
            if (this.nodes[i] == to) {
                this.open = i;
                return true;
            }
            else if (this.localPreserveWS) {
                this.nodes[i].options |= OPT_PRESERVE_WS;
            }
        }
        return false;
    }
    get currentPos() {
        this.closeExtra();
        let pos = 0;
        for (let i = this.open; i >= 0; i--) {
            let content = this.nodes[i].content;
            for (let j = content.length - 1; j >= 0; j--)
                pos += content[j].nodeSize;
            if (i)
                pos++;
        }
        return pos;
    }
    findAtPoint(parent, offset) {
        if (this.find)
            for (let i = 0; i < this.find.length; i++) {
                if (this.find[i].node == parent && this.find[i].offset == offset)
                    this.find[i].pos = this.currentPos;
            }
    }
    findInside(parent) {
        if (this.find)
            for (let i = 0; i < this.find.length; i++) {
                if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node))
                    this.find[i].pos = this.currentPos;
            }
    }
    findAround(parent, content, before) {
        if (parent != content && this.find)
            for (let i = 0; i < this.find.length; i++) {
                if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {
                    let pos = content.compareDocumentPosition(this.find[i].node);
                    if (pos & (before ? 2 : 4))
                        this.find[i].pos = this.currentPos;
                }
            }
    }
    findInText(textNode) {
        if (this.find)
            for (let i = 0; i < this.find.length; i++) {
                if (this.find[i].node == textNode)
                    this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);
            }
    }
    // Determines whether the given context string matches this context.
    matchesContext(context) {
        if (context.indexOf("|") > -1)
            return context.split(/\s*\|\s*/).some(this.matchesContext, this);
        let parts = context.split("/");
        let option = this.options.context;
        let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);
        let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);
        let match = (i, depth) => {
            for (; i >= 0; i--) {
                let part = parts[i];
                if (part == "") {
                    if (i == parts.length - 1 || i == 0)
                        continue;
                    for (; depth >= minDepth; depth--)
                        if (match(i - 1, depth))
                            return true;
                    return false;
                }
                else {
                    let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type
                        : option && depth >= minDepth ? option.node(depth - minDepth).type
                            : null;
                    if (!next || (next.name != part && !next.isInGroup(part)))
                        return false;
                    depth--;
                }
            }
            return true;
        };
        return match(parts.length - 1, this.open);
    }
    textblockFromContext() {
        let $context = this.options.context;
        if ($context)
            for (let d = $context.depth; d >= 0; d--) {
                let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;
                if (deflt && deflt.isTextblock && deflt.defaultAttrs)
                    return deflt;
            }
        for (let name in this.parser.schema.nodes) {
            let type = this.parser.schema.nodes[name];
            if (type.isTextblock && type.defaultAttrs)
                return type;
        }
    }
}
// Kludge to work around directly nested list nodes produced by some
// tools and allowed by browsers to mean that the nested list is
// actually part of the list item above it.
function normalizeList(dom) {
    for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
        let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;
        if (name && listTags.hasOwnProperty(name) && prevItem) {
            prevItem.appendChild(child);
            child = prevItem;
        }
        else if (name == "li") {
            prevItem = child;
        }
        else if (name) {
            prevItem = null;
        }
    }
}
// Apply a CSS selector.
function matches(dom, selector) {
    return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);
}
function copy(obj) {
    let copy = {};
    for (let prop in obj)
        copy[prop] = obj[prop];
    return copy;
}
// Used when finding a mark at the top level of a fragment parse.
// Checks whether it would be reasonable to apply a given mark type to
// a given node, by looking at the way the mark occurs in the schema.
function markMayApply(markType, nodeType) {
    let nodes = nodeType.schema.nodes;
    for (let name in nodes) {
        let parent = nodes[name];
        if (!parent.allowsMarkType(markType))
            continue;
        let seen = [], scan = (match) => {
            seen.push(match);
            for (let i = 0; i < match.edgeCount; i++) {
                let { type, next } = match.edge(i);
                if (type == nodeType)
                    return true;
                if (seen.indexOf(next) < 0 && scan(next))
                    return true;
            }
        };
        if (scan(parent.contentMatch))
            return true;
    }
}

/**
A DOM serializer knows how to convert ProseMirror nodes and
marks of various types to DOM nodes.
*/
class DOMSerializer {
    /**
    Create a serializer. `nodes` should map node names to functions
    that take a node and return a description of the corresponding
    DOM. `marks` does the same for mark names, but also gets an
    argument that tells it whether the mark's content is block or
    inline content (for typical use, it'll always be inline). A mark
    serializer may be `null` to indicate that marks of that type
    should not be serialized.
    */
    constructor(
    /**
    The node serialization functions.
    */
    nodes, 
    /**
    The mark serialization functions.
    */
    marks) {
        this.nodes = nodes;
        this.marks = marks;
    }
    /**
    Serialize the content of this fragment to a DOM fragment. When
    not in the browser, the `document` option, containing a DOM
    document, should be passed so that the serializer can create
    nodes.
    */
    serializeFragment(fragment, options = {}, target) {
        if (!target)
            target = doc(options).createDocumentFragment();
        let top = target, active = [];
        fragment.forEach(node => {
            if (active.length || node.marks.length) {
                let keep = 0, rendered = 0;
                while (keep < active.length && rendered < node.marks.length) {
                    let next = node.marks[rendered];
                    if (!this.marks[next.type.name]) {
                        rendered++;
                        continue;
                    }
                    if (!next.eq(active[keep][0]) || next.type.spec.spanning === false)
                        break;
                    keep++;
                    rendered++;
                }
                while (keep < active.length)
                    top = active.pop()[1];
                while (rendered < node.marks.length) {
                    let add = node.marks[rendered++];
                    let markDOM = this.serializeMark(add, node.isInline, options);
                    if (markDOM) {
                        active.push([add, top]);
                        top.appendChild(markDOM.dom);
                        top = markDOM.contentDOM || markDOM.dom;
                    }
                }
            }
            top.appendChild(this.serializeNodeInner(node, options));
        });
        return target;
    }
    /**
    @internal
    */
    serializeNodeInner(node, options) {
        let { dom, contentDOM } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);
        if (contentDOM) {
            if (node.isLeaf)
                throw new RangeError("Content hole not allowed in a leaf node spec");
            this.serializeFragment(node.content, options, contentDOM);
        }
        return dom;
    }
    /**
    Serialize this node to a DOM node. This can be useful when you
    need to serialize a part of a document, as opposed to the whole
    document. To serialize a whole document, use
    [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
    its [content](https://prosemirror.net/docs/ref/#model.Node.content).
    */
    serializeNode(node, options = {}) {
        let dom = this.serializeNodeInner(node, options);
        for (let i = node.marks.length - 1; i >= 0; i--) {
            let wrap = this.serializeMark(node.marks[i], node.isInline, options);
            if (wrap) {
                (wrap.contentDOM || wrap.dom).appendChild(dom);
                dom = wrap.dom;
            }
        }
        return dom;
    }
    /**
    @internal
    */
    serializeMark(mark, inline, options = {}) {
        let toDOM = this.marks[mark.type.name];
        return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);
    }
    static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
        return renderSpec(doc, structure, xmlNS, blockArraysIn);
    }
    /**
    Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
    properties in a schema's node and mark specs.
    */
    static fromSchema(schema) {
        return schema.cached.domSerializer ||
            (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));
    }
    /**
    Gather the serializers in a schema's node specs into an object.
    This can be useful as a base to build a custom serializer from.
    */
    static nodesFromSchema(schema) {
        let result = gatherToDOM(schema.nodes);
        if (!result.text)
            result.text = node => node.text;
        return result;
    }
    /**
    Gather the serializers in a schema's mark specs into an object.
    */
    static marksFromSchema(schema) {
        return gatherToDOM(schema.marks);
    }
}
function gatherToDOM(obj) {
    let result = {};
    for (let name in obj) {
        let toDOM = obj[name].spec.toDOM;
        if (toDOM)
            result[name] = toDOM;
    }
    return result;
}
function doc(options) {
    return options.document || window.document;
}
const suspiciousAttributeCache = new WeakMap();
function suspiciousAttributes(attrs) {
    let value = suspiciousAttributeCache.get(attrs);
    if (value === undefined)
        suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
    return value;
}
function suspiciousAttributesInner(attrs) {
    let result = null;
    function scan(value) {
        if (value && typeof value == "object") {
            if (Array.isArray(value)) {
                if (typeof value[0] == "string") {
                    if (!result)
                        result = [];
                    result.push(value);
                }
                else {
                    for (let i = 0; i < value.length; i++)
                        scan(value[i]);
                }
            }
            else {
                for (let prop in value)
                    scan(value[prop]);
            }
        }
    }
    scan(attrs);
    return result;
}
function renderSpec(doc, structure, xmlNS, blockArraysIn) {
    if (typeof structure == "string")
        return { dom: doc.createTextNode(structure) };
    if (structure.nodeType != null)
        return { dom: structure };
    if (structure.dom && structure.dom.nodeType != null)
        return structure;
    let tagName = structure[0], suspicious;
    if (typeof tagName != "string")
        throw new RangeError("Invalid array passed to renderSpec");
    if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) &&
        suspicious.indexOf(structure) > -1)
        throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
    let space = tagName.indexOf(" ");
    if (space > 0) {
        xmlNS = tagName.slice(0, space);
        tagName = tagName.slice(space + 1);
    }
    let contentDOM;
    let dom = (xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName));
    let attrs = structure[1], start = 1;
    if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
        start = 2;
        for (let name in attrs)
            if (attrs[name] != null) {
                let space = name.indexOf(" ");
                if (space > 0)
                    dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);
                else if (name == "style" && dom.style)
                    dom.style.cssText = attrs[name];
                else
                    dom.setAttribute(name, attrs[name]);
            }
    }
    for (let i = start; i < structure.length; i++) {
        let child = structure[i];
        if (child === 0) {
            if (i < structure.length - 1 || i > start)
                throw new RangeError("Content hole must be the only child of its parent node");
            return { dom, contentDOM: dom };
        }
        else {
            let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);
            dom.appendChild(inner);
            if (innerContent) {
                if (contentDOM)
                    throw new RangeError("Multiple content holes");
                contentDOM = innerContent;
            }
        }
    }
    return { dom, contentDOM };
}




/***/ }),

/***/ "./node_modules/prosemirror-schema-list/dist/index.js":
/*!************************************************************!*\
  !*** ./node_modules/prosemirror-schema-list/dist/index.js ***!
  \************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   addListNodes: function() { return /* binding */ addListNodes; },
/* harmony export */   bulletList: function() { return /* binding */ bulletList; },
/* harmony export */   liftListItem: function() { return /* binding */ liftListItem; },
/* harmony export */   listItem: function() { return /* binding */ listItem; },
/* harmony export */   orderedList: function() { return /* binding */ orderedList; },
/* harmony export */   sinkListItem: function() { return /* binding */ sinkListItem; },
/* harmony export */   splitListItem: function() { return /* binding */ splitListItem; },
/* harmony export */   splitListItemKeepMarks: function() { return /* binding */ splitListItemKeepMarks; },
/* harmony export */   wrapInList: function() { return /* binding */ wrapInList; },
/* harmony export */   wrapRangeInList: function() { return /* binding */ wrapRangeInList; }
/* harmony export */ });
/* harmony import */ var prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-transform */ "./node_modules/prosemirror-transform/dist/index.js");
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");
/* harmony import */ var prosemirror_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prosemirror-state */ "./node_modules/prosemirror-state/dist/index.js");




const olDOM = ["ol", 0], ulDOM = ["ul", 0], liDOM = ["li", 0];
/**
An ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single
attribute, `order`, which determines the number at which the list
starts counting, and defaults to 1. Represented as an `<ol>`
element.
*/
const orderedList = {
    attrs: { order: { default: 1, validate: "number" } },
    parseDOM: [{ tag: "ol", getAttrs(dom) {
                return { order: dom.hasAttribute("start") ? +dom.getAttribute("start") : 1 };
            } }],
    toDOM(node) {
        return node.attrs.order == 1 ? olDOM : ["ol", { start: node.attrs.order }, 0];
    }
};
/**
A bullet list node spec, represented in the DOM as `<ul>`.
*/
const bulletList = {
    parseDOM: [{ tag: "ul" }],
    toDOM() { return ulDOM; }
};
/**
A list item (`<li>`) spec.
*/
const listItem = {
    parseDOM: [{ tag: "li" }],
    toDOM() { return liDOM; },
    defining: true
};
function add(obj, props) {
    let copy = {};
    for (let prop in obj)
        copy[prop] = obj[prop];
    for (let prop in props)
        copy[prop] = props[prop];
    return copy;
}
/**
Convenience function for adding list-related node types to a map
specifying the nodes for a schema. Adds
[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `"ordered_list"`,
[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `"bullet_list"`, and
[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `"list_item"`.

`itemContent` determines the content expression for the list items.
If you want the commands defined in this module to apply to your
list structure, it should have a shape like `"paragraph block*"` or
`"paragraph (ordered_list | bullet_list)*"`. `listGroup` can be
given to assign a group name to the list node types, for example
`"block"`.
*/
function addListNodes(nodes, itemContent, listGroup) {
    return nodes.append({
        ordered_list: add(orderedList, { content: "list_item+", group: listGroup }),
        bullet_list: add(bulletList, { content: "list_item+", group: listGroup }),
        list_item: add(listItem, { content: itemContent })
    });
}
/**
Returns a command function that wraps the selection in a list with
the given type an attributes. If `dispatch` is null, only return a
value to indicate whether this is possible, but don't actually
perform the change.
*/
function wrapInList(listType, attrs = null) {
    return function (state, dispatch) {
        let { $from, $to } = state.selection;
        let range = $from.blockRange($to);
        if (!range)
            return false;
        let tr = dispatch ? state.tr : null;
        if (!wrapRangeInList(tr, range, listType, attrs))
            return false;
        if (dispatch)
            dispatch(tr.scrollIntoView());
        return true;
    };
}
/**
Try to wrap the given node range in a list of the given type.
Return `true` when this is possible, `false` otherwise. When `tr`
is non-null, the wrapping is added to that transaction. When it is
`null`, the function only queries whether the wrapping is
possible.
*/
function wrapRangeInList(tr, range, listType, attrs = null) {
    let doJoin = false, outerRange = range, doc = range.$from.doc;
    // This is at the top of an existing list item
    if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
        // Don't do anything if this is the top of the list
        if (range.$from.index(range.depth - 1) == 0)
            return false;
        let $insert = doc.resolve(range.start - 2);
        outerRange = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.NodeRange($insert, $insert, range.depth);
        if (range.endIndex < range.parent.childCount)
            range = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);
        doJoin = true;
    }
    let wrap = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.findWrapping)(outerRange, listType, attrs, range);
    if (!wrap)
        return false;
    if (tr)
        doWrapInList(tr, range, wrap, doJoin, listType);
    return true;
}
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
    let content = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty;
    for (let i = wrappers.length - 1; i >= 0; i--)
        content = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
    tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(content, 0, 0), wrappers.length, true));
    let found = 0;
    for (let i = 0; i < wrappers.length; i++)
        if (wrappers[i].type == listType)
            found = i + 1;
    let splitDepth = wrappers.length - found;
    let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;
    for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {
        if (!first && (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, splitPos, splitDepth)) {
            tr.split(splitPos, splitDepth);
            splitPos += 2 * splitDepth;
        }
        splitPos += parent.child(i).nodeSize;
    }
    return tr;
}
/**
Build a command that splits a non-empty textblock at the top level
of a list item by also splitting that list item.
*/
function splitListItem(itemType, itemAttrs) {
    return function (state, dispatch) {
        let { $from, $to, node } = state.selection;
        if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))
            return false;
        let grandParent = $from.node(-1);
        if (grandParent.type != itemType)
            return false;
        if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {
            // In an empty block. If this is a nested list, the wrapping
            // list item should be split. Otherwise, bail out and let next
            // command handle lifting.
            if ($from.depth == 3 || $from.node(-3).type != itemType ||
                $from.index(-2) != $from.node(-2).childCount - 1)
                return false;
            if (dispatch) {
                let wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty;
                let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
                // Build a fragment containing empty versions of the structure
                // from the outer list item to the parent node of the cursor
                for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)
                    wrap = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from($from.node(d).copy(wrap));
                let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1
                    : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
                // Add a second list item with an empty default start node
                wrap = wrap.append(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(itemType.createAndFill()));
                let start = $from.before($from.depth - (depthBefore - 1));
                let tr = state.tr.replace(start, $from.after(-depthAfter), new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(wrap, 4 - depthBefore, 0));
                let sel = -1;
                tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {
                    if (sel > -1)
                        return false;
                    if (node.isTextblock && node.content.size == 0)
                        sel = pos + 1;
                });
                if (sel > -1)
                    tr.setSelection(prosemirror_state__WEBPACK_IMPORTED_MODULE_2__.Selection.near(tr.doc.resolve(sel)));
                dispatch(tr.scrollIntoView());
            }
            return true;
        }
        let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
        let tr = state.tr.delete($from.pos, $to.pos);
        let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;
        if (!(0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canSplit)(tr.doc, $from.pos, 2, types))
            return false;
        if (dispatch)
            dispatch(tr.split($from.pos, 2, types).scrollIntoView());
        return true;
    };
}
/**
Acts like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but
without resetting the set of active marks at the cursor.
*/
function splitListItemKeepMarks(itemType, itemAttrs) {
    let split = splitListItem(itemType, itemAttrs);
    return (state, dispatch) => {
        return split(state, dispatch && (tr => {
            let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
            if (marks)
                tr.ensureMarks(marks);
            dispatch(tr);
        }));
    };
}
/**
Create a command to lift the list item around the selection up into
a wrapping list.
*/
function liftListItem(itemType) {
    return function (state, dispatch) {
        let { $from, $to } = state.selection;
        let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
        if (!range)
            return false;
        if (!dispatch)
            return true;
        if ($from.node(range.depth - 1).type == itemType) // Inside a parent list
            return liftToOuterList(state, dispatch, itemType, range);
        else // Outer list node
            return liftOutOfList(state, dispatch, range);
    };
}
function liftToOuterList(state, dispatch, itemType, range) {
    let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
    if (end < endOfList) {
        // There are siblings after the lifted items, which must become
        // children of the last item
        tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep(end - 1, endOfList, end, endOfList, new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
        range = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
    }
    const target = (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.liftTarget)(range);
    if (target == null)
        return false;
    tr.lift(range, target);
    let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);
    if ((0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.canJoin)(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)
        tr.join($after.pos);
    dispatch(tr.scrollIntoView());
    return true;
}
function liftOutOfList(state, dispatch, range) {
    let tr = state.tr, list = range.parent;
    // Merge the list items into a single big item
    for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
        pos -= list.child(i).nodeSize;
        tr.delete(pos - 1, pos + 1);
    }
    let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;
    if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)
        return false;
    let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
    let parent = $start.node(-1), indexBefore = $start.index(-1);
    if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty : prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(list))))
        return false;
    let start = $start.pos, end = start + item.nodeSize;
    // Strip off the surrounding list. At the sides where we're not at
    // the end of the list, the existing list is closed. At sides where
    // this is the end, it is overwritten to its end.
    tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice((atStart ? prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty : prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(list.copy(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty)))
        .append(atEnd ? prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty : prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(list.copy(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
    dispatch(tr.scrollIntoView());
    return true;
}
/**
Create a command to sink the list item around the selection down
into an inner list.
*/
function sinkListItem(itemType) {
    return function (state, dispatch) {
        let { $from, $to } = state.selection;
        let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
        if (!range)
            return false;
        let startIndex = range.startIndex;
        if (startIndex == 0)
            return false;
        let parent = range.parent, nodeBefore = parent.child(startIndex - 1);
        if (nodeBefore.type != itemType)
            return false;
        if (dispatch) {
            let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
            let inner = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(nestedBefore ? itemType.create() : null);
            let slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(itemType.create(null, prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
            let before = range.start, after = range.end;
            dispatch(state.tr.step(new prosemirror_transform__WEBPACK_IMPORTED_MODULE_0__.ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))
                .scrollIntoView());
        }
        return true;
    };
}




/***/ }),

/***/ "./node_modules/prosemirror-state/dist/index.js":
/*!******************************************************!*\
  !*** ./node_modules/prosemirror-state/dist/index.js ***!
  \******************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AllSelection: function() { return /* binding */ AllSelection; },
/* harmony export */   EditorState: function() { return /* binding */ EditorState; },
/* harmony export */   NodeSelection: function() { return /* binding */ NodeSelection; },
/* harmony export */   Plugin: function() { return /* binding */ Plugin; },
/* harmony export */   PluginKey: function() { return /* binding */ PluginKey; },
/* harmony export */   Selection: function() { return /* binding */ Selection; },
/* harmony export */   SelectionRange: function() { return /* binding */ SelectionRange; },
/* harmony export */   TextSelection: function() { return /* binding */ TextSelection; },
/* harmony export */   Transaction: function() { return /* binding */ Transaction; }
/* harmony export */ });
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");
/* harmony import */ var prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prosemirror-transform */ "./node_modules/prosemirror-transform/dist/index.js");



const classesById = Object.create(null);
/**
Superclass for editor selections. Every selection type should
extend this. Should not be instantiated directly.
*/
class Selection {
    /**
    Initialize a selection with the head and anchor and ranges. If no
    ranges are given, constructs a single range across `$anchor` and
    `$head`.
    */
    constructor(
    /**
    The resolved anchor of the selection (the side that stays in
    place when the selection is modified).
    */
    $anchor, 
    /**
    The resolved head of the selection (the side that moves when
    the selection is modified).
    */
    $head, ranges) {
        this.$anchor = $anchor;
        this.$head = $head;
        this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
    }
    /**
    The selection's anchor, as an unresolved position.
    */
    get anchor() { return this.$anchor.pos; }
    /**
    The selection's head.
    */
    get head() { return this.$head.pos; }
    /**
    The lower bound of the selection's main range.
    */
    get from() { return this.$from.pos; }
    /**
    The upper bound of the selection's main range.
    */
    get to() { return this.$to.pos; }
    /**
    The resolved lower  bound of the selection's main range.
    */
    get $from() {
        return this.ranges[0].$from;
    }
    /**
    The resolved upper bound of the selection's main range.
    */
    get $to() {
        return this.ranges[0].$to;
    }
    /**
    Indicates whether the selection contains any content.
    */
    get empty() {
        let ranges = this.ranges;
        for (let i = 0; i < ranges.length; i++)
            if (ranges[i].$from.pos != ranges[i].$to.pos)
                return false;
        return true;
    }
    /**
    Get the content of this selection as a slice.
    */
    content() {
        return this.$from.doc.slice(this.from, this.to, true);
    }
    /**
    Replace the selection with a slice or, if no slice is given,
    delete the selection. Will append to the given transaction.
    */
    replace(tr, content = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
        // Put the new selection at the position after the inserted
        // content. When that ended in an inline node, search backwards,
        // to get the position after that node. If not, search forward.
        let lastNode = content.content.lastChild, lastParent = null;
        for (let i = 0; i < content.openEnd; i++) {
            lastParent = lastNode;
            lastNode = lastNode.lastChild;
        }
        let mapFrom = tr.steps.length, ranges = this.ranges;
        for (let i = 0; i < ranges.length; i++) {
            let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
            tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty : content);
            if (i == 0)
                selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
        }
    }
    /**
    Replace the selection with the given node, appending the changes
    to the given transaction.
    */
    replaceWith(tr, node) {
        let mapFrom = tr.steps.length, ranges = this.ranges;
        for (let i = 0; i < ranges.length; i++) {
            let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
            let from = mapping.map($from.pos), to = mapping.map($to.pos);
            if (i) {
                tr.deleteRange(from, to);
            }
            else {
                tr.replaceRangeWith(from, to, node);
                selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
            }
        }
    }
    /**
    Find a valid cursor or leaf node selection starting at the given
    position and searching back if `dir` is negative, and forward if
    positive. When `textOnly` is true, only consider cursor
    selections. Will return null when no valid selection position is
    found.
    */
    static findFrom($pos, dir, textOnly = false) {
        let inner = $pos.parent.inlineContent ? new TextSelection($pos)
            : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
        if (inner)
            return inner;
        for (let depth = $pos.depth - 1; depth >= 0; depth--) {
            let found = dir < 0
                ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly)
                : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
            if (found)
                return found;
        }
        return null;
    }
    /**
    Find a valid cursor or leaf node selection near the given
    position. Searches forward first by default, but if `bias` is
    negative, it will search backwards first.
    */
    static near($pos, bias = 1) {
        return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
    }
    /**
    Find the cursor or leaf node selection closest to the start of
    the given document. Will return an
    [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
    exists.
    */
    static atStart(doc) {
        return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
    }
    /**
    Find the cursor or leaf node selection closest to the end of the
    given document.
    */
    static atEnd(doc) {
        return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
    }
    /**
    Deserialize the JSON representation of a selection. Must be
    implemented for custom classes (as a static class method).
    */
    static fromJSON(doc, json) {
        if (!json || !json.type)
            throw new RangeError("Invalid input for Selection.fromJSON");
        let cls = classesById[json.type];
        if (!cls)
            throw new RangeError(`No selection type ${json.type} defined`);
        return cls.fromJSON(doc, json);
    }
    /**
    To be able to deserialize selections from JSON, custom selection
    classes must register themselves with an ID string, so that they
    can be disambiguated. Try to pick something that's unlikely to
    clash with classes from other modules.
    */
    static jsonID(id, selectionClass) {
        if (id in classesById)
            throw new RangeError("Duplicate use of selection JSON ID " + id);
        classesById[id] = selectionClass;
        selectionClass.prototype.jsonID = id;
        return selectionClass;
    }
    /**
    Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
    which is a value that can be mapped without having access to a
    current document, and later resolved to a real selection for a
    given document again. (This is used mostly by the history to
    track and restore old selections.) The default implementation of
    this method just converts the selection to a text selection and
    returns the bookmark for that.
    */
    getBookmark() {
        return TextSelection.between(this.$anchor, this.$head).getBookmark();
    }
}
Selection.prototype.visible = true;
/**
Represents a selected range in a document.
*/
class SelectionRange {
    /**
    Create a range.
    */
    constructor(
    /**
    The lower bound of the range.
    */
    $from, 
    /**
    The upper bound of the range.
    */
    $to) {
        this.$from = $from;
        this.$to = $to;
    }
}
let warnedAboutTextSelection = false;
function checkTextSelection($pos) {
    if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
        warnedAboutTextSelection = true;
        console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
    }
}
/**
A text selection represents a classical editor selection, with a
head (the moving side) and anchor (immobile side), both of which
point into textblock nodes. It can be empty (a regular cursor
position).
*/
class TextSelection extends Selection {
    /**
    Construct a text selection between the given points.
    */
    constructor($anchor, $head = $anchor) {
        checkTextSelection($anchor);
        checkTextSelection($head);
        super($anchor, $head);
    }
    /**
    Returns a resolved position if this is a cursor selection (an
    empty text selection), and null otherwise.
    */
    get $cursor() { return this.$anchor.pos == this.$head.pos ? this.$head : null; }
    map(doc, mapping) {
        let $head = doc.resolve(mapping.map(this.head));
        if (!$head.parent.inlineContent)
            return Selection.near($head);
        let $anchor = doc.resolve(mapping.map(this.anchor));
        return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
    }
    replace(tr, content = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
        super.replace(tr, content);
        if (content == prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
            let marks = this.$from.marksAcross(this.$to);
            if (marks)
                tr.ensureMarks(marks);
        }
    }
    eq(other) {
        return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;
    }
    getBookmark() {
        return new TextBookmark(this.anchor, this.head);
    }
    toJSON() {
        return { type: "text", anchor: this.anchor, head: this.head };
    }
    /**
    @internal
    */
    static fromJSON(doc, json) {
        if (typeof json.anchor != "number" || typeof json.head != "number")
            throw new RangeError("Invalid input for TextSelection.fromJSON");
        return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
    }
    /**
    Create a text selection from non-resolved positions.
    */
    static create(doc, anchor, head = anchor) {
        let $anchor = doc.resolve(anchor);
        return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
    }
    /**
    Return a text selection that spans the given positions or, if
    they aren't text positions, find a text selection near them.
    `bias` determines whether the method searches forward (default)
    or backwards (negative number) first. Will fall back to calling
    [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
    doesn't contain a valid text position.
    */
    static between($anchor, $head, bias) {
        let dPos = $anchor.pos - $head.pos;
        if (!bias || dPos)
            bias = dPos >= 0 ? 1 : -1;
        if (!$head.parent.inlineContent) {
            let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);
            if (found)
                $head = found.$head;
            else
                return Selection.near($head, bias);
        }
        if (!$anchor.parent.inlineContent) {
            if (dPos == 0) {
                $anchor = $head;
            }
            else {
                $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;
                if (($anchor.pos < $head.pos) != (dPos < 0))
                    $anchor = $head;
            }
        }
        return new TextSelection($anchor, $head);
    }
}
Selection.jsonID("text", TextSelection);
class TextBookmark {
    constructor(anchor, head) {
        this.anchor = anchor;
        this.head = head;
    }
    map(mapping) {
        return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
    }
    resolve(doc) {
        return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
    }
}
/**
A node selection is a selection that points at a single node. All
nodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the
target of a node selection. In such a selection, `from` and `to`
point directly before and after the selected node, `anchor` equals
`from`, and `head` equals `to`..
*/
class NodeSelection extends Selection {
    /**
    Create a node selection. Does not verify the validity of its
    argument.
    */
    constructor($pos) {
        let node = $pos.nodeAfter;
        let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
        super($pos, $end);
        this.node = node;
    }
    map(doc, mapping) {
        let { deleted, pos } = mapping.mapResult(this.anchor);
        let $pos = doc.resolve(pos);
        if (deleted)
            return Selection.near($pos);
        return new NodeSelection($pos);
    }
    content() {
        return new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(this.node), 0, 0);
    }
    eq(other) {
        return other instanceof NodeSelection && other.anchor == this.anchor;
    }
    toJSON() {
        return { type: "node", anchor: this.anchor };
    }
    getBookmark() { return new NodeBookmark(this.anchor); }
    /**
    @internal
    */
    static fromJSON(doc, json) {
        if (typeof json.anchor != "number")
            throw new RangeError("Invalid input for NodeSelection.fromJSON");
        return new NodeSelection(doc.resolve(json.anchor));
    }
    /**
    Create a node selection from non-resolved positions.
    */
    static create(doc, from) {
        return new NodeSelection(doc.resolve(from));
    }
    /**
    Determines whether the given node may be selected as a node
    selection.
    */
    static isSelectable(node) {
        return !node.isText && node.type.spec.selectable !== false;
    }
}
NodeSelection.prototype.visible = false;
Selection.jsonID("node", NodeSelection);
class NodeBookmark {
    constructor(anchor) {
        this.anchor = anchor;
    }
    map(mapping) {
        let { deleted, pos } = mapping.mapResult(this.anchor);
        return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);
    }
    resolve(doc) {
        let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
        if (node && NodeSelection.isSelectable(node))
            return new NodeSelection($pos);
        return Selection.near($pos);
    }
}
/**
A selection type that represents selecting the whole document
(which can not necessarily be expressed with a text selection, when
there are for example leaf block nodes at the start or end of the
document).
*/
class AllSelection extends Selection {
    /**
    Create an all-selection over the given document.
    */
    constructor(doc) {
        super(doc.resolve(0), doc.resolve(doc.content.size));
    }
    replace(tr, content = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
        if (content == prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
            tr.delete(0, tr.doc.content.size);
            let sel = Selection.atStart(tr.doc);
            if (!sel.eq(tr.selection))
                tr.setSelection(sel);
        }
        else {
            super.replace(tr, content);
        }
    }
    toJSON() { return { type: "all" }; }
    /**
    @internal
    */
    static fromJSON(doc) { return new AllSelection(doc); }
    map(doc) { return new AllSelection(doc); }
    eq(other) { return other instanceof AllSelection; }
    getBookmark() { return AllBookmark; }
}
Selection.jsonID("all", AllSelection);
const AllBookmark = {
    map() { return this; },
    resolve(doc) { return new AllSelection(doc); }
};
// FIXME we'll need some awareness of text direction when scanning for selections
// Try to find a selection inside the given node. `pos` points at the
// position where the search starts. When `text` is true, only return
// text selections.
function findSelectionIn(doc, node, pos, index, dir, text = false) {
    if (node.inlineContent)
        return TextSelection.create(doc, pos);
    for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
        let child = node.child(i);
        if (!child.isAtom) {
            let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
            if (inner)
                return inner;
        }
        else if (!text && NodeSelection.isSelectable(child)) {
            return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
        }
        pos += child.nodeSize * dir;
    }
    return null;
}
function selectionToInsertionEnd(tr, startLen, bias) {
    let last = tr.steps.length - 1;
    if (last < startLen)
        return;
    let step = tr.steps[last];
    if (!(step instanceof prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.ReplaceStep || step instanceof prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.ReplaceAroundStep))
        return;
    let map = tr.mapping.maps[last], end;
    map.forEach((_from, _to, _newFrom, newTo) => { if (end == null)
        end = newTo; });
    tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
}

const UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
/**
An editor state transaction, which can be applied to a state to
create an updated state. Use
[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.

Transactions track changes to the document (they are a subclass of
[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,
like selection updates and adjustments of the set of [stored
marks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store
metadata properties in a transaction, which are extra pieces of
information that client code or plugins can use to describe what a
transaction represents, so that they can update their [own
state](https://prosemirror.net/docs/ref/#state.StateField) accordingly.

The [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata
properties: it will attach a property `"pointer"` with the value
`true` to selection transactions directly caused by mouse or touch
input, a `"composition"` property holding an ID identifying the
composition that caused it to transactions caused by composed DOM
input, and a `"uiEvent"` property of that may be `"paste"`,
`"cut"`, or `"drop"`.
*/
class Transaction extends prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.Transform {
    /**
    @internal
    */
    constructor(state) {
        super(state.doc);
        // The step count for which the current selection is valid.
        this.curSelectionFor = 0;
        // Bitfield to track which aspects of the state were updated by
        // this transaction.
        this.updated = 0;
        // Object used to store metadata properties for the transaction.
        this.meta = Object.create(null);
        this.time = Date.now();
        this.curSelection = state.selection;
        this.storedMarks = state.storedMarks;
    }
    /**
    The transaction's current selection. This defaults to the editor
    selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the
    transaction, but can be overwritten with
    [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
    */
    get selection() {
        if (this.curSelectionFor < this.steps.length) {
            this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
            this.curSelectionFor = this.steps.length;
        }
        return this.curSelection;
    }
    /**
    Update the transaction's current selection. Will determine the
    selection that the editor gets when the transaction is applied.
    */
    setSelection(selection) {
        if (selection.$from.doc != this.doc)
            throw new RangeError("Selection passed to setSelection must point at the current document");
        this.curSelection = selection;
        this.curSelectionFor = this.steps.length;
        this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
        this.storedMarks = null;
        return this;
    }
    /**
    Whether the selection was explicitly updated by this transaction.
    */
    get selectionSet() {
        return (this.updated & UPDATED_SEL) > 0;
    }
    /**
    Set the current stored marks.
    */
    setStoredMarks(marks) {
        this.storedMarks = marks;
        this.updated |= UPDATED_MARKS;
        return this;
    }
    /**
    Make sure the current stored marks or, if that is null, the marks
    at the selection, match the given set of marks. Does nothing if
    this is already the case.
    */
    ensureMarks(marks) {
        if (!prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))
            this.setStoredMarks(marks);
        return this;
    }
    /**
    Add a mark to the set of stored marks.
    */
    addStoredMark(mark) {
        return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
    }
    /**
    Remove a mark or mark type from the set of stored marks.
    */
    removeStoredMark(mark) {
        return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
    }
    /**
    Whether the stored marks were explicitly set for this transaction.
    */
    get storedMarksSet() {
        return (this.updated & UPDATED_MARKS) > 0;
    }
    /**
    @internal
    */
    addStep(step, doc) {
        super.addStep(step, doc);
        this.updated = this.updated & ~UPDATED_MARKS;
        this.storedMarks = null;
    }
    /**
    Update the timestamp for the transaction.
    */
    setTime(time) {
        this.time = time;
        return this;
    }
    /**
    Replace the current selection with the given slice.
    */
    replaceSelection(slice) {
        this.selection.replace(this, slice);
        return this;
    }
    /**
    Replace the selection with the given node. When `inheritMarks` is
    true and the content is inline, it inherits the marks from the
    place where it is inserted.
    */
    replaceSelectionWith(node, inheritMarks = true) {
        let selection = this.selection;
        if (inheritMarks)
            node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Mark.none)));
        selection.replaceWith(this, node);
        return this;
    }
    /**
    Delete the selection.
    */
    deleteSelection() {
        this.selection.replace(this);
        return this;
    }
    /**
    Replace the given range, or the selection if no range is given,
    with a text node containing the given string.
    */
    insertText(text, from, to) {
        let schema = this.doc.type.schema;
        if (from == null) {
            if (!text)
                return this.deleteSelection();
            return this.replaceSelectionWith(schema.text(text), true);
        }
        else {
            if (to == null)
                to = from;
            if (!text)
                return this.deleteRange(from, to);
            let marks = this.storedMarks;
            if (!marks) {
                let $from = this.doc.resolve(from);
                marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
            }
            this.replaceRangeWith(from, to, schema.text(text, marks));
            if (!this.selection.empty && this.selection.to == from + text.length)
                this.setSelection(Selection.near(this.selection.$to));
            return this;
        }
    }
    /**
    Store a metadata property in this transaction, keyed either by
    name or by plugin.
    */
    setMeta(key, value) {
        this.meta[typeof key == "string" ? key : key.key] = value;
        return this;
    }
    /**
    Retrieve a metadata property for a given name or plugin.
    */
    getMeta(key) {
        return this.meta[typeof key == "string" ? key : key.key];
    }
    /**
    Returns true if this transaction doesn't contain any metadata,
    and can thus safely be extended.
    */
    get isGeneric() {
        for (let _ in this.meta)
            return false;
        return true;
    }
    /**
    Indicate that the editor should scroll the selection into view
    when updated to the state produced by this transaction.
    */
    scrollIntoView() {
        this.updated |= UPDATED_SCROLL;
        return this;
    }
    /**
    True when this transaction has had `scrollIntoView` called on it.
    */
    get scrolledIntoView() {
        return (this.updated & UPDATED_SCROLL) > 0;
    }
}

function bind(f, self) {
    return !self || !f ? f : f.bind(self);
}
class FieldDesc {
    constructor(name, desc, self) {
        this.name = name;
        this.init = bind(desc.init, self);
        this.apply = bind(desc.apply, self);
    }
}
const baseFields = [
    new FieldDesc("doc", {
        init(config) { return config.doc || config.schema.topNodeType.createAndFill(); },
        apply(tr) { return tr.doc; }
    }),
    new FieldDesc("selection", {
        init(config, instance) { return config.selection || Selection.atStart(instance.doc); },
        apply(tr) { return tr.selection; }
    }),
    new FieldDesc("storedMarks", {
        init(config) { return config.storedMarks || null; },
        apply(tr, _marks, _old, state) { return state.selection.$cursor ? tr.storedMarks : null; }
    }),
    new FieldDesc("scrollToSelection", {
        init() { return 0; },
        apply(tr, prev) { return tr.scrolledIntoView ? prev + 1 : prev; }
    })
];
// Object wrapping the part of a state object that stays the same
// across transactions. Stored in the state's `config` property.
class Configuration {
    constructor(schema, plugins) {
        this.schema = schema;
        this.plugins = [];
        this.pluginsByKey = Object.create(null);
        this.fields = baseFields.slice();
        if (plugins)
            plugins.forEach(plugin => {
                if (this.pluginsByKey[plugin.key])
                    throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
                this.plugins.push(plugin);
                this.pluginsByKey[plugin.key] = plugin;
                if (plugin.spec.state)
                    this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));
            });
    }
}
/**
The state of a ProseMirror editor is represented by an object of
this type. A state is a persistent data structure—it isn't
updated, but rather a new state value is computed from an old one
using the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.

A state holds a number of built-in fields, and plugins can
[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.
*/
class EditorState {
    /**
    @internal
    */
    constructor(
    /**
    @internal
    */
    config) {
        this.config = config;
    }
    /**
    The schema of the state's document.
    */
    get schema() {
        return this.config.schema;
    }
    /**
    The plugins that are active in this state.
    */
    get plugins() {
        return this.config.plugins;
    }
    /**
    Apply the given transaction to produce a new state.
    */
    apply(tr) {
        return this.applyTransaction(tr).state;
    }
    /**
    @internal
    */
    filterTransaction(tr, ignore = -1) {
        for (let i = 0; i < this.config.plugins.length; i++)
            if (i != ignore) {
                let plugin = this.config.plugins[i];
                if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))
                    return false;
            }
        return true;
    }
    /**
    Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
    returns the precise transactions that were applied (which might
    be influenced by the [transaction
    hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
    plugins) along with the new state.
    */
    applyTransaction(rootTr) {
        if (!this.filterTransaction(rootTr))
            return { state: this, transactions: [] };
        let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
        // This loop repeatedly gives plugins a chance to respond to
        // transactions as new transactions are added, making sure to only
        // pass the transactions the plugin did not see before.
        for (;;) {
            let haveNew = false;
            for (let i = 0; i < this.config.plugins.length; i++) {
                let plugin = this.config.plugins[i];
                if (plugin.spec.appendTransaction) {
                    let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;
                    let tr = n < trs.length &&
                        plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
                    if (tr && newState.filterTransaction(tr, i)) {
                        tr.setMeta("appendedTransaction", rootTr);
                        if (!seen) {
                            seen = [];
                            for (let j = 0; j < this.config.plugins.length; j++)
                                seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });
                        }
                        trs.push(tr);
                        newState = newState.applyInner(tr);
                        haveNew = true;
                    }
                    if (seen)
                        seen[i] = { state: newState, n: trs.length };
                }
            }
            if (!haveNew)
                return { state: newState, transactions: trs };
        }
    }
    /**
    @internal
    */
    applyInner(tr) {
        if (!tr.before.eq(this.doc))
            throw new RangeError("Applying a mismatched transaction");
        let newInstance = new EditorState(this.config), fields = this.config.fields;
        for (let i = 0; i < fields.length; i++) {
            let field = fields[i];
            newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
        }
        return newInstance;
    }
    /**
    Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
    */
    get tr() { return new Transaction(this); }
    /**
    Create a new state.
    */
    static create(config) {
        let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
        let instance = new EditorState($config);
        for (let i = 0; i < $config.fields.length; i++)
            instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
        return instance;
    }
    /**
    Create a new state based on this one, but with an adjusted set
    of active plugins. State fields that exist in both sets of
    plugins are kept unchanged. Those that no longer exist are
    dropped, and those that are new are initialized using their
    [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
    configuration object..
    */
    reconfigure(config) {
        let $config = new Configuration(this.schema, config.plugins);
        let fields = $config.fields, instance = new EditorState($config);
        for (let i = 0; i < fields.length; i++) {
            let name = fields[i].name;
            instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
        }
        return instance;
    }
    /**
    Serialize this state to JSON. If you want to serialize the state
    of plugins, pass an object mapping property names to use in the
    resulting JSON object to plugin objects. The argument may also be
    a string or number, in which case it is ignored, to support the
    way `JSON.stringify` calls `toString` methods.
    */
    toJSON(pluginFields) {
        let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };
        if (this.storedMarks)
            result.storedMarks = this.storedMarks.map(m => m.toJSON());
        if (pluginFields && typeof pluginFields == 'object')
            for (let prop in pluginFields) {
                if (prop == "doc" || prop == "selection")
                    throw new RangeError("The JSON fields `doc` and `selection` are reserved");
                let plugin = pluginFields[prop], state = plugin.spec.state;
                if (state && state.toJSON)
                    result[prop] = state.toJSON.call(plugin, this[plugin.key]);
            }
        return result;
    }
    /**
    Deserialize a JSON representation of a state. `config` should
    have at least a `schema` field, and should contain array of
    plugins to initialize the state with. `pluginFields` can be used
    to deserialize the state of plugins, by associating plugin
    instances with the property names they use in the JSON object.
    */
    static fromJSON(config, json, pluginFields) {
        if (!json)
            throw new RangeError("Invalid input for EditorState.fromJSON");
        if (!config.schema)
            throw new RangeError("Required config field 'schema' missing");
        let $config = new Configuration(config.schema, config.plugins);
        let instance = new EditorState($config);
        $config.fields.forEach(field => {
            if (field.name == "doc") {
                instance.doc = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Node.fromJSON(config.schema, json.doc);
            }
            else if (field.name == "selection") {
                instance.selection = Selection.fromJSON(instance.doc, json.selection);
            }
            else if (field.name == "storedMarks") {
                if (json.storedMarks)
                    instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
            }
            else {
                if (pluginFields)
                    for (let prop in pluginFields) {
                        let plugin = pluginFields[prop], state = plugin.spec.state;
                        if (plugin.key == field.name && state && state.fromJSON &&
                            Object.prototype.hasOwnProperty.call(json, prop)) {
                            instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
                            return;
                        }
                    }
                instance[field.name] = field.init(config, instance);
            }
        });
        return instance;
    }
}

function bindProps(obj, self, target) {
    for (let prop in obj) {
        let val = obj[prop];
        if (val instanceof Function)
            val = val.bind(self);
        else if (prop == "handleDOMEvents")
            val = bindProps(val, self, {});
        target[prop] = val;
    }
    return target;
}
/**
Plugins bundle functionality that can be added to an editor.
They are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and
may influence that state and the view that contains it.
*/
class Plugin {
    /**
    Create a plugin.
    */
    constructor(
    /**
    The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).
    */
    spec) {
        this.spec = spec;
        /**
        The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.
        */
        this.props = {};
        if (spec.props)
            bindProps(spec.props, this, this.props);
        this.key = spec.key ? spec.key.key : createKey("plugin");
    }
    /**
    Extract the plugin's state field from an editor state.
    */
    getState(state) { return state[this.key]; }
}
const keys = Object.create(null);
function createKey(name) {
    if (name in keys)
        return name + "$" + ++keys[name];
    keys[name] = 0;
    return name + "$";
}
/**
A key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way
that makes it possible to find them, given an editor state.
Assigning a key does mean only one plugin of that type can be
active in a state.
*/
class PluginKey {
    /**
    Create a plugin key.
    */
    constructor(name = "key") { this.key = createKey(name); }
    /**
    Get the active plugin with this key, if any, from an editor
    state.
    */
    get(state) { return state.config.pluginsByKey[this.key]; }
    /**
    Get the plugin's state from an editor state.
    */
    getState(state) { return state[this.key]; }
}




/***/ }),

/***/ "./node_modules/prosemirror-transform/dist/index.js":
/*!**********************************************************!*\
  !*** ./node_modules/prosemirror-transform/dist/index.js ***!
  \**********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AddMarkStep: function() { return /* binding */ AddMarkStep; },
/* harmony export */   AddNodeMarkStep: function() { return /* binding */ AddNodeMarkStep; },
/* harmony export */   AttrStep: function() { return /* binding */ AttrStep; },
/* harmony export */   DocAttrStep: function() { return /* binding */ DocAttrStep; },
/* harmony export */   MapResult: function() { return /* binding */ MapResult; },
/* harmony export */   Mapping: function() { return /* binding */ Mapping; },
/* harmony export */   RemoveMarkStep: function() { return /* binding */ RemoveMarkStep; },
/* harmony export */   RemoveNodeMarkStep: function() { return /* binding */ RemoveNodeMarkStep; },
/* harmony export */   ReplaceAroundStep: function() { return /* binding */ ReplaceAroundStep; },
/* harmony export */   ReplaceStep: function() { return /* binding */ ReplaceStep; },
/* harmony export */   Step: function() { return /* binding */ Step; },
/* harmony export */   StepMap: function() { return /* binding */ StepMap; },
/* harmony export */   StepResult: function() { return /* binding */ StepResult; },
/* harmony export */   Transform: function() { return /* binding */ Transform; },
/* harmony export */   TransformError: function() { return /* binding */ TransformError; },
/* harmony export */   canJoin: function() { return /* binding */ canJoin; },
/* harmony export */   canSplit: function() { return /* binding */ canSplit; },
/* harmony export */   dropPoint: function() { return /* binding */ dropPoint; },
/* harmony export */   findWrapping: function() { return /* binding */ findWrapping; },
/* harmony export */   insertPoint: function() { return /* binding */ insertPoint; },
/* harmony export */   joinPoint: function() { return /* binding */ joinPoint; },
/* harmony export */   liftTarget: function() { return /* binding */ liftTarget; },
/* harmony export */   replaceStep: function() { return /* binding */ replaceStep; }
/* harmony export */ });
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");


// Recovery values encode a range index and an offset. They are
// represented as numbers, because tons of them will be created when
// mapping, for example, a large number of decorations. The number's
// lower 16 bits provide the index, the remaining bits the offset.
//
// Note: We intentionally don't use bit shift operators to en- and
// decode these, since those clip to 32 bits, which we might in rare
// cases want to overflow. A 64-bit float can represent 48-bit
// integers precisely.
const lower16 = 0xffff;
const factor16 = Math.pow(2, 16);
function makeRecover(index, offset) { return index + offset * factor16; }
function recoverIndex(value) { return value & lower16; }
function recoverOffset(value) { return (value - (value & lower16)) / factor16; }
const DEL_BEFORE = 1, DEL_AFTER = 2, DEL_ACROSS = 4, DEL_SIDE = 8;
/**
An object representing a mapped position with extra
information.
*/
class MapResult {
    /**
    @internal
    */
    constructor(
    /**
    The mapped version of the position.
    */
    pos, 
    /**
    @internal
    */
    delInfo, 
    /**
    @internal
    */
    recover) {
        this.pos = pos;
        this.delInfo = delInfo;
        this.recover = recover;
    }
    /**
    Tells you whether the position was deleted, that is, whether the
    step removed the token on the side queried (via the `assoc`)
    argument from the document.
    */
    get deleted() { return (this.delInfo & DEL_SIDE) > 0; }
    /**
    Tells you whether the token before the mapped position was deleted.
    */
    get deletedBefore() { return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0; }
    /**
    True when the token after the mapped position was deleted.
    */
    get deletedAfter() { return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0; }
    /**
    Tells whether any of the steps mapped through deletes across the
    position (including both the token before and after the
    position).
    */
    get deletedAcross() { return (this.delInfo & DEL_ACROSS) > 0; }
}
/**
A map describing the deletions and insertions made by a step, which
can be used to find the correspondence between positions in the
pre-step version of a document and the same position in the
post-step version.
*/
class StepMap {
    /**
    Create a position map. The modifications to the document are
    represented as an array of numbers, in which each group of three
    represents a modified chunk as `[start, oldSize, newSize]`.
    */
    constructor(
    /**
    @internal
    */
    ranges, 
    /**
    @internal
    */
    inverted = false) {
        this.ranges = ranges;
        this.inverted = inverted;
        if (!ranges.length && StepMap.empty)
            return StepMap.empty;
    }
    /**
    @internal
    */
    recover(value) {
        let diff = 0, index = recoverIndex(value);
        if (!this.inverted)
            for (let i = 0; i < index; i++)
                diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
        return this.ranges[index * 3] + diff + recoverOffset(value);
    }
    mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }
    map(pos, assoc = 1) { return this._map(pos, assoc, true); }
    /**
    @internal
    */
    _map(pos, assoc, simple) {
        let diff = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
        for (let i = 0; i < this.ranges.length; i += 3) {
            let start = this.ranges[i] - (this.inverted ? diff : 0);
            if (start > pos)
                break;
            let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex], end = start + oldSize;
            if (pos <= end) {
                let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
                let result = start + diff + (side < 0 ? 0 : newSize);
                if (simple)
                    return result;
                let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
                let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
                if (assoc < 0 ? pos != start : pos != end)
                    del |= DEL_SIDE;
                return new MapResult(result, del, recover);
            }
            diff += newSize - oldSize;
        }
        return simple ? pos + diff : new MapResult(pos + diff, 0, null);
    }
    /**
    @internal
    */
    touches(pos, recover) {
        let diff = 0, index = recoverIndex(recover);
        let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
        for (let i = 0; i < this.ranges.length; i += 3) {
            let start = this.ranges[i] - (this.inverted ? diff : 0);
            if (start > pos)
                break;
            let oldSize = this.ranges[i + oldIndex], end = start + oldSize;
            if (pos <= end && i == index * 3)
                return true;
            diff += this.ranges[i + newIndex] - oldSize;
        }
        return false;
    }
    /**
    Calls the given function on each of the changed ranges included in
    this map.
    */
    forEach(f) {
        let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;
        for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
            let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);
            let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];
            f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
            diff += newSize - oldSize;
        }
    }
    /**
    Create an inverted version of this map. The result can be used to
    map positions in the post-step document to the pre-step document.
    */
    invert() {
        return new StepMap(this.ranges, !this.inverted);
    }
    /**
    @internal
    */
    toString() {
        return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
    }
    /**
    Create a map that moves all positions by offset `n` (which may be
    negative). This can be useful when applying steps meant for a
    sub-document to a larger document, or vice-versa.
    */
    static offset(n) {
        return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);
    }
}
/**
A StepMap that contains no changed ranges.
*/
StepMap.empty = new StepMap([]);
/**
A mapping represents a pipeline of zero or more [step
maps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly
handling mapping positions through a series of steps in which some
steps are inverted versions of earlier steps. (This comes up when
‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for
collaboration or history management.)
*/
class Mapping {
    /**
    Create a new mapping with the given position maps.
    */
    constructor(maps, 
    /**
    @internal
    */
    mirror, 
    /**
    The starting position in the `maps` array, used when `map` or
    `mapResult` is called.
    */
    from = 0, 
    /**
    The end position in the `maps` array.
    */
    to = maps ? maps.length : 0) {
        this.mirror = mirror;
        this.from = from;
        this.to = to;
        this._maps = maps || [];
        this.ownData = !(maps || mirror);
    }
    /**
    The step maps in this mapping.
    */
    get maps() { return this._maps; }
    /**
    Create a mapping that maps only through a part of this one.
    */
    slice(from = 0, to = this.maps.length) {
        return new Mapping(this._maps, this.mirror, from, to);
    }
    /**
    Add a step map to the end of this mapping. If `mirrors` is
    given, it should be the index of the step map that is the mirror
    image of this one.
    */
    appendMap(map, mirrors) {
        if (!this.ownData) {
            this._maps = this._maps.slice();
            this.mirror = this.mirror && this.mirror.slice();
            this.ownData = true;
        }
        this.to = this._maps.push(map);
        if (mirrors != null)
            this.setMirror(this._maps.length - 1, mirrors);
    }
    /**
    Add all the step maps in a given mapping to this one (preserving
    mirroring information).
    */
    appendMapping(mapping) {
        for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
            let mirr = mapping.getMirror(i);
            this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);
        }
    }
    /**
    Finds the offset of the step map that mirrors the map at the
    given offset, in this mapping (as per the second argument to
    `appendMap`).
    */
    getMirror(n) {
        if (this.mirror)
            for (let i = 0; i < this.mirror.length; i++)
                if (this.mirror[i] == n)
                    return this.mirror[i + (i % 2 ? -1 : 1)];
    }
    /**
    @internal
    */
    setMirror(n, m) {
        if (!this.mirror)
            this.mirror = [];
        this.mirror.push(n, m);
    }
    /**
    Append the inverse of the given mapping to this one.
    */
    appendMappingInverted(mapping) {
        for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
            let mirr = mapping.getMirror(i);
            this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);
        }
    }
    /**
    Create an inverted version of this mapping.
    */
    invert() {
        let inverse = new Mapping;
        inverse.appendMappingInverted(this);
        return inverse;
    }
    /**
    Map a position through this mapping.
    */
    map(pos, assoc = 1) {
        if (this.mirror)
            return this._map(pos, assoc, true);
        for (let i = this.from; i < this.to; i++)
            pos = this._maps[i].map(pos, assoc);
        return pos;
    }
    /**
    Map a position through this mapping, returning a mapping
    result.
    */
    mapResult(pos, assoc = 1) { return this._map(pos, assoc, false); }
    /**
    @internal
    */
    _map(pos, assoc, simple) {
        let delInfo = 0;
        for (let i = this.from; i < this.to; i++) {
            let map = this._maps[i], result = map.mapResult(pos, assoc);
            if (result.recover != null) {
                let corr = this.getMirror(i);
                if (corr != null && corr > i && corr < this.to) {
                    i = corr;
                    pos = this._maps[corr].recover(result.recover);
                    continue;
                }
            }
            delInfo |= result.delInfo;
            pos = result.pos;
        }
        return simple ? pos : new MapResult(pos, delInfo, null);
    }
}

const stepsByID = Object.create(null);
/**
A step object represents an atomic change. It generally applies
only to the document it was created for, since the positions
stored in it will only make sense for that document.

New steps are defined by creating classes that extend `Step`,
overriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`
methods, and registering your class with a unique
JSON-serialization identifier using
[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).
*/
class Step {
    /**
    Get the step map that represents the changes made by this step,
    and which can be used to transform between positions in the old
    and the new document.
    */
    getMap() { return StepMap.empty; }
    /**
    Try to merge this step with another one, to be applied directly
    after it. Returns the merged step when possible, null if the
    steps can't be merged.
    */
    merge(other) { return null; }
    /**
    Deserialize a step from its JSON representation. Will call
    through to the step class' own implementation of this method.
    */
    static fromJSON(schema, json) {
        if (!json || !json.stepType)
            throw new RangeError("Invalid input for Step.fromJSON");
        let type = stepsByID[json.stepType];
        if (!type)
            throw new RangeError(`No step type ${json.stepType} defined`);
        return type.fromJSON(schema, json);
    }
    /**
    To be able to serialize steps to JSON, each step needs a string
    ID to attach to its JSON representation. Use this method to
    register an ID for your step classes. Try to pick something
    that's unlikely to clash with steps from other modules.
    */
    static jsonID(id, stepClass) {
        if (id in stepsByID)
            throw new RangeError("Duplicate use of step JSON ID " + id);
        stepsByID[id] = stepClass;
        stepClass.prototype.jsonID = id;
        return stepClass;
    }
}
/**
The result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a
new document or a failure value.
*/
class StepResult {
    /**
    @internal
    */
    constructor(
    /**
    The transformed document, if successful.
    */
    doc, 
    /**
    The failure message, if unsuccessful.
    */
    failed) {
        this.doc = doc;
        this.failed = failed;
    }
    /**
    Create a successful step result.
    */
    static ok(doc) { return new StepResult(doc, null); }
    /**
    Create a failed step result.
    */
    static fail(message) { return new StepResult(null, message); }
    /**
    Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
    arguments. Create a successful result if it succeeds, and a
    failed one if it throws a `ReplaceError`.
    */
    static fromReplace(doc, from, to, slice) {
        try {
            return StepResult.ok(doc.replace(from, to, slice));
        }
        catch (e) {
            if (e instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ReplaceError)
                return StepResult.fail(e.message);
            throw e;
        }
    }
}

function mapFragment(fragment, f, parent) {
    let mapped = [];
    for (let i = 0; i < fragment.childCount; i++) {
        let child = fragment.child(i);
        if (child.content.size)
            child = child.copy(mapFragment(child.content, f, child));
        if (child.isInline)
            child = f(child, parent, i);
        mapped.push(child);
    }
    return prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.fromArray(mapped);
}
/**
Add a mark to all inline content between two positions.
*/
class AddMarkStep extends Step {
    /**
    Create a mark step.
    */
    constructor(
    /**
    The start of the marked range.
    */
    from, 
    /**
    The end of the marked range.
    */
    to, 
    /**
    The mark to add.
    */
    mark) {
        super();
        this.from = from;
        this.to = to;
        this.mark = mark;
    }
    apply(doc) {
        let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from);
        let parent = $from.node($from.sharedDepth(this.to));
        let slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(mapFragment(oldSlice.content, (node, parent) => {
            if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type))
                return node;
            return node.mark(this.mark.addToSet(node.marks));
        }, parent), oldSlice.openStart, oldSlice.openEnd);
        return StepResult.fromReplace(doc, this.from, this.to, slice);
    }
    invert() {
        return new RemoveMarkStep(this.from, this.to, this.mark);
    }
    map(mapping) {
        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
        if (from.deleted && to.deleted || from.pos >= to.pos)
            return null;
        return new AddMarkStep(from.pos, to.pos, this.mark);
    }
    merge(other) {
        if (other instanceof AddMarkStep &&
            other.mark.eq(this.mark) &&
            this.from <= other.to && this.to >= other.from)
            return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
        return null;
    }
    toJSON() {
        return { stepType: "addMark", mark: this.mark.toJSON(),
            from: this.from, to: this.to };
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.from != "number" || typeof json.to != "number")
            throw new RangeError("Invalid input for AddMarkStep.fromJSON");
        return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
    }
}
Step.jsonID("addMark", AddMarkStep);
/**
Remove a mark from all inline content between two positions.
*/
class RemoveMarkStep extends Step {
    /**
    Create a mark-removing step.
    */
    constructor(
    /**
    The start of the unmarked range.
    */
    from, 
    /**
    The end of the unmarked range.
    */
    to, 
    /**
    The mark to remove.
    */
    mark) {
        super();
        this.from = from;
        this.to = to;
        this.mark = mark;
    }
    apply(doc) {
        let oldSlice = doc.slice(this.from, this.to);
        let slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(mapFragment(oldSlice.content, node => {
            return node.mark(this.mark.removeFromSet(node.marks));
        }, doc), oldSlice.openStart, oldSlice.openEnd);
        return StepResult.fromReplace(doc, this.from, this.to, slice);
    }
    invert() {
        return new AddMarkStep(this.from, this.to, this.mark);
    }
    map(mapping) {
        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
        if (from.deleted && to.deleted || from.pos >= to.pos)
            return null;
        return new RemoveMarkStep(from.pos, to.pos, this.mark);
    }
    merge(other) {
        if (other instanceof RemoveMarkStep &&
            other.mark.eq(this.mark) &&
            this.from <= other.to && this.to >= other.from)
            return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
        return null;
    }
    toJSON() {
        return { stepType: "removeMark", mark: this.mark.toJSON(),
            from: this.from, to: this.to };
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.from != "number" || typeof json.to != "number")
            throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
        return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
    }
}
Step.jsonID("removeMark", RemoveMarkStep);
/**
Add a mark to a specific node.
*/
class AddNodeMarkStep extends Step {
    /**
    Create a node mark step.
    */
    constructor(
    /**
    The position of the target node.
    */
    pos, 
    /**
    The mark to add.
    */
    mark) {
        super();
        this.pos = pos;
        this.mark = mark;
    }
    apply(doc) {
        let node = doc.nodeAt(this.pos);
        if (!node)
            return StepResult.fail("No node at mark step's position");
        let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
    }
    invert(doc) {
        let node = doc.nodeAt(this.pos);
        if (node) {
            let newSet = this.mark.addToSet(node.marks);
            if (newSet.length == node.marks.length) {
                for (let i = 0; i < node.marks.length; i++)
                    if (!node.marks[i].isInSet(newSet))
                        return new AddNodeMarkStep(this.pos, node.marks[i]);
                return new AddNodeMarkStep(this.pos, this.mark);
            }
        }
        return new RemoveNodeMarkStep(this.pos, this.mark);
    }
    map(mapping) {
        let pos = mapping.mapResult(this.pos, 1);
        return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
    }
    toJSON() {
        return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.pos != "number")
            throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
        return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
    }
}
Step.jsonID("addNodeMark", AddNodeMarkStep);
/**
Remove a mark from a specific node.
*/
class RemoveNodeMarkStep extends Step {
    /**
    Create a mark-removing step.
    */
    constructor(
    /**
    The position of the target node.
    */
    pos, 
    /**
    The mark to remove.
    */
    mark) {
        super();
        this.pos = pos;
        this.mark = mark;
    }
    apply(doc) {
        let node = doc.nodeAt(this.pos);
        if (!node)
            return StepResult.fail("No node at mark step's position");
        let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
    }
    invert(doc) {
        let node = doc.nodeAt(this.pos);
        if (!node || !this.mark.isInSet(node.marks))
            return this;
        return new AddNodeMarkStep(this.pos, this.mark);
    }
    map(mapping) {
        let pos = mapping.mapResult(this.pos, 1);
        return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
    }
    toJSON() {
        return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.pos != "number")
            throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
        return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
    }
}
Step.jsonID("removeNodeMark", RemoveNodeMarkStep);

/**
Replace a part of the document with a slice of new content.
*/
class ReplaceStep extends Step {
    /**
    The given `slice` should fit the 'gap' between `from` and
    `to`—the depths must line up, and the surrounding nodes must be
    able to be joined with the open sides of the slice. When
    `structure` is true, the step will fail if the content between
    from and to is not just a sequence of closing and then opening
    tokens (this is to guard against rebased replace steps
    overwriting something they weren't supposed to).
    */
    constructor(
    /**
    The start position of the replaced range.
    */
    from, 
    /**
    The end position of the replaced range.
    */
    to, 
    /**
    The slice to insert.
    */
    slice, 
    /**
    @internal
    */
    structure = false) {
        super();
        this.from = from;
        this.to = to;
        this.slice = slice;
        this.structure = structure;
    }
    apply(doc) {
        if (this.structure && contentBetween(doc, this.from, this.to))
            return StepResult.fail("Structure replace would overwrite content");
        return StepResult.fromReplace(doc, this.from, this.to, this.slice);
    }
    getMap() {
        return new StepMap([this.from, this.to - this.from, this.slice.size]);
    }
    invert(doc) {
        return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
    }
    map(mapping) {
        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
        if (from.deletedAcross && to.deletedAcross)
            return null;
        return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
    }
    merge(other) {
        if (!(other instanceof ReplaceStep) || other.structure || this.structure)
            return null;
        if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
            let slice = this.slice.size + other.slice.size == 0 ? prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty
                : new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
            return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
        }
        else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
            let slice = this.slice.size + other.slice.size == 0 ? prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty
                : new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
            return new ReplaceStep(other.from, this.to, slice, this.structure);
        }
        else {
            return null;
        }
    }
    toJSON() {
        let json = { stepType: "replace", from: this.from, to: this.to };
        if (this.slice.size)
            json.slice = this.slice.toJSON();
        if (this.structure)
            json.structure = true;
        return json;
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.from != "number" || typeof json.to != "number")
            throw new RangeError("Invalid input for ReplaceStep.fromJSON");
        return new ReplaceStep(json.from, json.to, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.fromJSON(schema, json.slice), !!json.structure);
    }
}
Step.jsonID("replace", ReplaceStep);
/**
Replace a part of the document with a slice of content, but
preserve a range of the replaced content by moving it into the
slice.
*/
class ReplaceAroundStep extends Step {
    /**
    Create a replace-around step with the given range and gap.
    `insert` should be the point in the slice into which the content
    of the gap should be moved. `structure` has the same meaning as
    it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
    */
    constructor(
    /**
    The start position of the replaced range.
    */
    from, 
    /**
    The end position of the replaced range.
    */
    to, 
    /**
    The start of preserved range.
    */
    gapFrom, 
    /**
    The end of preserved range.
    */
    gapTo, 
    /**
    The slice to insert.
    */
    slice, 
    /**
    The position in the slice where the preserved range should be
    inserted.
    */
    insert, 
    /**
    @internal
    */
    structure = false) {
        super();
        this.from = from;
        this.to = to;
        this.gapFrom = gapFrom;
        this.gapTo = gapTo;
        this.slice = slice;
        this.insert = insert;
        this.structure = structure;
    }
    apply(doc) {
        if (this.structure && (contentBetween(doc, this.from, this.gapFrom) ||
            contentBetween(doc, this.gapTo, this.to)))
            return StepResult.fail("Structure gap-replace would overwrite content");
        let gap = doc.slice(this.gapFrom, this.gapTo);
        if (gap.openStart || gap.openEnd)
            return StepResult.fail("Gap is not a flat range");
        let inserted = this.slice.insertAt(this.insert, gap.content);
        if (!inserted)
            return StepResult.fail("Content does not fit in gap");
        return StepResult.fromReplace(doc, this.from, this.to, inserted);
    }
    getMap() {
        return new StepMap([this.from, this.gapFrom - this.from, this.insert,
            this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);
    }
    invert(doc) {
        let gap = this.gapTo - this.gapFrom;
        return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
    }
    map(mapping) {
        let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
        let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
        let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
        if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)
            return null;
        return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
    }
    toJSON() {
        let json = { stepType: "replaceAround", from: this.from, to: this.to,
            gapFrom: this.gapFrom, gapTo: this.gapTo, insert: this.insert };
        if (this.slice.size)
            json.slice = this.slice.toJSON();
        if (this.structure)
            json.structure = true;
        return json;
    }
    /**
    @internal
    */
    static fromJSON(schema, json) {
        if (typeof json.from != "number" || typeof json.to != "number" ||
            typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
            throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
        return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
    }
}
Step.jsonID("replaceAround", ReplaceAroundStep);
function contentBetween(doc, from, to) {
    let $from = doc.resolve(from), dist = to - from, depth = $from.depth;
    while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
        depth--;
        dist--;
    }
    if (dist > 0) {
        let next = $from.node(depth).maybeChild($from.indexAfter(depth));
        while (dist > 0) {
            if (!next || next.isLeaf)
                return true;
            next = next.firstChild;
            dist--;
        }
    }
    return false;
}

function addMark(tr, from, to, mark) {
    let removed = [], added = [];
    let removing, adding;
    tr.doc.nodesBetween(from, to, (node, pos, parent) => {
        if (!node.isInline)
            return;
        let marks = node.marks;
        if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
            let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
            let newSet = mark.addToSet(marks);
            for (let i = 0; i < marks.length; i++) {
                if (!marks[i].isInSet(newSet)) {
                    if (removing && removing.to == start && removing.mark.eq(marks[i]))
                        removing.to = end;
                    else
                        removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
                }
            }
            if (adding && adding.to == start)
                adding.to = end;
            else
                added.push(adding = new AddMarkStep(start, end, mark));
        }
    });
    removed.forEach(s => tr.step(s));
    added.forEach(s => tr.step(s));
}
function removeMark(tr, from, to, mark) {
    let matched = [], step = 0;
    tr.doc.nodesBetween(from, to, (node, pos) => {
        if (!node.isInline)
            return;
        step++;
        let toRemove = null;
        if (mark instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.MarkType) {
            let set = node.marks, found;
            while (found = mark.isInSet(set)) {
                (toRemove || (toRemove = [])).push(found);
                set = found.removeFromSet(set);
            }
        }
        else if (mark) {
            if (mark.isInSet(node.marks))
                toRemove = [mark];
        }
        else {
            toRemove = node.marks;
        }
        if (toRemove && toRemove.length) {
            let end = Math.min(pos + node.nodeSize, to);
            for (let i = 0; i < toRemove.length; i++) {
                let style = toRemove[i], found;
                for (let j = 0; j < matched.length; j++) {
                    let m = matched[j];
                    if (m.step == step - 1 && style.eq(matched[j].style))
                        found = m;
                }
                if (found) {
                    found.to = end;
                    found.step = step;
                }
                else {
                    matched.push({ style, from: Math.max(pos, from), to: end, step });
                }
            }
        }
    });
    matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
}
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
    let node = tr.doc.nodeAt(pos);
    let replSteps = [], cur = pos + 1;
    for (let i = 0; i < node.childCount; i++) {
        let child = node.child(i), end = cur + child.nodeSize;
        let allowed = match.matchType(child.type);
        if (!allowed) {
            replSteps.push(new ReplaceStep(cur, end, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty));
        }
        else {
            match = allowed;
            for (let j = 0; j < child.marks.length; j++)
                if (!parentType.allowsMarkType(child.marks[j].type))
                    tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
            if (clearNewlines && child.isText && parentType.whitespace != "pre") {
                let m, newline = /\r?\n|\r/g, slice;
                while (m = newline.exec(child.text)) {
                    if (!slice)
                        slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
                    replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
                }
            }
        }
        cur = end;
    }
    if (!match.validEnd) {
        let fill = match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, true);
        tr.replace(cur, cur, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(fill, 0, 0));
    }
    for (let i = replSteps.length - 1; i >= 0; i--)
        tr.step(replSteps[i]);
}

function canCut(node, start, end) {
    return (start == 0 || node.canReplace(start, node.childCount)) &&
        (end == node.childCount || node.canReplace(0, end));
}
/**
Try to find a target depth to which the content in the given range
can be lifted. Will not go across
[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.
*/
function liftTarget(range) {
    let parent = range.parent;
    let content = parent.content.cutByIndex(range.startIndex, range.endIndex);
    for (let depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {
        let node = range.$from.node(depth);
        let index = range.$from.index(depth) + contentBefore, endIndex = range.$to.indexAfter(depth) - contentAfter;
        if (depth < range.depth && node.canReplace(index, endIndex, content))
            return depth;
        if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex))
            break;
        if (index)
            contentBefore = 1;
        if (endIndex < node.childCount)
            contentAfter = 1;
    }
    return null;
}
function lift(tr, range, target) {
    let { $from, $to, depth } = range;
    let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
    let start = gapStart, end = gapEnd;
    let before = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, openStart = 0;
    for (let d = depth, splitting = false; d > target; d--)
        if (splitting || $from.index(d) > 0) {
            splitting = true;
            before = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from($from.node(d).copy(before));
            openStart++;
        }
        else {
            start--;
        }
    let after = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, openEnd = 0;
    for (let d = depth, splitting = false; d > target; d--)
        if (splitting || $to.after(d + 1) < $to.end(d)) {
            splitting = true;
            after = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from($to.node(d).copy(after));
            openEnd++;
        }
        else {
            end++;
        }
    tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
}
/**
Try to find a valid way to wrap the content in the given range in a
node of the given type. May introduce extra nodes around and inside
the wrapper node, if necessary. Returns null if no valid wrapping
could be found. When `innerRange` is given, that range's content is
used as the content to fit into the wrapping, instead of the
content of `range`.
*/
function findWrapping(range, nodeType, attrs = null, innerRange = range) {
    let around = findWrappingOutside(range, nodeType);
    let inner = around && findWrappingInside(innerRange, nodeType);
    if (!inner)
        return null;
    return around.map(withAttrs)
        .concat({ type: nodeType, attrs }).concat(inner.map(withAttrs));
}
function withAttrs(type) { return { type, attrs: null }; }
function findWrappingOutside(range, type) {
    let { parent, startIndex, endIndex } = range;
    let around = parent.contentMatchAt(startIndex).findWrapping(type);
    if (!around)
        return null;
    let outer = around.length ? around[0] : type;
    return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
}
function findWrappingInside(range, type) {
    let { parent, startIndex, endIndex } = range;
    let inner = parent.child(startIndex);
    let inside = type.contentMatch.findWrapping(inner.type);
    if (!inside)
        return null;
    let lastType = inside.length ? inside[inside.length - 1] : type;
    let innerMatch = lastType.contentMatch;
    for (let i = startIndex; innerMatch && i < endIndex; i++)
        innerMatch = innerMatch.matchType(parent.child(i).type);
    if (!innerMatch || !innerMatch.validEnd)
        return null;
    return inside;
}
function wrap(tr, range, wrappers) {
    let content = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty;
    for (let i = wrappers.length - 1; i >= 0; i--) {
        if (content.size) {
            let match = wrappers[i].type.contentMatch.matchFragment(content);
            if (!match || !match.validEnd)
                throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
        }
        content = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
    }
    let start = range.start, end = range.end;
    tr.step(new ReplaceAroundStep(start, end, start, end, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(content, 0, 0), wrappers.length, true));
}
function setBlockType(tr, from, to, type, attrs) {
    if (!type.isTextblock)
        throw new RangeError("Type given to setBlockType should be a textblock");
    let mapFrom = tr.steps.length;
    tr.doc.nodesBetween(from, to, (node, pos) => {
        let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
        if (node.isTextblock && !node.hasMarkup(type, attrsHere) &&
            canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
            let convertNewlines = null;
            if (type.schema.linebreakReplacement) {
                let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
                if (pre && !supportLinebreak)
                    convertNewlines = false;
                else if (!pre && supportLinebreak)
                    convertNewlines = true;
            }
            // Ensure all markup that isn't allowed in the new node type is cleared
            if (convertNewlines === false)
                replaceLinebreaks(tr, node, pos, mapFrom);
            clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
            let mapping = tr.mapping.slice(mapFrom);
            let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
            tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
            if (convertNewlines === true)
                replaceNewlines(tr, node, pos, mapFrom);
            return false;
        }
    });
}
function replaceNewlines(tr, node, pos, mapFrom) {
    node.forEach((child, offset) => {
        if (child.isText) {
            let m, newline = /\r?\n|\r/g;
            while (m = newline.exec(child.text)) {
                let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
                tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
            }
        }
    });
}
function replaceLinebreaks(tr, node, pos, mapFrom) {
    node.forEach((child, offset) => {
        if (child.type == child.type.schema.linebreakReplacement) {
            let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
            tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
        }
    });
}
function canChangeType(doc, pos, type) {
    let $pos = doc.resolve(pos), index = $pos.index();
    return $pos.parent.canReplaceWith(index, index + 1, type);
}
/**
Change the type, attributes, and/or marks of the node at `pos`.
When `type` isn't given, the existing node type is preserved,
*/
function setNodeMarkup(tr, pos, type, attrs, marks) {
    let node = tr.doc.nodeAt(pos);
    if (!node)
        throw new RangeError("No node at given position");
    if (!type)
        type = node.type;
    let newNode = type.create(attrs, null, marks || node.marks);
    if (node.isLeaf)
        return tr.replaceWith(pos, pos + node.nodeSize, newNode);
    if (!type.validContent(node.content))
        throw new RangeError("Invalid content for node type " + type.name);
    tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(newNode), 0, 0), 1, true));
}
/**
Check whether splitting at the given position is allowed.
*/
function canSplit(doc, pos, depth = 1, typesAfter) {
    let $pos = doc.resolve(pos), base = $pos.depth - depth;
    let innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent;
    if (base < 0 || $pos.parent.type.spec.isolating ||
        !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) ||
        !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
        return false;
    for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
        let node = $pos.node(d), index = $pos.index(d);
        if (node.type.spec.isolating)
            return false;
        let rest = node.content.cutByIndex(index, node.childCount);
        let overrideChild = typesAfter && typesAfter[i + 1];
        if (overrideChild)
            rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
        let after = (typesAfter && typesAfter[i]) || node;
        if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest))
            return false;
    }
    let index = $pos.indexAfter(base);
    let baseType = typesAfter && typesAfter[0];
    return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
}
function split(tr, pos, depth = 1, typesAfter) {
    let $pos = tr.doc.resolve(pos), before = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, after = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty;
    for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
        before = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from($pos.node(d).copy(before));
        let typeAfter = typesAfter && typesAfter[i];
        after = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
    }
    tr.step(new ReplaceStep(pos, pos, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(before.append(after), depth, depth), true));
}
/**
Test whether the blocks before and after a given position can be
joined.
*/
function canJoin(doc, pos) {
    let $pos = doc.resolve(pos), index = $pos.index();
    return joinable($pos.nodeBefore, $pos.nodeAfter) &&
        $pos.parent.canReplace(index, index + 1);
}
function canAppendWithSubstitutedLinebreaks(a, b) {
    if (!b.content.size)
        a.type.compatibleContent(b.type);
    let match = a.contentMatchAt(a.childCount);
    let { linebreakReplacement } = a.type.schema;
    for (let i = 0; i < b.childCount; i++) {
        let child = b.child(i);
        let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
        match = match.matchType(type);
        if (!match)
            return false;
        if (!a.type.allowsMarks(child.marks))
            return false;
    }
    return match.validEnd;
}
function joinable(a, b) {
    return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
}
/**
Find an ancestor of the given position that can be joined to the
block before (or after if `dir` is positive). Returns the joinable
point, if any.
*/
function joinPoint(doc, pos, dir = -1) {
    let $pos = doc.resolve(pos);
    for (let d = $pos.depth;; d--) {
        let before, after, index = $pos.index(d);
        if (d == $pos.depth) {
            before = $pos.nodeBefore;
            after = $pos.nodeAfter;
        }
        else if (dir > 0) {
            before = $pos.node(d + 1);
            index++;
            after = $pos.node(d).maybeChild(index);
        }
        else {
            before = $pos.node(d).maybeChild(index - 1);
            after = $pos.node(d + 1);
        }
        if (before && !before.isTextblock && joinable(before, after) &&
            $pos.node(d).canReplace(index, index + 1))
            return pos;
        if (d == 0)
            break;
        pos = dir < 0 ? $pos.before(d) : $pos.after(d);
    }
}
function join(tr, pos, depth) {
    let convertNewlines = null;
    let { linebreakReplacement } = tr.doc.type.schema;
    let $before = tr.doc.resolve(pos - depth), beforeType = $before.node().type;
    if (linebreakReplacement && beforeType.inlineContent) {
        let pre = beforeType.whitespace == "pre";
        let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
        if (pre && !supportLinebreak)
            convertNewlines = false;
        else if (!pre && supportLinebreak)
            convertNewlines = true;
    }
    let mapFrom = tr.steps.length;
    if (convertNewlines === false) {
        let $after = tr.doc.resolve(pos + depth);
        replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
    }
    if (beforeType.inlineContent)
        clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
    let mapping = tr.mapping.slice(mapFrom), start = mapping.map(pos - depth);
    tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty, true));
    if (convertNewlines === true) {
        let $full = tr.doc.resolve(start);
        replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
    }
    return tr;
}
/**
Try to find a point where a node of the given type can be inserted
near `pos`, by searching up the node hierarchy when `pos` itself
isn't a valid place but is at the start or end of a node. Return
null if no position was found.
*/
function insertPoint(doc, pos, nodeType) {
    let $pos = doc.resolve(pos);
    if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))
        return pos;
    if ($pos.parentOffset == 0)
        for (let d = $pos.depth - 1; d >= 0; d--) {
            let index = $pos.index(d);
            if ($pos.node(d).canReplaceWith(index, index, nodeType))
                return $pos.before(d + 1);
            if (index > 0)
                return null;
        }
    if ($pos.parentOffset == $pos.parent.content.size)
        for (let d = $pos.depth - 1; d >= 0; d--) {
            let index = $pos.indexAfter(d);
            if ($pos.node(d).canReplaceWith(index, index, nodeType))
                return $pos.after(d + 1);
            if (index < $pos.node(d).childCount)
                return null;
        }
    return null;
}
/**
Finds a position at or around the given position where the given
slice can be inserted. Will look at parent nodes' nearest boundary
and try there, even if the original position wasn't directly at the
start or end of that node. Returns null when no position was found.
*/
function dropPoint(doc, pos, slice) {
    let $pos = doc.resolve(pos);
    if (!slice.content.size)
        return pos;
    let content = slice.content;
    for (let i = 0; i < slice.openStart; i++)
        content = content.firstChild.content;
    for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
        for (let d = $pos.depth; d >= 0; d--) {
            let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
            let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
            let parent = $pos.node(d), fits = false;
            if (pass == 1) {
                fits = parent.canReplace(insertPos, insertPos, content);
            }
            else {
                let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
                fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
            }
            if (fits)
                return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
        }
    }
    return null;
}

/**
‘Fit’ a slice into a given position in the document, producing a
[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if
there's no meaningful way to insert the slice here, or inserting it
would be a no-op (an empty slice over an empty range).
*/
function replaceStep(doc, from, to = from, slice = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
    if (from == to && !slice.size)
        return null;
    let $from = doc.resolve(from), $to = doc.resolve(to);
    // Optimization -- avoid work if it's obvious that it's not needed.
    if (fitsTrivially($from, $to, slice))
        return new ReplaceStep(from, to, slice);
    return new Fitter($from, $to, slice).fit();
}
function fitsTrivially($from, $to, slice) {
    return !slice.openStart && !slice.openEnd && $from.start() == $to.start() &&
        $from.parent.canReplace($from.index(), $to.index(), slice.content);
}
// Algorithm for 'placing' the elements of a slice into a gap:
//
// We consider the content of each node that is open to the left to be
// independently placeable. I.e. in <p("foo"), p("bar")>, when the
// paragraph on the left is open, "foo" can be placed (somewhere on
// the left side of the replacement gap) independently from p("bar").
//
// This class tracks the state of the placement progress in the
// following properties:
//
//  - `frontier` holds a stack of `{type, match}` objects that
//    represent the open side of the replacement. It starts at
//    `$from`, then moves forward as content is placed, and is finally
//    reconciled with `$to`.
//
//  - `unplaced` is a slice that represents the content that hasn't
//    been placed yet.
//
//  - `placed` is a fragment of placed content. Its open-start value
//    is implicit in `$from`, and its open-end value in `frontier`.
class Fitter {
    constructor($from, $to, unplaced) {
        this.$from = $from;
        this.$to = $to;
        this.unplaced = unplaced;
        this.frontier = [];
        this.placed = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty;
        for (let i = 0; i <= $from.depth; i++) {
            let node = $from.node(i);
            this.frontier.push({
                type: node.type,
                match: node.contentMatchAt($from.indexAfter(i))
            });
        }
        for (let i = $from.depth; i > 0; i--)
            this.placed = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from($from.node(i).copy(this.placed));
    }
    get depth() { return this.frontier.length - 1; }
    fit() {
        // As long as there's unplaced content, try to place some of it.
        // If that fails, either increase the open score of the unplaced
        // slice, or drop nodes from it, and then try again.
        while (this.unplaced.size) {
            let fit = this.findFittable();
            if (fit)
                this.placeNodes(fit);
            else
                this.openMore() || this.dropNode();
        }
        // When there's inline content directly after the frontier _and_
        // directly after `this.$to`, we must generate a `ReplaceAround`
        // step that pulls that content into the node after the frontier.
        // That means the fitting must be done to the end of the textblock
        // node after `this.$to`, not `this.$to` itself.
        let moveInline = this.mustMoveInline(), placedSize = this.placed.size - this.depth - this.$from.depth;
        let $from = this.$from, $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
        if (!$to)
            return null;
        // If closing to `$to` succeeded, create a step
        let content = this.placed, openStart = $from.depth, openEnd = $to.depth;
        while (openStart && openEnd && content.childCount == 1) { // Normalize by dropping open parent nodes
            content = content.firstChild.content;
            openStart--;
            openEnd--;
        }
        let slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(content, openStart, openEnd);
        if (moveInline > -1)
            return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
        if (slice.size || $from.pos != this.$to.pos) // Don't generate no-op steps
            return new ReplaceStep($from.pos, $to.pos, slice);
        return null;
    }
    // Find a position on the start spine of `this.unplaced` that has
    // content that can be moved somewhere on the frontier. Returns two
    // depths, one for the slice and one for the frontier.
    findFittable() {
        let startDepth = this.unplaced.openStart;
        for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
            let node = cur.firstChild;
            if (cur.childCount > 1)
                openEnd = 0;
            if (node.type.spec.isolating && openEnd <= d) {
                startDepth = d;
                break;
            }
            cur = node.content;
        }
        // Only try wrapping nodes (pass 2) after finding a place without
        // wrapping failed.
        for (let pass = 1; pass <= 2; pass++) {
            for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
                let fragment, parent = null;
                if (sliceDepth) {
                    parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
                    fragment = parent.content;
                }
                else {
                    fragment = this.unplaced.content;
                }
                let first = fragment.firstChild;
                for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
                    let { type, match } = this.frontier[frontierDepth], wrap, inject = null;
                    // In pass 1, if the next node matches, or there is no next
                    // node but the parents look compatible, we've found a
                    // place.
                    if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(first), false))
                        : parent && type.compatibleContent(parent.type)))
                        return { sliceDepth, frontierDepth, parent, inject };
                    // In pass 2, look for a set of wrapping nodes that make
                    // `first` fit here.
                    else if (pass == 2 && first && (wrap = match.findWrapping(first.type)))
                        return { sliceDepth, frontierDepth, parent, wrap };
                    // Don't continue looking further up if the parent node
                    // would fit here.
                    if (parent && match.matchType(parent.type))
                        break;
                }
            }
        }
    }
    openMore() {
        let { content, openStart, openEnd } = this.unplaced;
        let inner = contentAt(content, openStart);
        if (!inner.childCount || inner.firstChild.isLeaf)
            return false;
        this.unplaced = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
        return true;
    }
    dropNode() {
        let { content, openStart, openEnd } = this.unplaced;
        let inner = contentAt(content, openStart);
        if (inner.childCount <= 1 && openStart > 0) {
            let openAtEnd = content.size - openStart <= openStart + inner.size;
            this.unplaced = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
        }
        else {
            this.unplaced = new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
        }
    }
    // Move content from the unplaced slice at `sliceDepth` to the
    // frontier node at `frontierDepth`. Close that frontier node when
    // applicable.
    placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {
        while (this.depth > frontierDepth)
            this.closeFrontierNode();
        if (wrap)
            for (let i = 0; i < wrap.length; i++)
                this.openFrontierNode(wrap[i]);
        let slice = this.unplaced, fragment = parent ? parent.content : slice.content;
        let openStart = slice.openStart - sliceDepth;
        let taken = 0, add = [];
        let { match, type } = this.frontier[frontierDepth];
        if (inject) {
            for (let i = 0; i < inject.childCount; i++)
                add.push(inject.child(i));
            match = match.matchFragment(inject);
        }
        // Computes the amount of (end) open nodes at the end of the
        // fragment. When 0, the parent is open, but no more. When
        // negative, nothing is open.
        let openEndCount = (fragment.size + sliceDepth) - (slice.content.size - slice.openEnd);
        // Scan over the fragment, fitting as many child nodes as
        // possible.
        while (taken < fragment.childCount) {
            let next = fragment.child(taken), matches = match.matchType(next.type);
            if (!matches)
                break;
            taken++;
            if (taken > 1 || openStart == 0 || next.content.size) { // Drop empty open nodes
                match = matches;
                add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
            }
        }
        let toEnd = taken == fragment.childCount;
        if (!toEnd)
            openEndCount = -1;
        this.placed = addToFragment(this.placed, frontierDepth, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(add));
        this.frontier[frontierDepth].match = match;
        // If the parent types match, and the entire node was moved, and
        // it's not open, close this frontier node right away.
        if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
            this.closeFrontierNode();
        // Add new frontier nodes for any open nodes at the end.
        for (let i = 0, cur = fragment; i < openEndCount; i++) {
            let node = cur.lastChild;
            this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });
            cur = node.content;
        }
        // Update `this.unplaced`. Drop the entire node from which we
        // placed it we got to its end, otherwise just drop the placed
        // nodes.
        this.unplaced = !toEnd ? new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd)
            : sliceDepth == 0 ? prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty
                : new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
    }
    mustMoveInline() {
        if (!this.$to.parent.isTextblock)
            return -1;
        let top = this.frontier[this.depth], level;
        if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) ||
            (this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth))
            return -1;
        let { depth } = this.$to, after = this.$to.after(depth);
        while (depth > 1 && after == this.$to.end(--depth))
            ++after;
        return after;
    }
    findCloseLevel($to) {
        scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
            let { match, type } = this.frontier[i];
            let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
            let fit = contentAfterFits($to, i, type, match, dropInner);
            if (!fit)
                continue;
            for (let d = i - 1; d >= 0; d--) {
                let { match, type } = this.frontier[d];
                let matches = contentAfterFits($to, d, type, match, true);
                if (!matches || matches.childCount)
                    continue scan;
            }
            return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };
        }
    }
    close($to) {
        let close = this.findCloseLevel($to);
        if (!close)
            return null;
        while (this.depth > close.depth)
            this.closeFrontierNode();
        if (close.fit.childCount)
            this.placed = addToFragment(this.placed, close.depth, close.fit);
        $to = close.move;
        for (let d = close.depth + 1; d <= $to.depth; d++) {
            let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
            this.openFrontierNode(node.type, node.attrs, add);
        }
        return $to;
    }
    openFrontierNode(type, attrs = null, content) {
        let top = this.frontier[this.depth];
        top.match = top.match.matchType(type);
        this.placed = addToFragment(this.placed, this.depth, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(type.create(attrs, content)));
        this.frontier.push({ type, match: type.contentMatch });
    }
    closeFrontierNode() {
        let open = this.frontier.pop();
        let add = open.match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, true);
        if (add.childCount)
            this.placed = addToFragment(this.placed, this.frontier.length, add);
    }
}
function dropFromFragment(fragment, depth, count) {
    if (depth == 0)
        return fragment.cutByIndex(count, fragment.childCount);
    return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
}
function addToFragment(fragment, depth, content) {
    if (depth == 0)
        return fragment.append(content);
    return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
}
function contentAt(fragment, depth) {
    for (let i = 0; i < depth; i++)
        fragment = fragment.firstChild.content;
    return fragment;
}
function closeNodeStart(node, openStart, openEnd) {
    if (openStart <= 0)
        return node;
    let frag = node.content;
    if (openStart > 1)
        frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
    if (openStart > 0) {
        frag = node.type.contentMatch.fillBefore(frag).append(frag);
        if (openEnd <= 0)
            frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, true));
    }
    return node.copy(frag);
}
function contentAfterFits($to, depth, type, match, open) {
    let node = $to.node(depth), index = open ? $to.indexAfter(depth) : $to.index(depth);
    if (index == node.childCount && !type.compatibleContent(node.type))
        return null;
    let fit = match.fillBefore(node.content, true, index);
    return fit && !invalidMarks(type, node.content, index) ? fit : null;
}
function invalidMarks(type, fragment, start) {
    for (let i = start; i < fragment.childCount; i++)
        if (!type.allowsMarks(fragment.child(i).marks))
            return true;
    return false;
}
function definesContent(type) {
    return type.spec.defining || type.spec.definingForContent;
}
function replaceRange(tr, from, to, slice) {
    if (!slice.size)
        return tr.deleteRange(from, to);
    let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
    if (fitsTrivially($from, $to, slice))
        return tr.step(new ReplaceStep(from, to, slice));
    let targetDepths = coveredDepths($from, $to);
    // Can't replace the whole document, so remove 0 if it's present
    if (targetDepths[targetDepths.length - 1] == 0)
        targetDepths.pop();
    // Negative numbers represent not expansion over the whole node at
    // that depth, but replacing from $from.before(-D) to $to.pos.
    let preferredTarget = -($from.depth + 1);
    targetDepths.unshift(preferredTarget);
    // This loop picks a preferred target depth, if one of the covering
    // depths is not outside of a defining node, and adds negative
    // depths for any depth that has $from at its start and does not
    // cross a defining node.
    for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
        let spec = $from.node(d).type.spec;
        if (spec.defining || spec.definingAsContext || spec.isolating)
            break;
        if (targetDepths.indexOf(d) > -1)
            preferredTarget = d;
        else if ($from.before(d) == pos)
            targetDepths.splice(1, 0, -d);
    }
    // Try to fit each possible depth of the slice into each possible
    // target depth, starting with the preferred depths.
    let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
    let leftNodes = [], preferredDepth = slice.openStart;
    for (let content = slice.content, i = 0;; i++) {
        let node = content.firstChild;
        leftNodes.push(node);
        if (i == slice.openStart)
            break;
        content = node.content;
    }
    // Back up preferredDepth to cover defining textblocks directly
    // above it, possibly skipping a non-defining textblock.
    for (let d = preferredDepth - 1; d >= 0; d--) {
        let leftNode = leftNodes[d], def = definesContent(leftNode.type);
        if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))
            preferredDepth = d;
        else if (def || !leftNode.type.isTextblock)
            break;
    }
    for (let j = slice.openStart; j >= 0; j--) {
        let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
        let insert = leftNodes[openDepth];
        if (!insert)
            continue;
        for (let i = 0; i < targetDepths.length; i++) {
            // Loop over possible expansion levels, starting with the
            // preferred one
            let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length], expand = true;
            if (targetDepth < 0) {
                expand = false;
                targetDepth = -targetDepth;
            }
            let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
            if (parent.canReplaceWith(index, index, insert.type, insert.marks))
                return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
        }
    }
    let startSteps = tr.steps.length;
    for (let i = targetDepths.length - 1; i >= 0; i--) {
        tr.replace(from, to, slice);
        if (tr.steps.length > startSteps)
            break;
        let depth = targetDepths[i];
        if (depth < 0)
            continue;
        from = $from.before(depth);
        to = $to.after(depth);
    }
}
function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
    if (depth < oldOpen) {
        let first = fragment.firstChild;
        fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
    }
    if (depth > newOpen) {
        let match = parent.contentMatchAt(0);
        let start = match.fillBefore(fragment).append(fragment);
        fragment = start.append(match.matchFragment(start).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.empty, true));
    }
    return fragment;
}
function replaceRangeWith(tr, from, to, node) {
    if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
        let point = insertPoint(tr.doc, from, node.type);
        if (point != null)
            from = to = point;
    }
    tr.replaceRange(from, to, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(node), 0, 0));
}
function deleteRange(tr, from, to) {
    let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
    let covered = coveredDepths($from, $to);
    for (let i = 0; i < covered.length; i++) {
        let depth = covered[i], last = i == covered.length - 1;
        if ((last && depth == 0) || $from.node(depth).type.contentMatch.validEnd)
            return tr.delete($from.start(depth), $to.end(depth));
        if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))
            return tr.delete($from.before(depth), $to.after(depth));
    }
    for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
        if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d &&
            $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))
            return tr.delete($from.before(d), to);
    }
    tr.delete(from, to);
}
// Returns an array of all depths for which $from - $to spans the
// whole content of the nodes at that depth.
function coveredDepths($from, $to) {
    let result = [], minDepth = Math.min($from.depth, $to.depth);
    for (let d = minDepth; d >= 0; d--) {
        let start = $from.start(d);
        if (start < $from.pos - ($from.depth - d) ||
            $to.end(d) > $to.pos + ($to.depth - d) ||
            $from.node(d).type.spec.isolating ||
            $to.node(d).type.spec.isolating)
            break;
        if (start == $to.start(d) ||
            (d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent &&
                d && $to.start(d - 1) == start - 1))
            result.push(d);
    }
    return result;
}

/**
Update an attribute in a specific node.
*/
class AttrStep extends Step {
    /**
    Construct an attribute step.
    */
    constructor(
    /**
    The position of the target node.
    */
    pos, 
    /**
    The attribute to set.
    */
    attr, 
    // The attribute's new value.
    value) {
        super();
        this.pos = pos;
        this.attr = attr;
        this.value = value;
    }
    apply(doc) {
        let node = doc.nodeAt(this.pos);
        if (!node)
            return StepResult.fail("No node at attribute step's position");
        let attrs = Object.create(null);
        for (let name in node.attrs)
            attrs[name] = node.attrs[name];
        attrs[this.attr] = this.value;
        let updated = node.type.create(attrs, null, node.marks);
        return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
    }
    getMap() {
        return StepMap.empty;
    }
    invert(doc) {
        return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
    }
    map(mapping) {
        let pos = mapping.mapResult(this.pos, 1);
        return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
    }
    toJSON() {
        return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
    }
    static fromJSON(schema, json) {
        if (typeof json.pos != "number" || typeof json.attr != "string")
            throw new RangeError("Invalid input for AttrStep.fromJSON");
        return new AttrStep(json.pos, json.attr, json.value);
    }
}
Step.jsonID("attr", AttrStep);
/**
Update an attribute in the doc node.
*/
class DocAttrStep extends Step {
    /**
    Construct an attribute step.
    */
    constructor(
    /**
    The attribute to set.
    */
    attr, 
    // The attribute's new value.
    value) {
        super();
        this.attr = attr;
        this.value = value;
    }
    apply(doc) {
        let attrs = Object.create(null);
        for (let name in doc.attrs)
            attrs[name] = doc.attrs[name];
        attrs[this.attr] = this.value;
        let updated = doc.type.create(attrs, doc.content, doc.marks);
        return StepResult.ok(updated);
    }
    getMap() {
        return StepMap.empty;
    }
    invert(doc) {
        return new DocAttrStep(this.attr, doc.attrs[this.attr]);
    }
    map(mapping) {
        return this;
    }
    toJSON() {
        return { stepType: "docAttr", attr: this.attr, value: this.value };
    }
    static fromJSON(schema, json) {
        if (typeof json.attr != "string")
            throw new RangeError("Invalid input for DocAttrStep.fromJSON");
        return new DocAttrStep(json.attr, json.value);
    }
}
Step.jsonID("docAttr", DocAttrStep);

/**
@internal
*/
let TransformError = class extends Error {
};
TransformError = function TransformError(message) {
    let err = Error.call(this, message);
    err.__proto__ = TransformError.prototype;
    return err;
};
TransformError.prototype = Object.create(Error.prototype);
TransformError.prototype.constructor = TransformError;
TransformError.prototype.name = "TransformError";
/**
Abstraction to build up and track an array of
[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.

Most transforming methods return the `Transform` object itself, so
that they can be chained.
*/
class Transform {
    /**
    Create a transform that starts with the given document.
    */
    constructor(
    /**
    The current document (the result of applying the steps in the
    transform).
    */
    doc) {
        this.doc = doc;
        /**
        The steps in this transform.
        */
        this.steps = [];
        /**
        The documents before each of the steps.
        */
        this.docs = [];
        /**
        A mapping with the maps for each of the steps in this transform.
        */
        this.mapping = new Mapping;
    }
    /**
    The starting document.
    */
    get before() { return this.docs.length ? this.docs[0] : this.doc; }
    /**
    Apply a new step in this transform, saving the result. Throws an
    error when the step fails.
    */
    step(step) {
        let result = this.maybeStep(step);
        if (result.failed)
            throw new TransformError(result.failed);
        return this;
    }
    /**
    Try to apply a step in this transformation, ignoring it if it
    fails. Returns the step result.
    */
    maybeStep(step) {
        let result = step.apply(this.doc);
        if (!result.failed)
            this.addStep(step, result.doc);
        return result;
    }
    /**
    True when the document has been changed (when there are any
    steps).
    */
    get docChanged() {
        return this.steps.length > 0;
    }
    /**
    Return a single range, in post-transform document positions,
    that covers all content changed by this transform. Returns null
    if no replacements are made. Note that this will ignore changes
    that add/remove marks without replacing the underlying content.
    */
    changedRange() {
        let from = 1e9, to = -1e9;
        for (let i = 0; i < this.mapping.maps.length; i++) {
            let map = this.mapping.maps[i];
            if (i) {
                from = map.map(from, 1);
                to = map.map(to, -1);
            }
            map.forEach((_f, _t, fromB, toB) => {
                from = Math.min(from, fromB);
                to = Math.max(to, toB);
            });
        }
        return from == 1e9 ? null : { from, to };
    }
    /**
    @internal
    */
    addStep(step, doc) {
        this.docs.push(this.doc);
        this.steps.push(step);
        this.mapping.appendMap(step.getMap());
        this.doc = doc;
    }
    /**
    Replace the part of the document between `from` and `to` with the
    given `slice`.
    */
    replace(from, to = from, slice = prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty) {
        let step = replaceStep(this.doc, from, to, slice);
        if (step)
            this.step(step);
        return this;
    }
    /**
    Replace the given range with the given content, which may be a
    fragment, node, or array of nodes.
    */
    replaceWith(from, to, content) {
        return this.replace(from, to, new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Fragment.from(content), 0, 0));
    }
    /**
    Delete the content between the given positions.
    */
    delete(from, to) {
        return this.replace(from, to, prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Slice.empty);
    }
    /**
    Insert the given content at the given position.
    */
    insert(pos, content) {
        return this.replaceWith(pos, pos, content);
    }
    /**
    Replace a range of the document with a given slice, using
    `from`, `to`, and the slice's
    [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather
    than fixed start and end points. This method may grow the
    replaced area or close open nodes in the slice in order to get a
    fit that is more in line with WYSIWYG expectations, by dropping
    fully covered parent nodes of the replaced region when they are
    marked [non-defining as
    context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an
    open parent node from the slice that _is_ marked as [defining
    its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
    
    This is the method, for example, to handle paste. The similar
    [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more
    primitive tool which will _not_ move the start and end of its given
    range, and is useful in situations where you need more precise
    control over what happens.
    */
    replaceRange(from, to, slice) {
        replaceRange(this, from, to, slice);
        return this;
    }
    /**
    Replace the given range with a node, but use `from` and `to` as
    hints, rather than precise positions. When from and to are the same
    and are at the start or end of a parent node in which the given
    node doesn't fit, this method may _move_ them out towards a parent
    that does allow the given node to be placed. When the given range
    completely covers a parent node, this method may completely replace
    that parent node.
    */
    replaceRangeWith(from, to, node) {
        replaceRangeWith(this, from, to, node);
        return this;
    }
    /**
    Delete the given range, expanding it to cover fully covered
    parent nodes until a valid replace is found.
    */
    deleteRange(from, to) {
        deleteRange(this, from, to);
        return this;
    }
    /**
    Split the content in the given range off from its parent, if there
    is sibling content before or after it, and move it up the tree to
    the depth specified by `target`. You'll probably want to use
    [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
    sure the lift is valid.
    */
    lift(range, target) {
        lift(this, range, target);
        return this;
    }
    /**
    Join the blocks around the given position. If depth is 2, their
    last and first siblings are also joined, and so on.
    */
    join(pos, depth = 1) {
        join(this, pos, depth);
        return this;
    }
    /**
    Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
    The wrappers are assumed to be valid in this position, and should
    probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
    */
    wrap(range, wrappers) {
        wrap(this, range, wrappers);
        return this;
    }
    /**
    Set the type of all textblocks (partly) between `from` and `to` to
    the given node type with the given attributes.
    */
    setBlockType(from, to = from, type, attrs = null) {
        setBlockType(this, from, to, type, attrs);
        return this;
    }
    /**
    Change the type, attributes, and/or marks of the node at `pos`.
    When `type` isn't given, the existing node type is preserved,
    */
    setNodeMarkup(pos, type, attrs = null, marks) {
        setNodeMarkup(this, pos, type, attrs, marks);
        return this;
    }
    /**
    Set a single attribute on a given node to a new value.
    The `pos` addresses the document content. Use `setDocAttribute`
    to set attributes on the document itself.
    */
    setNodeAttribute(pos, attr, value) {
        this.step(new AttrStep(pos, attr, value));
        return this;
    }
    /**
    Set a single attribute on the document to a new value.
    */
    setDocAttribute(attr, value) {
        this.step(new DocAttrStep(attr, value));
        return this;
    }
    /**
    Add a mark to the node at position `pos`.
    */
    addNodeMark(pos, mark) {
        this.step(new AddNodeMarkStep(pos, mark));
        return this;
    }
    /**
    Remove a mark (or all marks of the given type) from the node at
    position `pos`.
    */
    removeNodeMark(pos, mark) {
        let node = this.doc.nodeAt(pos);
        if (!node)
            throw new RangeError("No node at position " + pos);
        if (mark instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Mark) {
            if (mark.isInSet(node.marks))
                this.step(new RemoveNodeMarkStep(pos, mark));
        }
        else {
            let set = node.marks, found, steps = [];
            while (found = mark.isInSet(set)) {
                steps.push(new RemoveNodeMarkStep(pos, found));
                set = found.removeFromSet(set);
            }
            for (let i = steps.length - 1; i >= 0; i--)
                this.step(steps[i]);
        }
        return this;
    }
    /**
    Split the node at the given position, and optionally, if `depth` is
    greater than one, any number of nodes above that. By default, the
    parts split off will inherit the node type of the original node.
    This can be changed by passing an array of types and attributes to
    use after the split (with the outermost nodes coming first).
    */
    split(pos, depth = 1, typesAfter) {
        split(this, pos, depth, typesAfter);
        return this;
    }
    /**
    Add the given mark to the inline content between `from` and `to`.
    */
    addMark(from, to, mark) {
        addMark(this, from, to, mark);
        return this;
    }
    /**
    Remove marks from inline nodes between `from` and `to`. When
    `mark` is a single mark, remove precisely that mark. When it is
    a mark type, remove all marks of that type. When it is null,
    remove all marks of any type.
    */
    removeMark(from, to, mark) {
        removeMark(this, from, to, mark);
        return this;
    }
    /**
    Removes all marks and nodes from the content of the node at
    `pos` that don't match the given new parent node type. Accepts
    an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
    third argument.
    */
    clearIncompatible(pos, parentType, match) {
        clearIncompatible(this, pos, parentType, match);
        return this;
    }
}




/***/ }),

/***/ "./node_modules/prosemirror-view/dist/index.js":
/*!*****************************************************!*\
  !*** ./node_modules/prosemirror-view/dist/index.js ***!
  \*****************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Decoration: function() { return /* binding */ Decoration; },
/* harmony export */   DecorationSet: function() { return /* binding */ DecorationSet; },
/* harmony export */   EditorView: function() { return /* binding */ EditorView; },
/* harmony export */   __endComposition: function() { return /* binding */ __endComposition; },
/* harmony export */   __parseFromClipboard: function() { return /* binding */ __parseFromClipboard; }
/* harmony export */ });
/* harmony import */ var prosemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prosemirror-state */ "./node_modules/prosemirror-state/dist/index.js");
/* harmony import */ var prosemirror_model__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prosemirror-model */ "./node_modules/prosemirror-model/dist/index.js");
/* harmony import */ var prosemirror_transform__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prosemirror-transform */ "./node_modules/prosemirror-transform/dist/index.js");




const domIndex = function (node) {
    for (var index = 0;; index++) {
        node = node.previousSibling;
        if (!node)
            return index;
    }
};
const parentNode = function (node) {
    let parent = node.assignedSlot || node.parentNode;
    return parent && parent.nodeType == 11 ? parent.host : parent;
};
let reusedRange = null;
// Note that this will always return the same range, because DOM range
// objects are every expensive, and keep slowing down subsequent DOM
// updates, for some reason.
const textRange = function (node, from, to) {
    let range = reusedRange || (reusedRange = document.createRange());
    range.setEnd(node, to == null ? node.nodeValue.length : to);
    range.setStart(node, from || 0);
    return range;
};
const clearReusedRange = function () {
    reusedRange = null;
};
// Scans forward and backward through DOM positions equivalent to the
// given one to see if the two are in the same place (i.e. after a
// text node vs at the end of that text node)
const isEquivalentPosition = function (node, off, targetNode, targetOff) {
    return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||
        scanFor(node, off, targetNode, targetOff, 1));
};
const atomElements = /^(img|br|input|textarea|hr)$/i;
function scanFor(node, off, targetNode, targetOff, dir) {
    var _a;
    for (;;) {
        if (node == targetNode && off == targetOff)
            return true;
        if (off == (dir < 0 ? 0 : nodeSize(node))) {
            let parent = node.parentNode;
            if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) ||
                node.contentEditable == "false")
                return false;
            off = domIndex(node) + (dir < 0 ? 0 : 1);
            node = parent;
        }
        else if (node.nodeType == 1) {
            let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
            if (child.nodeType == 1 && child.contentEditable == "false") {
                if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection)
                    off += dir;
                else
                    return false;
            }
            else {
                node = child;
                off = dir < 0 ? nodeSize(node) : 0;
            }
        }
        else {
            return false;
        }
    }
}
function nodeSize(node) {
    return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
}
function textNodeBefore$1(node, offset) {
    for (;;) {
        if (node.nodeType == 3 && offset)
            return node;
        if (node.nodeType == 1 && offset > 0) {
            if (node.contentEditable == "false")
                return null;
            node = node.childNodes[offset - 1];
            offset = nodeSize(node);
        }
        else if (node.parentNode && !hasBlockDesc(node)) {
            offset = domIndex(node);
            node = node.parentNode;
        }
        else {
            return null;
        }
    }
}
function textNodeAfter$1(node, offset) {
    for (;;) {
        if (node.nodeType == 3 && offset < node.nodeValue.length)
            return node;
        if (node.nodeType == 1 && offset < node.childNodes.length) {
            if (node.contentEditable == "false")
                return null;
            node = node.childNodes[offset];
            offset = 0;
        }
        else if (node.parentNode && !hasBlockDesc(node)) {
            offset = domIndex(node) + 1;
            node = node.parentNode;
        }
        else {
            return null;
        }
    }
}
function isOnEdge(node, offset, parent) {
    for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {
        if (node == parent)
            return true;
        let index = domIndex(node);
        node = node.parentNode;
        if (!node)
            return false;
        atStart = atStart && index == 0;
        atEnd = atEnd && index == nodeSize(node);
    }
}
function hasBlockDesc(dom) {
    let desc;
    for (let cur = dom; cur; cur = cur.parentNode)
        if (desc = cur.pmViewDesc)
            break;
    return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);
}
// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523
// (isCollapsed inappropriately returns true in shadow dom)
const selectionCollapsed = function (domSel) {
    return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);
};
function keyEvent(keyCode, key) {
    let event = document.createEvent("Event");
    event.initEvent("keydown", true, true);
    event.keyCode = keyCode;
    event.key = event.code = key;
    return event;
}
function deepActiveElement(doc) {
    let elt = doc.activeElement;
    while (elt && elt.shadowRoot)
        elt = elt.shadowRoot.activeElement;
    return elt;
}
function caretFromPoint(doc, x, y) {
    if (doc.caretPositionFromPoint) {
        try { // Firefox throws for this call in hard-to-predict circumstances (#994)
            let pos = doc.caretPositionFromPoint(x, y);
            // Clip the offset, because Chrome will return a text offset
            // into <input> nodes, which can't be treated as a regular DOM
            // offset
            if (pos)
                return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) };
        }
        catch (_) { }
    }
    if (doc.caretRangeFromPoint) {
        let range = doc.caretRangeFromPoint(x, y);
        if (range)
            return { node: range.startContainer, offset: Math.min(nodeSize(range.startContainer), range.startOffset) };
    }
}

const nav = typeof navigator != "undefined" ? navigator : null;
const doc = typeof document != "undefined" ? document : null;
const agent = (nav && nav.userAgent) || "";
const ie_edge = /Edge\/(\d+)/.exec(agent);
const ie_upto10 = /MSIE \d/.exec(agent);
const ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
const ie = !!(ie_upto10 || ie_11up || ie_edge);
const ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;
const gecko = !ie && /gecko\/(\d+)/i.test(agent);
gecko && +(/Firefox\/(\d+)/.exec(agent) || [0, 0])[1];
const _chrome = !ie && /Chrome\/(\d+)/.exec(agent);
const chrome = !!_chrome;
const chrome_version = _chrome ? +_chrome[1] : 0;
const safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);
// Is true for both iOS and iPadOS for convenience
const ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);
const mac = ios || (nav ? /Mac/.test(nav.platform) : false);
const windows = nav ? /Win/.test(nav.platform) : false;
const android = /Android \d/.test(agent);
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;

function windowRect(doc) {
    let vp = doc.defaultView && doc.defaultView.visualViewport;
    if (vp)
        return {
            left: 0, right: vp.width,
            top: 0, bottom: vp.height
        };
    return { left: 0, right: doc.documentElement.clientWidth,
        top: 0, bottom: doc.documentElement.clientHeight };
}
function getSide(value, side) {
    return typeof value == "number" ? value : value[side];
}
function clientRect(node) {
    let rect = node.getBoundingClientRect();
    // Adjust for elements with style "transform: scale()"
    let scaleX = (rect.width / node.offsetWidth) || 1;
    let scaleY = (rect.height / node.offsetHeight) || 1;
    // Make sure scrollbar width isn't included in the rectangle
    return { left: rect.left, right: rect.left + node.clientWidth * scaleX,
        top: rect.top, bottom: rect.top + node.clientHeight * scaleY };
}
function scrollRectIntoView(view, rect, startDOM) {
    let scrollThreshold = view.someProp("scrollThreshold") || 0, scrollMargin = view.someProp("scrollMargin") || 5;
    let doc = view.dom.ownerDocument;
    for (let parent = startDOM || view.dom;;) {
        if (!parent)
            break;
        if (parent.nodeType != 1) {
            parent = parentNode(parent);
            continue;
        }
        let elt = parent;
        let atTop = elt == doc.body;
        let bounding = atTop ? windowRect(doc) : clientRect(elt);
        let moveX = 0, moveY = 0;
        if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
            moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
        else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
            moveY = rect.bottom - rect.top > bounding.bottom - bounding.top
                ? rect.top + getSide(scrollMargin, "top") - bounding.top
                : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
        if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
            moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
        else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
            moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
        if (moveX || moveY) {
            if (atTop) {
                doc.defaultView.scrollBy(moveX, moveY);
            }
            else {
                let startX = elt.scrollLeft, startY = elt.scrollTop;
                if (moveY)
                    elt.scrollTop += moveY;
                if (moveX)
                    elt.scrollLeft += moveX;
                let dX = elt.scrollLeft - startX, dY = elt.scrollTop - startY;
                rect = { left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY };
            }
        }
        let pos = atTop ? "fixed" : getComputedStyle(parent).position;
        if (/^(fixed|sticky)$/.test(pos))
            break;
        parent = pos == "absolute" ? parent.offsetParent : parentNode(parent);
    }
}
// Store the scroll position of the editor's parent nodes, along with
// the top position of an element near the top of the editor, which
// will be used to make sure the visible viewport remains stable even
// when the size of the content above changes.
function storeScrollPos(view) {
    let rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);
    let refDOM, refTop;
    for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {
        let dom = view.root.elementFromPoint(x, y);
        if (!dom || dom == view.dom || !view.dom.contains(dom))
            continue;
        let localRect = dom.getBoundingClientRect();
        if (localRect.top >= startY - 20) {
            refDOM = dom;
            refTop = localRect.top;
            break;
        }
    }
    return { refDOM: refDOM, refTop: refTop, stack: scrollStack(view.dom) };
}
function scrollStack(dom) {
    let stack = [], doc = dom.ownerDocument;
    for (let cur = dom; cur; cur = parentNode(cur)) {
        stack.push({ dom: cur, top: cur.scrollTop, left: cur.scrollLeft });
        if (dom == doc)
            break;
    }
    return stack;
}
// Reset the scroll position of the editor's parent nodes to that what
// it was before, when storeScrollPos was called.
function resetScrollPos({ refDOM, refTop, stack }) {
    let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;
    restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);
}
function restoreScrollStack(stack, dTop) {
    for (let i = 0; i < stack.length; i++) {
        let { dom, top, left } = stack[i];
        if (dom.scrollTop != top + dTop)
            dom.scrollTop = top + dTop;
        if (dom.scrollLeft != left)
            dom.scrollLeft = left;
    }
}
let preventScrollSupported = null;
// Feature-detects support for .focus({preventScroll: true}), and uses
// a fallback kludge when not supported.
function focusPreventScroll(dom) {
    if (dom.setActive)
        return dom.setActive(); // in IE
    if (preventScrollSupported)
        return dom.focus(preventScrollSupported);
    let stored = scrollStack(dom);
    dom.focus(preventScrollSupported == null ? {
        get preventScroll() {
            preventScrollSupported = { preventScroll: true };
            return true;
        }
    } : undefined);
    if (!preventScrollSupported) {
        preventScrollSupported = false;
        restoreScrollStack(stored, 0);
    }
}
function findOffsetInNode(node, coords) {
    let closest, dxClosest = 2e8, coordsClosest, offset = 0;
    let rowBot = coords.top, rowTop = coords.top;
    let firstBelow, coordsBelow;
    for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
        let rects;
        if (child.nodeType == 1)
            rects = child.getClientRects();
        else if (child.nodeType == 3)
            rects = textRange(child).getClientRects();
        else
            continue;
        for (let i = 0; i < rects.length; i++) {
            let rect = rects[i];
            if (rect.top <= rowBot && rect.bottom >= rowTop) {
                rowBot = Math.max(rect.bottom, rowBot);
                rowTop = Math.min(rect.top, rowTop);
                let dx = rect.left > coords.left ? rect.left - coords.left
                    : rect.right < coords.left ? coords.left - rect.right : 0;
                if (dx < dxClosest) {
                    closest = child;
                    dxClosest = dx;
                    coordsClosest = dx && closest.nodeType == 3 ? {
                        left: rect.right < coords.left ? rect.right : rect.left,
                        top: coords.top
                    } : coords;
                    if (child.nodeType == 1 && dx)
                        offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
                    continue;
                }
            }
            else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
                firstBelow = child;
                coordsBelow = { left: Math.max(rect.left, Math.min(rect.right, coords.left)), top: rect.top };
            }
            if (!closest && (coords.left >= rect.right && coords.top >= rect.top ||
                coords.left >= rect.left && coords.top >= rect.bottom))
                offset = childIndex + 1;
        }
    }
    if (!closest && firstBelow) {
        closest = firstBelow;
        coordsClosest = coordsBelow;
        dxClosest = 0;
    }
    if (closest && closest.nodeType == 3)
        return findOffsetInText(closest, coordsClosest);
    if (!closest || (dxClosest && closest.nodeType == 1))
        return { node, offset };
    return findOffsetInNode(closest, coordsClosest);
}
function findOffsetInText(node, coords) {
    let len = node.nodeValue.length;
    let range = document.createRange(), result;
    for (let i = 0; i < len; i++) {
        range.setEnd(node, i + 1);
        range.setStart(node, i);
        let rect = singleRect(range, 1);
        if (rect.top == rect.bottom)
            continue;
        if (inRect(coords, rect)) {
            result = { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };
            break;
        }
    }
    range.detach();
    return result || { node, offset: 0 };
}
function inRect(coords, rect) {
    return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 &&
        coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;
}
function targetKludge(dom, coords) {
    let parent = dom.parentNode;
    if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)
        return parent;
    return dom;
}
function posFromElement(view, elt, coords) {
    let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
    if (node.nodeType == 1 && !node.firstChild) {
        let rect = node.getBoundingClientRect();
        bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
    }
    return view.docView.posFromDOM(node, offset, bias);
}
function posFromCaret(view, node, offset, coords) {
    // Browser (in caretPosition/RangeFromPoint) will agressively
    // normalize towards nearby inline nodes. Since we are interested in
    // positions between block nodes too, we first walk up the hierarchy
    // of nodes to see if there are block nodes that the coordinates
    // fall outside of. If so, we take the position before/after that
    // block. If not, we call `posFromDOM` on the raw node/offset.
    let outsideBlock = -1;
    for (let cur = node, sawBlock = false;;) {
        if (cur == view.dom)
            break;
        let desc = view.docView.nearestDesc(cur, true), rect;
        if (!desc)
            return null;
        if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) &&
            // Ignore elements with zero-size bounding rectangles
            ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
            if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
                // Only apply the horizontal test to the innermost block. Vertical for any parent.
                if (!sawBlock && rect.left > coords.left || rect.top > coords.top)
                    outsideBlock = desc.posBefore;
                else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)
                    outsideBlock = desc.posAfter;
                sawBlock = true;
            }
            if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {
                // If we are inside a leaf, return the side of the leaf closer to the coords
                let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2
                    : coords.left < (rect.left + rect.right) / 2;
                return before ? desc.posBefore : desc.posAfter;
            }
        }
        cur = desc.dom.parentNode;
    }
    return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);
}
function elementFromPoint(element, coords, box) {
    let len = element.childNodes.length;
    if (len && box.top < box.bottom) {
        for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {
            let child = element.childNodes[i];
            if (child.nodeType == 1) {
                let rects = child.getClientRects();
                for (let j = 0; j < rects.length; j++) {
                    let rect = rects[j];
                    if (inRect(coords, rect))
                        return elementFromPoint(child, coords, rect);
                }
            }
            if ((i = (i + 1) % len) == startI)
                break;
        }
    }
    return element;
}
// Given an x,y position on the editor, get the position in the document.
function posAtCoords(view, coords) {
    let doc = view.dom.ownerDocument, node, offset = 0;
    let caret = caretFromPoint(doc, coords.left, coords.top);
    if (caret)
        ({ node, offset } = caret);
    let elt = (view.root.elementFromPoint ? view.root : doc)
        .elementFromPoint(coords.left, coords.top);
    let pos;
    if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
        let box = view.dom.getBoundingClientRect();
        if (!inRect(coords, box))
            return null;
        elt = elementFromPoint(view.dom, coords, box);
        if (!elt)
            return null;
    }
    // Safari's caretRangeFromPoint returns nonsense when on a draggable element
    if (safari) {
        for (let p = elt; node && p; p = parentNode(p))
            if (p.draggable)
                node = undefined;
    }
    elt = targetKludge(elt, coords);
    if (node) {
        if (gecko && node.nodeType == 1) {
            // Firefox will sometimes return offsets into <input> nodes, which
            // have no actual children, from caretPositionFromPoint (#953)
            offset = Math.min(offset, node.childNodes.length);
            // It'll also move the returned position before image nodes,
            // even if those are behind it.
            if (offset < node.childNodes.length) {
                let next = node.childNodes[offset], box;
                if (next.nodeName == "IMG" && (box = next.getBoundingClientRect()).right <= coords.left &&
                    box.bottom > coords.top)
                    offset++;
            }
        }
        let prev;
        // When clicking above the right side of an uneditable node, Chrome will report a cursor position after that node.
        if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 &&
            prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top)
            offset--;
        // Suspiciously specific kludge to work around caret*FromPoint
        // never returning a position at the end of the document
        if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 &&
            coords.top > node.lastChild.getBoundingClientRect().bottom)
            pos = view.state.doc.content.size;
        // Ignore positions directly after a BR, since caret*FromPoint
        // 'round up' positions that would be more accurately placed
        // before the BR node.
        else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR")
            pos = posFromCaret(view, node, offset, coords);
    }
    if (pos == null)
        pos = posFromElement(view, elt, coords);
    let desc = view.docView.nearestDesc(elt, true);
    return { pos, inside: desc ? desc.posAtStart - desc.border : -1 };
}
function nonZero(rect) {
    return rect.top < rect.bottom || rect.left < rect.right;
}
function singleRect(target, bias) {
    let rects = target.getClientRects();
    if (rects.length) {
        let first = rects[bias < 0 ? 0 : rects.length - 1];
        if (nonZero(first))
            return first;
    }
    return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();
}
const BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
// Given a position in the document model, get a bounding box of the
// character at that position, relative to the window.
function coordsAtPos(view, pos, side) {
    let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
    let supportEmptyRange = webkit || gecko;
    if (node.nodeType == 3) {
        // These browsers support querying empty text ranges. Prefer that in
        // bidi context or when at the end of a node.
        if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
            let rect = singleRect(textRange(node, offset, offset), side);
            // Firefox returns bad results (the position before the space)
            // when querying a position directly after line-broken
            // whitespace. Detect this situation and and kludge around it
            if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
                let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
                if (rectBefore.top == rect.top) {
                    let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);
                    if (rectAfter.top != rect.top)
                        return flattenV(rectAfter, rectAfter.left < rectBefore.left);
                }
            }
            return rect;
        }
        else {
            let from = offset, to = offset, takeSide = side < 0 ? 1 : -1;
            if (side < 0 && !offset) {
                to++;
                takeSide = -1;
            }
            else if (side >= 0 && offset == node.nodeValue.length) {
                from--;
                takeSide = 1;
            }
            else if (side < 0) {
                from--;
            }
            else {
                to++;
            }
            return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);
        }
    }
    let $dom = view.state.doc.resolve(pos - (atom || 0));
    // Return a horizontal line in block context
    if (!$dom.parent.inlineContent) {
        if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
            let before = node.childNodes[offset - 1];
            if (before.nodeType == 1)
                return flattenH(before.getBoundingClientRect(), false);
        }
        if (atom == null && offset < nodeSize(node)) {
            let after = node.childNodes[offset];
            if (after.nodeType == 1)
                return flattenH(after.getBoundingClientRect(), true);
        }
        return flattenH(node.getBoundingClientRect(), side >= 0);
    }
    // Inline, not in text node (this is not Bidi-safe)
    if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
        let before = node.childNodes[offset - 1];
        let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1))
            // BR nodes tend to only return the rectangle before them.
            // Only use them if they are the last element in their parent
            : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
        if (target)
            return flattenV(singleRect(target, 1), false);
    }
    if (atom == null && offset < nodeSize(node)) {
        let after = node.childNodes[offset];
        while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords)
            after = after.nextSibling;
        let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, (supportEmptyRange ? 0 : 1))
            : after.nodeType == 1 ? after : null;
        if (target)
            return flattenV(singleRect(target, -1), true);
    }
    // All else failed, just try to get a rectangle for the target node
    return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
}
function flattenV(rect, left) {
    if (rect.width == 0)
        return rect;
    let x = left ? rect.left : rect.right;
    return { top: rect.top, bottom: rect.bottom, left: x, right: x };
}
function flattenH(rect, top) {
    if (rect.height == 0)
        return rect;
    let y = top ? rect.top : rect.bottom;
    return { top: y, bottom: y, left: rect.left, right: rect.right };
}
function withFlushedState(view, state, f) {
    let viewState = view.state, active = view.root.activeElement;
    if (viewState != state)
        view.updateState(state);
    if (active != view.dom)
        view.focus();
    try {
        return f();
    }
    finally {
        if (viewState != state)
            view.updateState(viewState);
        if (active != view.dom && active)
            active.focus();
    }
}
// Whether vertical position motion in a given direction
// from a position would leave a text block.
function endOfTextblockVertical(view, state, dir) {
    let sel = state.selection;
    let $pos = dir == "up" ? sel.$from : sel.$to;
    return withFlushedState(view, state, () => {
        let { node: dom } = view.docView.domFromPos($pos.pos, dir == "up" ? -1 : 1);
        for (;;) {
            let nearest = view.docView.nearestDesc(dom, true);
            if (!nearest)
                break;
            if (nearest.node.isBlock) {
                dom = nearest.contentDOM || nearest.dom;
                break;
            }
            dom = nearest.dom.parentNode;
        }
        let coords = coordsAtPos(view, $pos.pos, 1);
        for (let child = dom.firstChild; child; child = child.nextSibling) {
            let boxes;
            if (child.nodeType == 1)
                boxes = child.getClientRects();
            else if (child.nodeType == 3)
                boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
            else
                continue;
            for (let i = 0; i < boxes.length; i++) {
                let box = boxes[i];
                if (box.bottom > box.top + 1 &&
                    (dir == "up" ? coords.top - box.top > (box.bottom - coords.top) * 2
                        : box.bottom - coords.bottom > (coords.bottom - box.top) * 2))
                    return false;
            }
        }
        return true;
    });
}
const maybeRTL = /[\u0590-\u08ac]/;
function endOfTextblockHorizontal(view, state, dir) {
    let { $head } = state.selection;
    if (!$head.parent.isTextblock)
        return false;
    let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;
    let sel = view.domSelection();
    if (!sel)
        return $head.pos == $head.start() || $head.pos == $head.end();
    // If the textblock is all LTR, or the browser doesn't support
    // Selection.modify (Edge), fall back to a primitive approach
    if (!maybeRTL.test($head.parent.textContent) || !sel.modify)
        return dir == "left" || dir == "backward" ? atStart : atEnd;
    return withFlushedState(view, state, () => {
        // This is a huge hack, but appears to be the best we can
        // currently do: use `Selection.modify` to move the selection by
        // one character, and see if that moves the cursor out of the
        // textblock (or doesn't move it at all, when at the start/end of
        // the document).
        let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange();
        let oldBidiLevel = sel.caretBidiLevel // Only for Firefox
        ;
        sel.modify("move", dir, "character");
        let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
        let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
        let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) ||
            (oldNode == newNode && oldOff == newOff);
        // Restore the previous selection
        try {
            sel.collapse(anchorNode, anchorOffset);
            if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend)
                sel.extend(oldNode, oldOff);
        }
        catch (_) { }
        if (oldBidiLevel != null)
            sel.caretBidiLevel = oldBidiLevel;
        return result;
    });
}
let cachedState = null;
let cachedDir = null;
let cachedResult = false;
function endOfTextblock(view, state, dir) {
    if (cachedState == state && cachedDir == dir)
        return cachedResult;
    cachedState = state;
    cachedDir = dir;
    return cachedResult = dir == "up" || dir == "down"
        ? endOfTextblockVertical(view, state, dir)
        : endOfTextblockHorizontal(view, state, dir);
}

// View descriptions are data structures that describe the DOM that is
// used to represent the editor's content. They are used for:
//
// - Incremental redrawing when the document changes
//
// - Figuring out what part of the document a given DOM position
//   corresponds to
//
// - Wiring in custom implementations of the editing interface for a
//   given node
//
// They form a doubly-linked mutable tree, starting at `view.docView`.
const NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;
// Superclass for the various kinds of descriptions. Defines their
// basic structure and shared methods.
class ViewDesc {
    constructor(parent, children, dom, 
    // This is the node that holds the child views. It may be null for
    // descs that don't have children.
    contentDOM) {
        this.parent = parent;
        this.children = children;
        this.dom = dom;
        this.contentDOM = contentDOM;
        this.dirty = NOT_DIRTY;
        // An expando property on the DOM node provides a link back to its
        // description.
        dom.pmViewDesc = this;
    }
    // Used to check whether a given description corresponds to a
    // widget/mark/node.
    matchesWidget(widget) { return false; }
    matchesMark(mark) { return false; }
    matchesNode(node, outerDeco, innerDeco) { return false; }
    matchesHack(nodeName) { return false; }
    // When parsing in-editor content (in domchange.js), we allow
    // descriptions to determine the parse rules that should be used to
    // parse them.
    parseRule() { return null; }
    // Used by the editor's event handler to ignore events that come
    // from certain descs.
    stopEvent(event) { return false; }
    // The size of the content represented by this desc.
    get size() {
        let size = 0;
        for (let i = 0; i < this.children.length; i++)
            size += this.children[i].size;
        return size;
    }
    // For block nodes, this represents the space taken up by their
    // start/end tokens.
    get border() { return 0; }
    destroy() {
        this.parent = undefined;
        if (this.dom.pmViewDesc == this)
            this.dom.pmViewDesc = undefined;
        for (let i = 0; i < this.children.length; i++)
            this.children[i].destroy();
    }
    posBeforeChild(child) {
        for (let i = 0, pos = this.posAtStart;; i++) {
            let cur = this.children[i];
            if (cur == child)
                return pos;
            pos += cur.size;
        }
    }
    get posBefore() {
        return this.parent.posBeforeChild(this);
    }
    get posAtStart() {
        return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
    }
    get posAfter() {
        return this.posBefore + this.size;
    }
    get posAtEnd() {
        return this.posAtStart + this.size - 2 * this.border;
    }
    localPosFromDOM(dom, offset, bias) {
        // If the DOM position is in the content, use the child desc after
        // it to figure out a position.
        if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {
            if (bias < 0) {
                let domBefore, desc;
                if (dom == this.contentDOM) {
                    domBefore = dom.childNodes[offset - 1];
                }
                else {
                    while (dom.parentNode != this.contentDOM)
                        dom = dom.parentNode;
                    domBefore = dom.previousSibling;
                }
                while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this))
                    domBefore = domBefore.previousSibling;
                return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;
            }
            else {
                let domAfter, desc;
                if (dom == this.contentDOM) {
                    domAfter = dom.childNodes[offset];
                }
                else {
                    while (dom.parentNode != this.contentDOM)
                        dom = dom.parentNode;
                    domAfter = dom.nextSibling;
                }
                while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this))
                    domAfter = domAfter.nextSibling;
                return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;
            }
        }
        // Otherwise, use various heuristics, falling back on the bias
        // parameter, to determine whether to return the position at the
        // start or at the end of this view desc.
        let atEnd;
        if (dom == this.dom && this.contentDOM) {
            atEnd = offset > domIndex(this.contentDOM);
        }
        else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {
            atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
        }
        else if (this.dom.firstChild) {
            if (offset == 0)
                for (let search = dom;; search = search.parentNode) {
                    if (search == this.dom) {
                        atEnd = false;
                        break;
                    }
                    if (search.previousSibling)
                        break;
                }
            if (atEnd == null && offset == dom.childNodes.length)
                for (let search = dom;; search = search.parentNode) {
                    if (search == this.dom) {
                        atEnd = true;
                        break;
                    }
                    if (search.nextSibling)
                        break;
                }
        }
        return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;
    }
    nearestDesc(dom, onlyNodes = false) {
        for (let first = true, cur = dom; cur; cur = cur.parentNode) {
            let desc = this.getDesc(cur), nodeDOM;
            if (desc && (!onlyNodes || desc.node)) {
                // If dom is outside of this desc's nodeDOM, don't count it.
                if (first && (nodeDOM = desc.nodeDOM) &&
                    !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom))
                    first = false;
                else
                    return desc;
            }
        }
    }
    getDesc(dom) {
        let desc = dom.pmViewDesc;
        for (let cur = desc; cur; cur = cur.parent)
            if (cur == this)
                return desc;
    }
    posFromDOM(dom, offset, bias) {
        for (let scan = dom; scan; scan = scan.parentNode) {
            let desc = this.getDesc(scan);
            if (desc)
                return desc.localPosFromDOM(dom, offset, bias);
        }
        return -1;
    }
    // Find the desc for the node after the given pos, if any. (When a
    // parent node overrode rendering, there might not be one.)
    descAt(pos) {
        for (let i = 0, offset = 0; i < this.children.length; i++) {
            let child = this.children[i], end = offset + child.size;
            if (offset == pos && end != offset) {
                while (!child.border && child.children.length) {
                    for (let i = 0; i < child.children.length; i++) {
                        let inner = child.children[i];
                        if (inner.size) {
                            child = inner;
                            break;
                        }
                    }
                }
                return child;
            }
            if (pos < end)
                return child.descAt(pos - offset - child.border);
            offset = end;
        }
    }
    domFromPos(pos, side) {
        if (!this.contentDOM)
            return { node: this.dom, offset: 0, atom: pos + 1 };
        // First find the position in the child array
        let i = 0, offset = 0;
        for (let curPos = 0; i < this.children.length; i++) {
            let child = this.children[i], end = curPos + child.size;
            if (end > pos || child instanceof TrailingHackViewDesc) {
                offset = pos - curPos;
                break;
            }
            curPos = end;
        }
        // If this points into the middle of a child, call through
        if (offset)
            return this.children[i].domFromPos(offset - this.children[i].border, side);
        // Go back if there were any zero-length widgets with side >= 0 before this point
        for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--) { }
        // Scan towards the first useable node
        if (side <= 0) {
            let prev, enter = true;
            for (;; i--, enter = false) {
                prev = i ? this.children[i - 1] : null;
                if (!prev || prev.dom.parentNode == this.contentDOM)
                    break;
            }
            if (prev && side && enter && !prev.border && !prev.domAtom)
                return prev.domFromPos(prev.size, side);
            return { node: this.contentDOM, offset: prev ? domIndex(prev.dom) + 1 : 0 };
        }
        else {
            let next, enter = true;
            for (;; i++, enter = false) {
                next = i < this.children.length ? this.children[i] : null;
                if (!next || next.dom.parentNode == this.contentDOM)
                    break;
            }
            if (next && enter && !next.border && !next.domAtom)
                return next.domFromPos(0, side);
            return { node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length };
        }
    }
    // Used to find a DOM range in a single parent for a given changed
    // range.
    parseRange(from, to, base = 0) {
        if (this.children.length == 0)
            return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
        let fromOffset = -1, toOffset = -1;
        for (let offset = base, i = 0;; i++) {
            let child = this.children[i], end = offset + child.size;
            if (fromOffset == -1 && from <= end) {
                let childBase = offset + child.border;
                // FIXME maybe descend mark views to parse a narrower range?
                if (from >= childBase && to <= end - child.border && child.node &&
                    child.contentDOM && this.contentDOM.contains(child.contentDOM))
                    return child.parseRange(from, to, childBase);
                from = offset;
                for (let j = i; j > 0; j--) {
                    let prev = this.children[j - 1];
                    if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
                        fromOffset = domIndex(prev.dom) + 1;
                        break;
                    }
                    from -= prev.size;
                }
                if (fromOffset == -1)
                    fromOffset = 0;
            }
            if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {
                to = end;
                for (let j = i + 1; j < this.children.length; j++) {
                    let next = this.children[j];
                    if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {
                        toOffset = domIndex(next.dom);
                        break;
                    }
                    to += next.size;
                }
                if (toOffset == -1)
                    toOffset = this.contentDOM.childNodes.length;
                break;
            }
            offset = end;
        }
        return { node: this.contentDOM, from, to, fromOffset, toOffset };
    }
    emptyChildAt(side) {
        if (this.border || !this.contentDOM || !this.children.length)
            return false;
        let child = this.children[side < 0 ? 0 : this.children.length - 1];
        return child.size == 0 || child.emptyChildAt(side);
    }
    domAfterPos(pos) {
        let { node, offset } = this.domFromPos(pos, 0);
        if (node.nodeType != 1 || offset == node.childNodes.length)
            throw new RangeError("No node after pos " + pos);
        return node.childNodes[offset];
    }
    // View descs are responsible for setting any selection that falls
    // entirely inside of them, so that custom implementations can do
    // custom things with the selection. Note that this falls apart when
    // a selection starts in such a node and ends in another, in which
    // case we just use whatever domFromPos produces as a best effort.
    setSelection(anchor, head, view, force = false) {
        // If the selection falls entirely in a child, give it to that child
        let from = Math.min(anchor, head), to = Math.max(anchor, head);
        for (let i = 0, offset = 0; i < this.children.length; i++) {
            let child = this.children[i], end = offset + child.size;
            if (from > offset && to < end)
                return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);
            offset = end;
        }
        let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);
        let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);
        let domSel = view.root.getSelection();
        let selRange = view.domSelectionRange();
        let brKludge = false;
        // On Firefox, using Selection.collapse to put the cursor after a
        // BR node for some reason doesn't always work (#1073). On Safari,
        // the cursor sometimes inexplicable visually lags behind its
        // reported position in such situations (#1092).
        if ((gecko || safari) && anchor == head) {
            let { node, offset } = anchorDOM;
            if (node.nodeType == 3) {
                brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
                // Issue #1128
                if (brKludge && offset == node.nodeValue.length) {
                    for (let scan = node, after; scan; scan = scan.parentNode) {
                        if (after = scan.nextSibling) {
                            if (after.nodeName == "BR")
                                anchorDOM = headDOM = { node: after.parentNode, offset: domIndex(after) + 1 };
                            break;
                        }
                        let desc = scan.pmViewDesc;
                        if (desc && desc.node && desc.node.isBlock)
                            break;
                    }
                }
            }
            else {
                let prev = node.childNodes[offset - 1];
                brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
            }
        }
        // Firefox can act strangely when the selection is in front of an
        // uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536
        if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
            let after = selRange.focusNode.childNodes[selRange.focusOffset];
            if (after && after.contentEditable == "false")
                force = true;
        }
        if (!(force || brKludge && safari) &&
            isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) &&
            isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset))
            return;
        // Selection.extend can be used to create an 'inverted' selection
        // (one where the focus is before the anchor), but not all
        // browsers support it yet.
        let domSelExtended = false;
        if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {
            domSel.collapse(anchorDOM.node, anchorDOM.offset);
            try {
                if (anchor != head)
                    domSel.extend(headDOM.node, headDOM.offset);
                domSelExtended = true;
            }
            catch (_) {
                // In some cases with Chrome the selection is empty after calling
                // collapse, even when it should be valid. This appears to be a bug, but
                // it is difficult to isolate. If this happens fallback to the old path
                // without using extend.
                // Similarly, this could crash on Safari if the editor is hidden, and
                // there was no selection.
            }
        }
        if (!domSelExtended) {
            if (anchor > head) {
                let tmp = anchorDOM;
                anchorDOM = headDOM;
                headDOM = tmp;
            }
            let range = document.createRange();
            range.setEnd(headDOM.node, headDOM.offset);
            range.setStart(anchorDOM.node, anchorDOM.offset);
            domSel.removeAllRanges();
            domSel.addRange(range);
        }
    }
    ignoreMutation(mutation) {
        return !this.contentDOM && mutation.type != "selection";
    }
    get contentLost() {
        return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
    }
    // Remove a subtree of the element tree that has been touched
    // by a DOM change, so that the next update will redraw it.
    markDirty(from, to) {
        for (let offset = 0, i = 0; i < this.children.length; i++) {
            let child = this.children[i], end = offset + child.size;
            if (offset == end ? from <= end && to >= offset : from < end && to > offset) {
                let startInside = offset + child.border, endInside = end - child.border;
                if (from >= startInside && to <= endInside) {
                    this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
                    if (from == startInside && to == endInside &&
                        (child.contentLost || child.dom.parentNode != this.contentDOM))
                        child.dirty = NODE_DIRTY;
                    else
                        child.markDirty(from - startInside, to - startInside);
                    return;
                }
                else {
                    child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length
                        ? CONTENT_DIRTY : NODE_DIRTY;
                }
            }
            offset = end;
        }
        this.dirty = CONTENT_DIRTY;
    }
    markParentsDirty() {
        let level = 1;
        for (let node = this.parent; node; node = node.parent, level++) {
            let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;
            if (node.dirty < dirty)
                node.dirty = dirty;
        }
    }
    get domAtom() { return false; }
    get ignoreForCoords() { return false; }
    get ignoreForSelection() { return false; }
    isText(text) { return false; }
}
// A widget desc represents a widget decoration, which is a DOM node
// drawn between the document nodes.
class WidgetViewDesc extends ViewDesc {
    constructor(parent, widget, view, pos) {
        let self, dom = widget.type.toDOM;
        if (typeof dom == "function")
            dom = dom(view, () => {
                if (!self)
                    return pos;
                if (self.parent)
                    return self.parent.posBeforeChild(self);
            });
        if (!widget.type.spec.raw) {
            if (dom.nodeType != 1) {
                let wrap = document.createElement("span");
                wrap.appendChild(dom);
                dom = wrap;
            }
            dom.contentEditable = "false";
            dom.classList.add("ProseMirror-widget");
        }
        super(parent, [], dom, null);
        this.widget = widget;
        this.widget = widget;
        self = this;
    }
    matchesWidget(widget) {
        return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);
    }
    parseRule() { return { ignore: true }; }
    stopEvent(event) {
        let stop = this.widget.spec.stopEvent;
        return stop ? stop(event) : false;
    }
    ignoreMutation(mutation) {
        return mutation.type != "selection" || this.widget.spec.ignoreSelection;
    }
    destroy() {
        this.widget.type.destroy(this.dom);
        super.destroy();
    }
    get domAtom() { return true; }
    get ignoreForSelection() { return !!this.widget.type.spec.relaxedSide; }
    get side() { return this.widget.type.side; }
}
class CompositionViewDesc extends ViewDesc {
    constructor(parent, dom, textDOM, text) {
        super(parent, [], dom, null);
        this.textDOM = textDOM;
        this.text = text;
    }
    get size() { return this.text.length; }
    localPosFromDOM(dom, offset) {
        if (dom != this.textDOM)
            return this.posAtStart + (offset ? this.size : 0);
        return this.posAtStart + offset;
    }
    domFromPos(pos) {
        return { node: this.textDOM, offset: pos };
    }
    ignoreMutation(mut) {
        return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue;
    }
}
// A mark desc represents a mark. May have multiple children,
// depending on how the mark is split. Note that marks are drawn using
// a fixed nesting order, for simplicity and predictability, so in
// some cases they will be split more often than would appear
// necessary.
class MarkViewDesc extends ViewDesc {
    constructor(parent, mark, dom, contentDOM, spec) {
        super(parent, [], dom, contentDOM);
        this.mark = mark;
        this.spec = spec;
    }
    static create(parent, mark, inline, view) {
        let custom = view.nodeViews[mark.type.name];
        let spec = custom && custom(mark, view, inline);
        if (!spec || !spec.dom)
            spec = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);
        return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);
    }
    parseRule() {
        if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView)
            return null;
        return { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
    }
    matchesMark(mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark); }
    markDirty(from, to) {
        super.markDirty(from, to);
        // Move dirty info to nearest node view
        if (this.dirty != NOT_DIRTY) {
            let parent = this.parent;
            while (!parent.node)
                parent = parent.parent;
            if (parent.dirty < this.dirty)
                parent.dirty = this.dirty;
            this.dirty = NOT_DIRTY;
        }
    }
    slice(from, to, view) {
        let copy = MarkViewDesc.create(this.parent, this.mark, true, view);
        let nodes = this.children, size = this.size;
        if (to < size)
            nodes = replaceNodes(nodes, to, size, view);
        if (from > 0)
            nodes = replaceNodes(nodes, 0, from, view);
        for (let i = 0; i < nodes.length; i++)
            nodes[i].parent = copy;
        copy.children = nodes;
        return copy;
    }
    ignoreMutation(mutation) {
        return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
    }
    destroy() {
        if (this.spec.destroy)
            this.spec.destroy();
        super.destroy();
    }
}
// Node view descs are the main, most common type of view desc, and
// correspond to an actual node in the document. Unlike mark descs,
// they populate their child array themselves.
class NodeViewDesc extends ViewDesc {
    constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {
        super(parent, [], dom, contentDOM);
        this.node = node;
        this.outerDeco = outerDeco;
        this.innerDeco = innerDeco;
        this.nodeDOM = nodeDOM;
    }
    // By default, a node is rendered using the `toDOM` method from the
    // node type spec. But client code can use the `nodeViews` spec to
    // supply a custom node view, which can influence various aspects of
    // the way the node works.
    //
    // (Using subclassing for this was intentionally decided against,
    // since it'd require exposing a whole slew of finicky
    // implementation details to the user code that they probably will
    // never need.)
    static create(parent, node, outerDeco, innerDeco, view, pos) {
        let custom = view.nodeViews[node.type.name], descObj;
        let spec = custom && custom(node, view, () => {
            // (This is a function that allows the custom view to find its
            // own position)
            if (!descObj)
                return pos;
            if (descObj.parent)
                return descObj.parent.posBeforeChild(descObj);
        }, outerDeco, innerDeco);
        let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;
        if (node.isText) {
            if (!dom)
                dom = document.createTextNode(node.text);
            else if (dom.nodeType != 3)
                throw new RangeError("Text must be rendered as a DOM text node");
        }
        else if (!dom) {
            let spec = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
            ({ dom, contentDOM } = spec);
        }
        if (!contentDOM && !node.isText && dom.nodeName != "BR") { // Chrome gets confused by <br contenteditable=false>
            if (!dom.hasAttribute("contenteditable"))
                dom.contentEditable = "false";
            if (node.type.spec.draggable)
                dom.draggable = true;
        }
        let nodeDOM = dom;
        dom = applyOuterDeco(dom, outerDeco, node);
        if (spec)
            return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);
        else if (node.isText)
            return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);
        else
            return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);
    }
    parseRule() {
        // Experimental kludge to allow opt-in re-parsing of nodes
        if (this.node.type.spec.reparseInView)
            return null;
        // FIXME the assumption that this can always return the current
        // attrs means that if the user somehow manages to change the
        // attrs in the dom, that won't be picked up. Not entirely sure
        // whether this is a problem
        let rule = { node: this.node.type.name, attrs: this.node.attrs };
        if (this.node.type.whitespace == "pre")
            rule.preserveWhitespace = "full";
        if (!this.contentDOM) {
            rule.getContent = () => this.node.content;
        }
        else if (!this.contentLost) {
            rule.contentElement = this.contentDOM;
        }
        else {
            // Chrome likes to randomly recreate parent nodes when
            // backspacing things. When that happens, this tries to find the
            // new parent.
            for (let i = this.children.length - 1; i >= 0; i--) {
                let child = this.children[i];
                if (this.dom.contains(child.dom.parentNode)) {
                    rule.contentElement = child.dom.parentNode;
                    break;
                }
            }
            if (!rule.contentElement)
                rule.getContent = () => prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty;
        }
        return rule;
    }
    matchesNode(node, outerDeco, innerDeco) {
        return this.dirty == NOT_DIRTY && node.eq(this.node) &&
            sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);
    }
    get size() { return this.node.nodeSize; }
    get border() { return this.node.isLeaf ? 0 : 1; }
    // Syncs `this.children` to match `this.node.content` and the local
    // decorations, possibly introducing nesting for marks. Then, in a
    // separate step, syncs the DOM inside `this.contentDOM` to
    // `this.children`.
    updateChildren(view, pos) {
        let inline = this.node.inlineContent, off = pos;
        let composition = view.composing ? this.localCompositionInfo(view, pos) : null;
        let localComposition = composition && composition.pos > -1 ? composition : null;
        let compositionInChild = composition && composition.pos < 0;
        let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
        iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
            if (widget.spec.marks)
                updater.syncToMarks(widget.spec.marks, inline, view, i);
            else if (widget.type.side >= 0 && !insideNode)
                updater.syncToMarks(i == this.node.childCount ? prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Mark.none : this.node.child(i).marks, inline, view, i);
            // If the next node is a desc matching this widget, reuse it,
            // otherwise insert the widget as a new view desc.
            updater.placeWidget(widget, view, off);
        }, (child, outerDeco, innerDeco, i) => {
            // Make sure the wrapping mark descs match the node's marks.
            updater.syncToMarks(child.marks, inline, view, i);
            // Try several strategies for drawing this node
            let compIndex;
            if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;
            else if (compositionInChild && view.state.selection.from > off &&
                view.state.selection.to < off + child.nodeSize &&
                (compIndex = updater.findIndexWithChild(composition.node)) > -1 &&
                updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;
            else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) ;
            else {
                // Add it as a new view
                updater.addNode(child, outerDeco, innerDeco, view, off);
            }
            off += child.nodeSize;
        });
        // Drop all remaining descs after the current position.
        updater.syncToMarks([], inline, view, 0);
        if (this.node.isTextblock)
            updater.addTextblockHacks();
        updater.destroyRest();
        // Sync the DOM if anything changed
        if (updater.changed || this.dirty == CONTENT_DIRTY) {
            // May have to protect focused DOM from being changed if a composition is active
            if (localComposition)
                this.protectLocalComposition(view, localComposition);
            renderDescs(this.contentDOM, this.children, view);
            if (ios)
                iosHacks(this.dom);
        }
    }
    localCompositionInfo(view, pos) {
        // Only do something if both the selection and a focused text node
        // are inside of this node
        let { from, to } = view.state.selection;
        if (!(view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection) || from < pos || to > pos + this.node.content.size)
            return null;
        let textNode = view.input.compositionNode;
        if (!textNode || !this.dom.contains(textNode.parentNode))
            return null;
        if (this.node.inlineContent) {
            // Find the text in the focused node in the node, stop if it's not
            // there (may have been modified through other means, in which
            // case it should overwritten)
            let text = textNode.nodeValue;
            let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);
            return textPos < 0 ? null : { node: textNode, pos: textPos, text };
        }
        else {
            return { node: textNode, pos: -1, text: "" };
        }
    }
    protectLocalComposition(view, { node, pos, text }) {
        // The node is already part of a local view desc, leave it there
        if (this.getDesc(node))
            return;
        // Create a composition view for the orphaned nodes
        let topNode = node;
        for (;; topNode = topNode.parentNode) {
            if (topNode.parentNode == this.contentDOM)
                break;
            while (topNode.previousSibling)
                topNode.parentNode.removeChild(topNode.previousSibling);
            while (topNode.nextSibling)
                topNode.parentNode.removeChild(topNode.nextSibling);
            if (topNode.pmViewDesc)
                topNode.pmViewDesc = undefined;
        }
        let desc = new CompositionViewDesc(this, topNode, node, text);
        view.input.compositionNodes.push(desc);
        // Patch up this.children to contain the composition view
        this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);
    }
    // If this desc must be updated to match the given node decoration,
    // do so and return true.
    update(node, outerDeco, innerDeco, view) {
        if (this.dirty == NODE_DIRTY ||
            !node.sameMarkup(this.node))
            return false;
        this.updateInner(node, outerDeco, innerDeco, view);
        return true;
    }
    updateInner(node, outerDeco, innerDeco, view) {
        this.updateOuterDeco(outerDeco);
        this.node = node;
        this.innerDeco = innerDeco;
        if (this.contentDOM)
            this.updateChildren(view, this.posAtStart);
        this.dirty = NOT_DIRTY;
    }
    updateOuterDeco(outerDeco) {
        if (sameOuterDeco(outerDeco, this.outerDeco))
            return;
        let needsWrap = this.nodeDOM.nodeType != 1;
        let oldDOM = this.dom;
        this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
        if (this.dom != oldDOM) {
            oldDOM.pmViewDesc = undefined;
            this.dom.pmViewDesc = this;
        }
        this.outerDeco = outerDeco;
    }
    // Mark this node as being the selected node.
    selectNode() {
        if (this.nodeDOM.nodeType == 1) {
            this.nodeDOM.classList.add("ProseMirror-selectednode");
            if (this.contentDOM || !this.node.type.spec.draggable)
                this.nodeDOM.draggable = true;
        }
    }
    // Remove selected node marking from this node.
    deselectNode() {
        if (this.nodeDOM.nodeType == 1) {
            this.nodeDOM.classList.remove("ProseMirror-selectednode");
            if (this.contentDOM || !this.node.type.spec.draggable)
                this.nodeDOM.removeAttribute("draggable");
        }
    }
    get domAtom() { return this.node.isAtom; }
}
// Create a view desc for the top-level document node, to be exported
// and used by the view class.
function docViewDesc(doc, outerDeco, innerDeco, dom, view) {
    applyOuterDeco(dom, outerDeco, doc);
    let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);
    if (docView.contentDOM)
        docView.updateChildren(view, 0);
    return docView;
}
class TextViewDesc extends NodeViewDesc {
    constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {
        super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);
    }
    parseRule() {
        let skip = this.nodeDOM.parentNode;
        while (skip && skip != this.dom && !skip.pmIsDeco)
            skip = skip.parentNode;
        return { skip: (skip || true) };
    }
    update(node, outerDeco, innerDeco, view) {
        if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||
            !node.sameMarkup(this.node))
            return false;
        this.updateOuterDeco(outerDeco);
        if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {
            this.nodeDOM.nodeValue = node.text;
            if (view.trackWrites == this.nodeDOM)
                view.trackWrites = null;
        }
        this.node = node;
        this.dirty = NOT_DIRTY;
        return true;
    }
    inParent() {
        let parentDOM = this.parent.contentDOM;
        for (let n = this.nodeDOM; n; n = n.parentNode)
            if (n == parentDOM)
                return true;
        return false;
    }
    domFromPos(pos) {
        return { node: this.nodeDOM, offset: pos };
    }
    localPosFromDOM(dom, offset, bias) {
        if (dom == this.nodeDOM)
            return this.posAtStart + Math.min(offset, this.node.text.length);
        return super.localPosFromDOM(dom, offset, bias);
    }
    ignoreMutation(mutation) {
        return mutation.type != "characterData" && mutation.type != "selection";
    }
    slice(from, to, view) {
        let node = this.node.cut(from, to), dom = document.createTextNode(node.text);
        return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);
    }
    markDirty(from, to) {
        super.markDirty(from, to);
        if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length))
            this.dirty = NODE_DIRTY;
    }
    get domAtom() { return false; }
    isText(text) { return this.node.text == text; }
}
// A dummy desc used to tag trailing BR or IMG nodes created to work
// around contentEditable terribleness.
class TrailingHackViewDesc extends ViewDesc {
    parseRule() { return { ignore: true }; }
    matchesHack(nodeName) { return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName; }
    get domAtom() { return true; }
    get ignoreForCoords() { return this.dom.nodeName == "IMG"; }
}
// A separate subclass is used for customized node views, so that the
// extra checks only have to be made for nodes that are actually
// customized.
class CustomNodeViewDesc extends NodeViewDesc {
    constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {
        super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);
        this.spec = spec;
    }
    // A custom `update` method gets to decide whether the update goes
    // through. If it does, and there's a `contentDOM` node, our logic
    // updates the children.
    update(node, outerDeco, innerDeco, view) {
        if (this.dirty == NODE_DIRTY)
            return false;
        if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {
            let result = this.spec.update(node, outerDeco, innerDeco);
            if (result)
                this.updateInner(node, outerDeco, innerDeco, view);
            return result;
        }
        else if (!this.contentDOM && !node.isLeaf) {
            return false;
        }
        else {
            return super.update(node, outerDeco, innerDeco, view);
        }
    }
    selectNode() {
        this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
    }
    deselectNode() {
        this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
    }
    setSelection(anchor, head, view, force) {
        this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root)
            : super.setSelection(anchor, head, view, force);
    }
    destroy() {
        if (this.spec.destroy)
            this.spec.destroy();
        super.destroy();
    }
    stopEvent(event) {
        return this.spec.stopEvent ? this.spec.stopEvent(event) : false;
    }
    ignoreMutation(mutation) {
        return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
    }
}
// Sync the content of the given DOM node with the nodes associated
// with the given array of view descs, recursing into mark descs
// because this should sync the subtree for a whole node at a time.
function renderDescs(parentDOM, descs, view) {
    let dom = parentDOM.firstChild, written = false;
    for (let i = 0; i < descs.length; i++) {
        let desc = descs[i], childDOM = desc.dom;
        if (childDOM.parentNode == parentDOM) {
            while (childDOM != dom) {
                dom = rm(dom);
                written = true;
            }
            dom = dom.nextSibling;
        }
        else {
            written = true;
            parentDOM.insertBefore(childDOM, dom);
        }
        if (desc instanceof MarkViewDesc) {
            let pos = dom ? dom.previousSibling : parentDOM.lastChild;
            renderDescs(desc.contentDOM, desc.children, view);
            dom = pos ? pos.nextSibling : parentDOM.firstChild;
        }
    }
    while (dom) {
        dom = rm(dom);
        written = true;
    }
    if (written && view.trackWrites == parentDOM)
        view.trackWrites = null;
}
const OuterDecoLevel = function (nodeName) {
    if (nodeName)
        this.nodeName = nodeName;
};
OuterDecoLevel.prototype = Object.create(null);
const noDeco = [new OuterDecoLevel];
function computeOuterDeco(outerDeco, node, needsWrap) {
    if (outerDeco.length == 0)
        return noDeco;
    let top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];
    for (let i = 0; i < outerDeco.length; i++) {
        let attrs = outerDeco[i].type.attrs;
        if (!attrs)
            continue;
        if (attrs.nodeName)
            result.push(top = new OuterDecoLevel(attrs.nodeName));
        for (let name in attrs) {
            let val = attrs[name];
            if (val == null)
                continue;
            if (needsWrap && result.length == 1)
                result.push(top = new OuterDecoLevel(node.isInline ? "span" : "div"));
            if (name == "class")
                top.class = (top.class ? top.class + " " : "") + val;
            else if (name == "style")
                top.style = (top.style ? top.style + ";" : "") + val;
            else if (name != "nodeName")
                top[name] = val;
        }
    }
    return result;
}
function patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {
    // Shortcut for trivial case
    if (prevComputed == noDeco && curComputed == noDeco)
        return nodeDOM;
    let curDOM = nodeDOM;
    for (let i = 0; i < curComputed.length; i++) {
        let deco = curComputed[i], prev = prevComputed[i];
        if (i) {
            let parent;
            if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&
                (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) {
                curDOM = parent;
            }
            else {
                parent = document.createElement(deco.nodeName);
                parent.pmIsDeco = true;
                parent.appendChild(curDOM);
                prev = noDeco[0];
                curDOM = parent;
            }
        }
        patchAttributes(curDOM, prev || noDeco[0], deco);
    }
    return curDOM;
}
function patchAttributes(dom, prev, cur) {
    for (let name in prev)
        if (name != "class" && name != "style" && name != "nodeName" && !(name in cur))
            dom.removeAttribute(name);
    for (let name in cur)
        if (name != "class" && name != "style" && name != "nodeName" && cur[name] != prev[name])
            dom.setAttribute(name, cur[name]);
    if (prev.class != cur.class) {
        let prevList = prev.class ? prev.class.split(" ").filter(Boolean) : [];
        let curList = cur.class ? cur.class.split(" ").filter(Boolean) : [];
        for (let i = 0; i < prevList.length; i++)
            if (curList.indexOf(prevList[i]) == -1)
                dom.classList.remove(prevList[i]);
        for (let i = 0; i < curList.length; i++)
            if (prevList.indexOf(curList[i]) == -1)
                dom.classList.add(curList[i]);
        if (dom.classList.length == 0)
            dom.removeAttribute("class");
    }
    if (prev.style != cur.style) {
        if (prev.style) {
            let prop = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m;
            while (m = prop.exec(prev.style))
                dom.style.removeProperty(m[1]);
        }
        if (cur.style)
            dom.style.cssText += cur.style;
    }
}
function applyOuterDeco(dom, deco, node) {
    return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
}
function sameOuterDeco(a, b) {
    if (a.length != b.length)
        return false;
    for (let i = 0; i < a.length; i++)
        if (!a[i].type.eq(b[i].type))
            return false;
    return true;
}
// Remove a DOM node and return its next sibling.
function rm(dom) {
    let next = dom.nextSibling;
    dom.parentNode.removeChild(dom);
    return next;
}
// Helper class for incrementally updating a tree of mark descs and
// the widget and node descs inside of them.
class ViewTreeUpdater {
    constructor(top, lock, view) {
        this.lock = lock;
        this.view = view;
        // Index into `this.top`'s child array, represents the current
        // update position.
        this.index = 0;
        // When entering a mark, the current top and index are pushed
        // onto this.
        this.stack = [];
        // Tracks whether anything was changed
        this.changed = false;
        this.top = top;
        this.preMatch = preMatch(top.node.content, top);
    }
    // Destroy and remove the children between the given indices in
    // `this.top`.
    destroyBetween(start, end) {
        if (start == end)
            return;
        for (let i = start; i < end; i++)
            this.top.children[i].destroy();
        this.top.children.splice(start, end - start);
        this.changed = true;
    }
    // Destroy all remaining children in `this.top`.
    destroyRest() {
        this.destroyBetween(this.index, this.top.children.length);
    }
    // Sync the current stack of mark descs with the given array of
    // marks, reusing existing mark descs when possible.
    syncToMarks(marks, inline, view, parentIndex) {
        let keep = 0, depth = this.stack.length >> 1;
        let maxKeep = Math.min(depth, marks.length);
        while (keep < maxKeep &&
            (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1])
                .matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)
            keep++;
        while (keep < depth) {
            this.destroyRest();
            this.top.dirty = NOT_DIRTY;
            this.index = this.stack.pop();
            this.top = this.stack.pop();
            depth--;
        }
        while (depth < marks.length) {
            this.stack.push(this.top, this.index + 1);
            let found = -1, scanTo = this.top.children.length;
            if (parentIndex < this.preMatch.index)
                scanTo = Math.min(this.index + 3, scanTo);
            for (let i = this.index; i < scanTo; i++) {
                let next = this.top.children[i];
                if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {
                    found = i;
                    break;
                }
            }
            if (found > -1) {
                if (found > this.index) {
                    this.changed = true;
                    this.destroyBetween(this.index, found);
                }
                this.top = this.top.children[this.index];
            }
            else {
                let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);
                this.top.children.splice(this.index, 0, markDesc);
                this.top = markDesc;
                this.changed = true;
            }
            this.index = 0;
            depth++;
        }
    }
    // Try to find a node desc matching the given data. Skip over it and
    // return true when successful.
    findNodeMatch(node, outerDeco, innerDeco, index) {
        let found = -1, targetDesc;
        if (index >= this.preMatch.index &&
            (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top &&
            targetDesc.matchesNode(node, outerDeco, innerDeco)) {
            found = this.top.children.indexOf(targetDesc, this.index);
        }
        else {
            for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {
                let child = this.top.children[i];
                if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {
                    found = i;
                    break;
                }
            }
        }
        if (found < 0)
            return false;
        this.destroyBetween(this.index, found);
        this.index++;
        return true;
    }
    updateNodeAt(node, outerDeco, innerDeco, index, view) {
        let child = this.top.children[index];
        if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM)
            child.dirty = CONTENT_DIRTY;
        if (!child.update(node, outerDeco, innerDeco, view))
            return false;
        this.destroyBetween(this.index, index);
        this.index++;
        return true;
    }
    findIndexWithChild(domNode) {
        for (;;) {
            let parent = domNode.parentNode;
            if (!parent)
                return -1;
            if (parent == this.top.contentDOM) {
                let desc = domNode.pmViewDesc;
                if (desc)
                    for (let i = this.index; i < this.top.children.length; i++) {
                        if (this.top.children[i] == desc)
                            return i;
                    }
                return -1;
            }
            domNode = parent;
        }
    }
    // Try to update the next node, if any, to the given data. Checks
    // pre-matches to avoid overwriting nodes that could still be used.
    updateNextNode(node, outerDeco, innerDeco, view, index, pos) {
        for (let i = this.index; i < this.top.children.length; i++) {
            let next = this.top.children[i];
            if (next instanceof NodeViewDesc) {
                let preMatch = this.preMatch.matched.get(next);
                if (preMatch != null && preMatch != index)
                    return false;
                let nextDOM = next.dom, updated;
                // Can't update if nextDOM is or contains this.lock, except if
                // it's a text node whose content already matches the new text
                // and whose decorations match the new ones.
                let locked = this.isLocked(nextDOM) &&
                    !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&
                        next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));
                if (!locked && next.update(node, outerDeco, innerDeco, view)) {
                    this.destroyBetween(this.index, i);
                    if (next.dom != nextDOM)
                        this.changed = true;
                    this.index++;
                    return true;
                }
                else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
                    this.destroyBetween(this.index, i);
                    this.top.children[this.index] = updated;
                    if (updated.contentDOM) {
                        updated.dirty = CONTENT_DIRTY;
                        updated.updateChildren(view, pos + 1);
                        updated.dirty = NOT_DIRTY;
                    }
                    this.changed = true;
                    this.index++;
                    return true;
                }
                break;
            }
        }
        return false;
    }
    // When a node with content is replaced by a different node with
    // identical content, move over its children.
    recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {
        if (next.dirty || node.isAtom || !next.children.length ||
            !next.node.content.eq(node.content) ||
            !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))
            return null;
        let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
        if (wrapper.contentDOM) {
            wrapper.children = next.children;
            next.children = [];
            for (let ch of wrapper.children)
                ch.parent = wrapper;
        }
        next.destroy();
        return wrapper;
    }
    // Insert the node as a newly created node desc.
    addNode(node, outerDeco, innerDeco, view, pos) {
        let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
        if (desc.contentDOM)
            desc.updateChildren(view, pos + 1);
        this.top.children.splice(this.index++, 0, desc);
        this.changed = true;
    }
    placeWidget(widget, view, pos) {
        let next = this.index < this.top.children.length ? this.top.children[this.index] : null;
        if (next && next.matchesWidget(widget) &&
            (widget == next.widget || !next.widget.type.toDOM.parentNode)) {
            this.index++;
        }
        else {
            let desc = new WidgetViewDesc(this.top, widget, view, pos);
            this.top.children.splice(this.index++, 0, desc);
            this.changed = true;
        }
    }
    // Make sure a textblock looks and behaves correctly in
    // contentEditable.
    addTextblockHacks() {
        let lastChild = this.top.children[this.index - 1], parent = this.top;
        while (lastChild instanceof MarkViewDesc) {
            parent = lastChild;
            lastChild = parent.children[parent.children.length - 1];
        }
        if (!lastChild || // Empty textblock
            !(lastChild instanceof TextViewDesc) ||
            /\n$/.test(lastChild.node.text) ||
            (this.view.requiresGeckoHackNode && /\s$/.test(lastChild.node.text))) {
            // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)
            if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == "false")
                this.addHackNode("IMG", parent);
            this.addHackNode("BR", this.top);
        }
    }
    addHackNode(nodeName, parent) {
        if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {
            this.index++;
        }
        else {
            let dom = document.createElement(nodeName);
            if (nodeName == "IMG") {
                dom.className = "ProseMirror-separator";
                dom.alt = "";
            }
            if (nodeName == "BR")
                dom.className = "ProseMirror-trailingBreak";
            let hack = new TrailingHackViewDesc(this.top, [], dom, null);
            if (parent != this.top)
                parent.children.push(hack);
            else
                parent.children.splice(this.index++, 0, hack);
            this.changed = true;
        }
    }
    isLocked(node) {
        return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
    }
}
// Iterate from the end of the fragment and array of descs to find
// directly matching ones, in order to avoid overeagerly reusing those
// for other nodes.
function preMatch(frag, parentDesc) {
    let curDesc = parentDesc, descI = curDesc.children.length;
    let fI = frag.childCount, matched = new Map, matches = [];
    outer: while (fI > 0) {
        let desc;
        for (;;) {
            if (descI) {
                let next = curDesc.children[descI - 1];
                if (next instanceof MarkViewDesc) {
                    curDesc = next;
                    descI = next.children.length;
                }
                else {
                    desc = next;
                    descI--;
                    break;
                }
            }
            else if (curDesc == parentDesc) {
                break outer;
            }
            else {
                descI = curDesc.parent.children.indexOf(curDesc);
                curDesc = curDesc.parent;
            }
        }
        let node = desc.node;
        if (!node)
            continue;
        if (node != frag.child(fI - 1))
            break;
        --fI;
        matched.set(desc, fI);
        matches.push(desc);
    }
    return { index: fI, matched, matches: matches.reverse() };
}
function compareSide(a, b) {
    return a.type.side - b.type.side;
}
// This function abstracts iterating over the nodes and decorations in
// a fragment. Calls `onNode` for each node, with its local and child
// decorations. Splits text nodes when there is a decoration starting
// or ending inside of them. Calls `onWidget` for each widget.
function iterDeco(parent, deco, onWidget, onNode) {
    let locals = deco.locals(parent), offset = 0;
    // Simple, cheap variant for when there are no local decorations
    if (locals.length == 0) {
        for (let i = 0; i < parent.childCount; i++) {
            let child = parent.child(i);
            onNode(child, locals, deco.forChild(offset, child), i);
            offset += child.nodeSize;
        }
        return;
    }
    let decoIndex = 0, active = [], restNode = null;
    for (let parentIndex = 0;;) {
        let widget, widgets;
        while (decoIndex < locals.length && locals[decoIndex].to == offset) {
            let next = locals[decoIndex++];
            if (next.widget) {
                if (!widget)
                    widget = next;
                else
                    (widgets || (widgets = [widget])).push(next);
            }
        }
        if (widget) {
            if (widgets) {
                widgets.sort(compareSide);
                for (let i = 0; i < widgets.length; i++)
                    onWidget(widgets[i], parentIndex, !!restNode);
            }
            else {
                onWidget(widget, parentIndex, !!restNode);
            }
        }
        let child, index;
        if (restNode) {
            index = -1;
            child = restNode;
            restNode = null;
        }
        else if (parentIndex < parent.childCount) {
            index = parentIndex;
            child = parent.child(parentIndex++);
        }
        else {
            break;
        }
        for (let i = 0; i < active.length; i++)
            if (active[i].to <= offset)
                active.splice(i--, 1);
        while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)
            active.push(locals[decoIndex++]);
        let end = offset + child.nodeSize;
        if (child.isText) {
            let cutAt = end;
            if (decoIndex < locals.length && locals[decoIndex].from < cutAt)
                cutAt = locals[decoIndex].from;
            for (let i = 0; i < active.length; i++)
                if (active[i].to < cutAt)
                    cutAt = active[i].to;
            if (cutAt < end) {
                restNode = child.cut(cutAt - offset);
                child = child.cut(0, cutAt - offset);
                end = cutAt;
                index = -1;
            }
        }
        else {
            while (decoIndex < locals.length && locals[decoIndex].to < end)
                decoIndex++;
        }
        let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();
        onNode(child, outerDeco, deco.forChild(offset, child), index);
        offset = end;
    }
}
// List markers in Mobile Safari will mysteriously disappear
// sometimes. This works around that.
function iosHacks(dom) {
    if (dom.nodeName == "UL" || dom.nodeName == "OL") {
        let oldCSS = dom.style.cssText;
        dom.style.cssText = oldCSS + "; list-style: square !important";
        window.getComputedStyle(dom).listStyle;
        dom.style.cssText = oldCSS;
    }
}
// Find a piece of text in an inline fragment, overlapping from-to
function findTextInFragment(frag, text, from, to) {
    for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {
        let child = frag.child(i++), childStart = pos;
        pos += child.nodeSize;
        if (!child.isText)
            continue;
        let str = child.text;
        while (i < frag.childCount) {
            let next = frag.child(i++);
            pos += next.nodeSize;
            if (!next.isText)
                break;
            str += next.text;
        }
        if (pos >= from) {
            if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)
                return to - text.length;
            let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
            if (found >= 0 && found + text.length + childStart >= from)
                return childStart + found;
            if (from == to && str.length >= (to + text.length) - childStart &&
                str.slice(to - childStart, to - childStart + text.length) == text)
                return to;
        }
    }
    return -1;
}
// Replace range from-to in an array of view descs with replacement
// (may be null to just delete). This goes very much against the grain
// of the rest of this code, which tends to create nodes with the
// right shape in one go, rather than messing with them after
// creation, but is necessary in the composition hack.
function replaceNodes(nodes, from, to, view, replacement) {
    let result = [];
    for (let i = 0, off = 0; i < nodes.length; i++) {
        let child = nodes[i], start = off, end = off += child.size;
        if (start >= to || end <= from) {
            result.push(child);
        }
        else {
            if (start < from)
                result.push(child.slice(0, from - start, view));
            if (replacement) {
                result.push(replacement);
                replacement = undefined;
            }
            if (end > to)
                result.push(child.slice(to - start, child.size, view));
        }
    }
    return result;
}

function selectionFromDOM(view, origin = null) {
    let domSel = view.domSelectionRange(), doc = view.state.doc;
    if (!domSel.focusNode)
        return null;
    let nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;
    let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);
    if (head < 0)
        return null;
    let $head = doc.resolve(head), anchor, selection;
    if (selectionCollapsed(domSel)) {
        anchor = head;
        while (nearestDesc && !nearestDesc.node)
            nearestDesc = nearestDesc.parent;
        let nearestDescNode = nearestDesc.node;
        if (nearestDesc && nearestDescNode.isAtom && prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent
            && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
            let pos = nearestDesc.posBefore;
            selection = new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection(head == pos ? $head : doc.resolve(pos));
        }
    }
    else {
        if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
            let min = head, max = head;
            for (let i = 0; i < domSel.rangeCount; i++) {
                let range = domSel.getRangeAt(i);
                min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));
                max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));
            }
            if (min < 0)
                return null;
            [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];
            $head = doc.resolve(head);
        }
        else {
            anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
        }
        if (anchor < 0)
            return null;
    }
    let $anchor = doc.resolve(anchor);
    if (!selection) {
        let bias = origin == "pointer" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;
        selection = selectionBetween(view, $anchor, $head, bias);
    }
    return selection;
}
function editorOwnsSelection(view) {
    return view.editable ? view.hasFocus() :
        hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);
}
function selectionToDOM(view, force = false) {
    let sel = view.state.selection;
    syncNodeSelection(view, sel);
    if (!editorOwnsSelection(view))
        return;
    // The delayed drag selection causes issues with Cell Selections
    // in Safari. And the drag selection delay is to workarond issues
    // which only present in Chrome.
    if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {
        let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;
        if (domSel.anchorNode && curSel.anchorNode &&
            isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {
            view.input.mouseDown.delayedSelectionSync = true;
            view.domObserver.setCurSelection();
            return;
        }
    }
    view.domObserver.disconnectSelection();
    if (view.cursorWrapper) {
        selectCursorWrapper(view);
    }
    else {
        let { anchor, head } = sel, resetEditableFrom, resetEditableTo;
        if (brokenSelectBetweenUneditable && !(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection)) {
            if (!sel.$from.parent.inlineContent)
                resetEditableFrom = temporarilyEditableNear(view, sel.from);
            if (!sel.empty && !sel.$from.parent.inlineContent)
                resetEditableTo = temporarilyEditableNear(view, sel.to);
        }
        view.docView.setSelection(anchor, head, view, force);
        if (brokenSelectBetweenUneditable) {
            if (resetEditableFrom)
                resetEditable(resetEditableFrom);
            if (resetEditableTo)
                resetEditable(resetEditableTo);
        }
        if (sel.visible) {
            view.dom.classList.remove("ProseMirror-hideselection");
        }
        else {
            view.dom.classList.add("ProseMirror-hideselection");
            if ("onselectionchange" in document)
                removeClassOnSelectionChange(view);
        }
    }
    view.domObserver.setCurSelection();
    view.domObserver.connectSelection();
}
// Kludge to work around Webkit not allowing a selection to start/end
// between non-editable block nodes. We briefly make something
// editable, set the selection, then set it uneditable again.
const brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;
function temporarilyEditableNear(view, pos) {
    let { node, offset } = view.docView.domFromPos(pos, 0);
    let after = offset < node.childNodes.length ? node.childNodes[offset] : null;
    let before = offset ? node.childNodes[offset - 1] : null;
    if (safari && after && after.contentEditable == "false")
        return setEditable(after);
    if ((!after || after.contentEditable == "false") &&
        (!before || before.contentEditable == "false")) {
        if (after)
            return setEditable(after);
        else if (before)
            return setEditable(before);
    }
}
function setEditable(element) {
    element.contentEditable = "true";
    if (safari && element.draggable) {
        element.draggable = false;
        element.wasDraggable = true;
    }
    return element;
}
function resetEditable(element) {
    element.contentEditable = "false";
    if (element.wasDraggable) {
        element.draggable = true;
        element.wasDraggable = null;
    }
}
function removeClassOnSelectionChange(view) {
    let doc = view.dom.ownerDocument;
    doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
    let domSel = view.domSelectionRange();
    let node = domSel.anchorNode, offset = domSel.anchorOffset;
    doc.addEventListener("selectionchange", view.input.hideSelectionGuard = () => {
        if (domSel.anchorNode != node || domSel.anchorOffset != offset) {
            doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
            setTimeout(() => {
                if (!editorOwnsSelection(view) || view.state.selection.visible)
                    view.dom.classList.remove("ProseMirror-hideselection");
            }, 20);
        }
    });
}
function selectCursorWrapper(view) {
    let domSel = view.domSelection();
    if (!domSel)
        return;
    let node = view.cursorWrapper.dom, img = node.nodeName == "IMG";
    if (img)
        domSel.collapse(node.parentNode, domIndex(node) + 1);
    else
        domSel.collapse(node, 0);
    // Kludge to kill 'control selection' in IE11 when selecting an
    // invisible cursor wrapper, since that would result in those weird
    // resize handles and a selection that considers the absolutely
    // positioned wrapper, rather than the root editable node, the
    // focused element.
    if (!img && !view.state.selection.visible && ie && ie_version <= 11) {
        node.disabled = true;
        node.disabled = false;
    }
}
function syncNodeSelection(view, sel) {
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection) {
        let desc = view.docView.descAt(sel.from);
        if (desc != view.lastSelectedViewDesc) {
            clearNodeSelection(view);
            if (desc)
                desc.selectNode();
            view.lastSelectedViewDesc = desc;
        }
    }
    else {
        clearNodeSelection(view);
    }
}
// Clear all DOM statefulness of the last node selection.
function clearNodeSelection(view) {
    if (view.lastSelectedViewDesc) {
        if (view.lastSelectedViewDesc.parent)
            view.lastSelectedViewDesc.deselectNode();
        view.lastSelectedViewDesc = undefined;
    }
}
function selectionBetween(view, $anchor, $head, bias) {
    return view.someProp("createSelectionBetween", f => f(view, $anchor, $head))
        || prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection.between($anchor, $head, bias);
}
function hasFocusAndSelection(view) {
    if (view.editable && !view.hasFocus())
        return false;
    return hasSelection(view);
}
function hasSelection(view) {
    let sel = view.domSelectionRange();
    if (!sel.anchorNode)
        return false;
    try {
        // Firefox will raise 'permission denied' errors when accessing
        // properties of `sel.anchorNode` when it's in a generated CSS
        // element.
        return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) &&
            (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));
    }
    catch (_) {
        return false;
    }
}
function anchorInRightPlace(view) {
    let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);
    let domSel = view.domSelectionRange();
    return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);
}

function moveSelectionBlock(state, dir) {
    let { $anchor, $head } = state.selection;
    let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);
    let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;
    return $start && prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection.findFrom($start, dir);
}
function apply(view, sel) {
    view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());
    return true;
}
function selectHorizontally(view, dir, mods) {
    let sel = view.state.selection;
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection) {
        if (mods.indexOf("s") > -1) {
            let { $head } = sel, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;
            if (!node || node.isText || !node.isLeaf)
                return false;
            let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));
            return apply(view, new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection(sel.$anchor, $newHead));
        }
        else if (!sel.empty) {
            return false;
        }
        else if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) {
            let next = moveSelectionBlock(view.state, dir);
            if (next && (next instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection))
                return apply(view, next);
            return false;
        }
        else if (!(mac && mods.indexOf("m") > -1)) {
            let $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;
            if (!node || node.isText)
                return false;
            let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
            if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM))
                return false;
            if (prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(node)) {
                return apply(view, new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
            }
            else if (webkit) {
                // Chrome and Safari will introduce extra pointless cursor
                // positions around inline uneditable nodes, so we have to
                // take over and move the cursor past them (#937)
                return apply(view, new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
            }
            else {
                return false;
            }
        }
    }
    else if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection && sel.node.isInline) {
        return apply(view, new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection(dir > 0 ? sel.$to : sel.$from));
    }
    else {
        let next = moveSelectionBlock(view.state, dir);
        if (next)
            return apply(view, next);
        return false;
    }
}
function nodeLen(node) {
    return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
}
function isIgnorable(dom, dir) {
    let desc = dom.pmViewDesc;
    return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
}
function skipIgnoredNodes(view, dir) {
    return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
}
// Make sure the cursor isn't directly after one or more ignored
// nodes, which will confuse the browser's cursor motion logic.
function skipIgnoredNodesBefore(view) {
    let sel = view.domSelectionRange();
    let node = sel.focusNode, offset = sel.focusOffset;
    if (!node)
        return;
    let moveNode, moveOffset, force = false;
    // Gecko will do odd things when the selection is directly in front
    // of a non-editable node, so in that case, move it into the next
    // node if possible. Issue prosemirror/prosemirror#832.
    if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1))
        force = true;
    for (;;) {
        if (offset > 0) {
            if (node.nodeType != 1) {
                break;
            }
            else {
                let before = node.childNodes[offset - 1];
                if (isIgnorable(before, -1)) {
                    moveNode = node;
                    moveOffset = --offset;
                }
                else if (before.nodeType == 3) {
                    node = before;
                    offset = node.nodeValue.length;
                }
                else
                    break;
            }
        }
        else if (isBlockNode(node)) {
            break;
        }
        else {
            let prev = node.previousSibling;
            while (prev && isIgnorable(prev, -1)) {
                moveNode = node.parentNode;
                moveOffset = domIndex(prev);
                prev = prev.previousSibling;
            }
            if (!prev) {
                node = node.parentNode;
                if (node == view.dom)
                    break;
                offset = 0;
            }
            else {
                node = prev;
                offset = nodeLen(node);
            }
        }
    }
    if (force)
        setSelFocus(view, node, offset);
    else if (moveNode)
        setSelFocus(view, moveNode, moveOffset);
}
// Make sure the cursor isn't directly before one or more ignored
// nodes.
function skipIgnoredNodesAfter(view) {
    let sel = view.domSelectionRange();
    let node = sel.focusNode, offset = sel.focusOffset;
    if (!node)
        return;
    let len = nodeLen(node);
    let moveNode, moveOffset;
    for (;;) {
        if (offset < len) {
            if (node.nodeType != 1)
                break;
            let after = node.childNodes[offset];
            if (isIgnorable(after, 1)) {
                moveNode = node;
                moveOffset = ++offset;
            }
            else
                break;
        }
        else if (isBlockNode(node)) {
            break;
        }
        else {
            let next = node.nextSibling;
            while (next && isIgnorable(next, 1)) {
                moveNode = next.parentNode;
                moveOffset = domIndex(next) + 1;
                next = next.nextSibling;
            }
            if (!next) {
                node = node.parentNode;
                if (node == view.dom)
                    break;
                offset = len = 0;
            }
            else {
                node = next;
                offset = 0;
                len = nodeLen(node);
            }
        }
    }
    if (moveNode)
        setSelFocus(view, moveNode, moveOffset);
}
function isBlockNode(dom) {
    let desc = dom.pmViewDesc;
    return desc && desc.node && desc.node.isBlock;
}
function textNodeAfter(node, offset) {
    while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {
        offset = domIndex(node) + 1;
        node = node.parentNode;
    }
    while (node && offset < node.childNodes.length) {
        let next = node.childNodes[offset];
        if (next.nodeType == 3)
            return next;
        if (next.nodeType == 1 && next.contentEditable == "false")
            break;
        node = next;
        offset = 0;
    }
}
function textNodeBefore(node, offset) {
    while (node && !offset && !hasBlockDesc(node)) {
        offset = domIndex(node);
        node = node.parentNode;
    }
    while (node && offset) {
        let next = node.childNodes[offset - 1];
        if (next.nodeType == 3)
            return next;
        if (next.nodeType == 1 && next.contentEditable == "false")
            break;
        node = next;
        offset = node.childNodes.length;
    }
}
function setSelFocus(view, node, offset) {
    if (node.nodeType != 3) {
        let before, after;
        if (after = textNodeAfter(node, offset)) {
            node = after;
            offset = 0;
        }
        else if (before = textNodeBefore(node, offset)) {
            node = before;
            offset = before.nodeValue.length;
        }
    }
    let sel = view.domSelection();
    if (!sel)
        return;
    if (selectionCollapsed(sel)) {
        let range = document.createRange();
        range.setEnd(node, offset);
        range.setStart(node, offset);
        sel.removeAllRanges();
        sel.addRange(range);
    }
    else if (sel.extend) {
        sel.extend(node, offset);
    }
    view.domObserver.setCurSelection();
    let { state } = view;
    // If no state update ends up happening, reset the selection.
    setTimeout(() => {
        if (view.state == state)
            selectionToDOM(view);
    }, 50);
}
function findDirection(view, pos) {
    let $pos = view.state.doc.resolve(pos);
    if (!(chrome || windows) && $pos.parent.inlineContent) {
        let coords = view.coordsAtPos(pos);
        if (pos > $pos.start()) {
            let before = view.coordsAtPos(pos - 1);
            let mid = (before.top + before.bottom) / 2;
            if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1)
                return before.left < coords.left ? "ltr" : "rtl";
        }
        if (pos < $pos.end()) {
            let after = view.coordsAtPos(pos + 1);
            let mid = (after.top + after.bottom) / 2;
            if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1)
                return after.left > coords.left ? "ltr" : "rtl";
        }
    }
    let computed = getComputedStyle(view.dom).direction;
    return computed == "rtl" ? "rtl" : "ltr";
}
// Check whether vertical selection motion would involve node
// selections. If so, apply it (if not, the result is left to the
// browser)
function selectVertically(view, dir, mods) {
    let sel = view.state.selection;
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel.empty || mods.indexOf("s") > -1)
        return false;
    if (mac && mods.indexOf("m") > -1)
        return false;
    let { $from, $to } = sel;
    if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) {
        let next = moveSelectionBlock(view.state, dir);
        if (next && (next instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection))
            return apply(view, next);
    }
    if (!$from.parent.inlineContent) {
        let side = dir < 0 ? $from : $to;
        let beyond = sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.AllSelection ? prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection.near(side, dir) : prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection.findFrom(side, dir);
        return beyond ? apply(view, beyond) : false;
    }
    return false;
}
function stopNativeHorizontalDelete(view, dir) {
    if (!(view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection))
        return true;
    let { $head, $anchor, empty } = view.state.selection;
    if (!$head.sameParent($anchor))
        return true;
    if (!empty)
        return false;
    if (view.endOfTextblock(dir > 0 ? "forward" : "backward"))
        return true;
    let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);
    if (nextNode && !nextNode.isText) {
        let tr = view.state.tr;
        if (dir < 0)
            tr.delete($head.pos - nextNode.nodeSize, $head.pos);
        else
            tr.delete($head.pos, $head.pos + nextNode.nodeSize);
        view.dispatch(tr);
        return true;
    }
    return false;
}
function switchEditable(view, node, state) {
    view.domObserver.stop();
    node.contentEditable = state;
    view.domObserver.start();
}
// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821
// In which Safari (and at some point in the past, Chrome) does really
// wrong things when the down arrow is pressed when the cursor is
// directly at the start of a textblock and has an uneditable node
// after it
function safariDownArrowBug(view) {
    if (!safari || view.state.selection.$head.parentOffset > 0)
        return false;
    let { focusNode, focusOffset } = view.domSelectionRange();
    if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&
        focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
        let child = focusNode.firstChild;
        switchEditable(view, child, "true");
        setTimeout(() => switchEditable(view, child, "false"), 20);
    }
    return false;
}
// A backdrop key mapping used to make sure we always suppress keys
// that have a dangerous default effect, even if the commands they are
// bound to return false, and to make sure that cursor-motion keys
// find a cursor (as opposed to a node selection) when pressed. For
// cursor-motion keys, the code in the handlers also takes care of
// block selections.
function getMods(event) {
    let result = "";
    if (event.ctrlKey)
        result += "c";
    if (event.metaKey)
        result += "m";
    if (event.altKey)
        result += "a";
    if (event.shiftKey)
        result += "s";
    return result;
}
function captureKeyDown(view, event) {
    let code = event.keyCode, mods = getMods(event);
    if (code == 8 || (mac && code == 72 && mods == "c")) { // Backspace, Ctrl-h on Mac
        return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);
    }
    else if ((code == 46 && !event.shiftKey) || (mac && code == 68 && mods == "c")) { // Delete, Ctrl-d on Mac
        return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);
    }
    else if (code == 13 || code == 27) { // Enter, Esc
        return true;
    }
    else if (code == 37 || (mac && code == 66 && mods == "c")) { // Left arrow, Ctrl-b on Mac
        let dir = code == 37 ? (findDirection(view, view.state.selection.from) == "ltr" ? -1 : 1) : -1;
        return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
    }
    else if (code == 39 || (mac && code == 70 && mods == "c")) { // Right arrow, Ctrl-f on Mac
        let dir = code == 39 ? (findDirection(view, view.state.selection.from) == "ltr" ? 1 : -1) : 1;
        return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
    }
    else if (code == 38 || (mac && code == 80 && mods == "c")) { // Up arrow, Ctrl-p on Mac
        return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);
    }
    else if (code == 40 || (mac && code == 78 && mods == "c")) { // Down arrow, Ctrl-n on Mac
        return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);
    }
    else if (mods == (mac ? "m" : "c") &&
        (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]
        return true;
    }
    return false;
}

function serializeForClipboard(view, slice) {
    view.someProp("transformCopied", f => { slice = f(slice, view); });
    let context = [], { content, openStart, openEnd } = slice;
    while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
        openStart--;
        openEnd--;
        let node = content.firstChild;
        context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);
        content = node.content;
    }
    let serializer = view.someProp("clipboardSerializer") || prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMSerializer.fromSchema(view.state.schema);
    let doc = detachedDoc(), wrap = doc.createElement("div");
    wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
    let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
    while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
        for (let i = needsWrap.length - 1; i >= 0; i--) {
            let wrapper = doc.createElement(needsWrap[i]);
            while (wrap.firstChild)
                wrapper.appendChild(wrap.firstChild);
            wrap.appendChild(wrapper);
            wrappers++;
        }
        firstChild = wrap.firstChild;
    }
    if (firstChild && firstChild.nodeType == 1)
        firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
    let text = view.someProp("clipboardTextSerializer", f => f(slice, view)) ||
        slice.content.textBetween(0, slice.content.size, "\n\n");
    return { dom: wrap, text, slice };
}
// Read a slice of content from the clipboard (or drop data).
function parseFromClipboard(view, text, html, plainText, $context) {
    let inCode = $context.parent.type.spec.code;
    let dom, slice;
    if (!html && !text)
        return null;
    let asText = !!text && (plainText || inCode || !html);
    if (asText) {
        view.someProp("transformPastedText", f => { text = f(text, inCode || plainText, view); });
        if (inCode) {
            slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0);
            view.someProp("transformPasted", f => { slice = f(slice, view, true); });
            return slice;
        }
        let parsed = view.someProp("clipboardTextParser", f => f(text, $context, plainText, view));
        if (parsed) {
            slice = parsed;
        }
        else {
            let marks = $context.marks();
            let { schema } = view.state, serializer = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMSerializer.fromSchema(schema);
            dom = document.createElement("div");
            text.split(/(?:\r\n?|\n)+/).forEach(block => {
                let p = dom.appendChild(document.createElement("p"));
                if (block)
                    p.appendChild(serializer.serializeNode(schema.text(block, marks)));
            });
        }
    }
    else {
        view.someProp("transformPastedHTML", f => { html = f(html, view); });
        dom = readHTML(html);
        if (webkit)
            restoreReplacedSpaces(dom);
    }
    let contextNode = dom && dom.querySelector("[data-pm-slice]");
    let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
    if (sliceData && sliceData[3])
        for (let i = +sliceData[3]; i > 0; i--) {
            let child = dom.firstChild;
            while (child && child.nodeType != 1)
                child = child.nextSibling;
            if (!child)
                break;
            dom = child;
        }
    if (!slice) {
        let parser = view.someProp("clipboardParser") || view.someProp("domParser") || prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMParser.fromSchema(view.state.schema);
        slice = parser.parseSlice(dom, {
            preserveWhitespace: !!(asText || sliceData),
            context: $context,
            ruleFromNode(dom) {
                if (dom.nodeName == "BR" && !dom.nextSibling &&
                    dom.parentNode && !inlineParents.test(dom.parentNode.nodeName))
                    return { ignore: true };
                return null;
            }
        });
    }
    if (sliceData) {
        slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);
    }
    else { // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent
        slice = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.maxOpen(normalizeSiblings(slice.content, $context), true);
        if (slice.openStart || slice.openEnd) {
            let openStart = 0, openEnd = 0;
            for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) { }
            for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) { }
            slice = closeSlice(slice, openStart, openEnd);
        }
    }
    view.someProp("transformPasted", f => { slice = f(slice, view, asText); });
    return slice;
}
const inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
// Takes a slice parsed with parseSlice, which means there hasn't been
// any content-expression checking done on the top nodes, tries to
// find a parent node in the current context that might fit the nodes,
// and if successful, rebuilds the slice so that it fits into that parent.
//
// This addresses the problem that Transform.replace expects a
// coherent slice, and will fail to place a set of siblings that don't
// fit anywhere in the schema.
function normalizeSiblings(fragment, $context) {
    if (fragment.childCount < 2)
        return fragment;
    for (let d = $context.depth; d >= 0; d--) {
        let parent = $context.node(d);
        let match = parent.contentMatchAt($context.index(d));
        let lastWrap, result = [];
        fragment.forEach(node => {
            if (!result)
                return;
            let wrap = match.findWrapping(node.type), inLast;
            if (!wrap)
                return result = null;
            if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {
                result[result.length - 1] = inLast;
            }
            else {
                if (result.length)
                    result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);
                let wrapped = withWrappers(node, wrap);
                result.push(wrapped);
                match = match.matchType(wrapped.type);
                lastWrap = wrap;
            }
        });
        if (result)
            return prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(result);
    }
    return fragment;
}
function withWrappers(node, wrap, from = 0) {
    for (let i = wrap.length - 1; i >= from; i--)
        node = wrap[i].create(null, prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(node));
    return node;
}
// Used to group adjacent nodes wrapped in similar parents by
// normalizeSiblings into the same parent node
function addToSibling(wrap, lastWrap, node, sibling, depth) {
    if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {
        let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);
        if (inner)
            return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
        let match = sibling.contentMatchAt(sibling.childCount);
        if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1]))
            return sibling.copy(sibling.content.append(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(withWrappers(node, wrap, depth + 1))));
    }
}
function closeRight(node, depth) {
    if (depth == 0)
        return node;
    let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));
    let fill = node.contentMatchAt(node.childCount).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty, true);
    return node.copy(fragment.append(fill));
}
function closeRange(fragment, side, from, to, depth, openEnd) {
    let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;
    if (fragment.childCount > 1)
        openEnd = 0;
    if (depth < to - 1)
        inner = closeRange(inner, side, from, to, depth + 1, openEnd);
    if (depth >= from)
        inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner)
            : inner.append(node.contentMatchAt(node.childCount).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.empty, true));
    return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
}
function closeSlice(slice, openStart, openEnd) {
    if (openStart < slice.openStart)
        slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);
    if (openEnd < slice.openEnd)
        slice = new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);
    return slice;
}
// Trick from jQuery -- some elements must be wrapped in other
// elements for innerHTML to work. I.e. if you do `div.innerHTML =
// "<td>..</td>"` the table cells are ignored.
const wrapMap = {
    thead: ["table"],
    tbody: ["table"],
    tfoot: ["table"],
    caption: ["table"],
    colgroup: ["table"],
    col: ["table", "colgroup"],
    tr: ["table", "tbody"],
    td: ["table", "tbody", "tr"],
    th: ["table", "tbody", "tr"]
};
let _detachedDoc = null;
function detachedDoc() {
    return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
}
let _policy = null;
function maybeWrapTrusted(html) {
    let trustedTypes = window.trustedTypes;
    if (!trustedTypes)
        return html;
    // With the require-trusted-types-for CSP, Chrome will block
    // innerHTML, even on a detached document. This wraps the string in
    // a way that makes the browser allow us to use its parser again.
    if (!_policy)
        _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
    return _policy.createHTML(html);
}
function readHTML(html) {
    let metas = /^(\s*<meta [^>]*>)*/.exec(html);
    if (metas)
        html = html.slice(metas[0].length);
    let elt = detachedDoc().createElement("div");
    let firstTag = /<([a-z][^>\s]+)/i.exec(html), wrap;
    if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()])
        html = wrap.map(n => "<" + n + ">").join("") + html + wrap.map(n => "</" + n + ">").reverse().join("");
    elt.innerHTML = maybeWrapTrusted(html);
    if (wrap)
        for (let i = 0; i < wrap.length; i++)
            elt = elt.querySelector(wrap[i]) || elt;
    return elt;
}
// Webkit browsers do some hard-to-predict replacement of regular
// spaces with non-breaking spaces when putting content on the
// clipboard. This tries to convert such non-breaking spaces (which
// will be wrapped in a plain span on Chrome, a span with class
// Apple-converted-space on Safari) back to regular spaces.
function restoreReplacedSpaces(dom) {
    let nodes = dom.querySelectorAll(chrome ? "span:not([class]):not([style])" : "span.Apple-converted-space");
    for (let i = 0; i < nodes.length; i++) {
        let node = nodes[i];
        if (node.childNodes.length == 1 && node.textContent == "\u00a0" && node.parentNode)
            node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node);
    }
}
function addContext(slice, context) {
    if (!slice.size)
        return slice;
    let schema = slice.content.firstChild.type.schema, array;
    try {
        array = JSON.parse(context);
    }
    catch (e) {
        return slice;
    }
    let { content, openStart, openEnd } = slice;
    for (let i = array.length - 2; i >= 0; i -= 2) {
        let type = schema.nodes[array[i]];
        if (!type || type.hasRequiredAttrs())
            break;
        content = prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(type.create(array[i + 1], content));
        openStart++;
        openEnd++;
    }
    return new prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice(content, openStart, openEnd);
}

// A collection of DOM events that occur within the editor, and callback functions
// to invoke when the event fires.
const handlers = {};
const editHandlers = {};
const passiveHandlers = { touchstart: true, touchmove: true };
class InputState {
    constructor() {
        this.shiftKey = false;
        this.mouseDown = null;
        this.lastKeyCode = null;
        this.lastKeyCodeTime = 0;
        this.lastClick = { time: 0, x: 0, y: 0, type: "", button: 0 };
        this.lastSelectionOrigin = null;
        this.lastSelectionTime = 0;
        this.lastIOSEnter = 0;
        this.lastIOSEnterFallbackTimeout = -1;
        this.lastFocus = 0;
        this.lastTouch = 0;
        this.lastChromeDelete = 0;
        this.composing = false;
        this.compositionNode = null;
        this.composingTimeout = -1;
        this.compositionNodes = [];
        this.compositionEndedAt = -2e8;
        this.compositionID = 1;
        this.badSafariComposition = false;
        // Set to a composition ID when there are pending changes at compositionend
        this.compositionPendingChanges = 0;
        this.domChangeCount = 0;
        this.eventHandlers = Object.create(null);
        this.hideSelectionGuard = null;
    }
}
function initInput(view) {
    for (let event in handlers) {
        let handler = handlers[event];
        view.dom.addEventListener(event, view.input.eventHandlers[event] = (event) => {
            if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&
                (view.editable || !(event.type in editHandlers)))
                handler(view, event);
        }, passiveHandlers[event] ? { passive: true } : undefined);
    }
    // On Safari, for reasons beyond my understanding, adding an input
    // event handler makes an issue where the composition vanishes when
    // you press enter go away.
    if (safari)
        view.dom.addEventListener("input", () => null);
    ensureListeners(view);
}
function setSelectionOrigin(view, origin) {
    view.input.lastSelectionOrigin = origin;
    view.input.lastSelectionTime = Date.now();
}
function destroyInput(view) {
    view.domObserver.stop();
    for (let type in view.input.eventHandlers)
        view.dom.removeEventListener(type, view.input.eventHandlers[type]);
    clearTimeout(view.input.composingTimeout);
    clearTimeout(view.input.lastIOSEnterFallbackTimeout);
}
function ensureListeners(view) {
    view.someProp("handleDOMEvents", currentHandlers => {
        for (let type in currentHandlers)
            if (!view.input.eventHandlers[type])
                view.dom.addEventListener(type, view.input.eventHandlers[type] = event => runCustomHandler(view, event));
    });
}
function runCustomHandler(view, event) {
    return view.someProp("handleDOMEvents", handlers => {
        let handler = handlers[event.type];
        return handler ? handler(view, event) || event.defaultPrevented : false;
    });
}
function eventBelongsToView(view, event) {
    if (!event.bubbles)
        return true;
    if (event.defaultPrevented)
        return false;
    for (let node = event.target; node != view.dom; node = node.parentNode)
        if (!node || node.nodeType == 11 ||
            (node.pmViewDesc && node.pmViewDesc.stopEvent(event)))
            return false;
    return true;
}
function dispatchEvent(view, event) {
    if (!runCustomHandler(view, event) && handlers[event.type] &&
        (view.editable || !(event.type in editHandlers)))
        handlers[event.type](view, event);
}
editHandlers.keydown = (view, _event) => {
    let event = _event;
    view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
    if (inOrNearComposition(view, event))
        return;
    view.input.lastKeyCode = event.keyCode;
    view.input.lastKeyCodeTime = Date.now();
    // Suppress enter key events on Chrome Android, because those tend
    // to be part of a confused sequence of composition events fired,
    // and handling them eagerly tends to corrupt the input.
    if (android && chrome && event.keyCode == 13)
        return;
    if (event.keyCode != 229)
        view.domObserver.forceFlush();
    // On iOS, if we preventDefault enter key presses, the virtual
    // keyboard gets confused. So the hack here is to set a flag that
    // makes the DOM change code recognize that what just happens should
    // be replaced by whatever the Enter key handlers do.
    if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {
        let now = Date.now();
        view.input.lastIOSEnter = now;
        view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
            if (view.input.lastIOSEnter == now) {
                view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")));
                view.input.lastIOSEnter = 0;
            }
        }, 200);
    }
    else if (view.someProp("handleKeyDown", f => f(view, event)) || captureKeyDown(view, event)) {
        event.preventDefault();
    }
    else {
        setSelectionOrigin(view, "key");
    }
};
editHandlers.keyup = (view, event) => {
    if (event.keyCode == 16)
        view.input.shiftKey = false;
};
editHandlers.keypress = (view, _event) => {
    let event = _event;
    if (inOrNearComposition(view, event) || !event.charCode ||
        event.ctrlKey && !event.altKey || mac && event.metaKey)
        return;
    if (view.someProp("handleKeyPress", f => f(view, event))) {
        event.preventDefault();
        return;
    }
    let sel = view.state.selection;
    if (!(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection) || !sel.$from.sameParent(sel.$to)) {
        let text = String.fromCharCode(event.charCode);
        let deflt = () => view.state.tr.insertText(text).scrollIntoView();
        if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", f => f(view, sel.$from.pos, sel.$to.pos, text, deflt)))
            view.dispatch(deflt());
        event.preventDefault();
    }
};
function eventCoords(event) { return { left: event.clientX, top: event.clientY }; }
function isNear(event, click) {
    let dx = click.x - event.clientX, dy = click.y - event.clientY;
    return dx * dx + dy * dy < 100;
}
function runHandlerOnContext(view, propName, pos, inside, event) {
    if (inside == -1)
        return false;
    let $pos = view.state.doc.resolve(inside);
    for (let i = $pos.depth + 1; i > 0; i--) {
        if (view.someProp(propName, f => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true)
            : f(view, pos, $pos.node(i), $pos.before(i), event, false)))
            return true;
    }
    return false;
}
function updateSelection(view, selection, origin) {
    if (!view.focused)
        view.focus();
    if (view.state.selection.eq(selection))
        return;
    let tr = view.state.tr.setSelection(selection);
    if (origin == "pointer")
        tr.setMeta("pointer", true);
    view.dispatch(tr);
}
function selectClickedLeaf(view, inside) {
    if (inside == -1)
        return false;
    let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
    if (node && node.isAtom && prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(node)) {
        updateSelection(view, new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection($pos), "pointer");
        return true;
    }
    return false;
}
function selectClickedNode(view, inside) {
    if (inside == -1)
        return false;
    let sel = view.state.selection, selectedNode, selectAt;
    if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection)
        selectedNode = sel.node;
    let $pos = view.state.doc.resolve(inside);
    for (let i = $pos.depth + 1; i > 0; i--) {
        let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
        if (prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(node)) {
            if (selectedNode && sel.$from.depth > 0 &&
                i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos)
                selectAt = $pos.before(sel.$from.depth);
            else
                selectAt = $pos.before(i);
            break;
        }
    }
    if (selectAt != null) {
        updateSelection(view, prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.create(view.state.doc, selectAt), "pointer");
        return true;
    }
    else {
        return false;
    }
}
function handleSingleClick(view, pos, inside, event, selectNode) {
    return runHandlerOnContext(view, "handleClickOn", pos, inside, event) ||
        view.someProp("handleClick", f => f(view, pos, event)) ||
        (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));
}
function handleDoubleClick(view, pos, inside, event) {
    return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) ||
        view.someProp("handleDoubleClick", f => f(view, pos, event));
}
function handleTripleClick(view, pos, inside, event) {
    return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) ||
        view.someProp("handleTripleClick", f => f(view, pos, event)) ||
        defaultTripleClick(view, inside, event);
}
function defaultTripleClick(view, inside, event) {
    if (event.button != 0)
        return false;
    let doc = view.state.doc;
    if (inside == -1) {
        if (doc.inlineContent) {
            updateSelection(view, prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection.create(doc, 0, doc.content.size), "pointer");
            return true;
        }
        return false;
    }
    let $pos = doc.resolve(inside);
    for (let i = $pos.depth + 1; i > 0; i--) {
        let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
        let nodePos = $pos.before(i);
        if (node.inlineContent)
            updateSelection(view, prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
        else if (prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(node))
            updateSelection(view, prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.create(doc, nodePos), "pointer");
        else
            continue;
        return true;
    }
}
function forceDOMFlush(view) {
    return endComposition(view);
}
const selectNodeModifier = mac ? "metaKey" : "ctrlKey";
handlers.mousedown = (view, _event) => {
    let event = _event;
    view.input.shiftKey = event.shiftKey;
    let flushed = forceDOMFlush(view);
    let now = Date.now(), type = "singleClick";
    if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier] &&
        view.input.lastClick.button == event.button) {
        if (view.input.lastClick.type == "singleClick")
            type = "doubleClick";
        else if (view.input.lastClick.type == "doubleClick")
            type = "tripleClick";
    }
    view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type, button: event.button };
    let pos = view.posAtCoords(eventCoords(event));
    if (!pos)
        return;
    if (type == "singleClick") {
        if (view.input.mouseDown)
            view.input.mouseDown.done();
        view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
    }
    else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {
        event.preventDefault();
    }
    else {
        setSelectionOrigin(view, "pointer");
    }
};
class MouseDown {
    constructor(view, pos, event, flushed) {
        this.view = view;
        this.pos = pos;
        this.event = event;
        this.flushed = flushed;
        this.delayedSelectionSync = false;
        this.mightDrag = null;
        this.startDoc = view.state.doc;
        this.selectNode = !!event[selectNodeModifier];
        this.allowDefault = event.shiftKey;
        let targetNode, targetPos;
        if (pos.inside > -1) {
            targetNode = view.state.doc.nodeAt(pos.inside);
            targetPos = pos.inside;
        }
        else {
            let $pos = view.state.doc.resolve(pos.pos);
            targetNode = $pos.parent;
            targetPos = $pos.depth ? $pos.before() : 0;
        }
        const target = flushed ? null : event.target;
        const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
        this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
        let { selection } = view.state;
        if (event.button == 0 &&
            targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
            selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection && selection.from <= targetPos && selection.to > targetPos)
            this.mightDrag = {
                node: targetNode,
                pos: targetPos,
                addAttr: !!(this.target && !this.target.draggable),
                setUneditable: !!(this.target && gecko && !this.target.hasAttribute("contentEditable"))
            };
        if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {
            this.view.domObserver.stop();
            if (this.mightDrag.addAttr)
                this.target.draggable = true;
            if (this.mightDrag.setUneditable)
                setTimeout(() => {
                    if (this.view.input.mouseDown == this)
                        this.target.setAttribute("contentEditable", "false");
                }, 20);
            this.view.domObserver.start();
        }
        view.root.addEventListener("mouseup", this.up = this.up.bind(this));
        view.root.addEventListener("mousemove", this.move = this.move.bind(this));
        setSelectionOrigin(view, "pointer");
    }
    done() {
        this.view.root.removeEventListener("mouseup", this.up);
        this.view.root.removeEventListener("mousemove", this.move);
        if (this.mightDrag && this.target) {
            this.view.domObserver.stop();
            if (this.mightDrag.addAttr)
                this.target.removeAttribute("draggable");
            if (this.mightDrag.setUneditable)
                this.target.removeAttribute("contentEditable");
            this.view.domObserver.start();
        }
        if (this.delayedSelectionSync)
            setTimeout(() => selectionToDOM(this.view));
        this.view.input.mouseDown = null;
    }
    up(event) {
        this.done();
        if (!this.view.dom.contains(event.target))
            return;
        let pos = this.pos;
        if (this.view.state.doc != this.startDoc)
            pos = this.view.posAtCoords(eventCoords(event));
        this.updateAllowDefault(event);
        if (this.allowDefault || !pos) {
            setSelectionOrigin(this.view, "pointer");
        }
        else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {
            event.preventDefault();
        }
        else if (event.button == 0 &&
            (this.flushed ||
                // Safari ignores clicks on draggable elements
                (safari && this.mightDrag && !this.mightDrag.node.isAtom) ||
                // Chrome will sometimes treat a node selection as a
                // cursor, but still report that the node is selected
                // when asked through getSelection. You'll then get a
                // situation where clicking at the point where that
                // (hidden) cursor is doesn't change the selection, and
                // thus doesn't get a reaction from ProseMirror. This
                // works around that.
                (chrome && !this.view.state.selection.visible &&
                    Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {
            updateSelection(this.view, prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection.near(this.view.state.doc.resolve(pos.pos)), "pointer");
            event.preventDefault();
        }
        else {
            setSelectionOrigin(this.view, "pointer");
        }
    }
    move(event) {
        this.updateAllowDefault(event);
        setSelectionOrigin(this.view, "pointer");
        if (event.buttons == 0)
            this.done();
    }
    updateAllowDefault(event) {
        if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||
            Math.abs(this.event.y - event.clientY) > 4))
            this.allowDefault = true;
    }
}
handlers.touchstart = view => {
    view.input.lastTouch = Date.now();
    forceDOMFlush(view);
    setSelectionOrigin(view, "pointer");
};
handlers.touchmove = view => {
    view.input.lastTouch = Date.now();
    setSelectionOrigin(view, "pointer");
};
handlers.contextmenu = view => forceDOMFlush(view);
function inOrNearComposition(view, event) {
    if (view.composing)
        return true;
    // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.
    // On Japanese input method editors (IMEs), the Enter key is used to confirm character
    // selection. On Safari, when Enter is pressed, compositionend and keydown events are
    // emitted. The keydown event triggers newline insertion, which we don't want.
    // This method returns true if the keydown event should be ignored.
    // We only ignore it once, as pressing Enter a second time *should* insert a newline.
    // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.
    // This guards against the case where compositionend is triggered without the keyboard
    // (e.g. character confirmation may be done with the mouse), and keydown is triggered
    // afterwards- we wouldn't want to ignore the keydown event in this case.
    if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {
        view.input.compositionEndedAt = -2e8;
        return true;
    }
    return false;
}
// Drop active composition after 5 seconds of inactivity on Android
const timeoutComposition = android ? 5000 : -1;
editHandlers.compositionstart = editHandlers.compositionupdate = view => {
    if (!view.composing) {
        view.domObserver.flush();
        let { state } = view, $pos = state.selection.$to;
        if (state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection &&
            (state.storedMarks ||
                (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||
                chrome && windows && selectionBeforeUneditable(view))) { // Issue #1500
            // Need to wrap the cursor in mark nodes different from the ones in the DOM context
            view.markCursor = view.state.storedMarks || $pos.marks();
            endComposition(view, true);
            view.markCursor = null;
        }
        else {
            endComposition(view, !state.selection.empty);
            // In firefox, if the cursor is after but outside a marked node,
            // the inserted text won't inherit the marks. So this moves it
            // inside if necessary.
            if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
                let sel = view.domSelectionRange();
                for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
                    let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
                    if (!before)
                        break;
                    if (before.nodeType == 3) {
                        let sel = view.domSelection();
                        if (sel)
                            sel.collapse(before, before.nodeValue.length);
                        break;
                    }
                    else {
                        node = before;
                        offset = -1;
                    }
                }
            }
        }
        view.input.composing = true;
    }
    scheduleComposeEnd(view, timeoutComposition);
};
function selectionBeforeUneditable(view) {
    let { focusNode, focusOffset } = view.domSelectionRange();
    if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length)
        return false;
    let next = focusNode.childNodes[focusOffset];
    return next.nodeType == 1 && next.contentEditable == "false";
}
editHandlers.compositionend = (view, event) => {
    if (view.composing) {
        view.input.composing = false;
        view.input.compositionEndedAt = event.timeStamp;
        view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
        view.input.compositionNode = null;
        if (view.input.badSafariComposition)
            view.domObserver.forceFlush();
        else if (view.input.compositionPendingChanges)
            Promise.resolve().then(() => view.domObserver.flush());
        view.input.compositionID++;
        scheduleComposeEnd(view, 20);
    }
};
function scheduleComposeEnd(view, delay) {
    clearTimeout(view.input.composingTimeout);
    if (delay > -1)
        view.input.composingTimeout = setTimeout(() => endComposition(view), delay);
}
function clearComposition(view) {
    if (view.composing) {
        view.input.composing = false;
        view.input.compositionEndedAt = timestampFromCustomEvent();
    }
    while (view.input.compositionNodes.length > 0)
        view.input.compositionNodes.pop().markParentsDirty();
}
function findCompositionNode(view) {
    let sel = view.domSelectionRange();
    if (!sel.focusNode)
        return null;
    let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
    let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
    if (textBefore && textAfter && textBefore != textAfter) {
        let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;
        if (textBefore == lastChanged || textAfter == lastChanged)
            return lastChanged;
        if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {
            return textAfter;
        }
        else if (view.input.compositionNode == textAfter) {
            let descBefore = textBefore.pmViewDesc;
            if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))
                return textAfter;
        }
    }
    return textBefore || textAfter;
}
function timestampFromCustomEvent() {
    let event = document.createEvent("Event");
    event.initEvent("event", true, true);
    return event.timeStamp;
}
/**
@internal
*/
function endComposition(view, restarting = false) {
    if (android && view.domObserver.flushingSoon >= 0)
        return;
    view.domObserver.forceFlush();
    clearComposition(view);
    if (restarting || view.docView && view.docView.dirty) {
        let sel = selectionFromDOM(view), cur = view.state.selection;
        if (sel && !sel.eq(cur))
            view.dispatch(view.state.tr.setSelection(sel));
        else if ((view.markCursor || restarting) && !cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent)
            view.dispatch(view.state.tr.deleteSelection());
        else
            view.updateState(view.state);
        return true;
    }
    return false;
}
function captureCopy(view, dom) {
    // The extra wrapper is somehow necessary on IE/Edge to prevent the
    // content from being mangled when it is put onto the clipboard
    if (!view.dom.parentNode)
        return;
    let wrap = view.dom.parentNode.appendChild(document.createElement("div"));
    wrap.appendChild(dom);
    wrap.style.cssText = "position: fixed; left: -10000px; top: 10px";
    let sel = getSelection(), range = document.createRange();
    range.selectNodeContents(dom);
    // Done because IE will fire a selectionchange moving the selection
    // to its start when removeAllRanges is called and the editor still
    // has focus (which will mess up the editor's selection state).
    view.dom.blur();
    sel.removeAllRanges();
    sel.addRange(range);
    setTimeout(() => {
        if (wrap.parentNode)
            wrap.parentNode.removeChild(wrap);
        view.focus();
    }, 50);
}
// This is very crude, but unfortunately both these browsers _pretend_
// that they have a clipboard API—all the objects and methods are
// there, they just don't work, and they are hard to test.
const brokenClipboardAPI = (ie && ie_version < 15) ||
    (ios && webkit_version < 604);
handlers.copy = editHandlers.cut = (view, _event) => {
    let event = _event;
    let sel = view.state.selection, cut = event.type == "cut";
    if (sel.empty)
        return;
    // IE and Edge's clipboard interface is completely broken
    let data = brokenClipboardAPI ? null : event.clipboardData;
    let slice = sel.content(), { dom, text } = serializeForClipboard(view, slice);
    if (data) {
        event.preventDefault();
        data.clearData();
        data.setData("text/html", dom.innerHTML);
        data.setData("text/plain", text);
    }
    else {
        captureCopy(view, dom);
    }
    if (cut)
        view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
};
function sliceSingleNode(slice) {
    return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;
}
function capturePaste(view, event) {
    if (!view.dom.parentNode)
        return;
    let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;
    let target = view.dom.parentNode.appendChild(document.createElement(plainText ? "textarea" : "div"));
    if (!plainText)
        target.contentEditable = "true";
    target.style.cssText = "position: fixed; left: -10000px; top: 10px";
    target.focus();
    let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
    setTimeout(() => {
        view.focus();
        if (target.parentNode)
            target.parentNode.removeChild(target);
        if (plainText)
            doPaste(view, target.value, null, plain, event);
        else
            doPaste(view, target.textContent, target.innerHTML, plain, event);
    }, 50);
}
function doPaste(view, text, html, preferPlain, event) {
    let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
    if (view.someProp("handlePaste", f => f(view, event, slice || prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.empty)))
        return true;
    if (!slice)
        return false;
    let singleNode = sliceSingleNode(slice);
    let tr = singleNode
        ? view.state.tr.replaceSelectionWith(singleNode, preferPlain)
        : view.state.tr.replaceSelection(slice);
    view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
    return true;
}
function getText(clipboardData) {
    let text = clipboardData.getData("text/plain") || clipboardData.getData("Text");
    if (text)
        return text;
    let uris = clipboardData.getData("text/uri-list");
    return uris ? uris.replace(/\r?\n/g, " ") : "";
}
editHandlers.paste = (view, _event) => {
    let event = _event;
    // Handling paste from JavaScript during composition is very poorly
    // handled by browsers, so as a dodgy but preferable kludge, we just
    // let the browser do its native thing there, except on Android,
    // where the editor is almost always composing.
    if (view.composing && !android)
        return;
    let data = brokenClipboardAPI ? null : event.clipboardData;
    let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
    if (data && doPaste(view, getText(data), data.getData("text/html"), plain, event))
        event.preventDefault();
    else
        capturePaste(view, event);
};
class Dragging {
    constructor(slice, move, node) {
        this.slice = slice;
        this.move = move;
        this.node = node;
    }
}
const dragCopyModifier = mac ? "altKey" : "ctrlKey";
function dragMoves(view, event) {
    let moves = view.someProp("dragCopies", test => !test(event));
    return moves != null ? moves : !event[dragCopyModifier];
}
handlers.dragstart = (view, _event) => {
    let event = _event;
    let mouseDown = view.input.mouseDown;
    if (mouseDown)
        mouseDown.done();
    if (!event.dataTransfer)
        return;
    let sel = view.state.selection;
    let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));
    let node;
    if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection ? sel.to - 1 : sel.to)) ;
    else if (mouseDown && mouseDown.mightDrag) {
        node = prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);
    }
    else if (event.target && event.target.nodeType == 1) {
        let desc = view.docView.nearestDesc(event.target, true);
        if (desc && desc.node.type.spec.draggable && desc != view.docView)
            node = prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.create(view.state.doc, desc.posBefore);
    }
    let draggedSlice = (node || view.state.selection).content();
    let { dom, text, slice } = serializeForClipboard(view, draggedSlice);
    // Pre-120 Chrome versions clear files when calling `clearData` (#1472)
    if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)
        event.dataTransfer.clearData();
    event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
    // See https://github.com/ProseMirror/prosemirror/issues/1156
    event.dataTransfer.effectAllowed = "copyMove";
    if (!brokenClipboardAPI)
        event.dataTransfer.setData("text/plain", text);
    view.dragging = new Dragging(slice, dragMoves(view, event), node);
};
handlers.dragend = view => {
    let dragging = view.dragging;
    window.setTimeout(() => {
        if (view.dragging == dragging)
            view.dragging = null;
    }, 50);
};
editHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();
editHandlers.drop = (view, event) => {
    try {
        handleDrop(view, event, view.dragging);
    }
    finally {
        view.dragging = null;
    }
};
function handleDrop(view, event, dragging) {
    if (!event.dataTransfer)
        return;
    let eventPos = view.posAtCoords(eventCoords(event));
    if (!eventPos)
        return;
    let $mouse = view.state.doc.resolve(eventPos.pos);
    let slice = dragging && dragging.slice;
    if (slice) {
        view.someProp("transformPasted", f => { slice = f(slice, view, false); });
    }
    else {
        slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
    }
    let move = !!(dragging && dragMoves(view, event));
    if (view.someProp("handleDrop", f => f(view, event, slice || prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Slice.empty, move))) {
        event.preventDefault();
        return;
    }
    if (!slice)
        return;
    event.preventDefault();
    let insertPos = slice ? (0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_2__.dropPoint)(view.state.doc, $mouse.pos, slice) : $mouse.pos;
    if (insertPos == null)
        insertPos = $mouse.pos;
    let tr = view.state.tr;
    if (move) {
        let { node } = dragging;
        if (node)
            node.replace(tr);
        else
            tr.deleteSelection();
    }
    let pos = tr.mapping.map(insertPos);
    let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;
    let beforeInsert = tr.doc;
    if (isNode)
        tr.replaceRangeWith(pos, pos, slice.content.firstChild);
    else
        tr.replaceRange(pos, pos, slice);
    if (tr.doc.eq(beforeInsert))
        return;
    let $pos = tr.doc.resolve(pos);
    if (isNode && prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.isSelectable(slice.content.firstChild) &&
        $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {
        tr.setSelection(new prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection($pos));
    }
    else {
        let end = tr.mapping.map(insertPos);
        tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);
        tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));
    }
    view.focus();
    view.dispatch(tr.setMeta("uiEvent", "drop"));
}
handlers.focus = view => {
    view.input.lastFocus = Date.now();
    if (!view.focused) {
        view.domObserver.stop();
        view.dom.classList.add("ProseMirror-focused");
        view.domObserver.start();
        view.focused = true;
        setTimeout(() => {
            if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange()))
                selectionToDOM(view);
        }, 20);
    }
};
handlers.blur = (view, _event) => {
    let event = _event;
    if (view.focused) {
        view.domObserver.stop();
        view.dom.classList.remove("ProseMirror-focused");
        view.domObserver.start();
        if (event.relatedTarget && view.dom.contains(event.relatedTarget))
            view.domObserver.currentSelection.clear();
        view.focused = false;
    }
};
handlers.beforeinput = (view, _event) => {
    let event = _event;
    // We should probably do more with beforeinput events, but support
    // is so spotty that I'm still waiting to see where they are going.
    // Very specific hack to deal with backspace sometimes failing on
    // Chrome Android when after an uneditable node.
    if (chrome && android && event.inputType == "deleteContentBackward") {
        view.domObserver.flushSoon();
        let { domChangeCount } = view.input;
        setTimeout(() => {
            if (view.input.domChangeCount != domChangeCount)
                return; // Event already had some effect
            // This bug tends to close the virtual keyboard, so we refocus
            view.dom.blur();
            view.focus();
            if (view.someProp("handleKeyDown", f => f(view, keyEvent(8, "Backspace"))))
                return;
            let { $cursor } = view.state.selection;
            // Crude approximation of backspace behavior when no command handled it
            if ($cursor && $cursor.pos > 0)
                view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());
        }, 50);
    }
};
// Make sure all handlers get registered
for (let prop in editHandlers)
    handlers[prop] = editHandlers[prop];

function compareObjs(a, b) {
    if (a == b)
        return true;
    for (let p in a)
        if (a[p] !== b[p])
            return false;
    for (let p in b)
        if (!(p in a))
            return false;
    return true;
}
class WidgetType {
    constructor(toDOM, spec) {
        this.toDOM = toDOM;
        this.spec = spec || noSpec;
        this.side = this.spec.side || 0;
    }
    map(mapping, span, offset, oldOffset) {
        let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);
        return deleted ? null : new Decoration(pos - offset, pos - offset, this);
    }
    valid() { return true; }
    eq(other) {
        return this == other ||
            (other instanceof WidgetType &&
                (this.spec.key && this.spec.key == other.spec.key ||
                    this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)));
    }
    destroy(node) {
        if (this.spec.destroy)
            this.spec.destroy(node);
    }
}
class InlineType {
    constructor(attrs, spec) {
        this.attrs = attrs;
        this.spec = spec || noSpec;
    }
    map(mapping, span, offset, oldOffset) {
        let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
        let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;
        return from >= to ? null : new Decoration(from, to, this);
    }
    valid(_, span) { return span.from < span.to; }
    eq(other) {
        return this == other ||
            (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&
                compareObjs(this.spec, other.spec));
    }
    static is(span) { return span.type instanceof InlineType; }
    destroy() { }
}
class NodeType {
    constructor(attrs, spec) {
        this.attrs = attrs;
        this.spec = spec || noSpec;
    }
    map(mapping, span, offset, oldOffset) {
        let from = mapping.mapResult(span.from + oldOffset, 1);
        if (from.deleted)
            return null;
        let to = mapping.mapResult(span.to + oldOffset, -1);
        if (to.deleted || to.pos <= from.pos)
            return null;
        return new Decoration(from.pos - offset, to.pos - offset, this);
    }
    valid(node, span) {
        let { index, offset } = node.content.findIndex(span.from), child;
        return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;
    }
    eq(other) {
        return this == other ||
            (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&
                compareObjs(this.spec, other.spec));
    }
    destroy() { }
}
/**
Decoration objects can be provided to the view through the
[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in
several variants—see the static members of this class for details.
*/
class Decoration {
    /**
    @internal
    */
    constructor(
    /**
    The start position of the decoration.
    */
    from, 
    /**
    The end position. Will be the same as `from` for [widget
    decorations](https://prosemirror.net/docs/ref/#view.Decoration^widget).
    */
    to, 
    /**
    @internal
    */
    type) {
        this.from = from;
        this.to = to;
        this.type = type;
    }
    /**
    @internal
    */
    copy(from, to) {
        return new Decoration(from, to, this.type);
    }
    /**
    @internal
    */
    eq(other, offset = 0) {
        return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;
    }
    /**
    @internal
    */
    map(mapping, offset, oldOffset) {
        return this.type.map(mapping, this, offset, oldOffset);
    }
    /**
    Creates a widget decoration, which is a DOM node that's shown in
    the document at the given position. It is recommended that you
    delay rendering the widget by passing a function that will be
    called when the widget is actually drawn in a view, but you can
    also directly pass a DOM node. `getPos` can be used to find the
    widget's current document position.
    */
    static widget(pos, toDOM, spec) {
        return new Decoration(pos, pos, new WidgetType(toDOM, spec));
    }
    /**
    Creates an inline decoration, which adds the given attributes to
    each inline node between `from` and `to`.
    */
    static inline(from, to, attrs, spec) {
        return new Decoration(from, to, new InlineType(attrs, spec));
    }
    /**
    Creates a node decoration. `from` and `to` should point precisely
    before and after a node in the document. That node, and only that
    node, will receive the given attributes.
    */
    static node(from, to, attrs, spec) {
        return new Decoration(from, to, new NodeType(attrs, spec));
    }
    /**
    The spec provided when creating this decoration. Can be useful
    if you've stored extra information in that object.
    */
    get spec() { return this.type.spec; }
    /**
    @internal
    */
    get inline() { return this.type instanceof InlineType; }
    /**
    @internal
    */
    get widget() { return this.type instanceof WidgetType; }
}
const none = [], noSpec = {};
/**
A collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such
a way that the drawing algorithm can efficiently use and compare
them. This is a persistent data structure—it is not modified,
updates create a new value.
*/
class DecorationSet {
    /**
    @internal
    */
    constructor(local, children) {
        this.local = local.length ? local : none;
        this.children = children.length ? children : none;
    }
    /**
    Create a set of decorations, using the structure of the given
    document. This will consume (modify) the `decorations` array, so
    you must make a copy if you want need to preserve that.
    */
    static create(doc, decorations) {
        return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;
    }
    /**
    Find all decorations in this set which touch the given range
    (including decorations that start or end directly at the
    boundaries) and match the given predicate on their spec. When
    `start` and `end` are omitted, all decorations in the set are
    considered. When `predicate` isn't given, all decorations are
    assumed to match.
    */
    find(start, end, predicate) {
        let result = [];
        this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);
        return result;
    }
    findInner(start, end, result, offset, predicate) {
        for (let i = 0; i < this.local.length; i++) {
            let span = this.local[i];
            if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))
                result.push(span.copy(span.from + offset, span.to + offset));
        }
        for (let i = 0; i < this.children.length; i += 3) {
            if (this.children[i] < end && this.children[i + 1] > start) {
                let childOff = this.children[i] + 1;
                this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);
            }
        }
    }
    /**
    Map the set of decorations in response to a change in the
    document.
    */
    map(mapping, doc, options) {
        if (this == empty || mapping.maps.length == 0)
            return this;
        return this.mapInner(mapping, doc, 0, 0, options || noSpec);
    }
    /**
    @internal
    */
    mapInner(mapping, node, offset, oldOffset, options) {
        let newLocal;
        for (let i = 0; i < this.local.length; i++) {
            let mapped = this.local[i].map(mapping, offset, oldOffset);
            if (mapped && mapped.type.valid(node, mapped))
                (newLocal || (newLocal = [])).push(mapped);
            else if (options.onRemove)
                options.onRemove(this.local[i].spec);
        }
        if (this.children.length)
            return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);
        else
            return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;
    }
    /**
    Add the given array of decorations to the ones in the set,
    producing a new set. Consumes the `decorations` array. Needs
    access to the current document to create the appropriate tree
    structure.
    */
    add(doc, decorations) {
        if (!decorations.length)
            return this;
        if (this == empty)
            return DecorationSet.create(doc, decorations);
        return this.addInner(doc, decorations, 0);
    }
    addInner(doc, decorations, offset) {
        let children, childIndex = 0;
        doc.forEach((childNode, childOffset) => {
            let baseOffset = childOffset + offset, found;
            if (!(found = takeSpansForNode(decorations, childNode, baseOffset)))
                return;
            if (!children)
                children = this.children.slice();
            while (childIndex < children.length && children[childIndex] < childOffset)
                childIndex += 3;
            if (children[childIndex] == childOffset)
                children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);
            else
                children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));
            childIndex += 3;
        });
        let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);
        for (let i = 0; i < local.length; i++)
            if (!local[i].type.valid(doc, local[i]))
                local.splice(i--, 1);
        return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);
    }
    /**
    Create a new set that contains the decorations in this set, minus
    the ones in the given array.
    */
    remove(decorations) {
        if (decorations.length == 0 || this == empty)
            return this;
        return this.removeInner(decorations, 0);
    }
    removeInner(decorations, offset) {
        let children = this.children, local = this.local;
        for (let i = 0; i < children.length; i += 3) {
            let found;
            let from = children[i] + offset, to = children[i + 1] + offset;
            for (let j = 0, span; j < decorations.length; j++)
                if (span = decorations[j]) {
                    if (span.from > from && span.to < to) {
                        decorations[j] = null;
                        (found || (found = [])).push(span);
                    }
                }
            if (!found)
                continue;
            if (children == this.children)
                children = this.children.slice();
            let removed = children[i + 2].removeInner(found, from + 1);
            if (removed != empty) {
                children[i + 2] = removed;
            }
            else {
                children.splice(i, 3);
                i -= 3;
            }
        }
        if (local.length)
            for (let i = 0, span; i < decorations.length; i++)
                if (span = decorations[i]) {
                    for (let j = 0; j < local.length; j++)
                        if (local[j].eq(span, offset)) {
                            if (local == this.local)
                                local = this.local.slice();
                            local.splice(j--, 1);
                        }
                }
        if (children == this.children && local == this.local)
            return this;
        return local.length || children.length ? new DecorationSet(local, children) : empty;
    }
    forChild(offset, node) {
        if (this == empty)
            return this;
        if (node.isLeaf)
            return DecorationSet.empty;
        let child, local;
        for (let i = 0; i < this.children.length; i += 3)
            if (this.children[i] >= offset) {
                if (this.children[i] == offset)
                    child = this.children[i + 2];
                break;
            }
        let start = offset + 1, end = start + node.content.size;
        for (let i = 0; i < this.local.length; i++) {
            let dec = this.local[i];
            if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {
                let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
                if (from < to)
                    (local || (local = [])).push(dec.copy(from, to));
            }
        }
        if (local) {
            let localSet = new DecorationSet(local.sort(byPos), none);
            return child ? new DecorationGroup([localSet, child]) : localSet;
        }
        return child || empty;
    }
    /**
    @internal
    */
    eq(other) {
        if (this == other)
            return true;
        if (!(other instanceof DecorationSet) ||
            this.local.length != other.local.length ||
            this.children.length != other.children.length)
            return false;
        for (let i = 0; i < this.local.length; i++)
            if (!this.local[i].eq(other.local[i]))
                return false;
        for (let i = 0; i < this.children.length; i += 3)
            if (this.children[i] != other.children[i] ||
                this.children[i + 1] != other.children[i + 1] ||
                !this.children[i + 2].eq(other.children[i + 2]))
                return false;
        return true;
    }
    /**
    @internal
    */
    locals(node) {
        return removeOverlap(this.localsInner(node));
    }
    /**
    @internal
    */
    localsInner(node) {
        if (this == empty)
            return none;
        if (node.inlineContent || !this.local.some(InlineType.is))
            return this.local;
        let result = [];
        for (let i = 0; i < this.local.length; i++) {
            if (!(this.local[i].type instanceof InlineType))
                result.push(this.local[i]);
        }
        return result;
    }
    forEachSet(f) { f(this); }
}
/**
The empty set of decorations.
*/
DecorationSet.empty = new DecorationSet([], []);
/**
@internal
*/
DecorationSet.removeOverlap = removeOverlap;
const empty = DecorationSet.empty;
// An abstraction that allows the code dealing with decorations to
// treat multiple DecorationSet objects as if it were a single object
// with (a subset of) the same interface.
class DecorationGroup {
    constructor(members) {
        this.members = members;
    }
    map(mapping, doc) {
        const mappedDecos = this.members.map(member => member.map(mapping, doc, noSpec));
        return DecorationGroup.from(mappedDecos);
    }
    forChild(offset, child) {
        if (child.isLeaf)
            return DecorationSet.empty;
        let found = [];
        for (let i = 0; i < this.members.length; i++) {
            let result = this.members[i].forChild(offset, child);
            if (result == empty)
                continue;
            if (result instanceof DecorationGroup)
                found = found.concat(result.members);
            else
                found.push(result);
        }
        return DecorationGroup.from(found);
    }
    eq(other) {
        if (!(other instanceof DecorationGroup) ||
            other.members.length != this.members.length)
            return false;
        for (let i = 0; i < this.members.length; i++)
            if (!this.members[i].eq(other.members[i]))
                return false;
        return true;
    }
    locals(node) {
        let result, sorted = true;
        for (let i = 0; i < this.members.length; i++) {
            let locals = this.members[i].localsInner(node);
            if (!locals.length)
                continue;
            if (!result) {
                result = locals;
            }
            else {
                if (sorted) {
                    result = result.slice();
                    sorted = false;
                }
                for (let j = 0; j < locals.length; j++)
                    result.push(locals[j]);
            }
        }
        return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;
    }
    // Create a group for the given array of decoration sets, or return
    // a single set when possible.
    static from(members) {
        switch (members.length) {
            case 0: return empty;
            case 1: return members[0];
            default: return new DecorationGroup(members.every(m => m instanceof DecorationSet) ? members :
                members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));
        }
    }
    forEachSet(f) {
        for (let i = 0; i < this.members.length; i++)
            this.members[i].forEachSet(f);
    }
}
function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {
    let children = oldChildren.slice();
    // Mark the children that are directly touched by changes, and
    // move those that are after the changes.
    for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {
        let moved = 0;
        mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {
            let dSize = (newEnd - newStart) - (oldEnd - oldStart);
            for (let i = 0; i < children.length; i += 3) {
                let end = children[i + 1];
                if (end < 0 || oldStart > end + baseOffset - moved)
                    continue;
                let start = children[i] + baseOffset - moved;
                if (oldEnd >= start) {
                    children[i + 1] = oldStart <= start ? -2 : -1;
                }
                else if (oldStart >= baseOffset && dSize) {
                    children[i] += dSize;
                    children[i + 1] += dSize;
                }
            }
            moved += dSize;
        });
        baseOffset = mapping.maps[i].map(baseOffset, -1);
    }
    // Find the child nodes that still correspond to a single node,
    // recursively call mapInner on them and update their positions.
    let mustRebuild = false;
    for (let i = 0; i < children.length; i += 3)
        if (children[i + 1] < 0) { // Touched nodes
            if (children[i + 1] == -2) {
                mustRebuild = true;
                children[i + 1] = -1;
                continue;
            }
            let from = mapping.map(oldChildren[i] + oldOffset), fromLocal = from - offset;
            if (fromLocal < 0 || fromLocal >= node.content.size) {
                mustRebuild = true;
                continue;
            }
            // Must read oldChildren because children was tagged with -1
            let to = mapping.map(oldChildren[i + 1] + oldOffset, -1), toLocal = to - offset;
            let { index, offset: childOffset } = node.content.findIndex(fromLocal);
            let childNode = node.maybeChild(index);
            if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {
                let mapped = children[i + 2]
                    .mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);
                if (mapped != empty) {
                    children[i] = fromLocal;
                    children[i + 1] = toLocal;
                    children[i + 2] = mapped;
                }
                else {
                    children[i + 1] = -2;
                    mustRebuild = true;
                }
            }
            else {
                mustRebuild = true;
            }
        }
    // Remaining children must be collected and rebuilt into the appropriate structure
    if (mustRebuild) {
        let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options);
        let built = buildTree(decorations, node, 0, options);
        newLocal = built.local;
        for (let i = 0; i < children.length; i += 3)
            if (children[i + 1] < 0) {
                children.splice(i, 3);
                i -= 3;
            }
        for (let i = 0, j = 0; i < built.children.length; i += 3) {
            let from = built.children[i];
            while (j < children.length && children[j] < from)
                j += 3;
            children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);
        }
    }
    return new DecorationSet(newLocal.sort(byPos), children);
}
function moveSpans(spans, offset) {
    if (!offset || !spans.length)
        return spans;
    let result = [];
    for (let i = 0; i < spans.length; i++) {
        let span = spans[i];
        result.push(new Decoration(span.from + offset, span.to + offset, span.type));
    }
    return result;
}
function mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {
    // Gather all decorations from the remaining marked children
    function gather(set, oldOffset) {
        for (let i = 0; i < set.local.length; i++) {
            let mapped = set.local[i].map(mapping, offset, oldOffset);
            if (mapped)
                decorations.push(mapped);
            else if (options.onRemove)
                options.onRemove(set.local[i].spec);
        }
        for (let i = 0; i < set.children.length; i += 3)
            gather(set.children[i + 2], set.children[i] + oldOffset + 1);
    }
    for (let i = 0; i < children.length; i += 3)
        if (children[i + 1] == -1)
            gather(children[i + 2], oldChildren[i] + oldOffset + 1);
    return decorations;
}
function takeSpansForNode(spans, node, offset) {
    if (node.isLeaf)
        return null;
    let end = offset + node.nodeSize, found = null;
    for (let i = 0, span; i < spans.length; i++) {
        if ((span = spans[i]) && span.from > offset && span.to < end) {
            (found || (found = [])).push(span);
            spans[i] = null;
        }
    }
    return found;
}
function withoutNulls(array) {
    let result = [];
    for (let i = 0; i < array.length; i++)
        if (array[i] != null)
            result.push(array[i]);
    return result;
}
// Build up a tree that corresponds to a set of decorations. `offset`
// is a base offset that should be subtracted from the `from` and `to`
// positions in the spans (so that we don't have to allocate new spans
// for recursive calls).
function buildTree(spans, node, offset, options) {
    let children = [], hasNulls = false;
    node.forEach((childNode, localStart) => {
        let found = takeSpansForNode(spans, childNode, localStart + offset);
        if (found) {
            hasNulls = true;
            let subtree = buildTree(found, childNode, offset + localStart + 1, options);
            if (subtree != empty)
                children.push(localStart, localStart + childNode.nodeSize, subtree);
        }
    });
    let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);
    for (let i = 0; i < locals.length; i++)
        if (!locals[i].type.valid(node, locals[i])) {
            if (options.onRemove)
                options.onRemove(locals[i].spec);
            locals.splice(i--, 1);
        }
    return locals.length || children.length ? new DecorationSet(locals, children) : empty;
}
// Used to sort decorations so that ones with a low start position
// come first, and within a set with the same start position, those
// with an smaller end position come first.
function byPos(a, b) {
    return a.from - b.from || a.to - b.to;
}
// Scan a sorted array of decorations for partially overlapping spans,
// and split those so that only fully overlapping spans are left (to
// make subsequent rendering easier). Will return the input array if
// no partially overlapping spans are found (the common case).
function removeOverlap(spans) {
    let working = spans;
    for (let i = 0; i < working.length - 1; i++) {
        let span = working[i];
        if (span.from != span.to)
            for (let j = i + 1; j < working.length; j++) {
                let next = working[j];
                if (next.from == span.from) {
                    if (next.to != span.to) {
                        if (working == spans)
                            working = spans.slice();
                        // Followed by a partially overlapping larger span. Split that
                        // span.
                        working[j] = next.copy(next.from, span.to);
                        insertAhead(working, j + 1, next.copy(span.to, next.to));
                    }
                    continue;
                }
                else {
                    if (next.from < span.to) {
                        if (working == spans)
                            working = spans.slice();
                        // The end of this one overlaps with a subsequent span. Split
                        // this one.
                        working[i] = span.copy(span.from, next.from);
                        insertAhead(working, j, span.copy(next.from, span.to));
                    }
                    break;
                }
            }
    }
    return working;
}
function insertAhead(array, i, deco) {
    while (i < array.length && byPos(deco, array[i]) > 0)
        i++;
    array.splice(i, 0, deco);
}
// Get the decorations associated with the current props of a view.
function viewDecorations(view) {
    let found = [];
    view.someProp("decorations", f => {
        let result = f(view.state);
        if (result && result != empty)
            found.push(result);
    });
    if (view.cursorWrapper)
        found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));
    return DecorationGroup.from(found);
}

const observeOptions = {
    childList: true,
    characterData: true,
    characterDataOldValue: true,
    attributes: true,
    attributeOldValue: true,
    subtree: true
};
// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified
const useCharData = ie && ie_version <= 11;
class SelectionState {
    constructor() {
        this.anchorNode = null;
        this.anchorOffset = 0;
        this.focusNode = null;
        this.focusOffset = 0;
    }
    set(sel) {
        this.anchorNode = sel.anchorNode;
        this.anchorOffset = sel.anchorOffset;
        this.focusNode = sel.focusNode;
        this.focusOffset = sel.focusOffset;
    }
    clear() {
        this.anchorNode = this.focusNode = null;
    }
    eq(sel) {
        return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&
            sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;
    }
}
class DOMObserver {
    constructor(view, handleDOMChange) {
        this.view = view;
        this.handleDOMChange = handleDOMChange;
        this.queue = [];
        this.flushingSoon = -1;
        this.observer = null;
        this.currentSelection = new SelectionState;
        this.onCharData = null;
        this.suppressingSelectionUpdates = false;
        this.lastChangedTextNode = null;
        this.observer = window.MutationObserver &&
            new window.MutationObserver(mutations => {
                for (let i = 0; i < mutations.length; i++)
                    this.queue.push(mutations[i]);
                if (ie && ie_version <= 11 && mutations.some(m => m.type == "childList" && m.removedNodes.length ||
                    m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length)) {
                    // IE11 will sometimes (on backspacing out a single character
                    // text node after a BR node) call the observer callback
                    // before actually updating the DOM, which will cause
                    // ProseMirror to miss the change (see #930)
                    this.flushSoon();
                }
                else if (safari && view.composing && mutations.some(m => m.type == "childList" && m.target.nodeName == "TR")) {
                    // Safari does weird stuff when finishing a composition in a
                    // table cell, which tends to involve inserting inappropriate
                    // nodes in the table row.
                    view.input.badSafariComposition = true;
                    this.flushSoon();
                }
                else {
                    this.flush();
                }
            });
        if (useCharData) {
            this.onCharData = e => {
                this.queue.push({ target: e.target, type: "characterData", oldValue: e.prevValue });
                this.flushSoon();
            };
        }
        this.onSelectionChange = this.onSelectionChange.bind(this);
    }
    flushSoon() {
        if (this.flushingSoon < 0)
            this.flushingSoon = window.setTimeout(() => { this.flushingSoon = -1; this.flush(); }, 20);
    }
    forceFlush() {
        if (this.flushingSoon > -1) {
            window.clearTimeout(this.flushingSoon);
            this.flushingSoon = -1;
            this.flush();
        }
    }
    start() {
        if (this.observer) {
            this.observer.takeRecords();
            this.observer.observe(this.view.dom, observeOptions);
        }
        if (this.onCharData)
            this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData);
        this.connectSelection();
    }
    stop() {
        if (this.observer) {
            let take = this.observer.takeRecords();
            if (take.length) {
                for (let i = 0; i < take.length; i++)
                    this.queue.push(take[i]);
                window.setTimeout(() => this.flush(), 20);
            }
            this.observer.disconnect();
        }
        if (this.onCharData)
            this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData);
        this.disconnectSelection();
    }
    connectSelection() {
        this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
    }
    disconnectSelection() {
        this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
    }
    suppressSelectionUpdates() {
        this.suppressingSelectionUpdates = true;
        setTimeout(() => this.suppressingSelectionUpdates = false, 50);
    }
    onSelectionChange() {
        if (!hasFocusAndSelection(this.view))
            return;
        if (this.suppressingSelectionUpdates)
            return selectionToDOM(this.view);
        // Deletions on IE11 fire their events in the wrong order, giving
        // us a selection change event before the DOM changes are
        // reported.
        if (ie && ie_version <= 11 && !this.view.state.selection.empty) {
            let sel = this.view.domSelectionRange();
            // Selection.isCollapsed isn't reliable on IE
            if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))
                return this.flushSoon();
        }
        this.flush();
    }
    setCurSelection() {
        this.currentSelection.set(this.view.domSelectionRange());
    }
    ignoreSelectionChange(sel) {
        if (!sel.focusNode)
            return true;
        let ancestors = new Set, container;
        for (let scan = sel.focusNode; scan; scan = parentNode(scan))
            ancestors.add(scan);
        for (let scan = sel.anchorNode; scan; scan = parentNode(scan))
            if (ancestors.has(scan)) {
                container = scan;
                break;
            }
        let desc = container && this.view.docView.nearestDesc(container);
        if (desc && desc.ignoreMutation({
            type: "selection",
            target: container.nodeType == 3 ? container.parentNode : container
        })) {
            this.setCurSelection();
            return true;
        }
    }
    pendingRecords() {
        if (this.observer)
            for (let mut of this.observer.takeRecords())
                this.queue.push(mut);
        return this.queue;
    }
    flush() {
        let { view } = this;
        if (!view.docView || this.flushingSoon > -1)
            return;
        let mutations = this.pendingRecords();
        if (mutations.length)
            this.queue = [];
        let sel = view.domSelectionRange();
        let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
        let from = -1, to = -1, typeOver = false, added = [];
        if (view.editable) {
            for (let i = 0; i < mutations.length; i++) {
                let result = this.registerMutation(mutations[i], added);
                if (result) {
                    from = from < 0 ? result.from : Math.min(result.from, from);
                    to = to < 0 ? result.to : Math.max(result.to, to);
                    if (result.typeOver)
                        typeOver = true;
                }
            }
        }
        if (added.some(n => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
            // Browsers sometimes insert a bogus break node if you
            // backspace out the last bit of text before an inline-flex node (#1552)
            for (let node of added)
                if (node.nodeName == "BR" && node.parentNode) {
                    let after = node.nextSibling;
                    if (after && after.nodeType == 1 && after.contentEditable == "false")
                        node.parentNode.removeChild(node);
                }
        }
        else if (gecko && added.length) {
            let brs = added.filter(n => n.nodeName == "BR");
            if (brs.length == 2) {
                let [a, b] = brs;
                if (a.parentNode && a.parentNode.parentNode == b.parentNode)
                    b.remove();
                else
                    a.remove();
            }
            else {
                let { focusNode } = this.currentSelection;
                for (let br of brs) {
                    let parent = br.parentNode;
                    if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent))
                        br.remove();
                }
            }
        }
        let readSel = null;
        // If it looks like the browser has reset the selection to the
        // start of the document after focus, restore the selection from
        // the state
        if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 &&
            Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 &&
            selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) &&
            readSel.eq(prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.Selection.near(view.state.doc.resolve(0), 1))) {
            view.input.lastFocus = 0;
            selectionToDOM(view);
            this.currentSelection.set(sel);
            view.scrollToSelection();
        }
        else if (from > -1 || newSel) {
            if (from > -1) {
                view.docView.markDirty(from, to);
                checkCSS(view);
            }
            if (view.input.badSafariComposition) {
                view.input.badSafariComposition = false;
                fixUpBadSafariComposition(view, added);
            }
            this.handleDOMChange(from, to, typeOver, added);
            if (view.docView && view.docView.dirty)
                view.updateState(view.state);
            else if (!this.currentSelection.eq(sel))
                selectionToDOM(view);
            this.currentSelection.set(sel);
        }
    }
    registerMutation(mut, added) {
        // Ignore mutations inside nodes that were already noted as inserted
        if (added.indexOf(mut.target) > -1)
            return null;
        let desc = this.view.docView.nearestDesc(mut.target);
        if (mut.type == "attributes" &&
            (desc == this.view.docView || mut.attributeName == "contenteditable" ||
                // Firefox sometimes fires spurious events for null/empty styles
                (mut.attributeName == "style" && !mut.oldValue && !mut.target.getAttribute("style"))))
            return null;
        if (!desc || desc.ignoreMutation(mut))
            return null;
        if (mut.type == "childList") {
            for (let i = 0; i < mut.addedNodes.length; i++) {
                let node = mut.addedNodes[i];
                added.push(node);
                if (node.nodeType == 3)
                    this.lastChangedTextNode = node;
            }
            if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))
                return { from: desc.posBefore, to: desc.posAfter };
            let prev = mut.previousSibling, next = mut.nextSibling;
            if (ie && ie_version <= 11 && mut.addedNodes.length) {
                // IE11 gives us incorrect next/prev siblings for some
                // insertions, so if there are added nodes, recompute those
                for (let i = 0; i < mut.addedNodes.length; i++) {
                    let { previousSibling, nextSibling } = mut.addedNodes[i];
                    if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0)
                        prev = previousSibling;
                    if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0)
                        next = nextSibling;
                }
            }
            let fromOffset = prev && prev.parentNode == mut.target
                ? domIndex(prev) + 1 : 0;
            let from = desc.localPosFromDOM(mut.target, fromOffset, -1);
            let toOffset = next && next.parentNode == mut.target
                ? domIndex(next) : mut.target.childNodes.length;
            let to = desc.localPosFromDOM(mut.target, toOffset, 1);
            return { from, to };
        }
        else if (mut.type == "attributes") {
            return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
        }
        else { // "characterData"
            this.lastChangedTextNode = mut.target;
            return {
                from: desc.posAtStart,
                to: desc.posAtEnd,
                // An event was generated for a text change that didn't change
                // any text. Mark the dom change to fall back to assuming the
                // selection was typed over with an identical value if it can't
                // find another change.
                typeOver: mut.target.nodeValue == mut.oldValue
            };
        }
    }
}
let cssChecked = new WeakMap();
let cssCheckWarned = false;
function checkCSS(view) {
    if (cssChecked.has(view))
        return;
    cssChecked.set(view, null);
    if (['normal', 'nowrap', 'pre-line'].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {
        view.requiresGeckoHackNode = gecko;
        if (cssCheckWarned)
            return;
        console["warn"]("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.");
        cssCheckWarned = true;
    }
}
function rangeToSelectionRange(view, range) {
    let anchorNode = range.startContainer, anchorOffset = range.startOffset;
    let focusNode = range.endContainer, focusOffset = range.endOffset;
    let currentAnchor = view.domAtPos(view.state.selection.anchor);
    // Since such a range doesn't distinguish between anchor and head,
    // use a heuristic that flips it around if its end matches the
    // current anchor.
    if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))
        [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];
    return { anchorNode, anchorOffset, focusNode, focusOffset };
}
// Used to work around a Safari Selection/shadow DOM bug
// Based on https://github.com/codemirror/dev/issues/414 fix
function safariShadowSelectionRange(view, selection) {
    if (selection.getComposedRanges) {
        let range = selection.getComposedRanges(view.root)[0];
        if (range)
            return rangeToSelectionRange(view, range);
    }
    let found;
    function read(event) {
        event.preventDefault();
        event.stopImmediatePropagation();
        found = event.getTargetRanges()[0];
    }
    // Because Safari (at least in 2018-2022) doesn't provide regular
    // access to the selection inside a shadowRoot, we have to perform a
    // ridiculous hack to get at it—using `execCommand` to trigger a
    // `beforeInput` event so that we can read the target range from the
    // event.
    view.dom.addEventListener("beforeinput", read, true);
    document.execCommand("indent");
    view.dom.removeEventListener("beforeinput", read, true);
    return found ? rangeToSelectionRange(view, found) : null;
}
function blockParent(view, node) {
    for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {
        let desc = view.docView.nearestDesc(p, true);
        if (desc && desc.node.isBlock)
            return p;
    }
    return null;
}
// Kludge for a Safari bug where, on ending a composition in an
// otherwise empty table cell, it randomly moves the composed text
// into the table row around that cell, greatly confusing everything
// (#188).
function fixUpBadSafariComposition(view, addedNodes) {
    var _a;
    let { focusNode, focusOffset } = view.domSelectionRange();
    for (let node of addedNodes) {
        if (((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName) == "TR") {
            let nextCell = node.nextSibling;
            while (nextCell && (nextCell.nodeName != "TD" && nextCell.nodeName != "TH"))
                nextCell = nextCell.nextSibling;
            if (nextCell) {
                let parent = nextCell;
                for (;;) {
                    let first = parent.firstChild;
                    if (!first || first.nodeType != 1 || first.contentEditable == "false" ||
                        /^(BR|IMG)$/.test(first.nodeName))
                        break;
                    parent = first;
                }
                parent.insertBefore(node, parent.firstChild);
                if (focusNode == node)
                    view.domSelection().collapse(node, focusOffset);
            }
            else {
                node.parentNode.removeChild(node);
            }
        }
    }
}

// Note that all referencing and parsing is done with the
// start-of-operation selection and document, since that's the one
// that the DOM represents. If any changes came in in the meantime,
// the modification is mapped over those before it is applied, in
// readDOMChange.
function parseBetween(view, from_, to_) {
    let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);
    let domSel = view.domSelectionRange();
    let find;
    let anchor = domSel.anchorNode;
    if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
        find = [{ node: anchor, offset: domSel.anchorOffset }];
        if (!selectionCollapsed(domSel))
            find.push({ node: domSel.focusNode, offset: domSel.focusOffset });
    }
    // Work around issue in Chrome where backspacing sometimes replaces
    // the deleted content with a random BR node (issues #799, #831)
    if (chrome && view.input.lastKeyCode === 8) {
        for (let off = toOffset; off > fromOffset; off--) {
            let node = parent.childNodes[off - 1], desc = node.pmViewDesc;
            if (node.nodeName == "BR" && !desc) {
                toOffset = off;
                break;
            }
            if (!desc || desc.size)
                break;
        }
    }
    let startDoc = view.state.doc;
    let parser = view.someProp("domParser") || prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.DOMParser.fromSchema(view.state.schema);
    let $from = startDoc.resolve(from);
    let sel = null, doc = parser.parse(parent, {
        topNode: $from.parent,
        topMatch: $from.parent.contentMatchAt($from.index()),
        topOpen: true,
        from: fromOffset,
        to: toOffset,
        preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true,
        findPositions: find,
        ruleFromNode,
        context: $from
    });
    if (find && find[0].pos != null) {
        let anchor = find[0].pos, head = find[1] && find[1].pos;
        if (head == null)
            head = anchor;
        sel = { anchor: anchor + from, head: head + from };
    }
    return { doc, sel, from, to };
}
function ruleFromNode(dom) {
    let desc = dom.pmViewDesc;
    if (desc) {
        return desc.parseRule();
    }
    else if (dom.nodeName == "BR" && dom.parentNode) {
        // Safari replaces the list item or table cell with a BR
        // directly in the list node (?!) if you delete the last
        // character in a list item or table cell (#708, #862)
        if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {
            let skip = document.createElement("div");
            skip.appendChild(document.createElement("li"));
            return { skip };
        }
        else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {
            return { ignore: true };
        }
    }
    else if (dom.nodeName == "IMG" && dom.getAttribute("mark-placeholder")) {
        return { ignore: true };
    }
    return null;
}
const isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
function readDOMChange(view, from, to, typeOver, addedNodes) {
    let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
    view.input.compositionPendingChanges = 0;
    if (from < 0) {
        let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
        let newSel = selectionFromDOM(view, origin);
        if (newSel && !view.state.selection.eq(newSel)) {
            if (chrome && android &&
                view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime &&
                view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter"))))
                return;
            let tr = view.state.tr.setSelection(newSel);
            if (origin == "pointer")
                tr.setMeta("pointer", true);
            else if (origin == "key")
                tr.scrollIntoView();
            if (compositionID)
                tr.setMeta("composition", compositionID);
            view.dispatch(tr);
        }
        return;
    }
    let $before = view.state.doc.resolve(from);
    let shared = $before.sharedDepth(to);
    from = $before.before(shared + 1);
    to = view.state.doc.resolve(to).after(shared + 1);
    let sel = view.state.selection;
    let parse = parseBetween(view, from, to);
    let doc = view.state.doc, compare = doc.slice(parse.from, parse.to);
    let preferredPos, preferredSide;
    // Prefer anchoring to end when Backspace is pressed
    if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {
        preferredPos = view.state.selection.to;
        preferredSide = "end";
    }
    else {
        preferredPos = view.state.selection.from;
        preferredSide = "start";
    }
    view.input.lastKeyCode = null;
    let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
    if (change)
        view.input.domChangeCount++;
    if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) &&
        addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) &&
        (!change || change.endA >= change.endB) &&
        view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
        view.input.lastIOSEnter = 0;
        return;
    }
    if (!change) {
        if (typeOver && sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&
            !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {
            change = { start: sel.from, endA: sel.to, endB: sel.to };
        }
        else {
            if (parse.sel) {
                let sel = resolveSelection(view, view.state.doc, parse.sel);
                if (sel && !sel.eq(view.state.selection)) {
                    let tr = view.state.tr.setSelection(sel);
                    if (compositionID)
                        tr.setMeta("composition", compositionID);
                    view.dispatch(tr);
                }
            }
            return;
        }
    }
    // Handle the case where overwriting a selection by typing matches
    // the start or end of the selected content, creating a change
    // that's smaller than what was actually overwritten.
    if (view.state.selection.from < view.state.selection.to &&
        change.start == change.endB &&
        view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection) {
        if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&
            view.state.selection.from >= parse.from) {
            change.start = view.state.selection.from;
        }
        else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&
            view.state.selection.to <= parse.to) {
            change.endB += (view.state.selection.to - change.endA);
            change.endA = view.state.selection.to;
        }
    }
    // IE11 will insert a non-breaking space _ahead_ of the space after
    // the cursor space when adding a space before another space. When
    // that happened, adjust the change to cover the space instead.
    if (ie && ie_version <= 11 && change.endB == change.start + 1 &&
        change.endA == change.start && change.start > parse.from &&
        parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == " \u00a0") {
        change.start--;
        change.endA--;
        change.endB--;
    }
    let $from = parse.doc.resolveNoCache(change.start - parse.from);
    let $to = parse.doc.resolveNoCache(change.endB - parse.from);
    let $fromA = doc.resolve(change.start);
    let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
    // If this looks like the effect of pressing Enter (or was recorded
    // as being an iOS enter press), just dispatch an Enter key instead.
    if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
        (!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
        (!inlineChange && $from.pos < parse.doc.content.size &&
            (!$from.sameParent($to) || !$from.parent.inlineContent) &&
            $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")))) &&
        view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
        view.input.lastIOSEnter = 0;
        return;
    }
    // Same for backspace
    if (view.state.selection.anchor > change.start &&
        looksLikeBackspace(doc, change.start, change.endA, $from, $to) &&
        view.someProp("handleKeyDown", f => f(view, keyEvent(8, "Backspace")))) {
        if (android && chrome)
            view.domObserver.suppressSelectionUpdates(); // #820
        return;
    }
    // Chrome will occasionally, during composition, delete the
    // entire composition and then immediately insert it again. This is
    // used to detect that situation.
    if (chrome && change.endB == change.start)
        view.input.lastChromeDelete = Date.now();
    // This tries to detect Android virtual keyboard
    // enter-and-pick-suggestion action. That sometimes (see issue
    // #1059) first fires a DOM mutation, before moving the selection to
    // the newly created block. And then, because ProseMirror cleans up
    // the DOM selection, it gives up moving the selection entirely,
    // leaving the cursor in the wrong place. When that happens, we drop
    // the new paragraph from the initial change, and fire a simulated
    // enter key afterwards.
    if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth &&
        parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {
        change.endB -= 2;
        $to = parse.doc.resolveNoCache(change.endB - parse.from);
        setTimeout(() => {
            view.someProp("handleKeyDown", function (f) { return f(view, keyEvent(13, "Enter")); });
        }, 20);
    }
    let chFrom = change.start, chTo = change.endA;
    let mkTr = (base) => {
        let tr = base || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
        if (parse.sel) {
            let sel = resolveSelection(view, tr.doc, parse.sel);
            // Chrome will sometimes, during composition, report the
            // selection in the wrong place. If it looks like that is
            // happening, don't update the selection.
            // Edge just doesn't move the cursor forward when you start typing
            // in an empty block or between br nodes.
            if (sel && !(chrome && view.composing && sel.empty &&
                (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) &&
                (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) ||
                ie && sel.empty && sel.head == chFrom))
                tr.setSelection(sel);
        }
        if (compositionID)
            tr.setMeta("composition", compositionID);
        return tr.scrollIntoView();
    };
    let markChange;
    if (inlineChange) {
        if ($from.pos == $to.pos) { // Deletion
            // IE11 sometimes weirdly moves the DOM selection around after
            // backspacing out the first element in a textblock
            if (ie && ie_version <= 11 && $from.parentOffset == 0) {
                view.domObserver.suppressSelectionUpdates();
                setTimeout(() => selectionToDOM(view), 20);
            }
            let tr = mkTr(view.state.tr.delete(chFrom, chTo));
            let marks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));
            if (marks)
                tr.ensureMarks(marks);
            view.dispatch(tr);
        }
        else if ( // Adding or removing a mark
        change.endA == change.endB &&
            (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {
            let tr = mkTr(view.state.tr);
            if (markChange.type == "add")
                tr.addMark(chFrom, chTo, markChange.mark);
            else
                tr.removeMark(chFrom, chTo, markChange.mark);
            view.dispatch(tr);
        }
        else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {
            // Both positions in the same text node -- simply insert text
            let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);
            let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
            if (!view.someProp("handleTextInput", f => f(view, chFrom, chTo, text, deflt)))
                view.dispatch(deflt());
        }
        else {
            view.dispatch(mkTr());
        }
    }
    else {
        view.dispatch(mkTr());
    }
}
function resolveSelection(view, doc, parsedSel) {
    if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size)
        return null;
    return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));
}
// Given two same-length, non-empty fragments of inline content,
// determine whether the first could be created from the second by
// removing or adding a single mark type.
function isMarkChange(cur, prev) {
    let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;
    let added = curMarks, removed = prevMarks, type, mark, update;
    for (let i = 0; i < prevMarks.length; i++)
        added = prevMarks[i].removeFromSet(added);
    for (let i = 0; i < curMarks.length; i++)
        removed = curMarks[i].removeFromSet(removed);
    if (added.length == 1 && removed.length == 0) {
        mark = added[0];
        type = "add";
        update = (node) => node.mark(mark.addToSet(node.marks));
    }
    else if (added.length == 0 && removed.length == 1) {
        mark = removed[0];
        type = "remove";
        update = (node) => node.mark(mark.removeFromSet(node.marks));
    }
    else {
        return null;
    }
    let updated = [];
    for (let i = 0; i < prev.childCount; i++)
        updated.push(update(prev.child(i)));
    if (prosemirror_model__WEBPACK_IMPORTED_MODULE_1__.Fragment.from(updated).eq(cur))
        return { mark, type };
}
function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
    if ( // The content must have shrunk
    end - start <= $newEnd.pos - $newStart.pos ||
        // newEnd must point directly at or after the end of the block that newStart points into
        skipClosingAndOpening($newStart, true, false) < $newEnd.pos)
        return false;
    let $start = old.resolve(start);
    // Handle the case where, rather than joining blocks, the change just removed an entire block
    if (!$newStart.parent.isTextblock) {
        let after = $start.nodeAfter;
        return after != null && end == start + after.nodeSize;
    }
    // Start must be at the end of a block
    if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)
        return false;
    let $next = old.resolve(skipClosingAndOpening($start, true, true));
    // The next textblock must start before end and end near it
    if (!$next.parent.isTextblock || $next.pos > end ||
        skipClosingAndOpening($next, true, false) < end)
        return false;
    // The fragments after the join point must match
    return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
}
function skipClosingAndOpening($pos, fromEnd, mayOpen) {
    let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;
    while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
        depth--;
        end++;
        fromEnd = false;
    }
    if (mayOpen) {
        let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));
        while (next && !next.isLeaf) {
            next = next.firstChild;
            end++;
        }
    }
    return end;
}
function findDiff(a, b, pos, preferredPos, preferredSide) {
    let start = a.findDiffStart(b, pos);
    if (start == null)
        return null;
    let { a: endA, b: endB } = a.findDiffEnd(b, pos + a.size, pos + b.size);
    if (preferredSide == "end") {
        let adjust = Math.max(0, start - Math.min(endA, endB));
        preferredPos -= endA + adjust - start;
    }
    if (endA < start && a.size < b.size) {
        let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
        start -= move;
        if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1)))
            start += move ? 1 : -1;
        endB = start + (endB - endA);
        endA = start;
    }
    else if (endB < start) {
        let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
        start -= move;
        if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1)))
            start += move ? 1 : -1;
        endA = start + (endA - endB);
        endB = start;
    }
    return { start, endA, endB };
}
function isSurrogatePair(str) {
    if (str.length != 2)
        return false;
    let a = str.charCodeAt(0), b = str.charCodeAt(1);
    return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;
}

/**
@internal
*/
const __parseFromClipboard = parseFromClipboard;
/**
@internal
*/
const __endComposition = endComposition;
/**
An editor view manages the DOM structure that represents an
editable document. Its state and behavior are determined by its
[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).
*/
class EditorView {
    /**
    Create a view. `place` may be a DOM node that the editor should
    be appended to, a function that will place it into the document,
    or an object whose `mount` property holds the node to use as the
    document container. If it is `null`, the editor will not be
    added to the document.
    */
    constructor(place, props) {
        this._root = null;
        /**
        @internal
        */
        this.focused = false;
        /**
        Kludge used to work around a Chrome bug @internal
        */
        this.trackWrites = null;
        this.mounted = false;
        /**
        @internal
        */
        this.markCursor = null;
        /**
        @internal
        */
        this.cursorWrapper = null;
        /**
        @internal
        */
        this.lastSelectedViewDesc = undefined;
        /**
        @internal
        */
        this.input = new InputState;
        this.prevDirectPlugins = [];
        this.pluginViews = [];
        /**
        Holds `true` when a hack node is needed in Firefox to prevent the
        [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
        @internal
        */
        this.requiresGeckoHackNode = false;
        /**
        When editor content is being dragged, this object contains
        information about the dragged slice and whether it is being
        copied or moved. At any other time, it is null.
        */
        this.dragging = null;
        this._props = props;
        this.state = props.state;
        this.directPlugins = props.plugins || [];
        this.directPlugins.forEach(checkStateComponent);
        this.dispatch = this.dispatch.bind(this);
        this.dom = (place && place.mount) || document.createElement("div");
        if (place) {
            if (place.appendChild)
                place.appendChild(this.dom);
            else if (typeof place == "function")
                place(this.dom);
            else if (place.mount)
                this.mounted = true;
        }
        this.editable = getEditable(this);
        updateCursorWrapper(this);
        this.nodeViews = buildNodeViews(this);
        this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);
        this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));
        this.domObserver.start();
        initInput(this);
        this.updatePluginViews();
    }
    /**
    Holds `true` when a
    [composition](https://w3c.github.io/uievents/#events-compositionevents)
    is active.
    */
    get composing() { return this.input.composing; }
    /**
    The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
    */
    get props() {
        if (this._props.state != this.state) {
            let prev = this._props;
            this._props = {};
            for (let name in prev)
                this._props[name] = prev[name];
            this._props.state = this.state;
        }
        return this._props;
    }
    /**
    Update the view's props. Will immediately cause an update to
    the DOM.
    */
    update(props) {
        if (props.handleDOMEvents != this._props.handleDOMEvents)
            ensureListeners(this);
        let prevProps = this._props;
        this._props = props;
        if (props.plugins) {
            props.plugins.forEach(checkStateComponent);
            this.directPlugins = props.plugins;
        }
        this.updateStateInner(props.state, prevProps);
    }
    /**
    Update the view by updating existing props object with the object
    given as argument. Equivalent to `view.update(Object.assign({},
    view.props, props))`.
    */
    setProps(props) {
        let updated = {};
        for (let name in this._props)
            updated[name] = this._props[name];
        updated.state = this.state;
        for (let name in props)
            updated[name] = props[name];
        this.update(updated);
    }
    /**
    Update the editor's `state` prop, without touching any of the
    other props.
    */
    updateState(state) {
        this.updateStateInner(state, this._props);
    }
    updateStateInner(state, prevProps) {
        var _a;
        let prev = this.state, redraw = false, updateSel = false;
        // When stored marks are added, stop composition, so that they can
        // be displayed.
        if (state.storedMarks && this.composing) {
            clearComposition(this);
            updateSel = true;
        }
        this.state = state;
        let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;
        if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {
            let nodeViews = buildNodeViews(this);
            if (changedNodeViews(nodeViews, this.nodeViews)) {
                this.nodeViews = nodeViews;
                redraw = true;
            }
        }
        if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) {
            ensureListeners(this);
        }
        this.editable = getEditable(this);
        updateCursorWrapper(this);
        let innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);
        let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? "reset"
            : state.scrollToSelection > prev.scrollToSelection ? "to selection" : "preserve";
        let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);
        if (updateDoc || !state.selection.eq(prev.selection))
            updateSel = true;
        let oldScrollPos = scroll == "preserve" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);
        if (updateSel) {
            this.domObserver.stop();
            // Work around an issue in Chrome, IE, and Edge where changing
            // the DOM around an active selection puts it into a broken
            // state where the thing the user sees differs from the
            // selection reported by the Selection object (#710, #973,
            // #1011, #1013, #1035).
            let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing &&
                !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);
            if (updateDoc) {
                // If the node that the selection points into is written to,
                // Chrome sometimes starts misreporting the selection, so this
                // tracks that and forces a selection reset when our update
                // did write to the node.
                let chromeKludge = chrome ? (this.trackWrites = this.domSelectionRange().focusNode) : null;
                if (this.composing)
                    this.input.compositionNode = findCompositionNode(this);
                if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {
                    this.docView.updateOuterDeco(outerDeco);
                    this.docView.destroy();
                    this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);
                }
                if (chromeKludge && (!this.trackWrites || !this.dom.contains(this.trackWrites)))
                    forceSelUpdate = true;
            }
            // Work around for an issue where an update arriving right between
            // a DOM selection change and the "selectionchange" event for it
            // can cause a spurious DOM selection update, disrupting mouse
            // drag selection.
            if (forceSelUpdate ||
                !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&
                    anchorInRightPlace(this))) {
                selectionToDOM(this, forceSelUpdate);
            }
            else {
                syncNodeSelection(this, state.selection);
                this.domObserver.setCurSelection();
            }
            this.domObserver.start();
        }
        this.updatePluginViews(prev);
        if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc))
            this.updateDraggedNode(this.dragging, prev);
        if (scroll == "reset") {
            this.dom.scrollTop = 0;
        }
        else if (scroll == "to selection") {
            this.scrollToSelection();
        }
        else if (oldScrollPos) {
            resetScrollPos(oldScrollPos);
        }
    }
    /**
    @internal
    */
    scrollToSelection() {
        let startDOM = this.domSelectionRange().focusNode;
        if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode)) ;
        else if (this.someProp("handleScrollToSelection", f => f(this))) ;
        else if (this.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection) {
            let target = this.docView.domAfterPos(this.state.selection.from);
            if (target.nodeType == 1)
                scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
        }
        else {
            scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
        }
    }
    destroyPluginViews() {
        let view;
        while (view = this.pluginViews.pop())
            if (view.destroy)
                view.destroy();
    }
    updatePluginViews(prevState) {
        if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
            this.prevDirectPlugins = this.directPlugins;
            this.destroyPluginViews();
            for (let i = 0; i < this.directPlugins.length; i++) {
                let plugin = this.directPlugins[i];
                if (plugin.spec.view)
                    this.pluginViews.push(plugin.spec.view(this));
            }
            for (let i = 0; i < this.state.plugins.length; i++) {
                let plugin = this.state.plugins[i];
                if (plugin.spec.view)
                    this.pluginViews.push(plugin.spec.view(this));
            }
        }
        else {
            for (let i = 0; i < this.pluginViews.length; i++) {
                let pluginView = this.pluginViews[i];
                if (pluginView.update)
                    pluginView.update(this, prevState);
            }
        }
    }
    updateDraggedNode(dragging, prev) {
        let sel = dragging.node, found = -1;
        if (this.state.doc.nodeAt(sel.from) == sel.node) {
            found = sel.from;
        }
        else {
            let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);
            let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);
            if (moved == sel.node)
                found = movedPos;
        }
        this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? undefined : prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.NodeSelection.create(this.state.doc, found));
    }
    someProp(propName, f) {
        let prop = this._props && this._props[propName], value;
        if (prop != null && (value = f ? f(prop) : prop))
            return value;
        for (let i = 0; i < this.directPlugins.length; i++) {
            let prop = this.directPlugins[i].props[propName];
            if (prop != null && (value = f ? f(prop) : prop))
                return value;
        }
        let plugins = this.state.plugins;
        if (plugins)
            for (let i = 0; i < plugins.length; i++) {
                let prop = plugins[i].props[propName];
                if (prop != null && (value = f ? f(prop) : prop))
                    return value;
            }
    }
    /**
    Query whether the view has focus.
    */
    hasFocus() {
        // Work around IE not handling focus correctly if resize handles are shown.
        // If the cursor is inside an element with resize handles, activeElement
        // will be that element instead of this.dom.
        if (ie) {
            // If activeElement is within this.dom, and there are no other elements
            // setting `contenteditable` to false in between, treat it as focused.
            let node = this.root.activeElement;
            if (node == this.dom)
                return true;
            if (!node || !this.dom.contains(node))
                return false;
            while (node && this.dom != node && this.dom.contains(node)) {
                if (node.contentEditable == 'false')
                    return false;
                node = node.parentElement;
            }
            return true;
        }
        return this.root.activeElement == this.dom;
    }
    /**
    Focus the editor.
    */
    focus() {
        this.domObserver.stop();
        if (this.editable)
            focusPreventScroll(this.dom);
        selectionToDOM(this);
        this.domObserver.start();
    }
    /**
    Get the document root in which the editor exists. This will
    usually be the top-level `document`, but might be a [shadow
    DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
    root if the editor is inside one.
    */
    get root() {
        let cached = this._root;
        if (cached == null)
            for (let search = this.dom.parentNode; search; search = search.parentNode) {
                if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {
                    if (!search.getSelection)
                        Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();
                    return this._root = search;
                }
            }
        return cached || document;
    }
    /**
    When an existing editor view is moved to a new document or
    shadow tree, call this to make it recompute its root.
    */
    updateRoot() {
        this._root = null;
    }
    /**
    Given a pair of viewport coordinates, return the document
    position that corresponds to them. May return null if the given
    coordinates aren't inside of the editor. When an object is
    returned, its `pos` property is the position nearest to the
    coordinates, and its `inside` property holds the position of the
    inner node that the position falls inside of, or -1 if it is at
    the top level, not in any node.
    */
    posAtCoords(coords) {
        return posAtCoords(this, coords);
    }
    /**
    Returns the viewport rectangle at a given document position.
    `left` and `right` will be the same number, as this returns a
    flat cursor-ish rectangle. If the position is between two things
    that aren't directly adjacent, `side` determines which element
    is used. When < 0, the element before the position is used,
    otherwise the element after.
    */
    coordsAtPos(pos, side = 1) {
        return coordsAtPos(this, pos, side);
    }
    /**
    Find the DOM position that corresponds to the given document
    position. When `side` is negative, find the position as close as
    possible to the content before the position. When positive,
    prefer positions close to the content after the position. When
    zero, prefer as shallow a position as possible.
    
    Note that you should **not** mutate the editor's internal DOM,
    only inspect it (and even that is usually not necessary).
    */
    domAtPos(pos, side = 0) {
        return this.docView.domFromPos(pos, side);
    }
    /**
    Find the DOM node that represents the document node after the
    given position. May return `null` when the position doesn't point
    in front of a node or if the node is inside an opaque node view.
    
    This is intended to be able to call things like
    `getBoundingClientRect` on that DOM node. Do **not** mutate the
    editor DOM directly, or add styling this way, since that will be
    immediately overriden by the editor as it redraws the node.
    */
    nodeDOM(pos) {
        let desc = this.docView.descAt(pos);
        return desc ? desc.nodeDOM : null;
    }
    /**
    Find the document position that corresponds to a given DOM
    position. (Whenever possible, it is preferable to inspect the
    document structure directly, rather than poking around in the
    DOM, but sometimes—for example when interpreting an event
    target—you don't have a choice.)
    
    The `bias` parameter can be used to influence which side of a DOM
    node to use when the position is inside a leaf node.
    */
    posAtDOM(node, offset, bias = -1) {
        let pos = this.docView.posFromDOM(node, offset, bias);
        if (pos == null)
            throw new RangeError("DOM position not inside the editor");
        return pos;
    }
    /**
    Find out whether the selection is at the end of a textblock when
    moving in a given direction. When, for example, given `"left"`,
    it will return true if moving left from the current cursor
    position would leave that position's parent textblock. Will apply
    to the view's current state by default, but it is possible to
    pass a different state.
    */
    endOfTextblock(dir, state) {
        return endOfTextblock(this, state || this.state, dir);
    }
    /**
    Run the editor's paste logic with the given HTML string. The
    `event`, if given, will be passed to the
    [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
    */
    pasteHTML(html, event) {
        return doPaste(this, "", html, false, event || new ClipboardEvent("paste"));
    }
    /**
    Run the editor's paste logic with the given plain-text input.
    */
    pasteText(text, event) {
        return doPaste(this, text, null, true, event || new ClipboardEvent("paste"));
    }
    /**
    Serialize the given slice as it would be if it was copied from
    this editor. Returns a DOM element that contains a
    representation of the slice as its children, a textual
    representation, and the transformed slice (which can be
    different from the given input due to hooks like
    [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
    */
    serializeForClipboard(slice) {
        return serializeForClipboard(this, slice);
    }
    /**
    Removes the editor from the DOM and destroys all [node
    views](https://prosemirror.net/docs/ref/#view.NodeView).
    */
    destroy() {
        if (!this.docView)
            return;
        destroyInput(this);
        this.destroyPluginViews();
        if (this.mounted) {
            this.docView.update(this.state.doc, [], viewDecorations(this), this);
            this.dom.textContent = "";
        }
        else if (this.dom.parentNode) {
            this.dom.parentNode.removeChild(this.dom);
        }
        this.docView.destroy();
        this.docView = null;
        clearReusedRange();
    }
    /**
    This is true when the view has been
    [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
    used anymore).
    */
    get isDestroyed() {
        return this.docView == null;
    }
    /**
    Used for testing.
    */
    dispatchEvent(event) {
        return dispatchEvent(this, event);
    }
    /**
    @internal
    */
    domSelectionRange() {
        let sel = this.domSelection();
        if (!sel)
            return { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
        return safari && this.root.nodeType === 11 &&
            deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
    }
    /**
    @internal
    */
    domSelection() {
        return this.root.getSelection();
    }
}
EditorView.prototype.dispatch = function (tr) {
    let dispatchTransaction = this._props.dispatchTransaction;
    if (dispatchTransaction)
        dispatchTransaction.call(this, tr);
    else
        this.updateState(this.state.apply(tr));
};
function computeDocDeco(view) {
    let attrs = Object.create(null);
    attrs.class = "ProseMirror";
    attrs.contenteditable = String(view.editable);
    view.someProp("attributes", value => {
        if (typeof value == "function")
            value = value(view.state);
        if (value)
            for (let attr in value) {
                if (attr == "class")
                    attrs.class += " " + value[attr];
                else if (attr == "style")
                    attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];
                else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName")
                    attrs[attr] = String(value[attr]);
            }
    });
    if (!attrs.translate)
        attrs.translate = "no";
    return [Decoration.node(0, view.state.doc.content.size, attrs)];
}
function updateCursorWrapper(view) {
    if (view.markCursor) {
        let dom = document.createElement("img");
        dom.className = "ProseMirror-separator";
        dom.setAttribute("mark-placeholder", "true");
        dom.setAttribute("alt", "");
        view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.from, dom, { raw: true, marks: view.markCursor }) };
    }
    else {
        view.cursorWrapper = null;
    }
}
function getEditable(view) {
    return !view.someProp("editable", value => value(view.state) === false);
}
function selectionContextChanged(sel1, sel2) {
    let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));
    return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);
}
function buildNodeViews(view) {
    let result = Object.create(null);
    function add(obj) {
        for (let prop in obj)
            if (!Object.prototype.hasOwnProperty.call(result, prop))
                result[prop] = obj[prop];
    }
    view.someProp("nodeViews", add);
    view.someProp("markViews", add);
    return result;
}
function changedNodeViews(a, b) {
    let nA = 0, nB = 0;
    for (let prop in a) {
        if (a[prop] != b[prop])
            return true;
        nA++;
    }
    for (let _ in b)
        nB++;
    return nA != nB;
}
function checkStateComponent(plugin) {
    if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction)
        throw new RangeError("Plugins passed directly to the view must not have a state component");
}




/***/ }),

/***/ "./node_modules/react-transition-group/esm/CSSTransition.js":
/*!******************************************************************!*\
  !*** ./node_modules/react-transition-group/esm/CSSTransition.js ***!
  \******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js");
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var dom_helpers_addClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-helpers/addClass */ "./node_modules/dom-helpers/esm/addClass.js");
/* harmony import */ var dom_helpers_removeClass__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! dom-helpers/removeClass */ "./node_modules/dom-helpers/esm/removeClass.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _Transition__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Transition */ "./node_modules/react-transition-group/esm/Transition.js");
/* harmony import */ var _utils_PropTypes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/PropTypes */ "./node_modules/react-transition-group/esm/utils/PropTypes.js");
/* harmony import */ var _utils_reflow__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/reflow */ "./node_modules/react-transition-group/esm/utils/reflow.js");











var _addClass = function addClass(node, classes) {
  return node && classes && classes.split(' ').forEach(function (c) {
    return (0,dom_helpers_addClass__WEBPACK_IMPORTED_MODULE_4__["default"])(node, c);
  });
};

var removeClass = function removeClass(node, classes) {
  return node && classes && classes.split(' ').forEach(function (c) {
    return (0,dom_helpers_removeClass__WEBPACK_IMPORTED_MODULE_5__["default"])(node, c);
  });
};
/**
 * A transition component inspired by the excellent
 * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
 * use it if you're using CSS transitions or animations. It's built upon the
 * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
 * component, so it inherits all of its props.
 *
 * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
 * and `exit` states of the transition. The first class is applied and then a
 * second `*-active` class in order to activate the CSS transition. After the
 * transition, matching `*-done` class names are applied to persist the
 * transition state.
 *
 * ```jsx
 * function App() {
 *   const [inProp, setInProp] = useState(false);
 *   return (
 *     <div>
 *       <CSSTransition in={inProp} timeout={200} classNames="my-node">
 *         <div>
 *           {"I'll receive my-node-* classes"}
 *         </div>
 *       </CSSTransition>
 *       <button type="button" onClick={() => setInProp(true)}>
 *         Click to Enter
 *       </button>
 *     </div>
 *   );
 * }
 * ```
 *
 * When the `in` prop is set to `true`, the child component will first receive
 * the class `example-enter`, then the `example-enter-active` will be added in
 * the next tick. `CSSTransition` [forces a
 * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
 * between before adding the `example-enter-active`. This is an important trick
 * because it allows us to transition between `example-enter` and
 * `example-enter-active` even though they were added immediately one after
 * another. Most notably, this is what makes it possible for us to animate
 * _appearance_.
 *
 * ```css
 * .my-node-enter {
 *   opacity: 0;
 * }
 * .my-node-enter-active {
 *   opacity: 1;
 *   transition: opacity 200ms;
 * }
 * .my-node-exit {
 *   opacity: 1;
 * }
 * .my-node-exit-active {
 *   opacity: 0;
 *   transition: opacity 200ms;
 * }
 * ```
 *
 * `*-active` classes represent which styles you want to animate **to**, so it's
 * important to add `transition` declaration only to them, otherwise transitions
 * might not behave as intended! This might not be obvious when the transitions
 * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
 * the example above (minus `transition`), but it becomes apparent in more
 * complex transitions.
 *
 * **Note**: If you're using the
 * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
 * prop, make sure to define styles for `.appear-*` classes as well.
 */


var CSSTransition = /*#__PURE__*/function (_React$Component) {
  (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__["default"])(CSSTransition, _React$Component);

  function CSSTransition() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
    _this.appliedClasses = {
      appear: {},
      enter: {},
      exit: {}
    };

    _this.onEnter = function (maybeNode, maybeAppearing) {
      var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
          node = _this$resolveArgument[0],
          appearing = _this$resolveArgument[1];

      _this.removeClasses(node, 'exit');

      _this.addClass(node, appearing ? 'appear' : 'enter', 'base');

      if (_this.props.onEnter) {
        _this.props.onEnter(maybeNode, maybeAppearing);
      }
    };

    _this.onEntering = function (maybeNode, maybeAppearing) {
      var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
          node = _this$resolveArgument2[0],
          appearing = _this$resolveArgument2[1];

      var type = appearing ? 'appear' : 'enter';

      _this.addClass(node, type, 'active');

      if (_this.props.onEntering) {
        _this.props.onEntering(maybeNode, maybeAppearing);
      }
    };

    _this.onEntered = function (maybeNode, maybeAppearing) {
      var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
          node = _this$resolveArgument3[0],
          appearing = _this$resolveArgument3[1];

      var type = appearing ? 'appear' : 'enter';

      _this.removeClasses(node, type);

      _this.addClass(node, type, 'done');

      if (_this.props.onEntered) {
        _this.props.onEntered(maybeNode, maybeAppearing);
      }
    };

    _this.onExit = function (maybeNode) {
      var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
          node = _this$resolveArgument4[0];

      _this.removeClasses(node, 'appear');

      _this.removeClasses(node, 'enter');

      _this.addClass(node, 'exit', 'base');

      if (_this.props.onExit) {
        _this.props.onExit(maybeNode);
      }
    };

    _this.onExiting = function (maybeNode) {
      var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
          node = _this$resolveArgument5[0];

      _this.addClass(node, 'exit', 'active');

      if (_this.props.onExiting) {
        _this.props.onExiting(maybeNode);
      }
    };

    _this.onExited = function (maybeNode) {
      var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
          node = _this$resolveArgument6[0];

      _this.removeClasses(node, 'exit');

      _this.addClass(node, 'exit', 'done');

      if (_this.props.onExited) {
        _this.props.onExited(maybeNode);
      }
    };

    _this.resolveArguments = function (maybeNode, maybeAppearing) {
      return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
      : [maybeNode, maybeAppearing];
    };

    _this.getClassNames = function (type) {
      var classNames = _this.props.classNames;
      var isStringClassNames = typeof classNames === 'string';
      var prefix = isStringClassNames && classNames ? classNames + "-" : '';
      var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
      var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
      var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
      return {
        baseClassName: baseClassName,
        activeClassName: activeClassName,
        doneClassName: doneClassName
      };
    };

    return _this;
  }

  var _proto = CSSTransition.prototype;

  _proto.addClass = function addClass(node, type, phase) {
    var className = this.getClassNames(type)[phase + "ClassName"];

    var _this$getClassNames = this.getClassNames('enter'),
        doneClassName = _this$getClassNames.doneClassName;

    if (type === 'appear' && phase === 'done' && doneClassName) {
      className += " " + doneClassName;
    } // This is to force a repaint,
    // which is necessary in order to transition styles when adding a class name.


    if (phase === 'active') {
      if (node) (0,_utils_reflow__WEBPACK_IMPORTED_MODULE_9__.forceReflow)(node);
    }

    if (className) {
      this.appliedClasses[type][phase] = className;

      _addClass(node, className);
    }
  };

  _proto.removeClasses = function removeClasses(node, type) {
    var _this$appliedClasses$ = this.appliedClasses[type],
        baseClassName = _this$appliedClasses$.base,
        activeClassName = _this$appliedClasses$.active,
        doneClassName = _this$appliedClasses$.done;
    this.appliedClasses[type] = {};

    if (baseClassName) {
      removeClass(node, baseClassName);
    }

    if (activeClassName) {
      removeClass(node, activeClassName);
    }

    if (doneClassName) {
      removeClass(node, doneClassName);
    }
  };

  _proto.render = function render() {
    var _this$props = this.props,
        _ = _this$props.classNames,
        props = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_this$props, ["classNames"]);

    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_6___default().createElement(_Transition__WEBPACK_IMPORTED_MODULE_7__["default"], (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, props, {
      onEnter: this.onEnter,
      onEntered: this.onEntered,
      onEntering: this.onEntering,
      onExit: this.onExit,
      onExiting: this.onExiting,
      onExited: this.onExited
    }));
  };

  return CSSTransition;
}((react__WEBPACK_IMPORTED_MODULE_6___default().Component));

CSSTransition.defaultProps = {
  classNames: ''
};
CSSTransition.propTypes =  true ? (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, _Transition__WEBPACK_IMPORTED_MODULE_7__["default"].propTypes, {
  /**
   * The animation classNames applied to the component as it appears, enters,
   * exits or has finished the transition. A single name can be provided, which
   * will be suffixed for each stage, e.g. `classNames="fade"` applies:
   *
   * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
   * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
   * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
   *
   * A few details to note about how these classes are applied:
   *
   * 1. They are _joined_ with the ones that are already defined on the child
   *    component, so if you want to add some base styles, you can use
   *    `className` without worrying that it will be overridden.
   *
   * 2. If the transition component mounts with `in={false}`, no classes are
   *    applied yet. You might be expecting `*-exit-done`, but if you think
   *    about it, a component cannot finish exiting if it hasn't entered yet.
   *
   * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
   *    allows you to define different behavior for when appearing is done and
   *    when regular entering is done, using selectors like
   *    `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
   *    an epic entrance animation when element first appears in the DOM using
   *    [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
   *    simply use `fade-enter-done` for defining both cases.
   *
   * Each individual classNames can also be specified independently like:
   *
   * ```js
   * classNames={{
   *  appear: 'my-appear',
   *  appearActive: 'my-active-appear',
   *  appearDone: 'my-done-appear',
   *  enter: 'my-enter',
   *  enterActive: 'my-active-enter',
   *  enterDone: 'my-done-enter',
   *  exit: 'my-exit',
   *  exitActive: 'my-active-exit',
   *  exitDone: 'my-done-exit',
   * }}
   * ```
   *
   * If you want to set these classes using CSS Modules:
   *
   * ```js
   * import styles from './styles.css';
   * ```
   *
   * you might want to use camelCase in your CSS file, that way could simply
   * spread them instead of listing them one by one:
   *
   * ```js
   * classNames={{ ...styles }}
   * ```
   *
   * @type {string | {
   *  appear?: string,
   *  appearActive?: string,
   *  appearDone?: string,
   *  enter?: string,
   *  enterActive?: string,
   *  enterDone?: string,
   *  exit?: string,
   *  exitActive?: string,
   *  exitDone?: string,
   * }}
   */
  classNames: _utils_PropTypes__WEBPACK_IMPORTED_MODULE_8__.classNamesShape,

  /**
   * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
   * applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEnter: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),

  /**
   * A `<Transition>` callback fired immediately after the 'enter-active' or
   * 'appear-active' class is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEntering: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),

  /**
   * A `<Transition>` callback fired immediately after the 'enter' or
   * 'appear' classes are **removed** and the `done` class is added to the DOM node.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEntered: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),

  /**
   * A `<Transition>` callback fired immediately after the 'exit' class is
   * applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExit: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),

  /**
   * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExiting: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),

  /**
   * A `<Transition>` callback fired immediately after the 'exit' classes
   * are **removed** and the `exit-done` class is added to the DOM node.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExited: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func)
}) : 0;
/* harmony default export */ __webpack_exports__["default"] = (CSSTransition);

/***/ }),

/***/ "./node_modules/react-transition-group/esm/Transition.js":
/*!***************************************************************!*\
  !*** ./node_modules/react-transition-group/esm/Transition.js ***!
  \***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ENTERED: function() { return /* binding */ ENTERED; },
/* harmony export */   ENTERING: function() { return /* binding */ ENTERING; },
/* harmony export */   EXITED: function() { return /* binding */ EXITED; },
/* harmony export */   EXITING: function() { return /* binding */ EXITING; },
/* harmony export */   UNMOUNTED: function() { return /* binding */ UNMOUNTED; }
/* harmony export */ });
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-dom */ "react-dom");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./config */ "./node_modules/react-transition-group/esm/config.js");
/* harmony import */ var _utils_PropTypes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/PropTypes */ "./node_modules/react-transition-group/esm/utils/PropTypes.js");
/* harmony import */ var _TransitionGroupContext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TransitionGroupContext */ "./node_modules/react-transition-group/esm/TransitionGroupContext.js");
/* harmony import */ var _utils_reflow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/reflow */ "./node_modules/react-transition-group/esm/utils/reflow.js");









var UNMOUNTED = 'unmounted';
var EXITED = 'exited';
var ENTERING = 'entering';
var ENTERED = 'entered';
var EXITING = 'exiting';
/**
 * The Transition component lets you describe a transition from one component
 * state to another _over time_ with a simple declarative API. Most commonly
 * it's used to animate the mounting and unmounting of a component, but can also
 * be used to describe in-place transition states as well.
 *
 * ---
 *
 * **Note**: `Transition` is a platform-agnostic base component. If you're using
 * transitions in CSS, you'll probably want to use
 * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
 * instead. It inherits all the features of `Transition`, but contains
 * additional features necessary to play nice with CSS transitions (hence the
 * name of the component).
 *
 * ---
 *
 * By default the `Transition` component does not alter the behavior of the
 * component it renders, it only tracks "enter" and "exit" states for the
 * components. It's up to you to give meaning and effect to those states. For
 * example we can add styles to a component when it enters or exits:
 *
 * ```jsx
 * import { Transition } from 'react-transition-group';
 *
 * const duration = 300;
 *
 * const defaultStyle = {
 *   transition: `opacity ${duration}ms ease-in-out`,
 *   opacity: 0,
 * }
 *
 * const transitionStyles = {
 *   entering: { opacity: 1 },
 *   entered:  { opacity: 1 },
 *   exiting:  { opacity: 0 },
 *   exited:  { opacity: 0 },
 * };
 *
 * const Fade = ({ in: inProp }) => (
 *   <Transition in={inProp} timeout={duration}>
 *     {state => (
 *       <div style={{
 *         ...defaultStyle,
 *         ...transitionStyles[state]
 *       }}>
 *         I'm a fade Transition!
 *       </div>
 *     )}
 *   </Transition>
 * );
 * ```
 *
 * There are 4 main states a Transition can be in:
 *  - `'entering'`
 *  - `'entered'`
 *  - `'exiting'`
 *  - `'exited'`
 *
 * Transition state is toggled via the `in` prop. When `true` the component
 * begins the "Enter" stage. During this stage, the component will shift from
 * its current transition state, to `'entering'` for the duration of the
 * transition and then to the `'entered'` stage once it's complete. Let's take
 * the following example (we'll use the
 * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
 *
 * ```jsx
 * function App() {
 *   const [inProp, setInProp] = useState(false);
 *   return (
 *     <div>
 *       <Transition in={inProp} timeout={500}>
 *         {state => (
 *           // ...
 *         )}
 *       </Transition>
 *       <button onClick={() => setInProp(true)}>
 *         Click to Enter
 *       </button>
 *     </div>
 *   );
 * }
 * ```
 *
 * When the button is clicked the component will shift to the `'entering'` state
 * and stay there for 500ms (the value of `timeout`) before it finally switches
 * to `'entered'`.
 *
 * When `in` is `false` the same thing happens except the state moves from
 * `'exiting'` to `'exited'`.
 */

var Transition = /*#__PURE__*/function (_React$Component) {
  (0,_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(Transition, _React$Component);

  function Transition(props, context) {
    var _this;

    _this = _React$Component.call(this, props, context) || this;
    var parentGroup = context; // In the context of a TransitionGroup all enters are really appears

    var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
    var initialStatus;
    _this.appearStatus = null;

    if (props.in) {
      if (appear) {
        initialStatus = EXITED;
        _this.appearStatus = ENTERING;
      } else {
        initialStatus = ENTERED;
      }
    } else {
      if (props.unmountOnExit || props.mountOnEnter) {
        initialStatus = UNMOUNTED;
      } else {
        initialStatus = EXITED;
      }
    }

    _this.state = {
      status: initialStatus
    };
    _this.nextCallback = null;
    return _this;
  }

  Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
    var nextIn = _ref.in;

    if (nextIn && prevState.status === UNMOUNTED) {
      return {
        status: EXITED
      };
    }

    return null;
  } // getSnapshotBeforeUpdate(prevProps) {
  //   let nextStatus = null
  //   if (prevProps !== this.props) {
  //     const { status } = this.state
  //     if (this.props.in) {
  //       if (status !== ENTERING && status !== ENTERED) {
  //         nextStatus = ENTERING
  //       }
  //     } else {
  //       if (status === ENTERING || status === ENTERED) {
  //         nextStatus = EXITING
  //       }
  //     }
  //   }
  //   return { nextStatus }
  // }
  ;

  var _proto = Transition.prototype;

  _proto.componentDidMount = function componentDidMount() {
    this.updateStatus(true, this.appearStatus);
  };

  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
    var nextStatus = null;

    if (prevProps !== this.props) {
      var status = this.state.status;

      if (this.props.in) {
        if (status !== ENTERING && status !== ENTERED) {
          nextStatus = ENTERING;
        }
      } else {
        if (status === ENTERING || status === ENTERED) {
          nextStatus = EXITING;
        }
      }
    }

    this.updateStatus(false, nextStatus);
  };

  _proto.componentWillUnmount = function componentWillUnmount() {
    this.cancelNextCallback();
  };

  _proto.getTimeouts = function getTimeouts() {
    var timeout = this.props.timeout;
    var exit, enter, appear;
    exit = enter = appear = timeout;

    if (timeout != null && typeof timeout !== 'number') {
      exit = timeout.exit;
      enter = timeout.enter; // TODO: remove fallback for next major

      appear = timeout.appear !== undefined ? timeout.appear : enter;
    }

    return {
      exit: exit,
      enter: enter,
      appear: appear
    };
  };

  _proto.updateStatus = function updateStatus(mounting, nextStatus) {
    if (mounting === void 0) {
      mounting = false;
    }

    if (nextStatus !== null) {
      // nextStatus will always be ENTERING or EXITING.
      this.cancelNextCallback();

      if (nextStatus === ENTERING) {
        if (this.props.unmountOnExit || this.props.mountOnEnter) {
          var node = this.props.nodeRef ? this.props.nodeRef.current : react_dom__WEBPACK_IMPORTED_MODULE_4___default().findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
          // With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
          // To make the animation happen,  we have to separate each rendering and avoid being processed as batched.

          if (node) (0,_utils_reflow__WEBPACK_IMPORTED_MODULE_8__.forceReflow)(node);
        }

        this.performEnter(mounting);
      } else {
        this.performExit();
      }
    } else if (this.props.unmountOnExit && this.state.status === EXITED) {
      this.setState({
        status: UNMOUNTED
      });
    }
  };

  _proto.performEnter = function performEnter(mounting) {
    var _this2 = this;

    var enter = this.props.enter;
    var appearing = this.context ? this.context.isMounting : mounting;

    var _ref2 = this.props.nodeRef ? [appearing] : [react_dom__WEBPACK_IMPORTED_MODULE_4___default().findDOMNode(this), appearing],
        maybeNode = _ref2[0],
        maybeAppearing = _ref2[1];

    var timeouts = this.getTimeouts();
    var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
    // if we are mounting and running this it means appear _must_ be set

    if (!mounting && !enter || _config__WEBPACK_IMPORTED_MODULE_5__["default"].disabled) {
      this.safeSetState({
        status: ENTERED
      }, function () {
        _this2.props.onEntered(maybeNode);
      });
      return;
    }

    this.props.onEnter(maybeNode, maybeAppearing);
    this.safeSetState({
      status: ENTERING
    }, function () {
      _this2.props.onEntering(maybeNode, maybeAppearing);

      _this2.onTransitionEnd(enterTimeout, function () {
        _this2.safeSetState({
          status: ENTERED
        }, function () {
          _this2.props.onEntered(maybeNode, maybeAppearing);
        });
      });
    });
  };

  _proto.performExit = function performExit() {
    var _this3 = this;

    var exit = this.props.exit;
    var timeouts = this.getTimeouts();
    var maybeNode = this.props.nodeRef ? undefined : react_dom__WEBPACK_IMPORTED_MODULE_4___default().findDOMNode(this); // no exit animation skip right to EXITED

    if (!exit || _config__WEBPACK_IMPORTED_MODULE_5__["default"].disabled) {
      this.safeSetState({
        status: EXITED
      }, function () {
        _this3.props.onExited(maybeNode);
      });
      return;
    }

    this.props.onExit(maybeNode);
    this.safeSetState({
      status: EXITING
    }, function () {
      _this3.props.onExiting(maybeNode);

      _this3.onTransitionEnd(timeouts.exit, function () {
        _this3.safeSetState({
          status: EXITED
        }, function () {
          _this3.props.onExited(maybeNode);
        });
      });
    });
  };

  _proto.cancelNextCallback = function cancelNextCallback() {
    if (this.nextCallback !== null) {
      this.nextCallback.cancel();
      this.nextCallback = null;
    }
  };

  _proto.safeSetState = function safeSetState(nextState, callback) {
    // This shouldn't be necessary, but there are weird race conditions with
    // setState callbacks and unmounting in testing, so always make sure that
    // we can cancel any pending setState callbacks after we unmount.
    callback = this.setNextCallback(callback);
    this.setState(nextState, callback);
  };

  _proto.setNextCallback = function setNextCallback(callback) {
    var _this4 = this;

    var active = true;

    this.nextCallback = function (event) {
      if (active) {
        active = false;
        _this4.nextCallback = null;
        callback(event);
      }
    };

    this.nextCallback.cancel = function () {
      active = false;
    };

    return this.nextCallback;
  };

  _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
    this.setNextCallback(handler);
    var node = this.props.nodeRef ? this.props.nodeRef.current : react_dom__WEBPACK_IMPORTED_MODULE_4___default().findDOMNode(this);
    var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;

    if (!node || doesNotHaveTimeoutOrListener) {
      setTimeout(this.nextCallback, 0);
      return;
    }

    if (this.props.addEndListener) {
      var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
          maybeNode = _ref3[0],
          maybeNextCallback = _ref3[1];

      this.props.addEndListener(maybeNode, maybeNextCallback);
    }

    if (timeout != null) {
      setTimeout(this.nextCallback, timeout);
    }
  };

  _proto.render = function render() {
    var status = this.state.status;

    if (status === UNMOUNTED) {
      return null;
    }

    var _this$props = this.props,
        children = _this$props.children,
        _in = _this$props.in,
        _mountOnEnter = _this$props.mountOnEnter,
        _unmountOnExit = _this$props.unmountOnExit,
        _appear = _this$props.appear,
        _enter = _this$props.enter,
        _exit = _this$props.exit,
        _timeout = _this$props.timeout,
        _addEndListener = _this$props.addEndListener,
        _onEnter = _this$props.onEnter,
        _onEntering = _this$props.onEntering,
        _onEntered = _this$props.onEntered,
        _onExit = _this$props.onExit,
        _onExiting = _this$props.onExiting,
        _onExited = _this$props.onExited,
        _nodeRef = _this$props.nodeRef,
        childProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);

    return (
      /*#__PURE__*/
      // allows for nested Transitions
      react__WEBPACK_IMPORTED_MODULE_3___default().createElement(_TransitionGroupContext__WEBPACK_IMPORTED_MODULE_7__["default"].Provider, {
        value: null
      }, typeof children === 'function' ? children(status, childProps) : react__WEBPACK_IMPORTED_MODULE_3___default().cloneElement(react__WEBPACK_IMPORTED_MODULE_3___default().Children.only(children), childProps))
    );
  };

  return Transition;
}((react__WEBPACK_IMPORTED_MODULE_3___default().Component));

Transition.contextType = _TransitionGroupContext__WEBPACK_IMPORTED_MODULE_7__["default"];
Transition.propTypes =  true ? {
  /**
   * A React reference to DOM element that need to transition:
   * https://stackoverflow.com/a/51127130/4671932
   *
   *   - When `nodeRef` prop is used, `node` is not passed to callback functions
   *      (e.g. `onEnter`) because user already has direct access to the node.
   *   - When changing `key` prop of `Transition` in a `TransitionGroup` a new
   *     `nodeRef` need to be provided to `Transition` with changed `key` prop
   *     (see
   *     [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
   */
  nodeRef: prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape({
    current: typeof Element === 'undefined' ? (prop_types__WEBPACK_IMPORTED_MODULE_2___default().any) : function (propValue, key, componentName, location, propFullName, secret) {
      var value = propValue[key];
      return prop_types__WEBPACK_IMPORTED_MODULE_2___default().instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
    }
  }),

  /**
   * A `function` child can be used instead of a React element. This function is
   * called with the current transition status (`'entering'`, `'entered'`,
   * `'exiting'`, `'exited'`), which can be used to apply context
   * specific props to a component.
   *
   * ```jsx
   * <Transition in={this.state.in} timeout={150}>
   *   {state => (
   *     <MyComponent className={`fade fade-${state}`} />
   *   )}
   * </Transition>
   * ```
   */
  children: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_2___default().func).isRequired, (prop_types__WEBPACK_IMPORTED_MODULE_2___default().element).isRequired]).isRequired,

  /**
   * Show the component; triggers the enter or exit states
   */
  in: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * By default the child component is mounted immediately along with
   * the parent `Transition` component. If you want to "lazy mount" the component on the
   * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
   * mounted, even on "exited", unless you also specify `unmountOnExit`.
   */
  mountOnEnter: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * By default the child component stays mounted after it reaches the `'exited'` state.
   * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
   */
  unmountOnExit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * By default the child component does not perform the enter transition when
   * it first mounts, regardless of the value of `in`. If you want this
   * behavior, set both `appear` and `in` to `true`.
   *
   * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
   * > only adds an additional enter transition. However, in the
   * > `<CSSTransition>` component that first enter transition does result in
   * > additional `.appear-*` classes, that way you can choose to style it
   * > differently.
   */
  appear: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * Enable or disable enter transitions.
   */
  enter: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * Enable or disable exit transitions.
   */
  exit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().bool),

  /**
   * The duration of the transition, in milliseconds.
   * Required unless `addEndListener` is provided.
   *
   * You may specify a single timeout for all transitions:
   *
   * ```jsx
   * timeout={500}
   * ```
   *
   * or individually:
   *
   * ```jsx
   * timeout={{
   *  appear: 500,
   *  enter: 300,
   *  exit: 500,
   * }}
   * ```
   *
   * - `appear` defaults to the value of `enter`
   * - `enter` defaults to `0`
   * - `exit` defaults to `0`
   *
   * @type {number | { enter?: number, exit?: number, appear?: number }}
   */
  timeout: function timeout(props) {
    var pt = _utils_PropTypes__WEBPACK_IMPORTED_MODULE_6__.timeoutsShape;
    if (!props.addEndListener) pt = pt.isRequired;

    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }

    return pt.apply(void 0, [props].concat(args));
  },

  /**
   * Add a custom transition end trigger. Called with the transitioning
   * DOM node and a `done` callback. Allows for more fine grained transition end
   * logic. Timeouts are still used as a fallback if provided.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * ```jsx
   * addEndListener={(node, done) => {
   *   // use the css transitionend event to mark the finish of a transition
   *   node.addEventListener('transitionend', done, false);
   * }}
   * ```
   */
  addEndListener: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired before the "entering" status is applied. An extra parameter
   * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool) -> void
   */
  onEnter: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired after the "entering" status is applied. An extra parameter
   * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEntering: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired after the "entered" status is applied. An extra parameter
   * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool) -> void
   */
  onEntered: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired before the "exiting" status is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement) -> void
   */
  onExit: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired after the "exiting" status is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement) -> void
   */
  onExiting: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func),

  /**
   * Callback fired after the "exited" status is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement) -> void
   */
  onExited: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func)
} : 0; // Name the function so it is clearer in the documentation

function noop() {}

Transition.defaultProps = {
  in: false,
  mountOnEnter: false,
  unmountOnExit: false,
  appear: false,
  enter: true,
  exit: true,
  onEnter: noop,
  onEntering: noop,
  onEntered: noop,
  onExit: noop,
  onExiting: noop,
  onExited: noop
};
Transition.UNMOUNTED = UNMOUNTED;
Transition.EXITED = EXITED;
Transition.ENTERING = ENTERING;
Transition.ENTERED = ENTERED;
Transition.EXITING = EXITING;
/* harmony default export */ __webpack_exports__["default"] = (Transition);

/***/ }),

/***/ "./node_modules/react-transition-group/esm/TransitionGroupContext.js":
/*!***************************************************************************!*\
  !*** ./node_modules/react-transition-group/esm/TransitionGroupContext.js ***!
  \***************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

/* harmony default export */ __webpack_exports__["default"] = (react__WEBPACK_IMPORTED_MODULE_0___default().createContext(null));

/***/ }),

/***/ "./node_modules/react-transition-group/esm/config.js":
/*!***********************************************************!*\
  !*** ./node_modules/react-transition-group/esm/config.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ({
  disabled: false
});

/***/ }),

/***/ "./node_modules/react-transition-group/esm/utils/PropTypes.js":
/*!********************************************************************!*\
  !*** ./node_modules/react-transition-group/esm/utils/PropTypes.js ***!
  \********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   classNamesShape: function() { return /* binding */ classNamesShape; },
/* harmony export */   timeoutsShape: function() { return /* binding */ timeoutsShape; }
/* harmony export */ });
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);

var timeoutsShape =  true ? prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_0___default().number), prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
  enter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number),
  exit: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number),
  appear: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().number)
}).isRequired]) : 0;
var classNamesShape =  true ? prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_0___default().string), prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
  enter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  exit: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  active: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
}), prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({
  enter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  enterDone: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  enterActive: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  exit: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  exitDone: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),
  exitActive: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)
})]) : 0;

/***/ }),

/***/ "./node_modules/react-transition-group/esm/utils/reflow.js":
/*!*****************************************************************!*\
  !*** ./node_modules/react-transition-group/esm/utils/reflow.js ***!
  \*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   forceReflow: function() { return /* binding */ forceReflow; }
/* harmony export */ });
var forceReflow = function forceReflow(node) {
  return node.scrollTop;
};

/***/ }),

/***/ "./node_modules/react/cjs/react-jsx-runtime.development.js":
/*!*****************************************************************!*\
  !*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***!
  \*****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */



if (true) {
  (function() {
'use strict';

var React = __webpack_require__(/*! react */ "react");

// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types.
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
function getIteratorFn(maybeIterable) {
  if (maybeIterable === null || typeof maybeIterable !== 'object') {
    return null;
  }

  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];

  if (typeof maybeIterator === 'function') {
    return maybeIterator;
  }

  return null;
}

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

function error(format) {
  {
    {
      for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        args[_key2 - 1] = arguments[_key2];
      }

      printWarning('error', format, args);
    }
  }
}

function printWarning(level, format, args) {
  // When changing this logic, you might want to also
  // update consoleWithStackDev.www.js as well.
  {
    var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
    var stack = ReactDebugCurrentFrame.getStackAddendum();

    if (stack !== '') {
      format += '%s';
      args = args.concat([stack]);
    } // eslint-disable-next-line react-internal/safe-string-coercion


    var argsWithFormat = args.map(function (item) {
      return String(item);
    }); // Careful: RN currently depends on this prefix

    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
    // breaks IE9: https://github.com/facebook/react/issues/13610
    // eslint-disable-next-line react-internal/no-production-logging

    Function.prototype.apply.call(console[level], console, argsWithFormat);
  }
}

// -----------------------------------------------------------------------------

var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing

var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
// stuff. Intended to enable React core members to more easily debug scheduling
// issues in DEV builds.

var enableDebugTracing = false; // Track which Fiber(s) schedule render work.

var REACT_MODULE_REFERENCE;

{
  REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}

function isValidElementType(type) {
  if (typeof type === 'string' || typeof type === 'function') {
    return true;
  } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).


  if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing  || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden  || type === REACT_OFFSCREEN_TYPE || enableScopeAPI  || enableCacheElement  || enableTransitionTracing ) {
    return true;
  }

  if (typeof type === 'object' && type !== null) {
    if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
    // types supported by any Flight configuration anywhere since
    // we don't know which Flight build this will end up being used
    // with.
    type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
      return true;
    }
  }

  return false;
}

function getWrappedName(outerType, innerType, wrapperName) {
  var displayName = outerType.displayName;

  if (displayName) {
    return displayName;
  }

  var functionName = innerType.displayName || innerType.name || '';
  return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
} // Keep in sync with react-reconciler/getComponentNameFromFiber


function getContextName(type) {
  return type.displayName || 'Context';
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.


function getComponentNameFromType(type) {
  if (type == null) {
    // Host root, text node or just invalid type.
    return null;
  }

  {
    if (typeof type.tag === 'number') {
      error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
    }
  }

  if (typeof type === 'function') {
    return type.displayName || type.name || null;
  }

  if (typeof type === 'string') {
    return type;
  }

  switch (type) {
    case REACT_FRAGMENT_TYPE:
      return 'Fragment';

    case REACT_PORTAL_TYPE:
      return 'Portal';

    case REACT_PROFILER_TYPE:
      return 'Profiler';

    case REACT_STRICT_MODE_TYPE:
      return 'StrictMode';

    case REACT_SUSPENSE_TYPE:
      return 'Suspense';

    case REACT_SUSPENSE_LIST_TYPE:
      return 'SuspenseList';

  }

  if (typeof type === 'object') {
    switch (type.$$typeof) {
      case REACT_CONTEXT_TYPE:
        var context = type;
        return getContextName(context) + '.Consumer';

      case REACT_PROVIDER_TYPE:
        var provider = type;
        return getContextName(provider._context) + '.Provider';

      case REACT_FORWARD_REF_TYPE:
        return getWrappedName(type, type.render, 'ForwardRef');

      case REACT_MEMO_TYPE:
        var outerName = type.displayName || null;

        if (outerName !== null) {
          return outerName;
        }

        return getComponentNameFromType(type.type) || 'Memo';

      case REACT_LAZY_TYPE:
        {
          var lazyComponent = type;
          var payload = lazyComponent._payload;
          var init = lazyComponent._init;

          try {
            return getComponentNameFromType(init(payload));
          } catch (x) {
            return null;
          }
        }

      // eslint-disable-next-line no-fallthrough
    }
  }

  return null;
}

var assign = Object.assign;

// Helpers to patch console.logs to avoid logging during side-effect free
// replaying on render function. This currently only patches the object
// lazily which won't cover if the log function was extracted eagerly.
// We could also eagerly patch the method.
var disabledDepth = 0;
var prevLog;
var prevInfo;
var prevWarn;
var prevError;
var prevGroup;
var prevGroupCollapsed;
var prevGroupEnd;

function disabledLog() {}

disabledLog.__reactDisabledLog = true;
function disableLogs() {
  {
    if (disabledDepth === 0) {
      /* eslint-disable react-internal/no-production-logging */
      prevLog = console.log;
      prevInfo = console.info;
      prevWarn = console.warn;
      prevError = console.error;
      prevGroup = console.group;
      prevGroupCollapsed = console.groupCollapsed;
      prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099

      var props = {
        configurable: true,
        enumerable: true,
        value: disabledLog,
        writable: true
      }; // $FlowFixMe Flow thinks console is immutable.

      Object.defineProperties(console, {
        info: props,
        log: props,
        warn: props,
        error: props,
        group: props,
        groupCollapsed: props,
        groupEnd: props
      });
      /* eslint-enable react-internal/no-production-logging */
    }

    disabledDepth++;
  }
}
function reenableLogs() {
  {
    disabledDepth--;

    if (disabledDepth === 0) {
      /* eslint-disable react-internal/no-production-logging */
      var props = {
        configurable: true,
        enumerable: true,
        writable: true
      }; // $FlowFixMe Flow thinks console is immutable.

      Object.defineProperties(console, {
        log: assign({}, props, {
          value: prevLog
        }),
        info: assign({}, props, {
          value: prevInfo
        }),
        warn: assign({}, props, {
          value: prevWarn
        }),
        error: assign({}, props, {
          value: prevError
        }),
        group: assign({}, props, {
          value: prevGroup
        }),
        groupCollapsed: assign({}, props, {
          value: prevGroupCollapsed
        }),
        groupEnd: assign({}, props, {
          value: prevGroupEnd
        })
      });
      /* eslint-enable react-internal/no-production-logging */
    }

    if (disabledDepth < 0) {
      error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
    }
  }
}

var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var prefix;
function describeBuiltInComponentFrame(name, source, ownerFn) {
  {
    if (prefix === undefined) {
      // Extract the VM specific prefix used by each line.
      try {
        throw Error();
      } catch (x) {
        var match = x.stack.trim().match(/\n( *(at )?)/);
        prefix = match && match[1] || '';
      }
    } // We use the prefix to ensure our stacks line up with native stack frames.


    return '\n' + prefix + name;
  }
}
var reentry = false;
var componentFrameCache;

{
  var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
  componentFrameCache = new PossiblyWeakMap();
}

function describeNativeComponentFrame(fn, construct) {
  // If something asked for a stack inside a fake render, it should get ignored.
  if ( !fn || reentry) {
    return '';
  }

  {
    var frame = componentFrameCache.get(fn);

    if (frame !== undefined) {
      return frame;
    }
  }

  var control;
  reentry = true;
  var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.

  Error.prepareStackTrace = undefined;
  var previousDispatcher;

  {
    previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
    // for warnings.

    ReactCurrentDispatcher.current = null;
    disableLogs();
  }

  try {
    // This should throw.
    if (construct) {
      // Something should be setting the props in the constructor.
      var Fake = function () {
        throw Error();
      }; // $FlowFixMe


      Object.defineProperty(Fake.prototype, 'props', {
        set: function () {
          // We use a throwing setter instead of frozen or non-writable props
          // because that won't throw in a non-strict mode function.
          throw Error();
        }
      });

      if (typeof Reflect === 'object' && Reflect.construct) {
        // We construct a different control for this case to include any extra
        // frames added by the construct call.
        try {
          Reflect.construct(Fake, []);
        } catch (x) {
          control = x;
        }

        Reflect.construct(fn, [], Fake);
      } else {
        try {
          Fake.call();
        } catch (x) {
          control = x;
        }

        fn.call(Fake.prototype);
      }
    } else {
      try {
        throw Error();
      } catch (x) {
        control = x;
      }

      fn();
    }
  } catch (sample) {
    // This is inlined manually because closure doesn't do it for us.
    if (sample && control && typeof sample.stack === 'string') {
      // This extracts the first frame from the sample that isn't also in the control.
      // Skipping one frame that we assume is the frame that calls the two.
      var sampleLines = sample.stack.split('\n');
      var controlLines = control.stack.split('\n');
      var s = sampleLines.length - 1;
      var c = controlLines.length - 1;

      while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
        // We expect at least one stack frame to be shared.
        // Typically this will be the root most one. However, stack frames may be
        // cut off due to maximum stack limits. In this case, one maybe cut off
        // earlier than the other. We assume that the sample is longer or the same
        // and there for cut off earlier. So we should find the root most frame in
        // the sample somewhere in the control.
        c--;
      }

      for (; s >= 1 && c >= 0; s--, c--) {
        // Next we find the first one that isn't the same which should be the
        // frame that called our sample function and the control.
        if (sampleLines[s] !== controlLines[c]) {
          // In V8, the first line is describing the message but other VMs don't.
          // If we're about to return the first line, and the control is also on the same
          // line, that's a pretty good indicator that our sample threw at same line as
          // the control. I.e. before we entered the sample frame. So we ignore this result.
          // This can happen if you passed a class to function component, or non-function.
          if (s !== 1 || c !== 1) {
            do {
              s--;
              c--; // We may still have similar intermediate frames from the construct call.
              // The next one that isn't the same should be our match though.

              if (c < 0 || sampleLines[s] !== controlLines[c]) {
                // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
                var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
                // but we have a user-provided "displayName"
                // splice it in to make the stack more readable.


                if (fn.displayName && _frame.includes('<anonymous>')) {
                  _frame = _frame.replace('<anonymous>', fn.displayName);
                }

                {
                  if (typeof fn === 'function') {
                    componentFrameCache.set(fn, _frame);
                  }
                } // Return the line we found.


                return _frame;
              }
            } while (s >= 1 && c >= 0);
          }

          break;
        }
      }
    }
  } finally {
    reentry = false;

    {
      ReactCurrentDispatcher.current = previousDispatcher;
      reenableLogs();
    }

    Error.prepareStackTrace = previousPrepareStackTrace;
  } // Fallback to just using the name if we couldn't make it throw.


  var name = fn ? fn.displayName || fn.name : '';
  var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';

  {
    if (typeof fn === 'function') {
      componentFrameCache.set(fn, syntheticFrame);
    }
  }

  return syntheticFrame;
}
function describeFunctionComponentFrame(fn, source, ownerFn) {
  {
    return describeNativeComponentFrame(fn, false);
  }
}

function shouldConstruct(Component) {
  var prototype = Component.prototype;
  return !!(prototype && prototype.isReactComponent);
}

function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {

  if (type == null) {
    return '';
  }

  if (typeof type === 'function') {
    {
      return describeNativeComponentFrame(type, shouldConstruct(type));
    }
  }

  if (typeof type === 'string') {
    return describeBuiltInComponentFrame(type);
  }

  switch (type) {
    case REACT_SUSPENSE_TYPE:
      return describeBuiltInComponentFrame('Suspense');

    case REACT_SUSPENSE_LIST_TYPE:
      return describeBuiltInComponentFrame('SuspenseList');
  }

  if (typeof type === 'object') {
    switch (type.$$typeof) {
      case REACT_FORWARD_REF_TYPE:
        return describeFunctionComponentFrame(type.render);

      case REACT_MEMO_TYPE:
        // Memo may contain any component type so we recursively resolve it.
        return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);

      case REACT_LAZY_TYPE:
        {
          var lazyComponent = type;
          var payload = lazyComponent._payload;
          var init = lazyComponent._init;

          try {
            // Lazy may contain any component type so we recursively resolve it.
            return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
          } catch (x) {}
        }
    }
  }

  return '';
}

var hasOwnProperty = Object.prototype.hasOwnProperty;

var loggedTypeFailures = {};
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;

function setCurrentlyValidatingElement(element) {
  {
    if (element) {
      var owner = element._owner;
      var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
      ReactDebugCurrentFrame.setExtraStackFrame(stack);
    } else {
      ReactDebugCurrentFrame.setExtraStackFrame(null);
    }
  }
}

function checkPropTypes(typeSpecs, values, location, componentName, element) {
  {
    // $FlowFixMe This is okay but Flow doesn't know it.
    var has = Function.call.bind(hasOwnProperty);

    for (var typeSpecName in typeSpecs) {
      if (has(typeSpecs, typeSpecName)) {
        var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
        // fail the render phase where it didn't fail before. So we log it.
        // After these have been cleaned up, we'll let them throw.

        try {
          // This is intentionally an invariant that gets caught. It's the same
          // behavior as without this statement except with a better message.
          if (typeof typeSpecs[typeSpecName] !== 'function') {
            // eslint-disable-next-line react-internal/prod-error-codes
            var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
            err.name = 'Invariant Violation';
            throw err;
          }

          error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
        } catch (ex) {
          error$1 = ex;
        }

        if (error$1 && !(error$1 instanceof Error)) {
          setCurrentlyValidatingElement(element);

          error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);

          setCurrentlyValidatingElement(null);
        }

        if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
          // Only monitor this failure once because there tends to be a lot of the
          // same error.
          loggedTypeFailures[error$1.message] = true;
          setCurrentlyValidatingElement(element);

          error('Failed %s type: %s', location, error$1.message);

          setCurrentlyValidatingElement(null);
        }
      }
    }
  }
}

var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare

function isArray(a) {
  return isArrayImpl(a);
}

/*
 * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
 * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
 *
 * The functions in this module will throw an easier-to-understand,
 * easier-to-debug exception with a clear errors message message explaining the
 * problem. (Instead of a confusing exception thrown inside the implementation
 * of the `value` object).
 */
// $FlowFixMe only called in DEV, so void return is not possible.
function typeName(value) {
  {
    // toStringTag is needed for namespaced types like Temporal.Instant
    var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
    var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
    return type;
  }
} // $FlowFixMe only called in DEV, so void return is not possible.


function willCoercionThrow(value) {
  {
    try {
      testStringCoercion(value);
      return false;
    } catch (e) {
      return true;
    }
  }
}

function testStringCoercion(value) {
  // If you ended up here by following an exception call stack, here's what's
  // happened: you supplied an object or symbol value to React (as a prop, key,
  // DOM attribute, CSS property, string ref, etc.) and when React tried to
  // coerce it to a string using `'' + value`, an exception was thrown.
  //
  // The most common types that will cause this exception are `Symbol` instances
  // and Temporal objects like `Temporal.Instant`. But any object that has a
  // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
  // exception. (Library authors do this to prevent users from using built-in
  // numeric operators like `+` or comparison operators like `>=` because custom
  // methods are needed to perform accurate arithmetic or comparison.)
  //
  // To fix the problem, coerce this object or symbol value to a string before
  // passing it to React. The most reliable way is usually `String(value)`.
  //
  // To find which value is throwing, check the browser or debugger console.
  // Before this exception was thrown, there should be `console.error` output
  // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
  // problem and how that type was used: key, atrribute, input value prop, etc.
  // In most cases, this console output also shows the component and its
  // ancestor components where the exception happened.
  //
  // eslint-disable-next-line react-internal/safe-string-coercion
  return '' + value;
}
function checkKeyStringCoercion(value) {
  {
    if (willCoercionThrow(value)) {
      error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));

      return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
    }
  }
}

var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var RESERVED_PROPS = {
  key: true,
  ref: true,
  __self: true,
  __source: true
};
var specialPropKeyWarningShown;
var specialPropRefWarningShown;
var didWarnAboutStringRefs;

{
  didWarnAboutStringRefs = {};
}

function hasValidRef(config) {
  {
    if (hasOwnProperty.call(config, 'ref')) {
      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;

      if (getter && getter.isReactWarning) {
        return false;
      }
    }
  }

  return config.ref !== undefined;
}

function hasValidKey(config) {
  {
    if (hasOwnProperty.call(config, 'key')) {
      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;

      if (getter && getter.isReactWarning) {
        return false;
      }
    }
  }

  return config.key !== undefined;
}

function warnIfStringRefCannotBeAutoConverted(config, self) {
  {
    if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
      var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);

      if (!didWarnAboutStringRefs[componentName]) {
        error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);

        didWarnAboutStringRefs[componentName] = true;
      }
    }
  }
}

function defineKeyPropWarningGetter(props, displayName) {
  {
    var warnAboutAccessingKey = function () {
      if (!specialPropKeyWarningShown) {
        specialPropKeyWarningShown = true;

        error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
      }
    };

    warnAboutAccessingKey.isReactWarning = true;
    Object.defineProperty(props, 'key', {
      get: warnAboutAccessingKey,
      configurable: true
    });
  }
}

function defineRefPropWarningGetter(props, displayName) {
  {
    var warnAboutAccessingRef = function () {
      if (!specialPropRefWarningShown) {
        specialPropRefWarningShown = true;

        error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
      }
    };

    warnAboutAccessingRef.isReactWarning = true;
    Object.defineProperty(props, 'ref', {
      get: warnAboutAccessingRef,
      configurable: true
    });
  }
}
/**
 * Factory method to create a new React element. This no longer adheres to
 * the class pattern, so do not use new to call it. Also, instanceof check
 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
 * if something is a React Element.
 *
 * @param {*} type
 * @param {*} props
 * @param {*} key
 * @param {string|object} ref
 * @param {*} owner
 * @param {*} self A *temporary* helper to detect places where `this` is
 * different from the `owner` when React.createElement is called, so that we
 * can warn. We want to get rid of owner and replace string `ref`s with arrow
 * functions, and as long as `this` and owner are the same, there will be no
 * change in behavior.
 * @param {*} source An annotation object (added by a transpiler or otherwise)
 * indicating filename, line number, and/or other information.
 * @internal
 */


var ReactElement = function (type, key, ref, self, source, owner, props) {
  var element = {
    // This tag allows us to uniquely identify this as a React Element
    $$typeof: REACT_ELEMENT_TYPE,
    // Built-in properties that belong on the element
    type: type,
    key: key,
    ref: ref,
    props: props,
    // Record the component responsible for creating this element.
    _owner: owner
  };

  {
    // The validation flag is currently mutative. We put it on
    // an external backing store so that we can freeze the whole object.
    // This can be replaced with a WeakMap once they are implemented in
    // commonly used development environments.
    element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
    // the validation flag non-enumerable (where possible, which should
    // include every environment we run tests in), so the test framework
    // ignores it.

    Object.defineProperty(element._store, 'validated', {
      configurable: false,
      enumerable: false,
      writable: true,
      value: false
    }); // self and source are DEV only properties.

    Object.defineProperty(element, '_self', {
      configurable: false,
      enumerable: false,
      writable: false,
      value: self
    }); // Two elements created in two different places should be considered
    // equal for testing purposes and therefore we hide it from enumeration.

    Object.defineProperty(element, '_source', {
      configurable: false,
      enumerable: false,
      writable: false,
      value: source
    });

    if (Object.freeze) {
      Object.freeze(element.props);
      Object.freeze(element);
    }
  }

  return element;
};
/**
 * https://github.com/reactjs/rfcs/pull/107
 * @param {*} type
 * @param {object} props
 * @param {string} key
 */

function jsxDEV(type, config, maybeKey, source, self) {
  {
    var propName; // Reserved names are extracted

    var props = {};
    var key = null;
    var ref = null; // Currently, key can be spread in as a prop. This causes a potential
    // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
    // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
    // but as an intermediary step, we will use jsxDEV for everything except
    // <div {...props} key="Hi" />, because we aren't currently able to tell if
    // key is explicitly declared to be undefined or not.

    if (maybeKey !== undefined) {
      {
        checkKeyStringCoercion(maybeKey);
      }

      key = '' + maybeKey;
    }

    if (hasValidKey(config)) {
      {
        checkKeyStringCoercion(config.key);
      }

      key = '' + config.key;
    }

    if (hasValidRef(config)) {
      ref = config.ref;
      warnIfStringRefCannotBeAutoConverted(config, self);
    } // Remaining properties are added to a new props object


    for (propName in config) {
      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
        props[propName] = config[propName];
      }
    } // Resolve default props


    if (type && type.defaultProps) {
      var defaultProps = type.defaultProps;

      for (propName in defaultProps) {
        if (props[propName] === undefined) {
          props[propName] = defaultProps[propName];
        }
      }
    }

    if (key || ref) {
      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;

      if (key) {
        defineKeyPropWarningGetter(props, displayName);
      }

      if (ref) {
        defineRefPropWarningGetter(props, displayName);
      }
    }

    return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  }
}

var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;

function setCurrentlyValidatingElement$1(element) {
  {
    if (element) {
      var owner = element._owner;
      var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
      ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
    } else {
      ReactDebugCurrentFrame$1.setExtraStackFrame(null);
    }
  }
}

var propTypesMisspellWarningShown;

{
  propTypesMisspellWarningShown = false;
}
/**
 * Verifies the object is a ReactElement.
 * See https://reactjs.org/docs/react-api.html#isvalidelement
 * @param {?object} object
 * @return {boolean} True if `object` is a ReactElement.
 * @final
 */


function isValidElement(object) {
  {
    return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  }
}

function getDeclarationErrorAddendum() {
  {
    if (ReactCurrentOwner$1.current) {
      var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);

      if (name) {
        return '\n\nCheck the render method of `' + name + '`.';
      }
    }

    return '';
  }
}

function getSourceInfoErrorAddendum(source) {
  {
    if (source !== undefined) {
      var fileName = source.fileName.replace(/^.*[\\\/]/, '');
      var lineNumber = source.lineNumber;
      return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
    }

    return '';
  }
}
/**
 * Warn if there's no key explicitly set on dynamic arrays of children or
 * object keys are not valid. This allows us to keep track of children between
 * updates.
 */


var ownerHasKeyUseWarning = {};

function getCurrentComponentErrorInfo(parentType) {
  {
    var info = getDeclarationErrorAddendum();

    if (!info) {
      var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;

      if (parentName) {
        info = "\n\nCheck the top-level render call using <" + parentName + ">.";
      }
    }

    return info;
  }
}
/**
 * Warn if the element doesn't have an explicit key assigned to it.
 * This element is in an array. The array could grow and shrink or be
 * reordered. All children that haven't already been validated are required to
 * have a "key" property assigned to it. Error statuses are cached so a warning
 * will only be shown once.
 *
 * @internal
 * @param {ReactElement} element Element that requires a key.
 * @param {*} parentType element's parent's type.
 */


function validateExplicitKey(element, parentType) {
  {
    if (!element._store || element._store.validated || element.key != null) {
      return;
    }

    element._store.validated = true;
    var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);

    if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
      return;
    }

    ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
    // property, it may be the creator of the child that's responsible for
    // assigning it a key.

    var childOwner = '';

    if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
      // Give the component that originally created this child.
      childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
    }

    setCurrentlyValidatingElement$1(element);

    error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);

    setCurrentlyValidatingElement$1(null);
  }
}
/**
 * Ensure that every element either is passed in a static location, in an
 * array with an explicit keys property defined, or in an object literal
 * with valid key property.
 *
 * @internal
 * @param {ReactNode} node Statically passed child of any type.
 * @param {*} parentType node's parent's type.
 */


function validateChildKeys(node, parentType) {
  {
    if (typeof node !== 'object') {
      return;
    }

    if (isArray(node)) {
      for (var i = 0; i < node.length; i++) {
        var child = node[i];

        if (isValidElement(child)) {
          validateExplicitKey(child, parentType);
        }
      }
    } else if (isValidElement(node)) {
      // This element was passed in a valid location.
      if (node._store) {
        node._store.validated = true;
      }
    } else if (node) {
      var iteratorFn = getIteratorFn(node);

      if (typeof iteratorFn === 'function') {
        // Entry iterators used to provide implicit keys,
        // but now we print a separate warning for them later.
        if (iteratorFn !== node.entries) {
          var iterator = iteratorFn.call(node);
          var step;

          while (!(step = iterator.next()).done) {
            if (isValidElement(step.value)) {
              validateExplicitKey(step.value, parentType);
            }
          }
        }
      }
    }
  }
}
/**
 * Given an element, validate that its props follow the propTypes definition,
 * provided by the type.
 *
 * @param {ReactElement} element
 */


function validatePropTypes(element) {
  {
    var type = element.type;

    if (type === null || type === undefined || typeof type === 'string') {
      return;
    }

    var propTypes;

    if (typeof type === 'function') {
      propTypes = type.propTypes;
    } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
    // Inner props are checked in the reconciler.
    type.$$typeof === REACT_MEMO_TYPE)) {
      propTypes = type.propTypes;
    } else {
      return;
    }

    if (propTypes) {
      // Intentionally inside to avoid triggering lazy initializers:
      var name = getComponentNameFromType(type);
      checkPropTypes(propTypes, element.props, 'prop', name, element);
    } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
      propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:

      var _name = getComponentNameFromType(type);

      error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
    }

    if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
      error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
    }
  }
}
/**
 * Given a fragment, validate that it can only be provided with fragment props
 * @param {ReactElement} fragment
 */


function validateFragmentProps(fragment) {
  {
    var keys = Object.keys(fragment.props);

    for (var i = 0; i < keys.length; i++) {
      var key = keys[i];

      if (key !== 'children' && key !== 'key') {
        setCurrentlyValidatingElement$1(fragment);

        error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);

        setCurrentlyValidatingElement$1(null);
        break;
      }
    }

    if (fragment.ref !== null) {
      setCurrentlyValidatingElement$1(fragment);

      error('Invalid attribute `ref` supplied to `React.Fragment`.');

      setCurrentlyValidatingElement$1(null);
    }
  }
}

var didWarnAboutKeySpread = {};
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
  {
    var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
    // succeed and there will likely be errors in render.

    if (!validType) {
      var info = '';

      if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
        info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
      }

      var sourceInfo = getSourceInfoErrorAddendum(source);

      if (sourceInfo) {
        info += sourceInfo;
      } else {
        info += getDeclarationErrorAddendum();
      }

      var typeString;

      if (type === null) {
        typeString = 'null';
      } else if (isArray(type)) {
        typeString = 'array';
      } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
        typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
        info = ' Did you accidentally export a JSX literal instead of a component?';
      } else {
        typeString = typeof type;
      }

      error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
    }

    var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
    // TODO: Drop this when these are no longer allowed as the type argument.

    if (element == null) {
      return element;
    } // Skip key warning if the type isn't valid since our key validation logic
    // doesn't expect a non-string/function type and can throw confusing errors.
    // We don't want exception behavior to differ between dev and prod.
    // (Rendering will throw with a helpful message and as soon as the type is
    // fixed, the key warnings will appear.)


    if (validType) {
      var children = props.children;

      if (children !== undefined) {
        if (isStaticChildren) {
          if (isArray(children)) {
            for (var i = 0; i < children.length; i++) {
              validateChildKeys(children[i], type);
            }

            if (Object.freeze) {
              Object.freeze(children);
            }
          } else {
            error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
          }
        } else {
          validateChildKeys(children, type);
        }
      }
    }

    {
      if (hasOwnProperty.call(props, 'key')) {
        var componentName = getComponentNameFromType(type);
        var keys = Object.keys(props).filter(function (k) {
          return k !== 'key';
        });
        var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';

        if (!didWarnAboutKeySpread[componentName + beforeExample]) {
          var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';

          error('A props object containing a "key" prop is being spread into JSX:\n' + '  let props = %s;\n' + '  <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + '  let props = %s;\n' + '  <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);

          didWarnAboutKeySpread[componentName + beforeExample] = true;
        }
      }
    }

    if (type === REACT_FRAGMENT_TYPE) {
      validateFragmentProps(element);
    } else {
      validatePropTypes(element);
    }

    return element;
  }
} // These two functions exist to still get child warnings in dev
// even with the prod transform. This means that jsxDEV is purely
// opt-in behavior for better messages but that we won't stop
// giving you warnings if you use production apis.

function jsxWithValidationStatic(type, props, key) {
  {
    return jsxWithValidation(type, props, key, true);
  }
}
function jsxWithValidationDynamic(type, props, key) {
  {
    return jsxWithValidation(type, props, key, false);
  }
}

var jsx =  jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
// for now we can ship identical prod functions

var jsxs =  jsxWithValidationStatic ;

exports.Fragment = REACT_FRAGMENT_TYPE;
exports.jsx = jsx;
exports.jsxs = jsxs;
  })();
}


/***/ }),

/***/ "./node_modules/react/jsx-runtime.js":
/*!*******************************************!*\
  !*** ./node_modules/react/jsx-runtime.js ***!
  \*******************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";


if (false) // removed by dead control flow
{} else {
  module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/react/cjs/react-jsx-runtime.development.js");
}


/***/ }),

/***/ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js":
/*!**********************************************************************************************!*\
  !*** ./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js ***!
  \**********************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
/**
 * @license React
 * use-sync-external-store-shim.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


 true &&
  (function () {
    function is(x, y) {
      return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
    }
    function useSyncExternalStore$2(subscribe, getSnapshot) {
      didWarnOld18Alpha ||
        void 0 === React.startTransition ||
        ((didWarnOld18Alpha = !0),
        console.error(
          "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
        ));
      var value = getSnapshot();
      if (!didWarnUncachedGetSnapshot) {
        var cachedValue = getSnapshot();
        objectIs(value, cachedValue) ||
          (console.error(
            "The result of getSnapshot should be cached to avoid an infinite loop"
          ),
          (didWarnUncachedGetSnapshot = !0));
      }
      cachedValue = useState({
        inst: { value: value, getSnapshot: getSnapshot }
      });
      var inst = cachedValue[0].inst,
        forceUpdate = cachedValue[1];
      useLayoutEffect(
        function () {
          inst.value = value;
          inst.getSnapshot = getSnapshot;
          checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
        },
        [subscribe, value, getSnapshot]
      );
      useEffect(
        function () {
          checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
          return subscribe(function () {
            checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
          });
        },
        [subscribe]
      );
      useDebugValue(value);
      return value;
    }
    function checkIfSnapshotChanged(inst) {
      var latestGetSnapshot = inst.getSnapshot;
      inst = inst.value;
      try {
        var nextValue = latestGetSnapshot();
        return !objectIs(inst, nextValue);
      } catch (error) {
        return !0;
      }
    }
    function useSyncExternalStore$1(subscribe, getSnapshot) {
      return getSnapshot();
    }
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
    var React = __webpack_require__(/*! react */ "react"),
      objectIs = "function" === typeof Object.is ? Object.is : is,
      useState = React.useState,
      useEffect = React.useEffect,
      useLayoutEffect = React.useLayoutEffect,
      useDebugValue = React.useDebugValue,
      didWarnOld18Alpha = !1,
      didWarnUncachedGetSnapshot = !1,
      shim =
        "undefined" === typeof window ||
        "undefined" === typeof window.document ||
        "undefined" === typeof window.document.createElement
          ? useSyncExternalStore$1
          : useSyncExternalStore$2;
    exports.useSyncExternalStore =
      void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
  })();


/***/ }),

/***/ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js":
/*!************************************************************************************************************!*\
  !*** ./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js ***!
  \************************************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
/**
 * @license React
 * use-sync-external-store-shim/with-selector.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


 true &&
  (function () {
    function is(x, y) {
      return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
    }
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
    var React = __webpack_require__(/*! react */ "react"),
      shim = __webpack_require__(/*! use-sync-external-store/shim */ "./node_modules/use-sync-external-store/shim/index.js"),
      objectIs = "function" === typeof Object.is ? Object.is : is,
      useSyncExternalStore = shim.useSyncExternalStore,
      useRef = React.useRef,
      useEffect = React.useEffect,
      useMemo = React.useMemo,
      useDebugValue = React.useDebugValue;
    exports.useSyncExternalStoreWithSelector = function (
      subscribe,
      getSnapshot,
      getServerSnapshot,
      selector,
      isEqual
    ) {
      var instRef = useRef(null);
      if (null === instRef.current) {
        var inst = { hasValue: !1, value: null };
        instRef.current = inst;
      } else inst = instRef.current;
      instRef = useMemo(
        function () {
          function memoizedSelector(nextSnapshot) {
            if (!hasMemo) {
              hasMemo = !0;
              memoizedSnapshot = nextSnapshot;
              nextSnapshot = selector(nextSnapshot);
              if (void 0 !== isEqual && inst.hasValue) {
                var currentSelection = inst.value;
                if (isEqual(currentSelection, nextSnapshot))
                  return (memoizedSelection = currentSelection);
              }
              return (memoizedSelection = nextSnapshot);
            }
            currentSelection = memoizedSelection;
            if (objectIs(memoizedSnapshot, nextSnapshot))
              return currentSelection;
            var nextSelection = selector(nextSnapshot);
            if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
              return (memoizedSnapshot = nextSnapshot), currentSelection;
            memoizedSnapshot = nextSnapshot;
            return (memoizedSelection = nextSelection);
          }
          var hasMemo = !1,
            memoizedSnapshot,
            memoizedSelection,
            maybeGetServerSnapshot =
              void 0 === getServerSnapshot ? null : getServerSnapshot;
          return [
            function () {
              return memoizedSelector(getSnapshot());
            },
            null === maybeGetServerSnapshot
              ? void 0
              : function () {
                  return memoizedSelector(maybeGetServerSnapshot());
                }
          ];
        },
        [getSnapshot, getServerSnapshot, selector, isEqual]
      );
      var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
      useEffect(
        function () {
          inst.hasValue = !0;
          inst.value = value;
        },
        [value]
      );
      useDebugValue(value);
      return value;
    };
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
  })();


/***/ }),

/***/ "./node_modules/use-sync-external-store/shim/index.js":
/*!************************************************************!*\
  !*** ./node_modules/use-sync-external-store/shim/index.js ***!
  \************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";


if (false) // removed by dead control flow
{} else {
  module.exports = __webpack_require__(/*! ../cjs/use-sync-external-store-shim.development.js */ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js");
}


/***/ }),

/***/ "./node_modules/use-sync-external-store/shim/with-selector.js":
/*!********************************************************************!*\
  !*** ./node_modules/use-sync-external-store/shim/with-selector.js ***!
  \********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

"use strict";


if (false) // removed by dead control flow
{} else {
  module.exports = __webpack_require__(/*! ../cjs/use-sync-external-store-shim/with-selector.development.js */ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js");
}


/***/ }),

/***/ "./node_modules/w3c-keyname/index.js":
/*!*******************************************!*\
  !*** ./node_modules/w3c-keyname/index.js ***!
  \*******************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   base: function() { return /* binding */ base; },
/* harmony export */   keyName: function() { return /* binding */ keyName; },
/* harmony export */   shift: function() { return /* binding */ shift; }
/* harmony export */ });
var base = {
  8: "Backspace",
  9: "Tab",
  10: "Enter",
  12: "NumLock",
  13: "Enter",
  16: "Shift",
  17: "Control",
  18: "Alt",
  20: "CapsLock",
  27: "Escape",
  32: " ",
  33: "PageUp",
  34: "PageDown",
  35: "End",
  36: "Home",
  37: "ArrowLeft",
  38: "ArrowUp",
  39: "ArrowRight",
  40: "ArrowDown",
  44: "PrintScreen",
  45: "Insert",
  46: "Delete",
  59: ";",
  61: "=",
  91: "Meta",
  92: "Meta",
  106: "*",
  107: "+",
  108: ",",
  109: "-",
  110: ".",
  111: "/",
  144: "NumLock",
  145: "ScrollLock",
  160: "Shift",
  161: "Shift",
  162: "Control",
  163: "Control",
  164: "Alt",
  165: "Alt",
  173: "-",
  186: ";",
  187: "=",
  188: ",",
  189: "-",
  190: ".",
  191: "/",
  192: "`",
  219: "[",
  220: "\\",
  221: "]",
  222: "'"
}

var shift = {
  48: ")",
  49: "!",
  50: "@",
  51: "#",
  52: "$",
  53: "%",
  54: "^",
  55: "&",
  56: "*",
  57: "(",
  59: ":",
  61: "+",
  173: "_",
  186: ":",
  187: "+",
  188: "<",
  189: "_",
  190: ">",
  191: "?",
  192: "~",
  219: "{",
  220: "|",
  221: "}",
  222: "\""
}

var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform)
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent)

// Fill in the digit keys
for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)

// The function keys
for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i

// And the alphabetic keys
for (var i = 65; i <= 90; i++) {
  base[i] = String.fromCharCode(i + 32)
  shift[i] = String.fromCharCode(i)
}

// For each code that doesn't have a shift-equivalent, copy the base name
for (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]

function keyName(event) {
  // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.
  // On IE, shift effect is never included in `.key`.
  var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||
      ie && event.shiftKey && event.key && event.key.length == 1 ||
      event.key == "Unidentified"
  var name = (!ignoreKey && event.key) ||
    (event.shiftKey ? shift : base)[event.keyCode] ||
    event.key || "Unidentified"
  // Edge sometimes produces wrong names (Issue #3)
  if (name == "Esc") name = "Escape"
  if (name == "Del") name = "Delete"
  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
  if (name == "Left") name = "ArrowLeft"
  if (name == "Up") name = "ArrowUp"
  if (name == "Right") name = "ArrowRight"
  if (name == "Down") name = "ArrowDown"
  return name
}


/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/api.ts":
/*!***********************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/api.ts ***!
  \***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   apiClient: function() { return /* binding */ apiClient; }
/* harmony export */ });
/* harmony import */ var _elementor_http_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/http-client */ "@elementor/http-client");
/* harmony import */ var _elementor_http_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_http_client__WEBPACK_IMPORTED_MODULE_0__);

const ELEMENTOR_SETTING_URL = 'elementor/v1/settings';
const apiClient = {
  getElementorSetting: key => (0,_elementor_http_client__WEBPACK_IMPORTED_MODULE_0__.httpService)().get(`${ELEMENTOR_SETTING_URL}/${key}`).then(res => formatSettingResponse(res.data)),
  updateElementorSetting: (key, value) => (0,_elementor_http_client__WEBPACK_IMPORTED_MODULE_0__.httpService)().put(`${ELEMENTOR_SETTING_URL}/${key}`, {
    value
  })
};
const formatSettingResponse = response => response.data.value;

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts":
/*!*********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   HookOutsideProviderError: function() { return /* binding */ HookOutsideProviderError; },
/* harmony export */   MissingPropTypeError: function() { return /* binding */ MissingPropTypeError; },
/* harmony export */   UnsupportedParentError: function() { return /* binding */ UnsupportedParentError; }
/* harmony export */ });
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_0__);

const MissingPropTypeError = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.createError)({
  code: 'missing_prop_provider_prop_type',
  message: 'Prop type is missing'
});
const UnsupportedParentError = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.createError)({
  code: 'unsupported_prop_provider_prop_type',
  message: 'Parent prop type is not supported'
});
const HookOutsideProviderError = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.createError)({
  code: 'hook_outside_provider',
  message: 'Hook used outside of provider'
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PropKeyProvider: function() { return /* reexport safe */ _prop_key_context__WEBPACK_IMPORTED_MODULE_1__.PropKeyProvider; },
/* harmony export */   PropProvider: function() { return /* reexport safe */ _prop_context__WEBPACK_IMPORTED_MODULE_0__.PropProvider; },
/* harmony export */   useBoundProp: function() { return /* reexport safe */ _use_bound_prop__WEBPACK_IMPORTED_MODULE_2__.useBoundProp; },
/* harmony export */   usePropContext: function() { return /* reexport safe */ _prop_context__WEBPACK_IMPORTED_MODULE_0__.usePropContext; },
/* harmony export */   usePropKeyContext: function() { return /* reexport safe */ _prop_key_context__WEBPACK_IMPORTED_MODULE_1__.usePropKeyContext; }
/* harmony export */ });
/* harmony import */ var _prop_context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-context.tsx");
/* harmony import */ var _prop_key_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./prop-key-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-key-context.tsx");
/* harmony import */ var _use_bound_prop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./use-bound-prop */ "./packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts");




/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-context.tsx":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/bound-prop-context/prop-context.tsx ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PropProvider: function() { return /* binding */ PropProvider; },
/* harmony export */   usePropContext: function() { return /* binding */ usePropContext; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts");



const PropContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
const PropProvider = ({
  children,
  value,
  setValue,
  propType,
  placeholder,
  baseValue,
  isDisabled
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PropContext.Provider, {
    value: {
      value,
      propType,
      setValue: setValue,
      placeholder,
      baseValue,
      isDisabled
    }
  }, children);
};
const usePropContext = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PropContext);
  if (!context) {
    throw new _errors__WEBPACK_IMPORTED_MODULE_1__.HookOutsideProviderError({
      context: {
        hook: 'usePropContext',
        provider: 'PropProvider'
      }
    });
  }
  return context;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-key-context.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/bound-prop-context/prop-key-context.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PropKeyProvider: function() { return /* binding */ PropKeyProvider; },
/* harmony export */   usePropKeyContext: function() { return /* binding */ usePropKeyContext; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts");
/* harmony import */ var _prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-context.tsx");




const PropKeyContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
const PropKeyProvider = ({
  children,
  bind
}) => {
  const {
    propType
  } = (0,_prop_context__WEBPACK_IMPORTED_MODULE_2__.usePropContext)();
  if (!propType) {
    throw new _errors__WEBPACK_IMPORTED_MODULE_1__.MissingPropTypeError({
      context: {
        bind
      }
    });
  }
  if (propType.kind === 'array') {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ArrayPropKeyProvider, {
      bind: bind
    }, children);
  }
  if (propType.kind === 'object') {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ObjectPropKeyProvider, {
      bind: bind
    }, children);
  }
  throw new _errors__WEBPACK_IMPORTED_MODULE_1__.UnsupportedParentError({
    context: {
      propType
    }
  });
};
const ObjectPropKeyProvider = ({
  children,
  bind
}) => {
  const context = (0,_prop_context__WEBPACK_IMPORTED_MODULE_2__.usePropContext)();
  const {
    path
  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PropKeyContext) ?? {};
  const setValue = (value, options, meta) => {
    const newValue = {
      ...(context.value ?? context.baseValue),
      [bind]: value
    };
    return context?.setValue(newValue, options, {
      ...meta,
      bind
    });
  };
  const value = context.value?.[bind];
  const placeholder = context.placeholder?.[bind];
  const baseValue = context.baseValue?.[bind];
  const propType = context.propType.shape[bind];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PropKeyContext.Provider, {
    value: {
      ...context,
      value,
      setValue,
      placeholder,
      baseValue,
      bind,
      propType,
      path: [...(path ?? []), bind]
    }
  }, children);
};
const ArrayPropKeyProvider = ({
  children,
  bind
}) => {
  const context = (0,_prop_context__WEBPACK_IMPORTED_MODULE_2__.usePropContext)();
  const {
    path
  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PropKeyContext) ?? {};
  const setValue = (value, options) => {
    const newValue = [...(context.value ?? context.baseValue ?? [])];
    newValue[Number(bind)] = value;
    return context?.setValue(newValue, options, {
      bind
    });
  };
  const value = context.value?.[Number(bind)];
  const placeholder = context.placeholder?.[Number(bind)];
  const baseValue = context.baseValue?.[Number(bind)];
  const propType = context.propType.item_prop_type;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PropKeyContext.Provider, {
    value: {
      ...context,
      value,
      setValue,
      bind,
      propType,
      path: [...(path ?? []), bind],
      placeholder: placeholder ?? undefined,
      baseValue: baseValue ?? undefined
    }
  }, children);
};
const usePropKeyContext = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(PropKeyContext);
  if (!context) {
    throw new _errors__WEBPACK_IMPORTED_MODULE_1__.HookOutsideProviderError({
      context: {
        hook: 'usePropKeyContext',
        provider: 'PropKeyProvider'
      }
    });
  }
  return context;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useBoundProp: function() { return /* binding */ useBoundProp; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ "./packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts");
/* harmony import */ var _prop_key_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./prop-key-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/prop-key-context.tsx");



function useBoundProp(propTypeUtil) {
  const propKeyContext = (0,_prop_key_context__WEBPACK_IMPORTED_MODULE_2__.usePropKeyContext)();
  const {
    isValid,
    validate,
    restoreValue
  } = useValidation(propKeyContext.propType);
  const disabled = propKeyContext.isDisabled?.(propKeyContext.propType);
  const resetValue = () => {
    propKeyContext.setValue(propKeyContext.propType.initial_value ?? null);
  };

  // allow using the hook without a propTypeUtil, with no modifications or validations.
  if (!propTypeUtil) {
    return {
      ...propKeyContext,
      disabled,
      resetValue
    };
  }
  function setValue(value, options, meta) {
    if (!validate(value, meta?.validation)) {
      return;
    }
    if (value === null) {
      return propKeyContext?.setValue(null, options, meta);
    }
    return propKeyContext?.setValue(propTypeUtil?.create(value, options), {}, meta);
  }
  const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
  const hasBaseValue = propKeyContext.baseValue !== undefined && propKeyContext.baseValue !== null;
  const fallbackValue = hasBaseValue ? null : propType.default;
  const value = propTypeUtil.extract(propKeyContext.value ?? fallbackValue ?? null);
  const baseValue = propTypeUtil.extract(propKeyContext.baseValue ?? null);
  const placeholder = propTypeUtil.extract(propKeyContext.placeholder ?? propKeyContext.baseValue ?? null);
  return {
    ...propKeyContext,
    propType,
    setValue,
    value: isValid ? value : null,
    restoreValue,
    placeholder,
    baseValue,
    disabled,
    resetValue
  };
}
const useValidation = propType => {
  const [isValid, setIsValid] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true);

  // If the value does not pass the prop type validation, set the isValid state to false.
  // This will prevent the value from being set in the model, and its fallback will be used instead.
  const validate = (value, validation) => {
    let valid = true;
    if (propType.settings.required && value === null) {
      valid = false;
    }
    if (validation && !validation(value)) {
      valid = false;
    }
    setIsValid(valid);
    return valid;
  };
  const restoreValue = () => setIsValid(true);
  return {
    isValid,
    setIsValid,
    validate,
    restoreValue
  };
};

// utils
const resolveUnionPropType = (propType, key) => {
  let resolvedPropType = propType;
  if (propType.kind === 'union') {
    resolvedPropType = propType.prop_types[key];
  }
  if (!resolvedPropType) {
    throw new _errors__WEBPACK_IMPORTED_MODULE_1__.MissingPropTypeError({
      context: {
        key
      }
    });
  }
  return resolvedPropType;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/autocomplete.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/autocomplete.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Autocomplete: function() { return /* binding */ Autocomplete; },
/* harmony export */   findMatchingOption: function() { return /* binding */ findMatchingOption; },
/* harmony export */   isCategorizedOptionPool: function() { return /* binding */ isCategorizedOptionPool; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const Autocomplete = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((props, ref) => {
  const {
    options,
    onOptionChange,
    onTextChange,
    allowCustomValues = false,
    placeholder = '',
    minInputLength = 2,
    value = '',
    startAdornment,
    disablePortal = true,
    inputProps,
    ...restProps
  } = props;
  const optionKeys = factoryFilter(value, options, minInputLength).map(({
    id
  }) => id);
  const allowClear = !!value;

  // Prevents MUI warning when freeSolo/allowCustomValues is false
  const muiWarningPreventer = allowCustomValues || !!value?.toString()?.length;
  const isOptionEqualToValue = muiWarningPreventer ? undefined : () => true;
  const isValueFromOptions = typeof value === 'number' && !!findMatchingOption(options, value);
  const valueLength = value?.toString()?.length ?? 0;
  const meetsMinLength = valueLength >= minInputLength;
  const shouldOpen = meetsMinLength && (allowCustomValues ? optionKeys.length > 0 : true);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Autocomplete, _extends({}, restProps, {
    ref: ref,
    forcePopupIcon: false,
    disablePortal: disablePortal,
    disableClearable: true // Disabled component's auto clear icon to use our custom one instead
    ,
    freeSolo: allowCustomValues,
    openOnFocus: false,
    open: shouldOpen,
    value: value?.toString() || '',
    size: 'tiny',
    onChange: (_, newValue) => onOptionChange(Number(newValue)),
    readOnly: isValueFromOptions,
    options: optionKeys,
    getOptionKey: optionId => findMatchingOption(options, optionId)?.id || optionId,
    getOptionLabel: optionId => findMatchingOption(options, optionId)?.label || optionId.toString(),
    groupBy: isCategorizedOptionPool(options) ? optionId => findMatchingOption(options, optionId)?.groupLabel || optionId : undefined,
    isOptionEqualToValue: isOptionEqualToValue,
    filterOptions: () => optionKeys,
    renderOption: (optionProps, optionId) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, _extends({
      component: "li"
    }, optionProps, {
      key: optionProps.id
    }), findMatchingOption(options, optionId)?.label ?? optionId),
    renderInput: params => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(TextInput, {
      params: params,
      handleChange: newValue => onTextChange?.(newValue),
      allowClear: allowClear,
      placeholder: placeholder,
      hasSelectedValue: isValueFromOptions,
      startAdornment: startAdornment,
      extraInputProps: inputProps
    })
  }));
});
const TextInput = ({
  params,
  allowClear,
  placeholder,
  handleChange,
  hasSelectedValue,
  startAdornment,
  extraInputProps
}) => {
  const onChange = event => {
    handleChange(event.target.value);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, _extends({}, params, {
    placeholder: placeholder,
    onChange: onChange,
    inputProps: {
      ...(params.inputProps ?? {}),
      ...(extraInputProps ?? {})
    },
    sx: {
      '& .MuiInputBase-input': {
        cursor: hasSelectedValue ? 'default' : undefined
      }
    },
    InputProps: {
      ...params.InputProps,
      startAdornment: startAdornment || params.InputProps.startAdornment,
      endAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ClearButton, {
        params: params,
        allowClear: allowClear,
        handleChange: handleChange
      })
    }
  }));
};
const ClearButton = ({
  allowClear,
  handleChange,
  params
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
  position: "end"
}, allowClear && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
  size: params.size,
  onClick: () => handleChange(null),
  sx: {
    cursor: 'pointer'
  }
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.XIcon, {
  fontSize: params.size
})));
function findMatchingOption(options, optionId = null) {
  const formattedOption = (optionId || '').toString();
  return options.find(({
    id
  }) => formattedOption === id.toString());
}
function isCategorizedOptionPool(options) {
  if (options.length <= 1) {
    return false;
  }
  const uniqueGroupLabels = new Set(options.map(option => option.groupLabel));
  return uniqueGroupLabels.size > 1; // should not categorize options if there is only one group
}
function factoryFilter(newValue, options, minInputLength) {
  if (null === newValue) {
    return options;
  }
  const formattedValue = String(newValue || '')?.toLowerCase();
  if (formattedValue.length < minInputLength) {
    return new Array(0);
  }
  return options.filter(option => String(option.id).toLowerCase().includes(formattedValue) || option.label.toLowerCase().includes(formattedValue));
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/chips-list.tsx":
/*!******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/chips-list.tsx ***!
  \******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ChipsList: function() { return /* binding */ ChipsList; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }


const CHIP_SIZE = 'tiny';
function ChipsList({
  getLabel,
  getTagProps,
  values
}) {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, values.map((option, index) => {
    const {
      key,
      ...tagProps
    } = getTagProps({
      index
    });
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Chip, _extends({
      key: key,
      label: getLabel(option),
      size: CHIP_SIZE
    }, tagProps));
  }));
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/conditional-control-infotip.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/conditional-control-infotip.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ConditionalControlInfotip: function() { return /* binding */ ConditionalControlInfotip; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const DEFAULT_COLOR = 'secondary';
const ConditionalControlInfotip = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(({
  children,
  title,
  description,
  alertProps,
  infotipProps,
  ...props
}, ref) => {
  const theme = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.useTheme)();
  const isUiRtl = 'rtl' === theme.direction;
  const isEnabled = props.isEnabled && (title || description);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    ref: ref
  }, isEnabled ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DirectionProvider, {
    rtl: isUiRtl
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Infotip, _extends({
    placement: 'right',
    color: DEFAULT_COLOR,
    slotProps: {
      popper: {
        modifiers: [{
          name: 'offset',
          options: {
            offset: [0, 10]
          }
        }]
      }
    }
  }, infotipProps, {
    content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.InfoAlert, _extends({
      color: DEFAULT_COLOR,
      sx: {
        width: 300,
        px: 1.5,
        py: 2
      }
    }, alertProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
      sx: {
        flexDirection: 'column',
        display: 'flex',
        gap: 0.5
      }
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.AlertTitle, null, title), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, description)))
  }), children)) : children);
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/conditional-tooltip.tsx":
/*!***************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/conditional-tooltip.tsx ***!
  \***************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ConditionalTooltip: function() { return /* binding */ ConditionalTooltip; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);


const ConditionalTooltip = ({
  showTooltip,
  children,
  label
}) => {
  return showTooltip && label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
    title: label,
    disableFocusListener: true,
    placement: "top"
  }, children) : children;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx":
/*!**************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-form-label.tsx ***!
  \**************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlFormLabel: function() { return /* binding */ ControlFormLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }


const ControlFormLabel = props => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.FormLabel, _extends({
    size: "tiny"
  }, props));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-label.tsx":
/*!*********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-label.tsx ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlLabel: function() { return /* binding */ ControlLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../control-adornments/control-adornments */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx");
/* harmony import */ var _control_form_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");




const ControlLabel = ({
  children,
  ...props
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, {
    direction: "row",
    alignItems: "center",
    justifyItems: "start",
    gap: 0.25
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_form_label__WEBPACK_IMPORTED_MODULE_3__.ControlFormLabel, props, children), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_2__.ControlAdornments, null));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx":
/*!****************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx ***!
  \****************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DisableItemAction: function() { return /* binding */ DisableItemAction; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");





const SIZE = 'tiny';
const DisableItemAction = () => {
  const {
    items,
    updateItem,
    index = -1
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  if (index === -1) {
    return null;
  }
  const propDisabled = items[index].item.disabled ?? false;
  const toggleLabel = propDisabled ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Show', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Hide', 'elementor');
  const onClick = () => {
    const self = structuredClone(items[index].item);
    self.disabled = !self.disabled;
    if (!self.disabled) {
      delete self.disabled;
    }
    updateItem(self, index);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: toggleLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: SIZE,
    onClick: onClick,
    "aria-label": toggleLabel
  }, propDisabled ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EyeOffIcon, {
    fontSize: SIZE
  }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EyeIcon, {
    fontSize: SIZE
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx":
/*!******************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx ***!
  \******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DuplicateItemAction: function() { return /* binding */ DuplicateItemAction; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");





const SIZE = 'tiny';
const DuplicateItemAction = () => {
  const {
    items,
    addItem,
    index = -1,
    isItemDisabled
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  if (index === -1) {
    return null;
  }
  const duplicateLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Duplicate', 'elementor');
  const item = items[index]?.item;
  const onClick = ev => {
    const newItem = structuredClone(item);
    addItem(ev, {
      item: newItem,
      index: index + 1
    });
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: duplicateLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: SIZE,
    onClick: onClick,
    "aria-label": duplicateLabel,
    disabled: isItemDisabled(index)
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.CopyIcon, {
    fontSize: SIZE
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx":
/*!***************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx ***!
  \***************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RemoveItemAction: function() { return /* binding */ RemoveItemAction; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");





const SIZE = 'tiny';
const RemoveItemAction = () => {
  const {
    removeItem,
    index = -1
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  if (index === -1) {
    return null;
  }
  const removeLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Remove', 'elementor');
  const onClick = () => removeItem(index);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: removeLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: SIZE,
    onClick: onClick,
    "aria-label": removeLabel
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.XIcon, {
    fontSize: SIZE
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/tooltip-add-item-action.tsx":
/*!********************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/actions/tooltip-add-item-action.tsx ***!
  \********************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TooltipAddItemAction: function() { return /* binding */ TooltipAddItemAction; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");





const SIZE = 'tiny';
const TooltipAddItemAction = ({
  disabled = false,
  enableTooltip = false,
  tooltipContent = null,
  newItemIndex,
  ariaLabel
}) => {
  const {
    addItem
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  const onClick = ev => addItem(ev, {
    index: newItemIndex
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ConditionalToolTip, {
    content: tooltipContent,
    enable: enableTooltip
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    component: "span",
    sx: {
      cursor: disabled ? 'not-allowed' : 'pointer'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: SIZE,
    disabled: disabled,
    onClick: onClick
    /* Translators: %s: Aria label. */,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Add %s item', 'elementor'), ariaLabel?.toLowerCase())
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PlusIcon, {
    fontSize: SIZE
  }))));
};
const ConditionalToolTip = ({
  children,
  enable,
  content
}) => enable && content ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Infotip, {
  placement: "right",
  color: "secondary",
  content: content
}, children) : children;

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/item-context.tsx":
/*!*********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/context/item-context.tsx ***!
  \*********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ItemContext: function() { return /* binding */ ItemContext; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

const ItemContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({
  index: -1,
  value: {}
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx":
/*!*************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx ***!
  \*************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EMPTY_OPEN_ITEM: function() { return /* binding */ EMPTY_OPEN_ITEM; },
/* harmony export */   RepeaterContextProvider: function() { return /* binding */ RepeaterContextProvider; },
/* harmony export */   useRepeaterContext: function() { return /* binding */ useRepeaterContext; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context_use_bound_prop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../bound-prop-context/use-bound-prop */ "./packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts");
/* harmony import */ var _hooks_use_repeater_popover_dismiss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../hooks/use-repeater-popover-dismiss */ "./packages/packages/libs/editor-controls/src/hooks/use-repeater-popover-dismiss.ts");
/* harmony import */ var _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../hooks/use-sync-external-state */ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx");
/* harmony import */ var _services_event_bus__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../services/event-bus */ "./packages/packages/libs/editor-controls/src/services/event-bus.ts");
/* harmony import */ var _item_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./item-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/item-context.tsx");








const RepeaterContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
const EMPTY_OPEN_ITEM = -1;
const useRepeaterContext = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(RepeaterContext);
  const itemContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_item_context__WEBPACK_IMPORTED_MODULE_6__.ItemContext);
  if (!context) {
    throw new Error('useRepeaterContext must be used within a RepeaterContextProvider');
  }
  return {
    ...context,
    ...itemContext
  };
};
const RepeaterContextProvider = ({
  children,
  initial,
  propTypeUtil,
  isItemDisabled = () => false
}) => {
  const {
    value: repeaterValues,
    setValue: setRepeaterValues
  } = (0,_bound_prop_context_use_bound_prop__WEBPACK_IMPORTED_MODULE_2__.useBoundProp)(propTypeUtil);
  const [items, setItems] = (0,_hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_4__.useSyncExternalState)({
    external: repeaterValues,
    fallback: () => [],
    setExternal: setRepeaterValues,
    persistWhen: () => true
  });
  const [uniqueKeys, setUniqueKeys] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => {
    return items?.map(() => generateUniqueKey()) ?? [];
  });
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    const nextLength = items?.length ?? 0;
    setUniqueKeys(prev => {
      const prevLength = prev.length;
      if (prevLength === nextLength) {
        return prev;
      }
      if (prevLength > nextLength) {
        return prev.slice(0, nextLength);
      }
      return [...prev, ...Array.from({
        length: nextLength - prevLength
      }, generateUniqueKey)];
    });
  }, [items?.length]);
  const itemsWithKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => uniqueKeys.map((key, index) => ({
    key,
    item: items[index]
  })).filter(({
    item
  }) => item !== undefined), [uniqueKeys, items]);
  const handleSetItems = newItemsWithKeys => {
    setItems(newItemsWithKeys.map(({
      item
    }) => item));
  };
  const [openItemIndex, setOpenItemIndex] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(EMPTY_OPEN_ITEM);
  const [rowRef, setRowRef] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
  const isOpen = openItemIndex !== EMPTY_OPEN_ITEM;
  const popoverState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.usePopupState)({
    variant: 'popover'
  });
  const addItem = (ev, config) => {
    const item = config?.item ?? {
      ...initial
    };
    const newIndex = config?.index ?? items.length;
    const newKey = generateUniqueKey();
    const newItems = [...items];
    newItems.splice(newIndex, 0, item);
    setItems(newItems);
    setUniqueKeys([...uniqueKeys.slice(0, newIndex), newKey, ...uniqueKeys.slice(newIndex)]);
    setOpenItemIndex(newIndex);
    popoverState.open(rowRef ?? ev);
    _services_event_bus__WEBPACK_IMPORTED_MODULE_5__.eventBus.emit(`${propTypeUtil.key}-item-added`, {
      itemValue: initial.value
    });
  };
  const removeItem = index => {
    const itemToRemove = items[index];
    setItems(items.filter((_, pos) => pos !== index));
    setUniqueKeys(uniqueKeys.filter((_, pos) => pos !== index));
    _services_event_bus__WEBPACK_IMPORTED_MODULE_5__.eventBus.emit(`${propTypeUtil.key}-item-removed`, {
      itemValue: itemToRemove?.value
    });
  };
  const updateItem = (updatedItem, index) => {
    const newItems = [...items.slice(0, index), updatedItem, ...items.slice(index + 1)];
    setItems(newItems);
  };
  const closePopover = () => {
    if (!isOpen) {
      return;
    }
    setOpenItemIndex(EMPTY_OPEN_ITEM);
    setRowRef(null);
    popoverState.close();
  };
  (0,_hooks_use_repeater_popover_dismiss__WEBPACK_IMPORTED_MODULE_3__.usePopoverDismiss)({
    isOpen,
    onClose: closePopover
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RepeaterContext.Provider, {
    value: {
      isOpen,
      openItemIndex,
      setOpenItemIndex,
      items: itemsWithKeys ?? [],
      setItems: handleSetItems,
      popoverState,
      initial,
      updateItem: updateItem,
      addItem: addItem,
      removeItem,
      rowRef,
      setRowRef,
      isItemDisabled: index => isItemDisabled(itemsWithKeys[index].item)
    }
  }, children);
};
const generateUniqueKey = () => {
  return Date.now() + Math.floor(Math.random() * 1000000);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/control-repeater.tsx":
/*!*****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/control-repeater.tsx ***!
  \*****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlRepeater: function() { return /* binding */ ControlRepeater; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _section_content__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../section-content */ "./packages/packages/libs/editor-controls/src/components/section-content.tsx");
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");



const ControlRepeater = ({
  children,
  initial,
  propTypeUtil,
  isItemDisabled
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_section_content__WEBPACK_IMPORTED_MODULE_1__.SectionContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_context_repeater_context__WEBPACK_IMPORTED_MODULE_2__.RepeaterContextProvider, {
    initial: initial,
    propTypeUtil: propTypeUtil,
    isItemDisabled: isItemDisabled
  }, children));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlRepeater: function() { return /* reexport safe */ _control_repeater__WEBPACK_IMPORTED_MODULE_3__.ControlRepeater; },
/* harmony export */   Item: function() { return /* reexport safe */ _items_item__WEBPACK_IMPORTED_MODULE_2__.Item; },
/* harmony export */   ItemsContainer: function() { return /* reexport safe */ _items_items_container__WEBPACK_IMPORTED_MODULE_1__.ItemsContainer; },
/* harmony export */   TooltipAddItemAction: function() { return /* reexport safe */ _actions_tooltip_add_item_action__WEBPACK_IMPORTED_MODULE_0__.TooltipAddItemAction; }
/* harmony export */ });
/* harmony import */ var _actions_tooltip_add_item_action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./actions/tooltip-add-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/tooltip-add-item-action.tsx");
/* harmony import */ var _items_items_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./items/items-container */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/items-container.tsx");
/* harmony import */ var _items_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./items/item */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/item.tsx");
/* harmony import */ var _control_repeater__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/control-repeater.tsx");





/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx":
/*!************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx ***!
  \************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EditItemPopover: function() { return /* binding */ EditItemPopover; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _repeater_repeater_popover__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../repeater/repeater-popover */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-popover.tsx");
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }





const EditItemPopover = ({
  children
}) => {
  const {
    popoverState,
    openItemIndex,
    isOpen,
    rowRef,
    setOpenItemIndex,
    setRowRef
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  if (!isOpen || !rowRef) {
    return null;
  }
  const onClose = () => {
    setRowRef(null);
    popoverState.setAnchorEl(null);
    setOpenItemIndex(_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.EMPTY_OPEN_ITEM);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_repeater_popover__WEBPACK_IMPORTED_MODULE_3__.RepeaterPopover, _extends({
    width: rowRef.offsetWidth
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.bindPopover)(popoverState), {
    onClose: onClose
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.PropKeyProvider, {
    bind: String(openItemIndex)
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, null, children)));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/item.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/items/item.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Item: function() { return /* binding */ Item; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../hooks/use-repeatable-control-context */ "./packages/packages/libs/editor-controls/src/hooks/use-repeatable-control-context.ts");
/* harmony import */ var _repeater_repeater_tag__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../repeater/repeater-tag */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-tag.tsx");
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _locations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../locations */ "./packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const Item = ({
  Label,
  Icon,
  actions
}) => {
  const {
    popoverState,
    setRowRef,
    openItemIndex,
    setOpenItemIndex,
    index = -1,
    value,
    isItemDisabled
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_5__.useRepeaterContext)();
  const repeatableContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_3__.RepeatableControlContext);
  const disableOpen = !!repeatableContext?.props?.readOnly;
  const triggerProps = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.bindTrigger)(popoverState);
  const onClick = ev => {
    if (disableOpen || isItemDisabled(index)) {
      return;
    }
    triggerProps.onClick(ev);
    setOpenItemIndex(index);
  };
  const setRef = ref => {
    if (!ref || openItemIndex !== index || ref === popoverState.anchorEl) {
      return;
    }
    setRowRef(ref);
    popoverState.setAnchorEl(ref);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_repeater_tag__WEBPACK_IMPORTED_MODULE_4__.RepeaterTag, _extends({
    ref: setRef,
    label: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_locations__WEBPACK_IMPORTED_MODULE_6__.RepeaterItemLabelSlot, {
      value: value
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, {
      value: value
    })),
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Open item', 'elementor')
  }, triggerProps, {
    onClick: onClick,
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_locations__WEBPACK_IMPORTED_MODULE_6__.RepeaterItemIconSlot, {
      value: value
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Icon, {
      value: value
    })),
    sx: {
      minHeight: theme => theme.spacing(3.5),
      ...(isItemDisabled(index) && {
        '[role="button"]': {
          cursor: 'not-allowed'
        }
      })
    },
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_locations__WEBPACK_IMPORTED_MODULE_6__.RepeaterItemActionsSlot, {
      index: index ?? -1
    }), actions)
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/items-container.tsx":
/*!**********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/items/items-container.tsx ***!
  \**********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ItemsContainer: function() { return /* binding */ ItemsContainer; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _repeater_sortable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../repeater/sortable */ "./packages/packages/libs/editor-controls/src/components/repeater/sortable.tsx");
/* harmony import */ var _context_item_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../context/item-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/item-context.tsx");
/* harmony import */ var _context_repeater_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");




const ItemsContainer = ({
  isSortable = true,
  children
}) => {
  const {
    items,
    setItems
  } = (0,_context_repeater_context__WEBPACK_IMPORTED_MODULE_3__.useRepeaterContext)();
  const keys = items.map(({
    key
  }) => key);
  if (!children) {
    return null;
  }
  const onChangeOrder = newKeys => {
    setItems(newKeys.map(key => {
      const index = items.findIndex(item => item.key === key);
      return items[index];
    }));
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_sortable__WEBPACK_IMPORTED_MODULE_1__.SortableProvider, {
    value: keys,
    onChange: onChangeOrder
  }, keys.map((key, index) => {
    const value = items[index].item;
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_sortable__WEBPACK_IMPORTED_MODULE_1__.SortableItem, {
      id: key,
      key: `sortable-${key}`,
      disabled: !isSortable
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_context_item_context__WEBPACK_IMPORTED_MODULE_2__.ItemContext.Provider, {
      value: {
        index,
        value
      }
    }, children));
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeaterItemActionsSlot: function() { return /* binding */ RepeaterItemActionsSlot; },
/* harmony export */   RepeaterItemIconSlot: function() { return /* binding */ RepeaterItemIconSlot; },
/* harmony export */   RepeaterItemLabelSlot: function() { return /* binding */ RepeaterItemLabelSlot; },
/* harmony export */   injectIntoRepeaterItemActions: function() { return /* binding */ injectIntoRepeaterItemActions; },
/* harmony export */   injectIntoRepeaterItemIcon: function() { return /* binding */ injectIntoRepeaterItemIcon; },
/* harmony export */   injectIntoRepeaterItemLabel: function() { return /* binding */ injectIntoRepeaterItemLabel; }
/* harmony export */ });
/* harmony import */ var _elementor_locations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/locations */ "@elementor/locations");
/* harmony import */ var _elementor_locations__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_locations__WEBPACK_IMPORTED_MODULE_0__);


// Repeaters
const {
  Slot: RepeaterItemIconSlot,
  inject: injectIntoRepeaterItemIcon
} = (0,_elementor_locations__WEBPACK_IMPORTED_MODULE_0__.createReplaceableLocation)();
const {
  Slot: RepeaterItemLabelSlot,
  inject: injectIntoRepeaterItemLabel
} = (0,_elementor_locations__WEBPACK_IMPORTED_MODULE_0__.createReplaceableLocation)();
const {
  Slot: RepeaterItemActionsSlot,
  inject: injectIntoRepeaterItemActions
} = (0,_elementor_locations__WEBPACK_IMPORTED_MODULE_0__.createLocation)();

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlToggleButtonGroup: function() { return /* binding */ ControlToggleButtonGroup; },
/* harmony export */   StyledToggleButton: function() { return /* binding */ StyledToggleButton; },
/* harmony export */   StyledToggleButtonGroup: function() { return /* binding */ StyledToggleButtonGroup; },
/* harmony export */   ToggleButtonGroupUi: function() { return /* binding */ ToggleButtonGroupUi; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _conditional_tooltip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditional-tooltip */ "./packages/packages/libs/editor-controls/src/components/conditional-tooltip.tsx");






const StyledToggleButtonGroup = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButtonGroup))`
	${({
  justify
}) => `justify-content: ${justify};`}
	button:not( :last-of-type ) {
		border-start-end-radius: 0;
		border-end-end-radius: 0;
	}
	button:not( :first-of-type ) {
		border-start-start-radius: 0;
		border-end-start-radius: 0;
	}
	button:last-of-type {
		border-start-end-radius: 8px;
		border-end-end-radius: 8px;
	}
`;
const StyledToggleButton = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButton), {
  shouldForwardProp: prop => prop !== 'isPlaceholder'
})`
	${({
  theme,
  isPlaceholder
}) => isPlaceholder && `
		color: ${theme.palette.text.tertiary};
		background-color: ${theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.04)' : 'rgba(0,0,0,0.02)'};

		&:hover {
			background-color: ${theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.04)'};
		}
	`}
`;
const ToggleButtonGroupUi = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(({
  justify = 'end',
  size = 'tiny',
  value,
  onChange,
  items,
  maxItems,
  exclusive = false,
  fullWidth = false,
  disabled,
  placeholder
}, ref) => {
  const shouldSliceItems = exclusive && maxItems !== undefined && items.length > maxItems;
  const menuItems = shouldSliceItems ? items.slice(maxItems - 1) : [];
  const fixedItems = shouldSliceItems ? items.slice(0, maxItems - 1) : items;
  const theme = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.useTheme)();
  const isRtl = 'rtl' === theme.direction;
  const handleChange = (_, newValue) => {
    onChange(newValue);
  };
  const getGridTemplateColumns = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    const isOffLimits = menuItems?.length;
    const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
    const templateColumnsSuffix = isOffLimits ? 'auto' : '';
    if (fullWidth) {
      return `repeat(${itemsCount}, 1fr) ${templateColumnsSuffix}`;
    }
    return `repeat(${itemsCount}, minmax(0, 25%)) ${templateColumnsSuffix}`;
  }, [menuItems?.length, fixedItems.length, fullWidth]);
  const shouldShowExclusivePlaceholder = exclusive && (value === null || value === undefined || value === '');
  const nonExclusiveSelectedValues = !exclusive && Array.isArray(value) ? value.map(v => typeof v === 'string' ? v : '').join(' ').trim().split(/\s+/).filter(Boolean) : [];
  const shouldShowNonExclusivePlaceholder = !exclusive && nonExclusiveSelectedValues.length === 0;
  const getPlaceholderArray = placeholderValue => {
    if (Array.isArray(placeholderValue)) {
      return placeholderValue.flatMap(p => {
        if (typeof p === 'string') {
          return p.trim().split(/\s+/).filter(Boolean);
        }
        return [];
      });
    }
    if (typeof placeholderValue === 'string') {
      return placeholderValue.trim().split(/\s+/).filter(Boolean);
    }
    return [];
  };
  const placeholderArray = getPlaceholderArray(placeholder);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledToggleButtonGroup, {
    ref: ref,
    justify: justify,
    value: value,
    onChange: handleChange,
    exclusive: exclusive,
    disabled: disabled,
    sx: {
      direction: isRtl ? 'rtl /* @noflip */' : 'ltr /* @noflip */',
      display: 'grid',
      gridTemplateColumns: getGridTemplateColumns,
      width: `100%`
    }
  }, fixedItems.map(({
    label,
    value: buttonValue,
    renderContent: Content,
    showTooltip,
    disabled: optionDisabled = false
  }) => {
    const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_conditional_tooltip__WEBPACK_IMPORTED_MODULE_4__.ConditionalTooltip, {
      key: buttonValue,
      label: label,
      showTooltip: showTooltip || false
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledToggleButton, {
      value: buttonValue,
      "aria-label": label,
      size: size,
      fullWidth: fullWidth,
      isPlaceholder: isPlaceholder,
      disabled: optionDisabled
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Content, {
      size: size
    })));
  }), menuItems.length && exclusive && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(SplitButtonGroup, {
    size: size,
    value: value || null,
    onChange: onChange,
    items: menuItems,
    fullWidth: fullWidth
  }));
});
const ControlToggleButtonGroup = props => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ToggleButtonGroupUi, props));
};
const SplitButtonGroup = ({
  size = 'tiny',
  onChange,
  items,
  fullWidth,
  value
}) => {
  const previewButton = usePreviewButton(items, value);
  const [isMenuOpen, setIsMenuOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const menuButtonRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const onMenuToggle = ev => {
    setIsMenuOpen(prev => !prev);
    ev.preventDefault();
  };
  const onMenuItemClick = newValue => {
    setIsMenuOpen(false);
    onToggleItem(newValue);
  };
  const onToggleItem = newValue => {
    const shouldRemove = newValue === value;
    onChange(shouldRemove ? null : newValue);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButton, {
    value: previewButton.value,
    "aria-label": previewButton.label,
    size: size,
    fullWidth: fullWidth,
    onClick: ev => {
      ev.preventDefault();
      onMenuItemClick(previewButton.value);
    }
  }, previewButton.renderContent({
    size
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButton, {
    size: size,
    "aria-expanded": isMenuOpen ? 'true' : undefined,
    "aria-haspopup": "menu",
    "aria-pressed": undefined,
    onClick: onMenuToggle,
    ref: menuButtonRef,
    value: "__chevron-icon-button__"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.ChevronDownIcon, {
    fontSize: size
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, {
    open: isMenuOpen,
    onClose: () => setIsMenuOpen(false),
    anchorEl: menuButtonRef.current,
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'right'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'right'
    },
    sx: {
      mt: 0.5
    }
  }, items.filter(item => item.value !== previewButton.value).map(({
    label,
    value: buttonValue
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, {
    key: buttonValue,
    selected: buttonValue === value,
    onClick: () => onMenuItemClick(buttonValue)
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, {
    sx: {
      fontSize: '14px'
    }
  }, label))))));
};
const usePreviewButton = (items, value) => {
  const [previewButton, setPreviewButton] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(items.find(item => item.value === value) ?? items[0]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    const selectedButton = items.find(item => item.value === value);
    if (selectedButton) {
      setPreviewButton(selectedButton);
    }
  }, [items, value]);
  return previewButton;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/enable-unfiltered-modal.tsx":
/*!*******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/enable-unfiltered-modal.tsx ***!
  \*******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EnableUnfilteredModal: function() { return /* binding */ EnableUnfilteredModal; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/use-unfiltered-files-upload */ "./packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts");





const ADMIN_TITLE_TEXT = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Enable Unfiltered Uploads', 'elementor');
const ADMIN_CONTENT_TEXT = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.', 'elementor');
const ADMIN_FAILED_CONTENT_TEXT_PT1 = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Failed to enable unfiltered files upload.', 'elementor');
const ADMIN_FAILED_CONTENT_TEXT_PT2 = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('You can try again, if the problem persists, please contact support.', 'elementor');
const WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
const EnableUnfilteredModal = props => {
  const {
    mutateAsync,
    isPending
  } = (0,_hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_3__.useUpdateUnfilteredFilesUpload)();
  const [isError, setIsError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const onClose = enabled => {
    props.onClose(enabled);
    setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
  };
  const handleEnable = async () => {
    try {
      const response = await mutateAsync({
        allowUnfilteredFilesUpload: true
      });
      if (response?.data?.success === false) {
        setIsError(true);
      } else {
        props.onClose(true);
      }
    } catch {
      setIsError(true);
    }
  };
  const dialogProps = {
    ...props,
    isPending,
    handleEnable,
    isError,
    onClose
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(AdminDialog, dialogProps);
};
const AdminDialog = ({
  open,
  onClose,
  handleEnable,
  isPending,
  isError
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Dialog, {
  open: open,
  maxWidth: 'sm',
  onClose: () => onClose(false)
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.DialogHeader, {
  logo: false
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.DialogTitle, null, ADMIN_TITLE_TEXT)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.DialogContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.DialogContentText, null, isError ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, ADMIN_FAILED_CONTENT_TEXT_PT1, " ", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("br", null), " ", ADMIN_FAILED_CONTENT_TEXT_PT2) : ADMIN_CONTENT_TEXT)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.DialogActions, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Button, {
  size: 'medium',
  color: "secondary",
  onClick: () => onClose(false)
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Cancel', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Button, {
  size: 'medium',
  onClick: () => handleEnable(),
  variant: "contained",
  color: "primary",
  disabled: isPending
}, isPending ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.CircularProgress, {
  size: 24
}) : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Enable', 'elementor'))));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/icon-buttons/clear-icon-button.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/icon-buttons/clear-icon-button.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ClearIconButton: function() { return /* binding */ ClearIconButton; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);



const CustomIconButton = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton)(({
  theme
}) => ({
  width: theme.spacing(2.5),
  height: theme.spacing(2.5)
}));
const ClearIconButton = ({
  tooltipText,
  onClick,
  disabled,
  size = 'tiny'
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
  title: tooltipText,
  placement: "top",
  disableInteractive: true
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(CustomIconButton, {
  "aria-label": tooltipText,
  size: size,
  onClick: onClick,
  disabled: disabled
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.BrushBigIcon, {
  fontSize: size
})));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/inline-editor-toolbar.tsx":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/inline-editor-toolbar.tsx ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InlineEditorToolbar: function() { return /* binding */ InlineEditorToolbar; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _tiptap_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tiptap/react */ "./node_modules/@tiptap/react/dist/index.js");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _url_popover__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url-popover */ "./packages/packages/libs/editor-controls/src/components/url-popover.tsx");








const InlineEditorToolbar = ({
  editor,
  elementId,
  sx = {}
}) => {
  const [urlValue, setUrlValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
  const [openInNewTab, setOpenInNewTab] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const toolbarRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const linkPopupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({
    variant: 'popover'
  });
  const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
  const editorState = (0,_tiptap_react__WEBPACK_IMPORTED_MODULE_4__.useEditorState)({
    editor,
    selector: ctx => possibleFormats.filter(format => ctx.editor.isActive(format))
  });
  const formatButtonsList = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    const buttons = Object.values(formatButtons);
    if (isElementClickable) {
      return buttons.filter(button => button.action !== 'link');
    }
    return buttons;
  }, [isElementClickable]);
  const handleLinkClick = () => {
    const linkAttrs = editor.getAttributes('link');
    setUrlValue(linkAttrs.href || '');
    setOpenInNewTab(linkAttrs.target === '_blank');
    linkPopupState.open(toolbarRef.current);
  };
  const handleUrlChange = event => {
    setUrlValue(event.target.value);
  };
  const handleToggleNewTab = () => {
    setOpenInNewTab(!openInNewTab);
  };
  const handleUrlSubmit = () => {
    if (urlValue) {
      editor.chain().focus().setLink({
        href: urlValue,
        target: openInNewTab ? '_blank' : '_self'
      }).run();
    } else {
      editor.chain().focus().unsetLink().run();
    }
    if (elementId) {
      window.dispatchEvent(new CustomEvent('elementor:inline-link-changed', {
        detail: {
          elementId
        }
      }));
    }
    linkPopupState.close();
  };
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    editor?.commands?.focus();
  }, [editor]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
    ref: toolbarRef,
    sx: {
      display: 'inline-flex',
      gap: 0.5,
      padding: 0.5,
      borderRadius: '8px',
      backgroundColor: 'background.paper',
      boxShadow: '0 2px 8px rgba(0, 0, 0, 0.2)',
      alignItems: 'center',
      visibility: linkPopupState.isOpen ? 'hidden' : 'visible',
      pointerEvents: linkPopupState.isOpen ? 'none' : 'all',
      ...sx
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, {
    title: clearButton.label,
    placement: "top",
    sx: {
      borderRadius: '8px'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.IconButton, {
    "aria-label": clearButton.label,
    onClick: () => clearButton.method(editor),
    size: "tiny"
  }, clearButton.icon)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ToggleButtonGroup, {
    value: editorState,
    size: "tiny",
    sx: {
      display: 'flex',
      gap: 0.5,
      border: 'none',
      [`& .${_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.toggleButtonGroupClasses.firstButton}, & .${_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.toggleButtonGroupClasses.middleButton}, & .${_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.toggleButtonGroupClasses.lastButton}`]: {
        borderRadius: '8px',
        border: 'none',
        marginLeft: 0,
        '&.Mui-selected': {
          marginLeft: 0
        },
        '& + &.Mui-selected': {
          marginLeft: 0
        }
      }
    }
  }, formatButtonsList.map(button => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, {
    title: button.label,
    key: button.action,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.ToggleButton, {
    value: button.action,
    "aria-label": button.label,
    size: "tiny",
    onClick: () => {
      if (button.action === 'link') {
        handleLinkClick();
      } else {
        button.method?.(editor);
      }
      editor?.commands?.focus();
    }
  }, button.icon)))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_url_popover__WEBPACK_IMPORTED_MODULE_6__.UrlPopover, {
    popupState: linkPopupState,
    anchorRef: toolbarRef,
    restoreValue: handleUrlSubmit,
    value: urlValue,
    onChange: handleUrlChange,
    openInNewTab: openInNewTab,
    onToggleNewTab: handleToggleNewTab
  }));
};
const checkIfElementIsClickable = elementId => {
  const container = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getContainer)(elementId);
  const type = container?.model.get('widgetType');
  const isButton = type === 'e-button';
  const hasLink = !!(0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementSetting)(elementId, 'link')?.value?.destination;
  return isButton || hasLink;
};
const toolbarButtons = {
  clear: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Clear', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.MinusIcon, {
      fontSize: "tiny"
    }),
    action: 'clear',
    method: editor => {
      editor.chain().focus().clearNodes().unsetAllMarks().run();
    }
  },
  bold: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bold', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.BoldIcon, {
      fontSize: "tiny"
    }),
    action: 'bold',
    method: editor => {
      editor.chain().focus().toggleBold().run();
    }
  },
  italic: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Italic', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ItalicIcon, {
      fontSize: "tiny"
    }),
    action: 'italic',
    method: editor => {
      editor.chain().focus().toggleItalic().run();
    }
  },
  underline: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Underline', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.UnderlineIcon, {
      fontSize: "tiny"
    }),
    action: 'underline',
    method: editor => {
      editor.chain().focus().toggleUnderline().run();
    }
  },
  strike: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Strikethrough', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.StrikethroughIcon, {
      fontSize: "tiny"
    }),
    action: 'strike',
    method: editor => {
      editor.chain().focus().toggleStrike().run();
    }
  },
  superscript: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Superscript', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.SuperscriptIcon, {
      fontSize: "tiny"
    }),
    action: 'superscript',
    method: editor => {
      editor.chain().focus().toggleSuperscript().run();
    }
  },
  subscript: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Subscript', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.SubscriptIcon, {
      fontSize: "tiny"
    }),
    action: 'subscript',
    method: editor => {
      editor.chain().focus().toggleSubscript().run();
    }
  },
  link: {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Link', 'elementor'),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.LinkIcon, {
      fontSize: "tiny"
    }),
    action: 'link',
    method: null
  }
};
const {
  clear: clearButton,
  ...formatButtons
} = toolbarButtons;
const possibleFormats = Object.keys(formatButtons);

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/inline-editor.tsx":
/*!*********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/inline-editor.tsx ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InlineEditor: function() { return /* binding */ InlineEditor; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _tiptap_extension_bold__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tiptap/extension-bold */ "./node_modules/@tiptap/extension-bold/dist/index.js");
/* harmony import */ var _tiptap_extension_document__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tiptap/extension-document */ "./node_modules/@tiptap/extension-document/dist/index.js");
/* harmony import */ var _tiptap_extension_hard_break__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tiptap/extension-hard-break */ "./node_modules/@tiptap/extension-hard-break/dist/index.js");
/* harmony import */ var _tiptap_extension_heading__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tiptap/extension-heading */ "./node_modules/@tiptap/extension-heading/dist/index.js");
/* harmony import */ var _tiptap_extension_italic__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @tiptap/extension-italic */ "./node_modules/@tiptap/extension-italic/dist/index.js");
/* harmony import */ var _tiptap_extension_link__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tiptap/extension-link */ "./node_modules/@tiptap/extension-link/dist/index.js");
/* harmony import */ var _tiptap_extension_paragraph__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @tiptap/extension-paragraph */ "./node_modules/@tiptap/extension-paragraph/dist/index.js");
/* harmony import */ var _tiptap_extension_strike__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @tiptap/extension-strike */ "./node_modules/@tiptap/extension-strike/dist/index.js");
/* harmony import */ var _tiptap_extension_subscript__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tiptap/extension-subscript */ "./node_modules/@tiptap/extension-subscript/dist/index.js");
/* harmony import */ var _tiptap_extension_superscript__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @tiptap/extension-superscript */ "./node_modules/@tiptap/extension-superscript/dist/index.js");
/* harmony import */ var _tiptap_extension_text__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @tiptap/extension-text */ "./node_modules/@tiptap/extension-text/dist/index.js");
/* harmony import */ var _tiptap_extension_underline__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @tiptap/extension-underline */ "./node_modules/@tiptap/extension-underline/dist/index.js");
/* harmony import */ var _tiptap_react__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @tiptap/react */ "./node_modules/@tiptap/react/dist/index.js");
/* harmony import */ var _utils_inline_editing__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/inline-editing */ "./packages/packages/libs/editor-controls/src/utils/inline-editing.ts");

















const ITALIC_KEYBOARD_SHORTCUT = 'i';
const BOLD_KEYBOARD_SHORTCUT = 'b';
const UNDERLINE_KEYBOARD_SHORTCUT = 'u';
const InlineEditor = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props, ref) => {
  const {
    value,
    setValue,
    placeholder = null,
    editorProps = {},
    elementClasses = '',
    autofocus = false,
    sx = {},
    onBlur = undefined,
    expectedTag = null,
    onEditorCreate,
    wrapperClassName,
    onSelectionEnd,
    mountElement = null
  } = props;
  const containerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const onBlurRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onBlur);
  onBlurRef.current = onBlur;
  const documentContentSettings = !!expectedTag ? 'block+' : 'inline*';
  const onUpdate = ({
    editor: updatedEditor
  }) => {
    const newValue = updatedEditor.getHTML();
    setValue((0,_utils_inline_editing__WEBPACK_IMPORTED_MODULE_15__.isEmpty)(newValue) ? null : newValue);
  };
  const onKeyDown = (_, event) => {
    if (event.key === 'Escape') {
      onBlurRef.current?.();
    }
    if (!event.metaKey && !event.ctrlKey || event.altKey) {
      return;
    }
    if ([ITALIC_KEYBOARD_SHORTCUT, BOLD_KEYBOARD_SHORTCUT, UNDERLINE_KEYBOARD_SHORTCUT].includes(event.key)) {
      event.stopPropagation();
    }
  };
  const editedElementAttributes = HTMLAttributes => ({
    ...HTMLAttributes,
    class: elementClasses
  });
  const editor = (0,_tiptap_react__WEBPACK_IMPORTED_MODULE_14__.useEditor)({
    ...(mountElement ? {
      element: mountElement
    } : {}),
    extensions: [_tiptap_extension_document__WEBPACK_IMPORTED_MODULE_3__["default"].extend({
      content: documentContentSettings
    }), _tiptap_extension_paragraph__WEBPACK_IMPORTED_MODULE_8__["default"].extend({
      renderHTML({
        HTMLAttributes
      }) {
        const tag = expectedTag ?? 'p';
        return [tag, editedElementAttributes(HTMLAttributes), 0];
      }
    }), _tiptap_extension_heading__WEBPACK_IMPORTED_MODULE_5__["default"].extend({
      renderHTML({
        node,
        HTMLAttributes
      }) {
        if (expectedTag) {
          return [expectedTag, editedElementAttributes(HTMLAttributes), 0];
        }
        const level = this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0];
        return [`h${level}`, editedElementAttributes(HTMLAttributes), 0];
      }
    }).configure({
      levels: [1, 2, 3, 4, 5, 6]
    }), _tiptap_extension_link__WEBPACK_IMPORTED_MODULE_7__["default"].configure({
      openOnClick: false
    }), _tiptap_extension_text__WEBPACK_IMPORTED_MODULE_12__["default"], _tiptap_extension_bold__WEBPACK_IMPORTED_MODULE_2__["default"], _tiptap_extension_italic__WEBPACK_IMPORTED_MODULE_6__["default"], _tiptap_extension_strike__WEBPACK_IMPORTED_MODULE_9__["default"], _tiptap_extension_superscript__WEBPACK_IMPORTED_MODULE_11__["default"], _tiptap_extension_subscript__WEBPACK_IMPORTED_MODULE_10__["default"], _tiptap_extension_underline__WEBPACK_IMPORTED_MODULE_13__["default"], _tiptap_extension_hard_break__WEBPACK_IMPORTED_MODULE_4__["default"].extend({
      addKeyboardShortcuts() {
        return {
          Enter: () => this.editor.commands.setHardBreak()
        };
      }
    })],
    content: value,
    onUpdate,
    autofocus,
    editorProps: {
      ...editorProps,
      handleDOMEvents: {
        keydown: onKeyDown
      },
      attributes: {
        ...(editorProps.attributes ?? {}),
        role: 'textbox',
        ...(placeholder ? {
          'data-placeholder': (0,_utils_inline_editing__WEBPACK_IMPORTED_MODULE_15__.htmlToPlainText)(placeholder)
        } : {}),
        ...(value === null || value === '' ? {
          class: 'is-empty'
        } : {})
      }
    },
    onCreate: onEditorCreate ? ({
      editor: mountedEditor
    }) => onEditorCreate(mountedEditor) : undefined,
    onBlur: mountElement ? undefined : () => onBlurRef.current?.(),
    onSelectionUpdate: onSelectionEnd ? ({
      editor: updatedEditor
    }) => onSelectionEnd(updatedEditor.view) : undefined
  });
  useOnUpdate(() => {
    if (!editor) {
      return;
    }
    const currentContent = editor.getHTML();
    if (currentContent !== value) {
      editor.commands.setContent(value, {
        emitUpdate: false
      });
    }
  }, [editor, value]);
  if (mountElement) {
    return null;
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    ref: containerRef,
    sx: sx,
    className: wrapperClassName
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_tiptap_react__WEBPACK_IMPORTED_MODULE_14__.EditorContent, {
    ref: ref,
    editor: editor
  }));
});
const useOnUpdate = (callback, dependencies) => {
  const hasMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (hasMounted.current) {
      callback();
    } else {
      hasMounted.current = true;
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, dependencies);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/item-selector.tsx":
/*!*********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/item-selector.tsx ***!
  \*********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ItemSelector: function() { return /* binding */ ItemSelector; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _hooks_use_filtered_items_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/use-filtered-items-list */ "./packages/packages/libs/editor-controls/src/hooks/use-filtered-items-list.ts");







const ItemSelector = ({
  itemsList,
  selectedItem,
  onItemChange,
  onClose,
  sectionWidth,
  title,
  itemStyle = () => ({}),
  onDebounce = () => {},
  icon,
  disabledItems,
  id = 'item-selector',
  footer,
  categoryItemContentTemplate
}) => {
  const [searchValue, setSearchValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
  const filteredItemsList = (0,_hooks_use_filtered_items_list__WEBPACK_IMPORTED_MODULE_5__.useFilteredItemsList)(itemsList, searchValue, disabledItems);
  const IconComponent = icon;
  const handleSearch = value => {
    setSearchValue(value);
  };
  const handleClose = () => {
    setSearchValue('');
    onClose();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverBody, {
    width: sectionWidth,
    id: id
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverHeader, {
    title: title,
    onClose: handleClose,
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(IconComponent, {
      fontSize: "tiny"
    })
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.SearchField, {
    value: searchValue,
    onSearch: handleSearch,
    placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Search', 'elementor'),
    id: id + '-search'
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      flex: 1,
      overflow: 'auto',
      minHeight: 0
    }
  }, filteredItemsList.length > 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemList, {
    itemListItems: filteredItemsList,
    setSelectedItem: onItemChange,
    handleClose: handleClose,
    selectedItem: selectedItem,
    itemStyle: itemStyle,
    onDebounce: onDebounce,
    categoryItemContentTemplate: categoryItemContentTemplate
  }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    alignItems: "center",
    justifyContent: "center",
    height: "100%",
    p: 2.5,
    gap: 1.5,
    overflow: "hidden"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(IconComponent, {
    fontSize: "large"
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      maxWidth: 160,
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, {
    align: "center",
    variant: "subtitle2",
    color: "text.secondary"
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Sorry, nothing matched', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, {
    variant: "subtitle2",
    color: "text.secondary",
    sx: {
      display: 'flex',
      width: '100%',
      justifyContent: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, "\u201C"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    component: "span",
    sx: {
      maxWidth: '80%',
      overflow: 'hidden',
      textOverflow: 'ellipsis'
    }
  }, searchValue), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, "\u201D."))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, {
    align: "center",
    variant: "caption",
    color: "text.secondary",
    sx: {
      display: 'flex',
      flexDirection: 'column'
    }
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Try something else.', 'elementor'), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Link, {
    color: "secondary",
    variant: "caption",
    component: "button",
    onClick: () => setSearchValue('')
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Clear & try again', 'elementor'))))), footer);
};
const ItemList = ({
  itemListItems,
  setSelectedItem,
  handleClose,
  selectedItem,
  itemStyle = () => ({}),
  onDebounce = () => {},
  categoryItemContentTemplate
}) => {
  const selectedItemFound = itemListItems.find(item => item.value === selectedItem);
  const debouncedVirtualizeChange = useDebounce(visibleItems => {
    visibleItems.forEach(item => {
      if (item && item.type === 'item') {
        onDebounce(item.value);
      }
    });
  }, 100);
  const memoizedItemStyle = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(item => itemStyle(item), [itemStyle]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverMenuList, {
    items: itemListItems,
    selectedValue: selectedItemFound?.value,
    onChange: debouncedVirtualizeChange,
    onSelect: setSelectedItem,
    onClose: handleClose,
    itemStyle: memoizedItemStyle,
    "data-testid": "item-list",
    categoryItemContentTemplate: categoryItemContentTemplate
  });
};
const useDebounce = (fn, delay) => {
  const [debouncedFn] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_3__.debounce)(fn, delay));
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
  return debouncedFn;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/number-input.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/number-input.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   NumberInput: function() { return /* binding */ NumberInput; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }



const RESTRICTED_INPUT_KEYS = ['e', 'E', '+'];
const NumberInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((props, ref) => {
  const [key, setKey] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0);
  const handleKeyDown = event => {
    blockRestrictedKeys(event, props.inputProps?.min);
    props.onKeyDown?.(event);
  };
  const handleBlur = event => {
    props.onBlur?.(event);
    const {
      valid
    } = event.target.validity;

    // HTML number input quirk: invalid input (e.g. "-9-") returns value="" but displays "-9-" to user,
    // so when we revert to last valid value we must re-mount the component to actually display it.
    if (!valid) {
      setKey(prev => prev + 1);
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TextField, _extends({}, props, {
    ref: ref,
    key: key,
    onKeyDown: handleKeyDown,
    onBlur: handleBlur
  }));
});
function blockRestrictedKeys(event, min) {
  const restrictedInputKeys = [...RESTRICTED_INPUT_KEYS];
  if (min >= 0) {
    restrictedInputKeys.push('-');
  }
  if (restrictedInputKeys.includes(event.key)) {
    event.preventDefault();
  }
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/popover-content.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PopoverContent: function() { return /* binding */ PopoverContent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }


const PopoverContent = ({
  gap = 1.5,
  children,
  ...props
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, _extends({}, props, {
  gap: gap
}), children);

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx":
/*!******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx ***!
  \******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PopoverGridContainer: function() { return /* binding */ PopoverGridContainer; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);



const PopoverGridContainer = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  gap = 1.5,
  alignItems = 'center',
  flexWrap = 'nowrap',
  children
}, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
  container: true,
  gap: gap,
  alignItems: alignItems,
  flexWrap: flexWrap,
  ref: ref
}, children));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/promotions/attributes-control.tsx":
/*!*************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/promotions/attributes-control.tsx ***!
  \*************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AttributesControl: function() { return /* binding */ AttributesControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _promotion_trigger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./promotion-trigger */ "./packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx");







const ARIA_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Attributes', 'elementor');
const TRACKING_DATA = {
  target_name: 'attributes',
  location_l2: 'general'
};
const AttributesControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(() => {
  const triggerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "row",
    spacing: 2,
    sx: {
      justifyContent: 'flex-end',
      alignItems: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_promotion_trigger__WEBPACK_IMPORTED_MODULE_5__.PromotionTrigger, {
    ref: triggerRef,
    promotionKey: "attributes",
    trackingData: TRACKING_DATA
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: ARIA_LABEL,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PlusIcon, {
    "aria-label": ARIA_LABEL,
    fontSize: "tiny",
    color: "disabled",
    onClick: () => triggerRef.current?.toggle(),
    sx: {
      cursor: 'pointer'
    }
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/promotions/display-conditions-control.tsx":
/*!*********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/promotions/display-conditions-control.tsx ***!
  \*********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DisplayConditionsControl: function() { return /* binding */ DisplayConditionsControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _promotion_trigger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./promotion-trigger */ "./packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx");







const ARIA_LABEL = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Display Conditions', 'elementor');
const TRACKING_DATA = {
  target_name: 'display_conditions',
  location_l2: 'general'
};
const DisplayConditionsControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(() => {
  const triggerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "row",
    spacing: 2,
    sx: {
      justifyContent: 'flex-end',
      alignItems: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_promotion_trigger__WEBPACK_IMPORTED_MODULE_5__.PromotionTrigger, {
    ref: triggerRef,
    promotionKey: "displayConditions",
    trackingData: TRACKING_DATA
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: ARIA_LABEL,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: "tiny",
    "aria-label": ARIA_LABEL,
    "data-behavior": "display-conditions",
    onClick: () => triggerRef.current?.toggle(),
    sx: {
      border: '1px solid',
      borderColor: 'divider',
      borderRadius: 1
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.SitemapIcon, {
    fontSize: "tiny",
    color: "disabled"
  }))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx":
/*!************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx ***!
  \************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PromotionTrigger: function() { return /* binding */ PromotionTrigger; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _utils_tracking__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/tracking */ "./packages/packages/libs/editor-controls/src/utils/tracking.ts");





function getV4Promotion(key) {
  return window.elementor?.config?.v4Promotions?.[key];
}
const PromotionTrigger = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  promotionKey,
  children,
  trackingData
}, ref) => {
  const [isOpen, setIsOpen] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const promotion = getV4Promotion(promotionKey);
  const toggle = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
    setIsOpen(prev => {
      if (!prev) {
        (0,_utils_tracking__WEBPACK_IMPORTED_MODULE_3__.trackViewPromotion)(trackingData);
      }
      return !prev;
    });
  }, [trackingData]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref, () => ({
    toggle
  }), [toggle]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, promotion && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PromotionInfotip, {
    title: promotion.title,
    content: promotion.content,
    assetUrl: promotion.image,
    ctaUrl: promotion.ctaUrl,
    open: isOpen,
    onClose: e => {
      e.stopPropagation();
      setIsOpen(false);
    },
    onCtaClick: () => (0,_utils_tracking__WEBPACK_IMPORTED_MODULE_3__.trackUpgradePromotionClick)(trackingData)
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    onClick: e => {
      e.stopPropagation();
      toggle();
    },
    sx: {
      cursor: 'pointer',
      display: 'inline-flex'
    }
  }, children ?? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PromotionChip, null))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeaterHeader: function() { return /* binding */ RepeaterHeader; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../control-adornments/control-adornments */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx");




const RepeaterHeader = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  label,
  children,
  adornment: Adornment = _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_2__.ControlAdornments
}, ref) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, {
    direction: "row",
    alignItems: "center",
    gap: 1,
    sx: {
      marginInlineEnd: -0.75,
      py: 0.25
    },
    ref: ref
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    display: "flex",
    alignItems: "center",
    gap: 1,
    sx: {
      flexGrow: 1
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Typography, {
    component: "label",
    variant: "caption",
    color: "text.secondary",
    sx: {
      lineHeight: 1
    }
  }, label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Adornment, null)), children);
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-popover.tsx":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/repeater/repeater-popover.tsx ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeaterPopover: function() { return /* binding */ RepeaterPopover; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }


const RepeaterPopover = ({
  children,
  width,
  ...props
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Popover, _extends({
    disablePortal: true,
    disableEnforceFocus: true,
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'left'
    },
    slotProps: {
      paper: {
        sx: {
          marginBlockStart: 0.5,
          width,
          overflow: 'visible'
        }
      }
    }
  }, props), children);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-tag.tsx":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/repeater/repeater-tag.tsx ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeaterTag: function() { return /* binding */ RepeaterTag; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }



const RepeaterTag = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((props, ref) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.UnstableTag, _extends({
    ref: ref,
    fullWidth: true,
    showActionsOnHover: true,
    variant: "outlined",
    sx: {
      minHeight: theme => theme.spacing(3.5)
    }
  }, props));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/repeater/repeater.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/repeater/repeater.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Repeater: function() { return /* binding */ Repeater; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../control-adornments/control-adornments */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx");
/* harmony import */ var _hooks_use_repeater_popover_dismiss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../hooks/use-repeater-popover-dismiss */ "./packages/packages/libs/editor-controls/src/hooks/use-repeater-popover-dismiss.ts");
/* harmony import */ var _control_repeater_locations__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../control-repeater/locations */ "./packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts");
/* harmony import */ var _section_content__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../section-content */ "./packages/packages/libs/editor-controls/src/components/section-content.tsx");
/* harmony import */ var _repeater_header__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _repeater_popover__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./repeater-popover */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-popover.tsx");
/* harmony import */ var _repeater_tag__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./repeater-tag */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-tag.tsx");
/* harmony import */ var _sortable__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sortable */ "./packages/packages/libs/editor-controls/src/components/repeater/sortable.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }













const SIZE = 'tiny';
const EMPTY_OPEN_ITEM = -1;
const Repeater = ({
  label,
  itemSettings,
  disabled = false,
  openOnAdd = false,
  values: items = [],
  setValues: setItems,
  showDuplicate = true,
  showToggle = true,
  showRemove = true,
  disableAddItemButton = false,
  addButtonInfotipContent,
  openItem: initialOpenItem = EMPTY_OPEN_ITEM,
  isSortable = true
}) => {
  const [openItem, setOpenItem] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialOpenItem);
  const uniqueKeys = items.map((item, index) => isSortable && 'getId' in itemSettings ? itemSettings.getId({
    item,
    index
  }) : String(index));
  const addRepeaterItem = () => {
    const newItem = structuredClone(itemSettings.initialValues);
    const newIndex = items.length;
    setItems([...items, newItem], {}, {
      action: {
        type: 'add',
        payload: [{
          index: newIndex,
          item: newItem
        }]
      }
    });
    if (openOnAdd) {
      setOpenItem(newIndex);
    }
  };
  const duplicateRepeaterItem = index => {
    const newItem = structuredClone(items[index]);

    // Insert the new (cloned item) at the next spot (after the current index)
    const atPosition = 1 + index;
    setItems([...items.slice(0, atPosition), newItem, ...items.slice(atPosition)], {}, {
      action: {
        type: 'duplicate',
        payload: [{
          index,
          item: newItem
        }]
      }
    });
  };
  const removeRepeaterItem = index => {
    const removedItem = items[index];
    setItems(items.filter((_, pos) => {
      return pos !== index;
    }), {}, {
      action: {
        type: 'remove',
        payload: [{
          index,
          item: removedItem
        }]
      }
    });
  };
  const toggleDisableRepeaterItem = index => {
    setItems(items.map((value, pos) => {
      if (pos === index) {
        const {
          disabled: propDisabled,
          ...rest
        } = value;

        // If the items should not be disabled, remove the disabled property.
        return {
          ...rest,
          ...(propDisabled ? {} : {
            disabled: true
          })
        };
      }
      return value;
    }), {}, {
      action: {
        type: 'toggle-disable'
      }
    });
  };
  const onChangeOrder = (reorderedKeys, meta) => {
    setItems(reorderedKeys.map(id => {
      return items[uniqueKeys.indexOf(id)];
    }), {}, {
      action: {
        type: 'reorder',
        payload: {
          ...meta
        }
      }
    });
  };
  const isButtonDisabled = disabled || disableAddItemButton;
  const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
  const addButton = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
    size: SIZE,
    sx: {
      ml: 'auto'
    },
    disabled: isButtonDisabled,
    onClick: addRepeaterItem,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Add item', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PlusIcon, {
    fontSize: SIZE
  }));
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_section_content__WEBPACK_IMPORTED_MODULE_7__.SectionContent, {
    gap: 2
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_header__WEBPACK_IMPORTED_MODULE_8__.RepeaterHeader, {
    label: label,
    adornment: _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_4__.ControlAdornments
  }, shouldShowInfotip ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Infotip, {
    placement: "right",
    content: addButtonInfotipContent,
    color: "secondary",
    slotProps: {
      popper: {
        sx: {
          width: 300
        }
      }
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      ...(isButtonDisabled ? {
        cursor: 'not-allowed'
      } : {})
    }
  }, addButton)) : addButton), 0 < uniqueKeys.length && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_sortable__WEBPACK_IMPORTED_MODULE_11__.SortableProvider, {
    value: uniqueKeys,
    onChange: onChangeOrder
  }, uniqueKeys.map(key => {
    const index = uniqueKeys.indexOf(key);
    const value = items[index];
    if (!value) {
      return null;
    }
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_sortable__WEBPACK_IMPORTED_MODULE_11__.SortableItem, {
      id: key,
      key: `sortable-${key}`,
      disabled: !isSortable
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RepeaterItem, {
      disabled: disabled,
      propDisabled: value?.disabled,
      label: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_repeater_locations__WEBPACK_IMPORTED_MODULE_6__.RepeaterItemLabelSlot, {
        value: value
      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(itemSettings.Label, {
        value: value,
        index: index
      })),
      startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_repeater_locations__WEBPACK_IMPORTED_MODULE_6__.RepeaterItemIconSlot, {
        value: value
      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(itemSettings.Icon, {
        value: value
      })),
      removeItem: () => removeRepeaterItem(index),
      duplicateItem: () => duplicateRepeaterItem(index),
      toggleDisableItem: () => toggleDisableRepeaterItem(index),
      openOnMount: openOnAdd && openItem === index,
      onOpen: () => setOpenItem(EMPTY_OPEN_ITEM),
      onPopoverOpen: itemSettings.onPopoverOpen,
      onPopoverClose: itemSettings.onPopoverClose,
      showDuplicate: showDuplicate,
      showToggle: showToggle,
      showRemove: showRemove,
      actions: itemSettings.actions,
      value: value
    }, props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(itemSettings.Content, _extends({}, props, {
      value: value,
      bind: String(index),
      index: index
    }))));
  })));
};
const RepeaterItem = ({
  label,
  propDisabled,
  startIcon,
  children,
  removeItem,
  duplicateItem,
  toggleDisableItem,
  openOnMount,
  onOpen,
  onPopoverOpen,
  onPopoverClose,
  showDuplicate,
  showToggle,
  showRemove,
  disabled,
  actions,
  value
}) => {
  const wrappedOnPopoverClose = onPopoverClose ? () => onPopoverClose(value) : undefined;
  const {
    popoverState,
    popoverProps,
    ref,
    setRef
  } = usePopover(openOnMount, () => {
    onOpen();
    onPopoverOpen?.(value);
  }, wrappedOnPopoverClose);
  const triggerProps = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popoverState);
  (0,_hooks_use_repeater_popover_dismiss__WEBPACK_IMPORTED_MODULE_5__.usePopoverDismiss)({
    isOpen: popoverState.isOpen,
    onClose: popoverProps.onClose
  });
  const duplicateLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Duplicate', 'elementor');
  const toggleLabel = propDisabled ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Show', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Hide', 'elementor');
  const removeLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Remove', 'elementor');
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      display: 'contents'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_tag__WEBPACK_IMPORTED_MODULE_10__.RepeaterTag, _extends({
    disabled: disabled,
    label: label,
    ref: setRef,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Open item', 'elementor')
  }, triggerProps, {
    onClick: e => {
      triggerProps.onClick(e);
      if (!popoverState.isOpen) {
        onPopoverOpen?.(value);
      }
    },
    startIcon: startIcon,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, showDuplicate && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
      title: duplicateLabel,
      placement: "top"
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
      size: SIZE,
      onClick: duplicateItem,
      "aria-label": duplicateLabel
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.CopyIcon, {
      fontSize: SIZE
    }))), showToggle && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
      title: toggleLabel,
      placement: "top"
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
      size: SIZE,
      onClick: toggleDisableItem,
      "aria-label": toggleLabel
    }, propDisabled ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EyeOffIcon, {
      fontSize: SIZE
    }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.EyeIcon, {
      fontSize: SIZE
    }))), actions?.(value), showRemove && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
      title: removeLabel,
      placement: "top"
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, {
      size: SIZE,
      onClick: removeItem,
      "aria-label": removeLabel
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.XIcon, {
      fontSize: SIZE
    }))))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeater_popover__WEBPACK_IMPORTED_MODULE_9__.RepeaterPopover, _extends({
    width: ref?.getBoundingClientRect().width
  }, popoverProps, {
    anchorEl: ref
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, children({
    anchorEl: ref
  }))));
};
const usePopover = (openOnMount, onOpen, onPopoverClose) => {
  const [ref, setRef] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
  const popoverState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({
    variant: 'popover'
  });
  const popoverProps = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindPopover)(popoverState);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (openOnMount && ref) {
      popoverState.open(ref);
      onOpen?.();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [ref]);
  const onClose = () => {
    popoverProps.onClose?.();
    onPopoverClose?.();
  };
  return {
    popoverState,
    ref,
    setRef,
    popoverProps: {
      ...popoverProps,
      onClose
    }
  };
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/repeater/sortable.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/repeater/sortable.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SortableItem: function() { return /* binding */ SortableItem; },
/* harmony export */   SortableProvider: function() { return /* binding */ SortableProvider; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const SortableProvider = props => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.List, {
    sx: {
      p: 0,
      my: -0.5,
      mx: 0
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableSortableProvider, _extends({
    restrictAxis: true,
    disableDragOverlay: false,
    variant: 'static'
  }, props)));
};
const SortableItem = ({
  id,
  children,
  disabled
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableSortableItem, {
    id: id,
    disabled: disabled,
    render: ({
      itemProps,
      triggerProps,
      itemStyle,
      triggerStyle,
      showDropIndication,
      dropIndicationStyle
    }) => {
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledListItem, _extends({}, itemProps, {
        style: itemStyle,
        tabIndex: -1
      }), !disabled && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(SortableTrigger, _extends({}, triggerProps, {
        style: triggerStyle
      })), children, showDropIndication && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledDivider, {
        style: dropIndicationStyle
      }));
    }
  });
};
const StyledListItem = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem))`
	position: relative;
	margin-inline: 0px;
	padding-inline: 0px;
	padding-block: ${({
  theme
}) => theme.spacing(0.5)};

	& .class-item-sortable-trigger {
		color: ${({
  theme
}) => theme.palette.action.active};
		height: 100%;
		display: flex;
		align-items: center;
		visibility: hidden;
		position: absolute;
		top: 50%;
		padding-inline-end: ${({
  theme
}) => theme.spacing(0.5)};
		transform: translate( -75%, -50% );
	}

	&[aria-describedby=''] > .MuiTag-root {
		background-color: ${({
  theme
}) => theme.palette.background.paper};
		box-shadow: ${({
  theme
}) => theme.shadows[3]};
	}

	&:hover,
	&:focus-within {
		& .class-item-sortable-trigger {
			visibility: visible;
		}
	}
`;
const SortableTrigger = props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", _extends({}, props, {
  role: "button",
  className: "class-item-sortable-trigger",
  tabIndex: 0,
  "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Drag item', 'elementor')
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.GripVerticalIcon, {
  fontSize: "tiny"
}));
const StyledDivider = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider))`
	height: 0px;
	border: none;
	overflow: visible;

	&:after {
		--height: 2px;
		content: '';
		display: block;
		width: 100%;
		height: var( --height );
		margin-block: calc( -1 * var( --height ) / 2 );
		border-radius: ${({
  theme
}) => theme.spacing(0.5)};
		background-color: ${({
  theme
}) => theme.palette.text.primary};
	}
`;

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/restricted-link-infotip.tsx":
/*!*******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/restricted-link-infotip.tsx ***!
  \*******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RestrictedLinkInfotip: function() { return /* binding */ RestrictedLinkInfotip; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);





const learnMoreButton = {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Learn More', 'elementor'),
  href: 'https://go.elementor.com/element-link-inside-link-infotip'
};
const INFOTIP_CONTENT = {
  descendant: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To add a link or action to this element, first remove the link or action from the elements inside of it.', 'elementor'),
  ancestor: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('To add a link or action to this container, first remove the link or action from its parent container.', 'elementor')
};
function isTargetInCurrentDocument(elementId) {
  if (!elementId) {
    return false;
  }
  const el = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getContainer)(elementId)?.view?.el;
  if (!el) {
    return false;
  }
  const targetDocId = el.closest('[data-elementor-id]')?.getAttribute('data-elementor-id');
  const currentDocId = String((0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getCurrentDocumentId)() ?? '');
  return !!(targetDocId && currentDocId && targetDocId === currentDocId);
}
const RestrictedLinkInfotip = ({
  linkInLinkRestriction,
  isVisible,
  children
}) => {
  const {
    shouldRestrict,
    reason,
    elementId
  } = linkInLinkRestriction;
  const showTakeMeThereCta = !!(elementId && isTargetInCurrentDocument(elementId));
  const handleTakeMeClick = () => {
    if (elementId) {
      (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.selectElement)(elementId);
    }
  };
  const content = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Alert, {
    color: "secondary",
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.InfoCircleFilledIcon, null),
    size: "small",
    action: showTakeMeThereCta ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.AlertAction, {
      sx: {
        width: 'fit-content'
      },
      variant: "contained",
      color: "secondary",
      onClick: handleTakeMeClick
    }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Take me there', 'elementor')) : undefined
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.AlertTitle, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Nested links', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
    component: "span"
  }, INFOTIP_CONTENT[reason ?? 'descendant'], ' ', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Link, {
    href: learnMoreButton.href,
    target: "_blank",
    color: "info.main"
  }, learnMoreButton.label)));
  return shouldRestrict && isVisible ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Infotip, {
    placement: "right",
    content: content,
    color: "secondary",
    slotProps: {
      popper: {
        sx: {
          width: 300
        }
      }
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, null, children)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, children);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/section-content.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/section-content.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SectionContent: function() { return /* binding */ SectionContent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);


const SectionContent = ({
  gap = 0.5,
  sx,
  children
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, {
  gap: gap,
  sx: {
    ...sx
  }
}, children);

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/size-control/size-input.tsx":
/*!*******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/size-control/size-input.tsx ***!
  \*******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SizeInput: function() { return /* binding */ SizeInput; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../hooks/use-typing-buffer */ "./packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts");
/* harmony import */ var _utils_size_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/size-control */ "./packages/packages/libs/editor-controls/src/utils/size-control.ts");
/* harmony import */ var _size_control_text_field_inner_selection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../size-control/text-field-inner-selection */ "./packages/packages/libs/editor-controls/src/components/size-control/text-field-inner-selection.tsx");







const SizeInput = ({
  units,
  handleUnitChange,
  handleSizeChange,
  placeholder,
  startIcon,
  onBlur,
  onFocus,
  onClick,
  size,
  unit,
  popupState,
  disabled,
  min,
  id,
  ariaLabel
}) => {
  const {
    appendKey,
    startsWith
  } = (0,_hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_4__.useTypingBuffer)();
  const inputType = (0,_utils_size_control__WEBPACK_IMPORTED_MODULE_5__.isUnitExtendedOption)(unit) ? 'text' : 'number';
  const inputValue = !(0,_utils_size_control__WEBPACK_IMPORTED_MODULE_5__.isUnitExtendedOption)(unit) && Number.isNaN(size) ? '' : size ?? '';
  const handleKeyDown = event => {
    const {
      key,
      altKey,
      ctrlKey,
      metaKey
    } = event;
    if (altKey || ctrlKey || metaKey) {
      return;
    }
    if ((0,_utils_size_control__WEBPACK_IMPORTED_MODULE_5__.isUnitExtendedOption)(unit) && !isNaN(Number(key))) {
      const defaultUnit = units?.[0];
      if (defaultUnit) {
        handleUnitChange(defaultUnit);
      }
      return;
    }
    if (!/^[a-zA-Z%]$/.test(key)) {
      return;
    }
    event.preventDefault();
    const newChar = key.toLowerCase();
    const updatedBuffer = appendKey(newChar);
    const matchedUnit = units.find(u => startsWith(u, updatedBuffer));
    if (matchedUnit) {
      handleUnitChange(matchedUnit);
    }
  };
  const popupAttributes = {
    'aria-controls': popupState.isOpen ? popupState.popupId : undefined,
    'aria-haspopup': true
  };
  const menuItemsAttributes = units.includes('custom') ? {
    custom: popupAttributes
  } : undefined;
  const alternativeOptionLabels = {
    custom: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.MathFunctionIcon, {
      fontSize: "tiny"
    })
  };
  const InputProps = {
    ...popupAttributes,
    readOnly: (0,_utils_size_control__WEBPACK_IMPORTED_MODULE_5__.isUnitExtendedOption)(unit),
    autoComplete: 'off',
    onClick,
    onFocus,
    startAdornment: startIcon ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
      position: "start",
      disabled: disabled
    }, startIcon) : undefined,
    endAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_text_field_inner_selection__WEBPACK_IMPORTED_MODULE_6__.SelectionEndAdornment, {
      disabled: disabled,
      options: units,
      onClick: handleUnitChange,
      value: unit,
      alternativeOptionLabels: alternativeOptionLabels,
      menuItemsAttributes: menuItemsAttributes
    })
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_text_field_inner_selection__WEBPACK_IMPORTED_MODULE_6__.TextFieldInnerSelection, {
    disabled: disabled,
    placeholder: placeholder,
    type: inputType,
    value: inputValue,
    onChange: handleSizeChange,
    onKeyDown: handleKeyDown,
    onBlur: onBlur,
    InputProps: InputProps,
    inputProps: {
      min,
      step: 'any',
      'aria-label': ariaLabel
    },
    isPopoverOpen: popupState.isOpen,
    id: id
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/size-control/text-field-inner-selection.tsx":
/*!***********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/size-control/text-field-inner-selection.tsx ***!
  \***********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectionEndAdornment: function() { return /* binding */ SelectionEndAdornment; },
/* harmony export */   TextFieldInnerSelection: function() { return /* binding */ TextFieldInnerSelection; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _utils_size_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/size-control */ "./packages/packages/libs/editor-controls/src/utils/size-control.ts");
/* harmony import */ var _number_input__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../number-input */ "./packages/packages/libs/editor-controls/src/components/number-input.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const TextFieldInnerSelection = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  placeholder,
  type,
  value,
  onChange,
  onBlur,
  onKeyDown,
  onKeyUp,
  InputProps,
  inputProps,
  disabled,
  isPopoverOpen,
  id
}, ref) => {
  const {
    placeholder: boundPropPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const getCursorStyle = () => ({
    input: {
      cursor: InputProps.readOnly ? 'default !important' : undefined
    }
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_number_input__WEBPACK_IMPORTED_MODULE_6__.NumberInput, {
    ref: ref,
    sx: getCursorStyle(),
    size: "tiny",
    fullWidth: true,
    type: type,
    value: value,
    onInput: onChange,
    onKeyDown: onKeyDown,
    onKeyUp: onKeyUp,
    disabled: disabled,
    onBlur: onBlur,
    focused: isPopoverOpen ? true : undefined,
    placeholder: placeholder ?? (String(boundPropPlaceholder?.size ?? '') || undefined),
    InputProps: InputProps,
    inputProps: inputProps,
    id: id
  });
});
const SelectionEndAdornment = ({
  options,
  alternativeOptionLabels = {},
  onClick,
  value,
  menuItemsAttributes = {},
  disabled
}) => {
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({
    variant: 'popover',
    popupId: (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)()
  });
  const handleMenuItemClick = index => {
    onClick(options[index]);
    popupState.close();
  };
  const {
    placeholder,
    showPrimaryColor
  } = useUnitPlaceholder(value);
  const itemStyles = {
    display: 'flex',
    flexDirection: 'column',
    justifyContent: 'center'
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.InputAdornment, {
    position: "end"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledButton, _extends({
    isPrimaryColor: showPrimaryColor,
    size: "small",
    disabled: disabled
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindTrigger)(popupState)), placeholder ?? alternativeOptionLabels[value] ?? value), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Menu, _extends({
    MenuListProps: {
      dense: true
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindMenu)(popupState)), options.map((option, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuListItem, _extends({
    key: option,
    onClick: () => handleMenuItemClick(index)
  }, menuItemsAttributes?.[option], {
    primaryTypographyProps: {
      variant: 'caption',
      sx: {
        ...itemStyles,
        lineHeight: '1'
      }
    },
    menuItemTextProps: {
      sx: itemStyles
    }
  }), alternativeOptionLabels[option] ?? option.toUpperCase()))));
};
function useUnitPlaceholder(value) {
  const {
    value: externalValue,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const size = externalValue?.size;
  const unit = externalValue?.unit;
  const isCustomUnitWithSize = value === 'custom' && Boolean(size);
  const isAutoUnit = value === 'auto';
  const showPrimaryColor = isAutoUnit || isCustomUnitWithSize || Boolean(size);
  if (!placeholder) {
    return {
      placeholder: null,
      showPrimaryColor
    };
  }
  const isMissingUnit = !unit;
  const showPlaceholder = isMissingUnit && value === _utils_size_control__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_UNIT;
  return {
    placeholder: showPlaceholder ? placeholder.unit : undefined,
    showPrimaryColor
  };
}
const StyledButton = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
  shouldForwardProp: prop => prop !== 'isPrimaryColor'
})(({
  isPrimaryColor,
  theme
}) => ({
  color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
  font: 'inherit',
  minWidth: 'initial',
  textTransform: 'uppercase'
}));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/size/unit-select.tsx":
/*!************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/size/unit-select.tsx ***!
  \************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UnitSelect: function() { return /* binding */ UnitSelect; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const menuItemContentStyles = {
  display: 'flex',
  flexDirection: 'column',
  justifyContent: 'center'
};
const UnitSelect = ({
  value,
  showPrimaryColor,
  onClick,
  options
}) => {
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({
    variant: 'popover',
    popupId: (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)()
  });
  const handleMenuItemClick = index => {
    onClick(options[index]);
    popupState.close();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledButton, _extends({
    isPrimaryColor: showPrimaryColor,
    size: "small"
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popupState)), value), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, _extends({
    MenuListProps: {
      dense: true
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindMenu)(popupState)), options.map((option, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.MenuListItem, {
    key: option,
    onClick: () => handleMenuItemClick(index),
    primaryTypographyProps: {
      variant: 'caption',
      sx: {
        ...menuItemContentStyles,
        lineHeight: '1'
      }
    },
    menuItemTextProps: {
      sx: menuItemContentStyles
    }
  }, option.toUpperCase()))));
};
const StyledButton = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, {
  shouldForwardProp: prop => prop !== 'isPrimaryColor'
})(({
  isPrimaryColor,
  theme
}) => ({
  color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
  font: 'inherit',
  minWidth: 'initial',
  textTransform: 'uppercase'
}));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/size/unstable-size-field.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/size/unstable-size-field.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UnstableSizeField: function() { return /* binding */ UnstableSizeField; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _hooks_use_size_value__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../hooks/use-size-value */ "./packages/packages/libs/editor-controls/src/hooks/use-size-value.ts");
/* harmony import */ var _unit_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./unit-select */ "./packages/packages/libs/editor-controls/src/components/size/unit-select.tsx");
/* harmony import */ var _unstable_size_input__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./unstable-size-input */ "./packages/packages/libs/editor-controls/src/components/size/unstable-size-input.tsx");





const UnstableSizeField = ({
  value,
  InputProps,
  onChange,
  onBlur,
  units,
  defaultUnit,
  startIcon
}) => {
  const {
    size,
    unit,
    setSize,
    setUnit
  } = (0,_hooks_use_size_value__WEBPACK_IMPORTED_MODULE_2__.useSizeValue)(value, onChange, defaultUnit);
  const shouldHighlightUnit = () => {
    return hasValue(size);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_unstable_size_input__WEBPACK_IMPORTED_MODULE_4__.UnstableSizeInput, {
    type: "number",
    value: size ?? '',
    onBlur: onBlur,
    onChange: event => setSize(event.target.value),
    InputProps: {
      ...InputProps,
      startAdornment: startIcon && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.InputAdornment, {
        position: "start"
      }, startIcon),
      endAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.InputAdornment, {
        position: "end"
      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_unit_select__WEBPACK_IMPORTED_MODULE_3__.UnitSelect, {
        options: units,
        value: unit,
        onClick: setUnit,
        showPrimaryColor: shouldHighlightUnit()
      }))
    }
  });
};
const hasValue = value => {
  return value !== null && value !== '';
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/size/unstable-size-input.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/size/unstable-size-input.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UnstableSizeInput: function() { return /* binding */ UnstableSizeInput; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _number_input__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../number-input */ "./packages/packages/libs/editor-controls/src/components/number-input.tsx");



const UnstableSizeInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  type,
  value,
  onChange,
  onKeyDown,
  onKeyUp,
  InputProps,
  onBlur,
  focused,
  disabled
}, ref) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_number_input__WEBPACK_IMPORTED_MODULE_1__.NumberInput, {
    ref: ref,
    size: "tiny",
    fullWidth: true,
    type: type,
    value: value,
    onKeyUp: onKeyUp,
    focused: focused,
    disabled: disabled,
    onKeyDown: onKeyDown,
    onInput: onChange,
    onBlur: onBlur,
    InputProps: InputProps,
    sx: getCursorStyle(InputProps?.readOnly ?? false)
  });
});
const getCursorStyle = readOnly => ({
  input: {
    cursor: readOnly ? 'default !important' : undefined
  }
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/text-field-popover.tsx":
/*!**************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/text-field-popover.tsx ***!
  \**************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TextFieldPopover: function() { return /* binding */ TextFieldPopover; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }






const SIZE = 'tiny';
const TextFieldPopover = props => {
  const {
    popupState,
    restoreValue,
    anchorRef,
    value,
    onChange
  } = props;
  const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (popupState.isOpen) {
      requestAnimationFrame(() => {
        if (inputRef.current) {
          inputRef.current.focus();
        }
      });
    }
  }, [popupState.isOpen]);
  const handleKeyPress = event => {
    if (event.key.toLowerCase() === 'enter') {
      handleClose();
    }
  };
  const handleClose = () => {
    restoreValue();
    popupState.close();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Popover, _extends({
    disablePortal: true,
    slotProps: {
      paper: {
        sx: {
          borderRadius: 2,
          width: anchorRef.current?.offsetWidth + 'px'
        }
      }
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindPopover)(popupState), {
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'center'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'center'
    },
    onClose: handleClose
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverHeader, {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('CSS function', 'elementor'),
    onClose: handleClose,
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.MathFunctionIcon, {
      fontSize: SIZE
    })
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.TextField, {
    value: value,
    onChange: onChange,
    onKeyPress: handleKeyPress,
    size: "tiny",
    type: "text",
    fullWidth: true,
    inputProps: {
      ref: inputRef
    },
    sx: {
      pt: 0,
      pr: 1.5,
      pb: 1.5,
      pl: 1.5
    }
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/components/url-popover.tsx":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/components/url-popover.tsx ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UrlPopover: function() { return /* binding */ UrlPopover; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }





const UrlPopover = ({
  popupState,
  restoreValue,
  anchorRef,
  value,
  onChange,
  openInNewTab,
  onToggleNewTab
}) => {
  const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (popupState.isOpen) {
      requestAnimationFrame(() => inputRef.current?.focus());
    }
  }, [popupState.isOpen]);
  const handleClose = () => {
    restoreValue();
    popupState.close();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Popover, _extends({
    slotProps: {
      paper: {
        sx: {
          borderRadius: '16px',
          width: anchorRef.current?.offsetWidth + 'px',
          marginTop: -1
        }
      }
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindPopover)(popupState), {
    anchorOrigin: {
      vertical: 'top',
      horizontal: 'left'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'left'
    },
    onClose: handleClose
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "row",
    alignItems: "center",
    gap: 1,
    sx: {
      p: 1.5
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, {
    value: value,
    onChange: onChange,
    size: "tiny",
    fullWidth: true,
    placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Type a URL', 'elementor'),
    inputProps: {
      ref: inputRef
    },
    color: "secondary",
    InputProps: {
      sx: {
        borderRadius: '8px'
      }
    },
    onKeyUp: event => event.key === 'Enter' && handleClose()
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Open in a new tab', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButton, {
    size: "tiny",
    value: "newTab",
    selected: openInNewTab,
    onClick: onToggleNewTab,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Open in a new tab', 'elementor'),
    sx: {
      borderRadius: '8px'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.ExternalLinkIcon, {
    fontSize: "tiny"
  })))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/control-actions/control-actions-context.tsx":
/*!************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/control-actions/control-actions-context.tsx ***!
  \************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlActionsProvider: function() { return /* binding */ ControlActionsProvider; },
/* harmony export */   useControlActions: function() { return /* binding */ useControlActions; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);


const Context = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
const ControlActionsProvider = ({
  children,
  items
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Context.Provider, {
  value: {
    items
  }
}, children);
const useControlActions = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(Context);
  if (!context) {
    throw new Error('useControlActions must be used within a ControlActionsProvider');
  }
  return context;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": function() { return /* binding */ ControlActions; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./control-actions-context */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions-context.tsx");




function ControlActions({
  children
}) {
  const {
    items
  } = (0,_control_actions_context__WEBPACK_IMPORTED_MODULE_3__.useControlActions)();
  const {
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.useBoundProp)();
  if (items.length === 0 || disabled) {
    return children;
  }
  const menuItems = items.map(({
    MenuItem,
    id
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MenuItem, {
    key: id
  }));
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.FloatingActionsBar, {
    actions: menuItems
  }, children);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments-context.tsx":
/*!******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/control-adornments/control-adornments-context.tsx ***!
  \******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlAdornmentsProvider: function() { return /* binding */ ControlAdornmentsProvider; },
/* harmony export */   useControlAdornments: function() { return /* binding */ useControlAdornments; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);


const Context = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
const ControlAdornmentsProvider = ({
  children,
  items
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Context.Provider, {
  value: {
    items
  }
}, children);
const useControlAdornments = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(Context);
  return context?.items ?? [];
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx":
/*!**********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx ***!
  \**********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlAdornments: function() { return /* binding */ ControlAdornments; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _control_adornments_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./control-adornments-context */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments-context.tsx");


function ControlAdornments({
  customContext
}) {
  const items = (0,_control_adornments_context__WEBPACK_IMPORTED_MODULE_1__.useControlAdornments)();
  if (items?.length === 0) {
    return null;
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, items.map(({
    Adornment,
    id
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Adornment, {
    key: id,
    customContext: customContext
  })));
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/control-replacements.tsx":
/*!*****************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/control-replacements.tsx ***!
  \*****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ControlReplacementsProvider: function() { return /* binding */ ControlReplacementsProvider; },
/* harmony export */   createControlReplacementsRegistry: function() { return /* binding */ createControlReplacementsRegistry; },
/* harmony export */   getControlReplacements: function() { return /* binding */ getControlReplacements; },
/* harmony export */   registerControlReplacement: function() { return /* binding */ registerControlReplacement; },
/* harmony export */   useControlReplacement: function() { return /* binding */ useControlReplacement; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");



const ControlReplacementContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)([]);
const ControlReplacementsProvider = ({
  replacements,
  children
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ControlReplacementContext.Provider, {
    value: replacements
  }, children);
};
const useControlReplacement = OriginalComponent => {
  const {
    value,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_1__.useBoundProp)();
  const replacements = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ControlReplacementContext);
  try {
    const replacement = replacements.find(r => r.condition({
      value,
      placeholder
    }));
    return {
      ControlToRender: replacement?.component ?? OriginalComponent,
      OriginalControl: OriginalComponent,
      isReplaced: !!replacement
    };
  } catch {
    return {
      ControlToRender: OriginalComponent,
      OriginalControl: OriginalComponent
    };
  }
};
const createControlReplacementsRegistry = () => {
  const controlReplacements = [];
  function registerControlReplacement(replacement) {
    controlReplacements.push(replacement);
  }
  function getControlReplacements() {
    return controlReplacements;
  }
  return {
    registerControlReplacement,
    getControlReplacements
  };
};
const {
  registerControlReplacement,
  getControlReplacements
} = createControlReplacementsRegistry();

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/aspect-ratio-control.tsx":
/*!**************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/aspect-ratio-control.tsx ***!
  \**************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AspectRatioControl: function() { return /* binding */ AspectRatioControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }











const RATIO_OPTIONS = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Auto', 'elementor'),
  value: 'auto'
}, {
  label: '1/1',
  value: '1/1'
}, {
  label: '4/3',
  value: '4/3'
}, {
  label: '3/4',
  value: '3/4'
}, {
  label: '16/9',
  value: '16/9'
}, {
  label: '9/16',
  value: '9/16'
}, {
  label: '3/2',
  value: '3/2'
}, {
  label: '2/3',
  value: '2/3'
}];
const CUSTOM_RATIO = 'custom';
const AspectRatioControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_9__.createControl)(({
  label
}) => {
  const {
    value: currentPropValue,
    setValue: setAspectRatioValue,
    disabled,
    placeholder: externalPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const aspectRatioValue = currentPropValue ?? externalPlaceholder;
  const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some(option => option.value === aspectRatioValue);
  const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split('/') : ['', ''];
  const [isCustom, setIsCustom] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isCustomSelected);
  const [customWidth, setCustomWidth] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialWidth);
  const [customHeight, setCustomHeight] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialHeight);
  const [selectedValue, setSelectedValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || '');
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    const isCustomValue = aspectRatioValue && !RATIO_OPTIONS.some(option => option.value === aspectRatioValue);
    if (isCustomValue) {
      const [width, height] = aspectRatioValue.split('/');
      setCustomWidth(width || '');
      setCustomHeight(height || '');
      setSelectedValue(CUSTOM_RATIO);
      setIsCustom(true);
    } else {
      setSelectedValue(aspectRatioValue || '');
      setIsCustom(false);
      setCustomWidth('');
      setCustomHeight('');
    }
  }, [aspectRatioValue]);
  const handleSelectChange = event => {
    const newValue = event.target.value;
    const isCustomRatio = newValue === CUSTOM_RATIO;
    setIsCustom(isCustomRatio);
    setSelectedValue(newValue);
    if (isCustomRatio) {
      return;
    }
    setAspectRatioValue(newValue);
  };
  const handleCustomWidthChange = event => {
    const newWidth = event.target.value;
    setCustomWidth(newWidth);
    if (newWidth && customHeight) {
      setAspectRatioValue(`${newWidth}/${customHeight}`);
    }
  };
  const handleCustomHeightChange = event => {
    const newHeight = event.target.value;
    setCustomHeight(newHeight);
    if (customWidth && newHeight) {
      setAspectRatioValue(`${customWidth}/${newHeight}`);
    }
  };
  const lookup = currentPropValue ?? externalPlaceholder;
  const selectedOption = RATIO_OPTIONS.find(option => option.value === lookup);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    direction: "column",
    gap: 2
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_7__.ControlLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Select, {
    size: "tiny",
    displayEmpty: true,
    sx: {
      overflow: 'hidden'
    },
    disabled: disabled,
    value: selectedValue,
    onChange: handleSelectChange,
    renderValue: isCustomSelected ? undefined : () => selectedOption?.label,
    fullWidth: true
  }, [...RATIO_OPTIONS, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Custom', 'elementor'),
    value: CUSTOM_RATIO
  }].map(({
    label: optionLabel,
    ...props
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuListItem, _extends({
    key: props.value
  }, props, {
    value: props.value ?? ''
  }), optionLabel))))), isCustom && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.TextField, {
    size: "tiny",
    type: "number",
    fullWidth: true,
    disabled: disabled,
    value: customWidth,
    onChange: handleCustomWidthChange,
    InputProps: {
      startAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.ArrowsMoveHorizontalIcon, {
        fontSize: "tiny"
      })
    }
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.TextField, {
    size: "tiny",
    type: "number",
    fullWidth: true,
    disabled: disabled,
    value: customHeight,
    onChange: handleCustomHeightChange,
    InputProps: {
      startAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.ArrowsMoveVerticalIcon, {
        fontSize: "tiny"
      })
    }
  })))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/attachment-type-control.tsx":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/attachment-type-control.tsx ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AttachmentTypeControl: function() { return /* binding */ AttachmentTypeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");







const AttachmentTypeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  label,
  options
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    direction: "column",
    gap: 1
  }, label && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_6__.SelectControl, {
    options: options
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.InfoAlert, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Linked uploads are saved to the server. Direct attachments will not appear under Submissions.', 'elementor'))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-control.tsx":
/*!*******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-control.tsx ***!
  \*******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundControl: function() { return /* binding */ BackgroundControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _color_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _background_overlay_background_overlay_repeater_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./background-overlay/background-overlay-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx");










const clipOptions = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Full element', 'elementor'),
  value: 'border-box'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Padding edges', 'elementor'),
  value: 'padding-box'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Content edges', 'elementor'),
  value: 'content-box'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Text', 'elementor'),
  value: 'text'
}];
const colorLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Color', 'elementor');
const clipLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Clipping', 'elementor');
const BackgroundControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(() => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, propContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "background-overlay"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_overlay_background_overlay_repeater_control__WEBPACK_IMPORTED_MODULE_9__.BackgroundOverlayRepeaterControl, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BackgroundColorField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BackgroundClipField, null));
});
const BackgroundColorField = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "color"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_5__.ControlLabel, null, colorLabel)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_color_control__WEBPACK_IMPORTED_MODULE_7__.ColorControl, null))));
};
const BackgroundClipField = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "clip"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_5__.ControlLabel, null, clipLabel)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_8__.SelectControl, {
    options: clipOptions
  }))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-gradient-color-control.tsx":
/*!**********************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-gradient-color-control.tsx ***!
  \**********************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundGradientColorControl: function() { return /* binding */ BackgroundGradientColorControl; },
/* harmony export */   initialBackgroundGradientOverlay: function() { return /* binding */ initialBackgroundGradientOverlay; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");





const BackgroundGradientColorControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(() => {
  const {
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundGradientOverlayPropTypeUtil);
  const handleChange = newValue => {
    const transformedValue = createTransformableValue(newValue);
    if (transformedValue.positions) {
      transformedValue.positions = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(newValue.positions.join(' '));
    }
    setValue(transformedValue);
  };

  // TODO: To support Global variables this won't be needed when we have a flexible Gradient Box
  const createTransformableValue = newValue => ({
    ...newValue,
    type: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(newValue.type),
    angle: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(newValue.angle),
    stops: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.gradientColorStopPropTypeUtil.create(newValue.stops.map(({
      color,
      offset
    }) => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorStopPropTypeUtil.create({
      color: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorPropTypeUtil.create(color),
      offset: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(offset)
    })))
  });

  // TODO: To support Global variables this won't be needed when we have a flexible Gradient Box
  const normalizeValue = () => {
    if (!value) {
      return;
    }
    const {
      type,
      angle,
      stops,
      positions
    } = value;
    return {
      type: type.value,
      angle: angle?.value || 0,
      stops: stops.value.map(({
        value: {
          color,
          offset
        }
      }) => ({
        color: color.value,
        offset: offset.value
      })),
      positions: positions?.value.split(' ')
    };
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableGradientBox, {
    sx: {
      width: 'auto',
      padding: 1.5
    },
    value: normalizeValue(),
    onChange: handleChange
  });
});
const initialBackgroundGradientOverlay = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundGradientOverlayPropTypeUtil.create({
  type: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create('linear'),
  angle: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(180),
  stops: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.gradientColorStopPropTypeUtil.create([_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorStopPropTypeUtil.create({
    color: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorPropTypeUtil.create('rgb(0,0,0)'),
    offset: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(0)
  }), _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorStopPropTypeUtil.create({
    color: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorPropTypeUtil.create('rgb(255,255,255)'),
    offset: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(100)
  })])
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx":
/*!********************************************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx ***!
  \********************************************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundImageOverlayAttachment: function() { return /* binding */ BackgroundImageOverlayAttachment; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _toggle_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../toggle-control */ "./packages/packages/libs/editor-controls/src/controls/toggle-control.tsx");







const attachmentControlOptions = [{
  value: 'fixed',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Fixed', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PinIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'scroll',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Scroll', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.PinnedOffIcon, {
    fontSize: size
  }),
  showTooltip: true
}];
const BackgroundImageOverlayAttachment = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Attachment', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      justifyContent: 'flex-end',
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_toggle_control__WEBPACK_IMPORTED_MODULE_6__.ToggleControl, {
    options: attachmentControlOptions
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx":
/*!******************************************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx ***!
  \******************************************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundImageOverlayPosition: function() { return /* binding */ BackgroundImageOverlayPosition; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");












const backgroundPositionOptions = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center center', 'elementor'),
  value: 'center center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center left', 'elementor'),
  value: 'center left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center right', 'elementor'),
  value: 'center right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top center', 'elementor'),
  value: 'top center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top left', 'elementor'),
  value: 'top left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top right', 'elementor'),
  value: 'top right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom center', 'elementor'),
  value: 'bottom center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom left', 'elementor'),
  value: 'bottom left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom right', 'elementor'),
  value: 'bottom right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Custom', 'elementor'),
  value: 'custom'
}];
const BackgroundImageOverlayPosition = () => {
  const backgroundImageOffsetContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundImagePositionOffsetPropTypeUtil);
  const stringPropContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const isCustom = !!backgroundImageOffsetContext.value;
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const handlePositionChange = event => {
    const value = event.target.value || null;
    if (value === 'custom') {
      backgroundImageOffsetContext.setValue({
        x: null,
        y: null
      });
    } else {
      stringPropContext.setValue(value);
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Position', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      justifyContent: 'flex-end',
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_9__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Select, {
    fullWidth: true,
    size: "tiny",
    onChange: handlePositionChange,
    disabled: stringPropContext.disabled,
    value: (backgroundImageOffsetContext.value ? 'custom' : stringPropContext.value) ?? ''
  }, backgroundPositionOptions.map(({
    label,
    value
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuListItem, {
    key: value,
    value: value ?? ''
  }, label))))))), isCustom ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, backgroundImageOffsetContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    spacing: 1.5,
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: 'x'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_10__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LetterXIcon, {
      fontSize: 'tiny'
    }),
    anchorRef: rowRef,
    min: -Number.MAX_SAFE_INTEGER
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: 'y'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_10__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LetterYIcon, {
      fontSize: 'tiny'
    }),
    anchorRef: rowRef,
    min: -Number.MAX_SAFE_INTEGER
  })))))) : null);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx":
/*!****************************************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx ***!
  \****************************************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundImageOverlayRepeat: function() { return /* binding */ BackgroundImageOverlayRepeat; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _toggle_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../toggle-control */ "./packages/packages/libs/editor-controls/src/controls/toggle-control.tsx");







const repeatControlOptions = [{
  value: 'repeat',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Repeat', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.GridDotsIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'repeat-x',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Repeat-x', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.DotsHorizontalIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'repeat-y',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Repeat-y', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.DotsVerticalIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'no-repeat',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('No-repeat', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.XIcon, {
    fontSize: size
  }),
  showTooltip: true
}];
const BackgroundImageOverlayRepeat = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Repeat', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      justifyContent: 'flex-end'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_toggle_control__WEBPACK_IMPORTED_MODULE_6__.ToggleControl, {
    options: repeatControlOptions
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx":
/*!**************************************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx ***!
  \**************************************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundImageOverlaySize: function() { return /* binding */ BackgroundImageOverlaySize; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../../components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");











const sizeControlOptions = [{
  value: 'auto',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Auto', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.LetterAIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'cover',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Cover', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowsMaximizeIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'contain',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Contain', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowBarBothIcon, {
    fontSize: size
  }),
  showTooltip: true
}, {
  value: 'custom',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Custom', 'elementor'),
  renderContent: ({
    size
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.PencilIcon, {
    fontSize: size
  }),
  showTooltip: true
}];
const BackgroundImageOverlaySize = () => {
  const backgroundImageScaleContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundImageSizeScalePropTypeUtil);
  const stringPropContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const isCustom = !!backgroundImageScaleContext.value;
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const handleSizeChange = size => {
    if (size === 'custom') {
      backgroundImageScaleContext.setValue({
        width: null,
        height: null
      });
    } else {
      stringPropContext.setValue(size);
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_6__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Size', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      justifyContent: 'flex-end'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_7__.ControlToggleButtonGroup, {
    exclusive: true,
    items: sizeControlOptions,
    onChange: handleSizeChange,
    disabled: stringPropContext.disabled,
    value: backgroundImageScaleContext.value ? 'custom' : stringPropContext.value
  })))), isCustom ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, backgroundImageScaleContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 12,
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'width'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowsMoveHorizontalIcon, {
      fontSize: 'tiny'
    }),
    extendedOptions: ['auto'],
    anchorRef: rowRef
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'height'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowsMoveVerticalIcon, {
      fontSize: 'tiny'
    }),
    extendedOptions: ['auto'],
    anchorRef: rowRef
  })))))) : null);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx":
/*!*******************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx ***!
  \*******************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BackgroundOverlayRepeaterControl: function() { return /* binding */ BackgroundOverlayRepeaterControl; },
/* harmony export */   ItemContent: function() { return /* binding */ ItemContent; },
/* harmony export */   ItemLabel: function() { return /* binding */ ItemLabel; },
/* harmony export */   getInitialBackgroundOverlay: function() { return /* binding */ getInitialBackgroundOverlay; },
/* harmony export */   initialBackgroundColorOverlay: function() { return /* binding */ initialBackgroundColorOverlay; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/wp-media */ "@elementor/wp-media");
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_wp_media__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../components/control-repeater/actions/disable-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../components/control-repeater/actions/duplicate-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../components/control-repeater/context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_control_repeater_items_item__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../components/control-repeater/items/item */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/item.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../env */ "./packages/packages/libs/editor-controls/src/env.ts");
/* harmony import */ var _color_control__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _image_control__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../image-control */ "./packages/packages/libs/editor-controls/src/controls/image-control.tsx");
/* harmony import */ var _background_gradient_color_control__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../background-gradient-color-control */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-gradient-color-control.tsx");
/* harmony import */ var _background_image_overlay_background_image_overlay_attachment__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./background-image-overlay/background-image-overlay-attachment */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx");
/* harmony import */ var _background_image_overlay_background_image_overlay_position__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./background-image-overlay/background-image-overlay-position */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx");
/* harmony import */ var _background_image_overlay_background_image_overlay_repeat__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./background-image-overlay/background-image-overlay-repeat */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx");
/* harmony import */ var _background_image_overlay_background_image_overlay_size__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./background-image-overlay/background-image-overlay-size */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx");
/* harmony import */ var _use_background_tabs_history__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./use-background-tabs-history */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/use-background-tabs-history.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }

























const DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR = '#00000033';
const initialBackgroundColorOverlay = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundColorOverlayPropTypeUtil.create({
  color: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorPropTypeUtil.create(DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR)
});
const getInitialBackgroundOverlay = () => ({
  $$type: 'background-image-overlay',
  value: {
    image: {
      $$type: 'image',
      value: {
        src: {
          $$type: 'image-src',
          value: {
            url: {
              $$type: 'url',
              value: _env__WEBPACK_IMPORTED_MODULE_16__.env.background_placeholder_image
            },
            id: null
          }
        },
        size: {
          $$type: 'string',
          value: 'large'
        }
      }
    }
  }
});
const backgroundResolutionOptions = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Thumbnail - 150 x 150', 'elementor'),
  value: 'thumbnail'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Medium - 300 x 300', 'elementor'),
  value: 'medium'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Large 1024 x 1024', 'elementor'),
  value: 'large'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Full', 'elementor'),
  value: 'full'
}];
const BackgroundOverlayRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_15__.createControl)(() => {
  const {
    propType,
    value: overlayValues,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundOverlayPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, {
    propType: propType,
    value: overlayValues,
    setValue: setValue
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.ControlRepeater, {
    initial: getInitialBackgroundOverlay(),
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundOverlayPropTypeUtil
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_14__.RepeaterHeader, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Overlay', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.TooltipAddItemAction, {
    newItemIndex: 0
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.ItemsContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_item__WEBPACK_IMPORTED_MODULE_12__.Item, {
    Icon: ItemIcon,
    Label: ItemLabel,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_8__.DuplicateItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_7__.DisableItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_9__.RemoveItemAction, null))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_11__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemContent, null))));
});
const ItemContent = () => {
  const {
    getTabsProps,
    getTabProps,
    getTabPanelProps
  } = (0,_use_background_tabs_history__WEBPACK_IMPORTED_MODULE_24__.useBackgroundTabsHistory)({
    image: getInitialBackgroundOverlay().value,
    color: initialBackgroundColorOverlay.value,
    gradient: _background_gradient_color_control__WEBPACK_IMPORTED_MODULE_19__.initialBackgroundGradientOverlay.value
  });
  const {
    rowRef
  } = (0,_components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_10__.useRepeaterContext)();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      width: '100%'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      borderBottom: 1,
      borderColor: 'divider'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tabs, _extends({
    size: "small",
    variant: "fullWidth"
  }, getTabsProps(), {
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Background Overlay', 'elementor')
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Image', 'elementor')
  }, getTabProps('image'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Gradient', 'elementor')
  }, getTabProps('gradient'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Color', 'elementor')
  }, getTabProps('color'))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps('image')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_13__.PopoverContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ImageOverlayContent, null))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps('gradient')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_gradient_color_control__WEBPACK_IMPORTED_MODULE_19__.BackgroundGradientColorControl, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps('color')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_13__.PopoverContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ColorOverlayContent, {
    anchorEl: rowRef
  }))));
};
const ItemIcon = ({
  value
}) => {
  switch (value.$$type) {
    case 'background-image-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemIconImage, {
        value: value
      });
    case 'background-color-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemIconColor, {
        value: value
      });
    case 'background-gradient-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemIconGradient, {
        value: value
      });
    default:
      return null;
  }
};
const extractColorFrom = prop => {
  if (prop?.value?.color?.value) {
    return prop.value.color.value;
  }
  return '';
};
const ItemIconColor = ({
  value: prop
}) => {
  const color = extractColorFrom(prop);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledUnstableColorIndicator, {
    size: "inherit",
    component: "span",
    value: color
  });
};
const ItemIconImage = ({
  value
}) => {
  const {
    imageUrl
  } = useImage(value);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CardMedia, {
    image: imageUrl,
    sx: theme => ({
      height: '1rem',
      width: '1rem',
      borderRadius: `${theme.shape.borderRadius / 2}px`,
      outline: `1px solid ${theme.palette.action.disabled}`
    })
  });
};
const ItemIconGradient = ({
  value
}) => {
  const gradient = getGradientValue(value);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledUnstableColorIndicator, {
    size: "inherit",
    component: "span",
    value: gradient
  });
};
const ItemLabel = ({
  value
}) => {
  switch (value.$$type) {
    case 'background-image-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemLabelImage, {
        value: value
      });
    case 'background-color-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemLabelColor, {
        value: value
      });
    case 'background-gradient-overlay':
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemLabelGradient, {
        value: value
      });
    default:
      return null;
  }
};
const ItemLabelColor = ({
  value: prop
}) => {
  const color = extractColorFrom(prop);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, color);
};
const ItemLabelImage = ({
  value
}) => {
  const {
    imageTitle
  } = useImage(value);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, imageTitle);
};
const ItemLabelGradient = ({
  value
}) => {
  if (value.value.type.value === 'linear') {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Linear Gradient', 'elementor'));
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Radial Gradient', 'elementor'));
};
const ColorOverlayContent = ({
  anchorEl
}) => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundColorOverlayPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, propContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'color'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_color_control__WEBPACK_IMPORTED_MODULE_17__.ColorControl, {
    anchorEl: anchorEl
  })));
};
const ImageOverlayContent = () => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundImageOverlayPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, propContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'image'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_image_control__WEBPACK_IMPORTED_MODULE_18__.ImageControl, {
    sizes: backgroundResolutionOptions
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'position'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_image_overlay_background_image_overlay_position__WEBPACK_IMPORTED_MODULE_21__.BackgroundImageOverlayPosition, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'repeat'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_image_overlay_background_image_overlay_repeat__WEBPACK_IMPORTED_MODULE_22__.BackgroundImageOverlayRepeat, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'size'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_image_overlay_background_image_overlay_size__WEBPACK_IMPORTED_MODULE_23__.BackgroundImageOverlaySize, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'attachment'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_background_image_overlay_background_image_overlay_attachment__WEBPACK_IMPORTED_MODULE_20__.BackgroundImageOverlayAttachment, null)));
};
const StyledUnstableColorIndicator = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableColorIndicator)(({
  theme
}) => ({
  height: '1rem',
  width: '1rem',
  borderRadius: `${theme.shape.borderRadius / 2}px`
}));
const useImage = image => {
  let imageTitle,
    imageUrl = null;
  const imageSrc = image?.value.image.value?.src.value;
  const {
    data: attachment
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_3__.useWpMediaAttachment)(imageSrc.id?.value || null);
  if (imageSrc.id) {
    const imageFileTypeExtension = getFileExtensionFromFilename(attachment?.filename);
    imageTitle = `${attachment?.title}${imageFileTypeExtension}` || null;
    imageUrl = attachment?.url || null;
  } else if (imageSrc.url) {
    imageUrl = imageSrc.url.value;
    imageTitle = imageUrl?.substring(imageUrl.lastIndexOf('/') + 1) || null;
  }
  return {
    imageTitle,
    imageUrl
  };
};
const getFileExtensionFromFilename = filename => {
  if (!filename) {
    return '';
  }

  // get the substring after the last . in the filename
  const extension = filename.substring(filename.lastIndexOf('.') + 1);
  return `.${extension}`;
};
const getGradientValue = value => {
  const gradient = value.value;
  const stops = gradient.stops.value?.map(({
    value: {
      color,
      offset
    }
  }) => `${color.value} ${offset.value ?? 0}%`)?.join(',');
  if (gradient.type.value === 'linear') {
    return `linear-gradient(${gradient.angle.value}deg, ${stops})`;
  }
  return `radial-gradient(circle at ${gradient.positions.value}, ${stops})`;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/use-background-tabs-history.ts":
/*!**********************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/use-background-tabs-history.ts ***!
  \**********************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useBackgroundTabsHistory: function() { return /* binding */ useBackgroundTabsHistory; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");




const useBackgroundTabsHistory = ({
  color: initialBackgroundColorOverlay,
  image: initialBackgroundImageOverlay,
  gradient: initialBackgroundGradientOverlay
}) => {
  const {
    value: imageValue,
    setValue: setImageValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundImageOverlayPropTypeUtil);
  const {
    value: colorValue,
    setValue: setColorValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundColorOverlayPropTypeUtil);
  const {
    value: gradientValue,
    setValue: setGradientValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backgroundGradientOverlayPropTypeUtil);
  const getCurrentOverlayType = () => {
    if (colorValue) {
      return 'color';
    }
    if (gradientValue) {
      return 'gradient';
    }
    return 'image';
  };
  const {
    getTabsProps,
    getTabProps,
    getTabPanelProps
  } = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.useTabs)(getCurrentOverlayType());
  const valuesHistory = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
    image: initialBackgroundImageOverlay,
    color: initialBackgroundColorOverlay,
    gradient: initialBackgroundGradientOverlay
  });
  const saveToHistory = (key, value) => {
    if (value) {
      valuesHistory.current[key] = value;
    }
  };
  const onTabChange = (e, tabName) => {
    switch (tabName) {
      case 'image':
        setImageValue(valuesHistory.current.image);
        saveToHistory('color', colorValue);
        saveToHistory('gradient', gradientValue);
        break;
      case 'gradient':
        setGradientValue(valuesHistory.current.gradient);
        saveToHistory('color', colorValue);
        saveToHistory('image', imageValue);
        break;
      case 'color':
        setColorValue(valuesHistory.current.color);
        saveToHistory('image', imageValue);
        saveToHistory('gradient', gradientValue);
    }
    return getTabsProps().onChange(e, tabName);
  };
  return {
    getTabProps,
    getTabPanelProps,
    getTabsProps: () => ({
      ...getTabsProps(),
      onChange: onTabChange
    })
  };
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/box-shadow-repeater-control.tsx":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/box-shadow-repeater-control.tsx ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BoxShadowRepeaterControl: function() { return /* binding */ BoxShadowRepeaterControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/control-repeater/actions/disable-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-repeater/actions/duplicate-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/control-repeater/context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _color_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");



















const BoxShadowRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_14__.createControl)(() => {
  const {
    propType,
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.boxShadowPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, {
    propType: propType,
    value: value,
    setValue: setValue,
    isDisabled: () => disabled
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_5__.ControlRepeater, {
    initial: initialShadow,
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.boxShadowPropTypeUtil
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_13__.RepeaterHeader, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Box shadow', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_5__.TooltipAddItemAction, {
    newItemIndex: 0,
    disabled: disabled,
    ariaLabel: 'Box shadow'
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_5__.ItemsContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_5__.Item, {
    Icon: ItemIcon,
    Label: ItemLabel,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_7__.DuplicateItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_6__.DisableItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_8__.RemoveItemAction, null))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_10__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Content, null))));
});
const StyledUnstableColorIndicator = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableColorIndicator)(({
  theme
}) => ({
  height: '1rem',
  width: '1rem',
  borderRadius: `${theme.shape.borderRadius / 2}px`
}));
const ItemIcon = ({
  value
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledUnstableColorIndicator, {
  size: "inherit",
  component: "span",
  value: value.value.color?.value
});
const Content = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.shadowPropTypeUtil);
  const rowRef = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  const {
    rowRef: anchorEl
  } = (0,_components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_9__.useRepeaterContext)();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_11__.PopoverContent, {
    p: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_12__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "color",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Color', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_color_control__WEBPACK_IMPORTED_MODULE_15__.ColorControl, {
    anchorEl: anchorEl
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "position",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Position', 'elementor'),
    sx: {
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_16__.SelectControl, {
    options: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Inset', 'elementor'),
      value: 'inset'
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Outset', 'elementor'),
      value: null
    }]
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_12__.PopoverGridContainer, {
    ref: rowRef[0]
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "hOffset",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Horizontal', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_17__.SizeControl, {
    anchorRef: rowRef[0],
    min: -Number.MAX_SAFE_INTEGER
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "vOffset",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Vertical', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_17__.SizeControl, {
    anchorRef: rowRef[0],
    min: -Number.MAX_SAFE_INTEGER
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_12__.PopoverGridContainer, {
    ref: rowRef[1]
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "blur",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Blur', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_17__.SizeControl, {
    anchorRef: rowRef[1]
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "spread",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Spread', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_17__.SizeControl, {
    anchorRef: rowRef[1],
    min: -Number.MAX_SAFE_INTEGER
  })))));
};
const Control = ({
  label,
  bind,
  children,
  sx
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: bind
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true,
  xs: 6,
  sx: sx
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  container: true,
  gap: 0.75,
  alignItems: "center"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true,
  xs: 12
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormLabel, {
  size: "tiny"
}, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true,
  xs: 12
}, children))));
const ItemLabel = ({
  value
}) => {
  const {
    position,
    hOffset,
    vOffset,
    blur,
    spread
  } = value.value;
  const {
    size: blurSize = '',
    unit: blurUnit = ''
  } = blur?.value || {};
  const {
    size: spreadSize = '',
    unit: spreadUnit = ''
  } = spread?.value || {};
  const {
    size: hOffsetSize = 'unset',
    unit: hOffsetUnit = ''
  } = hOffset?.value || {};
  const {
    size: vOffsetSize = 'unset',
    unit: vOffsetUnit = ''
  } = vOffset?.value || {};
  const positionLabel = position?.value || 'outset';
  const sizes = [[hOffsetSize, hOffsetUnit], [vOffsetSize, vOffsetUnit], [blurSize, blurUnit], [spreadSize, spreadUnit]].map(([size, unit]) => {
    if (unit !== 'custom') {
      return size + unit;
    }
    return !size ? _size_control__WEBPACK_IMPORTED_MODULE_17__.CUSTOM_SIZE_LABEL : size;
  }).join(' ');
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", {
    style: {
      textTransform: 'capitalize'
    }
  }, positionLabel, ": ", sizes);
};
const initialShadow = {
  $$type: 'shadow',
  value: {
    hOffset: {
      $$type: 'size',
      value: {
        unit: 'px',
        size: 0
      }
    },
    vOffset: {
      $$type: 'size',
      value: {
        unit: 'px',
        size: 0
      }
    },
    blur: {
      $$type: 'size',
      value: {
        unit: 'px',
        size: 10
      }
    },
    spread: {
      $$type: 'size',
      value: {
        unit: 'px',
        size: 0
      }
    },
    color: {
      $$type: 'color',
      value: 'rgba(0, 0, 0, 1)'
    },
    position: null
  }
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/chips-control.tsx":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/chips-control.tsx ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ChipsControl: function() { return /* binding */ ChipsControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_chips_list__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/chips-list */ "./packages/packages/libs/editor-controls/src/components/chips-list.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");







const SIZE = 'tiny';
const toChipsOption = (val, options) => options.find(opt => opt.value === val) ?? {
  label: val,
  value: val
};
const ChipsControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(({
  options,
  freeChips
}) => {
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringArrayPropTypeUtil);
  const selectedValues = (value || []).map(item => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(item)).filter(val => val !== null);
  const selectedOptions = selectedValues.map(val => toChipsOption(val, options));
  const handleChange = (_, newValue) => {
    setValue(newValue.map(option => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(typeof option === 'string' ? option : option.value)));
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Autocomplete, {
    fullWidth: true,
    multiple: true,
    freeSolo: freeChips,
    size: SIZE,
    disabled: disabled,
    value: selectedOptions,
    filterSelectedOptions: true,
    onChange: handleChange,
    options: options,
    getOptionLabel: option => typeof option === 'string' ? option : option.label,
    isOptionEqualToValue: (option, val) => option.value === val.value,
    renderInput: params => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, params),
    renderTags: (tagValues, getTagProps) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_chips_list__WEBPACK_IMPORTED_MODULE_4__.ChipsList, {
      getLabel: option => typeof option === 'string' ? option : option.label,
      getTagProps: getTagProps,
      values: tagValues
    })
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/color-control.tsx ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ColorControl: function() { return /* binding */ ColorControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }






const ColorControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  propTypeUtil = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorPropTypeUtil,
  anchorEl,
  slotProps = {},
  id,
  ...props
}) => {
  const {
    value,
    setValue,
    placeholder: boundPropPlaceholder,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(propTypeUtil);
  const placeholder = props.placeholder ?? boundPropPlaceholder;
  const handleChange = selectedColor => {
    setValue(selectedColor || null);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.UnstableColorField, _extends({
    id: id,
    size: "tiny",
    fullWidth: true,
    value: value ?? '',
    placeholder: placeholder ?? '',
    onChange: handleChange
  }, props, {
    disabled: disabled,
    slotProps: {
      ...slotProps,
      colorPicker: {
        anchorEl,
        anchorOrigin: {
          vertical: 'top',
          horizontal: 'right'
        },
        transformOrigin: {
          vertical: 'top',
          horizontal: -10
        },
        slotProps: {
          colorIndicator: {
            value: value ?? placeholder ?? ''
          },
          colorBox: {
            value: value ?? placeholder ?? ''
          }
        }
      }
    }
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/date-range-control.tsx":
/*!************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/date-range-control.tsx ***!
  \************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DateRangeControl: function() { return /* binding */ DateRangeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _date_string_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./date-string-control */ "./packages/packages/libs/editor-controls/src/controls/date-string-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const RANGE_LABELS = {
  min: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Min date', 'elementor'),
  max: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Max date', 'elementor')
};
const isMaxBeforeMin = (minIso, maxIso) => {
  if (!minIso || !maxIso) {
    return false;
  }
  return maxIso < minIso;
};
const RANGE_ERROR_MESSAGE = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Max date must be on or after Min date', 'elementor');
const DateRangeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(() => {
  const {
    value,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dateRangePropTypeUtil);
  const minString = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dateStringPropTypeUtil.extract(value?.min);
  const maxString = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dateStringPropTypeUtil.extract(value?.max);
  const hasInvalidRange = isMaxBeforeMin(minString, maxString);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: setValue
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    gap: 0.75
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, RANGE_LABELS.min)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BoundDateStringControl, {
    bind: 'min',
    ariaLabel: RANGE_LABELS.min,
    error: hasInvalidRange
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, RANGE_LABELS.max)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BoundDateStringControl, {
    bind: 'max',
    ariaLabel: RANGE_LABELS.max,
    error: hasInvalidRange
  })))), hasInvalidRange && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormHelperText, {
    error: true
  }, RANGE_ERROR_MESSAGE)));
});
const BoundDateStringControl = ({
  bind,
  ariaLabel,
  error
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_date_string_control__WEBPACK_IMPORTED_MODULE_7__.DateStringControl, {
    ariaLabel: ariaLabel,
    error: error,
    coerceInvalidToNull: true
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/date-string-control.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/date-string-control.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DateStringControl: function() { return /* binding */ DateStringControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _utils_date_time__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/date-time */ "./packages/packages/libs/editor-controls/src/utils/date-time.ts");







const DateStringControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  inputDisabled,
  ariaLabel,
  error,
  coerceInvalidToNull = false
}) => {
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dateStringPropTypeUtil);
  const isDisabled = inputDisabled ?? disabled;
  const slotProps = {
    textField: {
      size: 'tiny',
      fullWidth: true,
      error,
      inputProps: ariaLabel ? {
        'aria-label': ariaLabel
      } : undefined
    },
    openPickerButton: {
      size: 'tiny'
    },
    openPickerIcon: {
      fontSize: 'tiny'
    }
  };
  const handleChange = (newValue, format) => {
    if (!newValue) {
      setValue(null);
      return;
    }
    if (coerceInvalidToNull && !(0,_utils_date_time__WEBPACK_IMPORTED_MODULE_6__.isValidDayjs)(newValue)) {
      setValue(null);
      return;
    }
    setValue(newValue.format(format));
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.LocalizationProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DatePicker, {
    value: (0,_utils_date_time__WEBPACK_IMPORTED_MODULE_6__.parseDateString)(value ?? ''),
    onChange: newValue => handleChange(newValue, _utils_date_time__WEBPACK_IMPORTED_MODULE_6__.DATE_FORMAT),
    disabled: isDisabled,
    slotProps: slotProps
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/date-time-control.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/date-time-control.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DateTimeControl: function() { return /* binding */ DateTimeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const DATE_FORMAT = 'YYYY-MM-DD';
const TIME_FORMAT = 'HH:mm';
const DateTimeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(({
  inputDisabled
}) => {
  const {
    value,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.DateTimePropTypeUtil);
  const handleChange = (newValue, meta) => {
    const field = meta.bind;
    const fieldValue = newValue[field];
    if ((0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.isTransformable)(fieldValue)) {
      return setValue({
        ...value,
        [field]: fieldValue
      });
    }
    let formattedValue = '';
    if (fieldValue) {
      const dayjsValue = fieldValue;
      formattedValue = field === 'date' ? dayjsValue.format(DATE_FORMAT) : dayjsValue.format(TIME_FORMAT);
    }
    setValue({
      ...value,
      [field]: {
        $$type: 'string',
        value: formattedValue
      }
    });
  };
  const parseDateValue = dateStr => {
    if (!dateStr) {
      return null;
    }
    const d = dayjs__WEBPACK_IMPORTED_MODULE_1___default()(dateStr);
    return d && typeof d.isValid === 'function' && d.isValid() ? d : null;
  };
  const parseTimeValue = timeStr => {
    if (!timeStr) {
      return null;
    }
    const [hours, minutes] = timeStr.split(':');
    const h = Number.parseInt(hours ?? '', 10);
    const m = Number.parseInt(minutes ?? '', 10);
    if (Number.isNaN(h) || Number.isNaN(m)) {
      return null;
    }
    const base = dayjs__WEBPACK_IMPORTED_MODULE_1___default()();
    return base.hour(h).minute(m).second(0).millisecond(0);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: setValue
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.LocalizationProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
    display: "flex",
    gap: 1,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "date"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.DatePicker, {
    value: parseDateValue(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(value?.date)),
    onChange: v => handleChange({
      date: v
    }, {
      bind: 'date'
    }),
    disabled: inputDisabled,
    slotProps: {
      textField: {
        size: 'tiny'
      },
      openPickerButton: {
        size: 'tiny'
      },
      openPickerIcon: {
        fontSize: 'tiny'
      }
    }
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "time"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.TimePicker, {
    value: parseTimeValue(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(value?.time)),
    onChange: v => handleChange({
      time: v
    }, {
      bind: 'time'
    }),
    disabled: inputDisabled,
    slotProps: {
      textField: {
        size: 'tiny'
      },
      openPickerButton: {
        size: 'tiny'
      },
      openPickerIcon: {
        fontSize: 'tiny'
      }
    }
  }))))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-chips-field.tsx":
/*!*************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-chips-field.tsx ***!
  \*************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EmailChipsField: function() { return /* binding */ EmailChipsField; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_chips_list__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../components/chips-list */ "./packages/packages/libs/editor-controls/src/components/chips-list.tsx");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/utils.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









// type EmailChip = { label: string; value: string };

const EmailChipsField = ({
  fieldLabel,
  placeholder
}) => {
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringArrayPropTypeUtil);
  const [inputValue, setInputValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
  const items = value || [];
  const selectedValues = items.map(item => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(item)).filter(val => val !== null);
  const tryAddChip = raw => {
    const address = raw.trim();
    if (!address || selectedValues.includes(address) || !(0,_utils__WEBPACK_IMPORTED_MODULE_6__.isValidEmail)(address)) {
      return;
    }
    setValue([...items, _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(address)]);
    setInputValue('');
  };
  const handleChange = (_, newValue) => {
    const updated = [];
    for (const entry of newValue) {
      const address = entry.trim();
      if (!address || !(0,_utils__WEBPACK_IMPORTED_MODULE_6__.isValidEmail)(address)) {
        continue;
      }
      updated.push(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(address));
    }
    setValue(updated);
    setInputValue('');
  };
  const handleBlur = event => {
    const target = event.target;
    tryAddChip(target.value);
    setInputValue('');
  };
  const handleKeyDown = event => {
    if (_utils__WEBPACK_IMPORTED_MODULE_6__.CHIP_TRIGGER_KEYS.has(event.key) && inputValue.trim()) {
      event.preventDefault();
      tryAddChip(inputValue);
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    direction: "column",
    gap: 0.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, fieldLabel)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Autocomplete, {
    fullWidth: true,
    multiple: true,
    freeSolo: true,
    size: "tiny",
    disabled: disabled,
    inputValue: inputValue,
    onInputChange: (_, val, reason) => {
      if (reason !== 'reset') {
        setInputValue(val);
      }
    },
    value: selectedValues,
    onChange: handleChange,
    options: [],
    onBlur: handleBlur,
    getOptionLabel: option => option,
    isOptionEqualToValue: (option, val) => option === val,
    renderInput: params => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, _extends({}, params, {
      placeholder: placeholder,
      onKeyDown: handleKeyDown
    })),
    renderTags: (tagValues, getTagProps) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_chips_list__WEBPACK_IMPORTED_MODULE_4__.ChipsList, {
      getLabel: option => option,
      getTagProps: getTagProps,
      values: tagValues
    })
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-field.tsx":
/*!*******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-field.tsx ***!
  \*******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EmailField: function() { return /* binding */ EmailField; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _text_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../text-control */ "./packages/packages/libs/editor-controls/src/controls/text-control.tsx");





const EmailField = ({
  bind,
  label,
  placeholder
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.PropKeyProvider, {
  bind: bind
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
  container: true,
  direction: "column",
  gap: 0.5
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
  item: true
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_3__.ControlFormLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
  item: true
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_text_control__WEBPACK_IMPORTED_MODULE_4__.TextControl, {
  placeholder: placeholder
}))));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/fields.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/email-form-action-control/fields.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BccField: function() { return /* binding */ BccField; },
/* harmony export */   CcField: function() { return /* binding */ CcField; },
/* harmony export */   FromEmailField: function() { return /* binding */ FromEmailField; },
/* harmony export */   FromNameField: function() { return /* binding */ FromNameField; },
/* harmony export */   MessageField: function() { return /* binding */ MessageField; },
/* harmony export */   MetaDataField: function() { return /* binding */ MetaDataField; },
/* harmony export */   ReplyToField: function() { return /* binding */ ReplyToField; },
/* harmony export */   SendAsField: function() { return /* binding */ SendAsField; },
/* harmony export */   SendToField: function() { return /* binding */ SendToField; },
/* harmony export */   SubjectField: function() { return /* binding */ SubjectField; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _hooks_use_form_field_suggestions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../hooks/use-form-field-suggestions */ "./packages/packages/libs/editor-controls/src/hooks/use-form-field-suggestions.ts");
/* harmony import */ var _chips_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../chips-control */ "./packages/packages/libs/editor-controls/src/controls/chips-control.tsx");
/* harmony import */ var _mention_text_area_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../mention-text-area-control */ "./packages/packages/libs/editor-controls/src/controls/mention-text-area-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _email_chips_field__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./email-chips-field */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-chips-field.tsx");
/* harmony import */ var _email_field__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./email-field */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-field.tsx");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/utils.ts");













const SendToField = ({
  placeholder
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_chips_field__WEBPACK_IMPORTED_MODULE_10__.EmailChipsField, {
  fieldLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Send to', 'elementor'),
  placeholder: placeholder
});
const SubjectField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_field__WEBPACK_IMPORTED_MODULE_11__.EmailField, {
  bind: "subject",
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Email subject', 'elementor'),
  placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('New form submission', 'elementor')
});
const MessageField = () => {
  const suggestions = (0,_hooks_use_form_field_suggestions__WEBPACK_IMPORTED_MODULE_6__.useFormFieldSuggestions)();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "message"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    direction: "column",
    gap: 0.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Message', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_mention_text_area_control__WEBPACK_IMPORTED_MODULE_8__.MentionTextAreaControl, {
    suggestions: suggestions
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.InfoAlert, null, (0,_utils__WEBPACK_IMPORTED_MODULE_12__.shouldShowMentionsInfo)() ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('[all-fields] shortcode sends all fields. Type @ to insert specific fields and customize your message.', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('[all-fields] shortcode sends all fields.', 'elementor')))));
};
const FromEmailField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_field__WEBPACK_IMPORTED_MODULE_11__.EmailField, {
  bind: "from",
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('From email', 'elementor'),
  placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('What email should appear as the sender?', 'elementor')
});
const FromNameField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_field__WEBPACK_IMPORTED_MODULE_11__.EmailField, {
  bind: "from-name",
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('From name', 'elementor'),
  placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('What name should appear as the sender?', 'elementor')
});
const ReplyToField = () => {
  const emailSuggestions = (0,_hooks_use_form_field_suggestions__WEBPACK_IMPORTED_MODULE_6__.useFormFieldSuggestions)({
    inputType: 'email'
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "reply-to"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    direction: "column",
    gap: 0.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Reply-to', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_mention_text_area_control__WEBPACK_IMPORTED_MODULE_8__.MentionTextAreaControl, {
    suggestions: emailSuggestions,
    rows: 1,
    triggerPosition: "start",
    placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('You can type @ to insert an email field', 'elementor')
  }))));
};
const CcField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: "cc"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_chips_field__WEBPACK_IMPORTED_MODULE_10__.EmailChipsField, {
  fieldLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Cc', 'elementor')
}));
const BccField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: "bcc"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_email_chips_field__WEBPACK_IMPORTED_MODULE_10__.EmailChipsField, {
  fieldLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Bcc', 'elementor')
}));
const MetaDataField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: "meta-data"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
  gap: 0.5
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Metadata', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_chips_control__WEBPACK_IMPORTED_MODULE_7__.ChipsControl, {
  options: [{
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Date', 'elementor'),
    value: 'date'
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Time', 'elementor'),
    value: 'time'
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Page URL', 'elementor'),
    value: 'page-url'
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('User agent', 'elementor'),
    value: 'user-agent'
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Credit', 'elementor'),
    value: 'credit'
  }]
})));
const SendAsField = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: "send-as"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  container: true,
  direction: "column",
  gap: 0.5
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Send as', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_9__.SelectControl, {
  options: [{
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('HTML', 'elementor'),
    value: 'html'
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Plain Text', 'elementor'),
    value: 'plain'
  }]
}))));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/index.tsx":
/*!*************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/email-form-action-control/index.tsx ***!
  \*************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EmailFormActionControl: function() { return /* binding */ EmailFormActionControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fields */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/fields.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const EmailFormActionControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(({
  toPlaceholder,
  label
}) => {
  const {
    value,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.emailsPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: setValue
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, {
    gap: 2
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_6__.ControlLabel, null, label ? label + ' ' + (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('settings', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Email settings', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: "to"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.SendToField, {
    placeholder: toPlaceholder
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.SubjectField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.MessageField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.FromEmailField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(AdvancedSettings, null)));
});
const AdvancedSettings = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.CollapsibleContent, {
  defaultOpen: false
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
  sx: {
    pt: 2
  }
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, {
  gap: 2
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.FromNameField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.ReplyToField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.CcField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.BccField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.MetaDataField, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_fields__WEBPACK_IMPORTED_MODULE_8__.SendAsField, null))));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/utils.ts":
/*!************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/email-form-action-control/utils.ts ***!
  \************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CHIP_TRIGGER_KEYS: function() { return /* binding */ CHIP_TRIGGER_KEYS; },
/* harmony export */   isValidEmail: function() { return /* binding */ isValidEmail; },
/* harmony export */   shouldShowMentionsInfo: function() { return /* binding */ shouldShowMentionsInfo; }
/* harmony export */ });
/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/schema */ "@elementor/schema");
/* harmony import */ var _elementor_schema__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_schema__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_1__);


const MIN_PRO_VERSION_FOR_MENTIONS = '4.1.0';
const CHIP_TRIGGER_KEYS = new Set([' ', ',']);
function isValidEmail(email) {
  return _elementor_schema__WEBPACK_IMPORTED_MODULE_0__.z.string().email().safeParse(email).success;
}
const shouldShowMentionsInfo = () => {
  if (!(0,_elementor_utils__WEBPACK_IMPORTED_MODULE_1__.hasProInstalled)()) {
    return true;
  }
  const proVersion = window.elementorPro?.config?.version;
  if (!proVersion) {
    return false;
  }
  return (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_1__.isVersionGreaterOrEqual)(proVersion, MIN_PRO_VERSION_FOR_MENTIONS);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/equal-unequal-sizes-control.tsx":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/equal-unequal-sizes-control.tsx ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EqualUnequalSizesControl: function() { return /* binding */ EqualUnequalSizesControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }











function EqualUnequalSizesControl({
  label,
  icon,
  tooltipLabel,
  items,
  multiSizePropTypeUtil
}) {
  const popupId = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)();
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.usePopupState)({
    variant: 'popover',
    popupId
  });
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  const {
    propType: multiSizePropType,
    disabled: multiSizeDisabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(multiSizePropTypeUtil);
  const {
    value: masterValue,
    setValue: setMasterValue,
    placeholder: masterPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)();
  const getMultiSizeValues = sourceValue => {
    if (multiSizePropTypeUtil.isValid(sourceValue)) {
      return sourceValue.value;
    }
    const propValue = {};
    items.forEach(item => {
      propValue[item.bind] = sourceValue;
    });
    const derived = multiSizePropTypeUtil.create(propValue);
    return derived?.value;
  };
  const isShowingGeneralIndicator = !popupState.isOpen;
  const derivedValue = getMultiSizeValues(masterValue);
  const derivedPlaceholder = getMultiSizeValues(masterPlaceholder);
  const isEqualValues = values => {
    if (!values) {
      return true;
    }
    const multiSizeValue = multiSizePropTypeUtil.create(values);
    const propValue = {};
    items.forEach(item => {
      propValue[item.bind] = multiSizeValue?.value?.[item.bind] ?? null;
    });
    const allValues = Object.values(propValue).map(value => JSON.stringify(value));
    return allValues.every(value => value === allValues[0]);
  };
  const isMixedPlaceholder = !masterValue && !isEqualValues(derivedPlaceholder);
  const isMixed = isMixedPlaceholder || !isEqualValues(derivedValue);
  const applyMultiSizeValue = newValue => {
    if (!isEqualValues(newValue)) {
      setMasterValue(multiSizePropTypeUtil.create(newValue));
      return;
    }
    setMasterValue(Object.values(newValue)?.pop() ?? null);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap",
    ref: rowRefs[0]
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, !isShowingGeneralIndicator ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, label) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_5__.ControlLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Stack, {
    direction: "row",
    alignItems: "center",
    gap: 1
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    flexGrow: 1
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    placeholder: isMixed ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Mixed', 'elementor') : undefined,
    enablePropTypeUnits: !isMixed || !isMixedPlaceholder,
    anchorRef: rowRefs[0]
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
    title: tooltipLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_6__.StyledToggleButton, _extends({
    size: 'tiny',
    value: 'check',
    sx: {
      marginLeft: 'auto'
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.bindToggle)(popupState), {
    selected: popupState.isOpen,
    isPlaceholder: isMixedPlaceholder,
    "aria-label": tooltipLabel
  }), icon))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Popover, _extends({
    disablePortal: true,
    disableScrollLock: true,
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'right'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'right'
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.bindPopover)(popupState), {
    slotProps: {
      paper: {
        sx: {
          mt: 0.5,
          width: rowRefs[0].current?.getBoundingClientRect().width
        }
      }
    }
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropProvider, {
    propType: multiSizePropType,
    value: derivedValue,
    placeholder: derivedPlaceholder,
    setValue: applyMultiSizeValue,
    isDisabled: () => multiSizeDisabled
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_7__.PopoverContent, {
    p: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, {
    ref: rowRefs[1]
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MultiSizeValueControl, {
    item: items[0],
    rowRef: rowRefs[1]
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MultiSizeValueControl, {
    item: items[1],
    rowRef: rowRefs[1]
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, {
    ref: rowRefs[2]
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MultiSizeValueControl, {
    item: items[2],
    rowRef: rowRefs[2]
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MultiSizeValueControl, {
    item: items[3],
    rowRef: rowRefs[2]
  }))))));
}
const MultiSizeValueControl = ({
  item,
  rowRef
}) => {
  const {
    bind,
    label,
    icon,
    ariaLabel
  } = item;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_5__.ControlLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    startIcon: icon,
    ariaLabel: ariaLabel,
    anchorRef: rowRef
  })))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/configs.ts":
/*!***************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/configs.ts ***!
  \***************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FILTERS_BY_GROUP: function() { return /* binding */ FILTERS_BY_GROUP; }
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);

const FILTERS_BY_GROUP = {
  blur: {
    blur: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Blur', 'elementor'),
      valueName: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Radius', 'elementor')
    }
  },
  intensity: {
    brightness: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Brightness', 'elementor')
    },
    contrast: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Contrast', 'elementor')
    },
    saturate: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Saturate', 'elementor')
    }
  },
  'hue-rotate': {
    'hue-rotate': {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Hue Rotate', 'elementor'),
      valueName: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Angle', 'elementor')
    }
  },
  'color-tone': {
    grayscale: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Grayscale', 'elementor')
    },
    invert: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Invert', 'elementor')
    },
    sepia: {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Sepia', 'elementor')
    }
  },
  'drop-shadow': {
    'drop-shadow': {
      name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Drop shadow', 'elementor'),
      valueName: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Drop-shadow', 'elementor')
    }
  }
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx":
/*!**************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx ***!
  \**************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterConfigProvider: function() { return /* binding */ FilterConfigProvider; },
/* harmony export */   useFilterConfig: function() { return /* binding */ useFilterConfig; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils */ "./packages/packages/libs/editor-controls/src/controls/filter-control/utils.ts");





const FilterConfigContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
function FilterConfigProvider({
  children
}) {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.cssFilterFunctionPropUtil);
  const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    const config = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.buildFilterConfig)(propContext.propType.item_prop_type);
    const filterOptions = Object.entries(config).map(([key, conf]) => ({
      value: key,
      label: conf.name
    }));
    return {
      config,
      filterOptions,
      getFilterFunctionConfig: filterFunction => config[filterFunction],
      getInitialValue: () => config.blur.defaultValue
    };
  }, [propContext.propType]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FilterConfigContext.Provider, {
    value: contextValue
  }, children);
}
function useFilterConfig() {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(FilterConfigContext);
  if (!context) {
    throw new Error('useFilterConfig must be used within FilterConfigProvider');
  }
  return context;
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx":
/*!*********************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx ***!
  \*********************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DropShadowItemContent: function() { return /* binding */ DropShadowItemContent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _color_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");










const items = [{
  bind: 'xAxis',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('X-axis', 'elementor'),
  rowIndex: 0
}, {
  bind: 'yAxis',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Y-axis', 'elementor'),
  rowIndex: 0
}, {
  bind: 'blur',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Blur', 'elementor'),
  rowIndex: 1
}, {
  bind: 'color',
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Color', 'elementor'),
  rowIndex: 1
}];
const DropShadowItemContent = ({
  anchorEl
}) => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dropShadowFilterPropTypeUtil);
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, context, items.map(item => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__.PopoverGridContainer, {
    key: item.bind,
    ref: rowRefs[item.rowIndex] ?? null
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: item.bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, item.label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, item.bind === 'color' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_color_control__WEBPACK_IMPORTED_MODULE_7__.ColorControl, {
    anchorEl: anchorEl
  }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_8__.SizeControl, {
    anchorRef: rowRefs[item.rowIndex],
    enablePropTypeUnits: true,
    min: item.bind === 'blur' ? 0 : -Number.MAX_SAFE_INTEGER,
    defaultUnit: "px"
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-label.tsx":
/*!*******************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-label.tsx ***!
  \*******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DropShadowItemLabel: function() { return /* binding */ DropShadowItemLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");




const DropShadowItemLabel = ({
  value
}) => {
  const values = value.value.args.value;
  const keys = ['xAxis', 'yAxis', 'blur'];
  const labels = keys.map(key => values[key]?.value?.unit !== 'custom' ? `${values[key]?.value?.size ?? 0}${values[key]?.value?.unit ?? 'px'}` : values[key]?.value?.size || _size_control__WEBPACK_IMPORTED_MODULE_3__.CUSTOM_SIZE_LABEL);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    component: "span"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    component: "span",
    style: {
      textTransform: 'capitalize'
    }
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Drop shadow:', 'elementor')), ` ${labels.join(' ')}`);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-content.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/filter-content.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterContent: function() { return /* binding */ FilterContent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/control-repeater/context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _context_filter_config_context__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./context/filter-config-context */ "./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx");
/* harmony import */ var _drop_shadow_drop_shadow_item_content__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./drop-shadow/drop-shadow-item-content */ "./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx");
/* harmony import */ var _single_size_single_size_item_content__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./single-size/single-size-item-content */ "./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-content.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }













const FilterContent = () => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.cssFilterFunctionPropUtil);
  const {
    filterOptions,
    getFilterFunctionConfig
  } = (0,_context_filter_config_context__WEBPACK_IMPORTED_MODULE_10__.useFilterConfig)();
  const handleValueChange = (value, _, meta) => {
    let newValue = structuredClone(value);
    const funcConfig = getFilterFunctionConfig(newValue?.func.value);
    if (meta?.bind === 'func') {
      newValue = funcConfig.defaultValue.value;
    }
    if (!newValue.args) {
      return;
    }
    propContext.setValue(newValue);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, _extends({}, propContext, {
    setValue: handleValueChange
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "css-filter-func"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_7__.PopoverContent, {
    p: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_8__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Filter', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "func"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_9__.SelectControl, {
    options: filterOptions
  })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: "args"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FilterValueContent, null)))));
};
const FilterValueContent = () => {
  const {
    openItemIndex,
    items
  } = (0,_components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_6__.useRepeaterContext)();
  const currentItem = items[openItemIndex];
  const filterFunc = currentItem.item.value.func.value;
  const isDropShadow = filterFunc === 'drop-shadow';
  if (isDropShadow) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_drop_shadow_drop_shadow_item_content__WEBPACK_IMPORTED_MODULE_11__.DropShadowItemContent, null);
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_single_size_single_size_item_content__WEBPACK_IMPORTED_MODULE_12__.SingleSizeItemContent, {
    filterFunc: filterFunc
  });
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-icon.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/filter-icon.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterIcon: function() { return /* binding */ FilterIcon; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);


const FilterIcon = ({
  value
}) => {
  if (value.value.func.value !== 'drop-shadow') {
    return null;
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledUnstableColorIndicator, {
    size: "inherit",
    component: "span",
    value: value.value.args.value?.color.value
  });
};
const StyledUnstableColorIndicator = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.UnstableColorIndicator)(({
  theme
}) => ({
  borderRadius: `${theme.shape.borderRadius / 2}px`
}));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-label.tsx":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/filter-label.tsx ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterLabel: function() { return /* binding */ FilterLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _drop_shadow_drop_shadow_item_label__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./drop-shadow/drop-shadow-item-label */ "./packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-label.tsx");
/* harmony import */ var _single_size_single_size_item_label__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-size/single-size-item-label */ "./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-label.tsx");



const FilterLabel = ({
  value
}) => {
  if (value.value.func.value === 'drop-shadow') {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_drop_shadow_drop_shadow_item_label__WEBPACK_IMPORTED_MODULE_1__.DropShadowItemLabel, {
      value: value
    });
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_single_size_single_size_item_label__WEBPACK_IMPORTED_MODULE_2__.SingleSizeItemLabel, {
    value: value
  });
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-repeater-control.tsx":
/*!********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/filter-repeater-control.tsx ***!
  \********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FilterRepeaterControl: function() { return /* binding */ FilterRepeaterControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../components/control-repeater/actions/disable-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/control-repeater/actions/duplicate-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _context_filter_config_context__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./context/filter-config-context */ "./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx");
/* harmony import */ var _filter_content__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./filter-content */ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-content.tsx");
/* harmony import */ var _filter_icon__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./filter-icon */ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-icon.tsx");
/* harmony import */ var _filter_label__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./filter-label */ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-label.tsx");















const FILTER_CONFIG = {
  filter: {
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.filterPropTypeUtil,
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Filters', 'elementor')
  },
  'backdrop-filter': {
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.backdropFilterPropTypeUtil,
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Backdrop filters', 'elementor')
  }
};
const FilterRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_10__.createControl)(({
  filterPropName = 'filter'
}) => {
  const {
    propTypeUtil,
    label
  } = ensureFilterConfig(filterPropName);
  const {
    propType,
    value: filterValues,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(propTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_context_filter_config_context__WEBPACK_IMPORTED_MODULE_11__.FilterConfigProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropProvider, {
    propType: propType,
    value: filterValues,
    setValue: setValue
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Repeater, {
    propTypeUtil: propTypeUtil,
    label: label,
    filterPropName: filterPropName
  })));
});
const Repeater = ({
  propTypeUtil,
  label,
  filterPropName
}) => {
  const {
    getInitialValue
  } = (0,_context_filter_config_context__WEBPACK_IMPORTED_MODULE_11__.useFilterConfig)();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.ControlRepeater, {
    initial: getInitialValue(),
    propTypeUtil: propTypeUtil
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_9__.RepeaterHeader, {
    label: label
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.TooltipAddItemAction, {
    newItemIndex: 0,
    ariaLabel: filterPropName === 'backdrop-filter' ? 'backdrop filter' : 'filter'
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.ItemsContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.Item, {
    Label: _filter_label__WEBPACK_IMPORTED_MODULE_14__.FilterLabel,
    Icon: _filter_icon__WEBPACK_IMPORTED_MODULE_13__.FilterIcon,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_6__.DuplicateItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_5__.DisableItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_7__.RemoveItemAction, null))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_8__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_filter_content__WEBPACK_IMPORTED_MODULE_12__.FilterContent, null)));
};
function ensureFilterConfig(name) {
  if (name && name in FILTER_CONFIG) {
    return FILTER_CONFIG[name];
  }
  return FILTER_CONFIG.filter;
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-content.tsx":
/*!*********************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-content.tsx ***!
  \*********************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SingleSizeItemContent: function() { return /* binding */ SingleSizeItemContent; },
/* harmony export */   propTypeMap: function() { return /* binding */ propTypeMap; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
/* harmony import */ var _context_filter_config_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../context/filter-config-context */ "./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx");









const propTypeMap = {
  blur: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.blurFilterPropTypeUtil,
  intensity: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.intensityFilterPropTypeUtil,
  'hue-rotate': _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.hueRotateFilterPropTypeUtil,
  'color-tone': _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.colorToneFilterPropTypeUtil
};
const SingleSizeItemContent = ({
  filterFunc
}) => {
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const {
    getFilterFunctionConfig
  } = (0,_context_filter_config_context__WEBPACK_IMPORTED_MODULE_7__.useFilterConfig)();
  const {
    valueName,
    filterFunctionGroup
  } = getFilterFunctionConfig(filterFunc);
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(propTypeMap[filterFunctionGroup]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropKeyProvider, {
    bind: filterFunctionGroup
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropKeyProvider, {
    bind: 'size'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_5__.PopoverGridContainer, {
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, valueName)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_6__.SizeControl, {
    anchorRef: rowRef,
    enablePropTypeUnits: true
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-label.tsx":
/*!*******************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-label.tsx ***!
  \*******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SingleSizeItemLabel: function() { return /* binding */ SingleSizeItemLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _utils_size_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../utils/size-control */ "./packages/packages/libs/editor-controls/src/utils/size-control.ts");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
/* harmony import */ var _context_filter_config_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../context/filter-config-context */ "./packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx");





const SingleSizeItemLabel = ({
  value
}) => {
  const {
    func,
    args
  } = value.value;
  const {
    getFilterFunctionConfig
  } = (0,_context_filter_config_context__WEBPACK_IMPORTED_MODULE_4__.useFilterConfig)();
  const {
    defaultValue
  } = getFilterFunctionConfig(func.value ?? '');
  const defaultUnit = defaultValue.value.args.value?.size?.value?.unit ?? _utils_size_control__WEBPACK_IMPORTED_MODULE_2__.lengthUnits[0];
  const {
    unit,
    size
  } = args.value.size?.value ?? {
    unit: defaultUnit,
    size: 0
  };
  const label = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    component: "span",
    style: {
      textTransform: 'capitalize'
    }
  }, func.value ?? '', ":");
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    component: "span"
  }, label, ' ' + (unit !== 'custom' ? `${size ?? 0}${unit ?? defaultUnit}` : size || _size_control__WEBPACK_IMPORTED_MODULE_3__.CUSTOM_SIZE_LABEL));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/filter-control/utils.ts":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/filter-control/utils.ts ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   buildFilterConfig: function() { return /* binding */ buildFilterConfig; }
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _configs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./configs */ "./packages/packages/libs/editor-controls/src/controls/filter-control/configs.ts");


const AMOUNT_VALUE_NAME = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Amount', 'elementor');
const DEFAULT_FACTORIES = {
  'drop-shadow': propType => buildDropShadowDefault(propType)
};
function buildFilterConfig(cssFilterPropType) {
  function createEntry(filterFunctionGroup, filterFunction, {
    name,
    valueName
  }) {
    const propType = extractPropType(cssFilterPropType, filterFunctionGroup);
    const value = DEFAULT_FACTORIES[filterFunction]?.(propType) ?? buildSizeDefault(propType);
    const defaultValue = createDefaultValue({
      filterFunction,
      filterFunctionGroup,
      value
    });
    return [filterFunction, {
      name,
      valueName: valueName ?? AMOUNT_VALUE_NAME,
      defaultValue,
      filterFunctionGroup
    }];
  }
  const entries = Object.entries(_configs__WEBPACK_IMPORTED_MODULE_1__.FILTERS_BY_GROUP).flatMap(([filterFunctionGroup, group]) => Object.entries(group).map(([filterFunction, meta]) => createEntry(filterFunctionGroup, filterFunction, meta)));
  return Object.fromEntries(entries);
}
function createDefaultValue({
  filterFunction,
  filterFunctionGroup,
  value
}) {
  return {
    $$type: 'css-filter-func',
    value: {
      func: {
        $$type: 'string',
        value: filterFunction
      },
      args: {
        $$type: filterFunctionGroup,
        value
      }
    }
  };
}
function buildSizeDefault(propType) {
  const sizePropType = propType?.shape?.size;
  return {
    size: sizePropType?.default
  };
}
function buildDropShadowDefault(propType) {
  const dropShadowPropType = propType.shape;
  return {
    blur: dropShadowPropType?.blur?.default,
    xAxis: dropShadowPropType?.xAxis?.default,
    yAxis: dropShadowPropType?.yAxis?.default,
    color: dropShadowPropType?.color?.default ?? (dropShadowPropType?.color).prop_types.color.default
  };
}
function extractPropType(propType, filterFunctionGroup) {
  return propType.shape?.args?.prop_types[filterFunctionGroup];
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/font-family-control/enqueue-font.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/font-family-control/enqueue-font.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   enqueueFont: function() { return /* binding */ enqueueFont; }
/* harmony export */ });
const enqueueFont = (fontFamily, context = 'editor') => {
  const extendedWindow = window;
  return extendedWindow.elementor?.helpers?.enqueueFont?.(fontFamily, context) ?? null;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/font-family-control/font-family-control.tsx":
/*!*********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/font-family-control/font-family-control.tsx ***!
  \*********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   FontFamilyControl: function() { return /* binding */ FontFamilyControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_item_selector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/item-selector */ "./packages/packages/libs/editor-controls/src/components/item-selector.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _enqueue_font__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./enqueue-font */ "./packages/packages/libs/editor-controls/src/controls/font-family-control/enqueue-font.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }











const FontFamilyControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_8__.createControl)(({
  fontFamilies,
  sectionWidth,
  ariaLabel
}) => {
  const {
    value: fontFamily,
    setValue: setFontFamily,
    disabled,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.fontFamilyPropTypeUtil);
  const popoverState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({
    variant: 'popover'
  });
  const isShowingPlaceholder = !fontFamily && placeholder;
  const mapFontSubs = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    return fontFamilies.map(({
      label,
      fonts
    }) => ({
      label,
      items: fonts
    }));
  }, [fontFamilies]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.UnstableTag, _extends({
    id: "font-family-control",
    variant: "outlined",
    label: fontFamily || placeholder,
    endIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ChevronDownIcon, {
      fontSize: "tiny"
    })
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindTrigger)(popoverState), {
    fullWidth: true,
    disabled: disabled,
    "aria-label": ariaLabel,
    sx: isShowingPlaceholder ? {
      '& .MuiTag-label': {
        color: theme => theme.palette.text.tertiary
      },
      textTransform: 'capitalize'
    } : undefined
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Popover, _extends({
    disablePortal: true,
    disableScrollLock: true,
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'right'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'right'
    },
    sx: {
      my: 1.5
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindPopover)(popoverState)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_item_selector__WEBPACK_IMPORTED_MODULE_6__.ItemSelector, {
    id: "font-family-selector",
    itemsList: mapFontSubs,
    selectedItem: fontFamily,
    onItemChange: setFontFamily,
    onClose: popoverState.close,
    sectionWidth: sectionWidth,
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Font family', 'elementor'),
    itemStyle: item => ({
      fontFamily: item.value
    }),
    onDebounce: _enqueue_font__WEBPACK_IMPORTED_MODULE_9__.enqueueFont,
    icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_2__.TextIcon
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/gap-control.tsx":
/*!*****************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/gap-control.tsx ***!
  \*****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   GapControl: function() { return /* binding */ GapControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive");
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./size-control/unstable-size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx");












const GapControl = ({
  label
}) => {
  const stackRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const {
    disabled: sizeDisabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const {
    value: directionValue,
    setValue: setDirectionValue,
    propType,
    placeholder: directionPlaceholder,
    disabled: directionDisabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil);
  const {
    value: masterValue,
    setValue: setMasterValue,
    placeholder: masterPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)();
  const inferIsLinked = () => {
    if (_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil.isValid(masterValue)) {
      return false;
    }
    if (!masterValue && _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil.isValid(masterPlaceholder)) {
      return false;
    }
    return true;
  };
  const [isLinked, setIsLinked] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => inferIsLinked());
  const isCurrentlyDirection = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
  const activeBreakpoint = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__.useActiveBreakpoint)();
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => {
    setIsLinked(inferIsLinked());
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [activeBreakpoint, isCurrentlyDirection]);
  const onLinkToggle = () => {
    setIsLinked(prev => !prev);
    if (!_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil.isValid(masterValue)) {
      const currentValue = masterValue ? masterValue : null;
      if (!currentValue) {
        setMasterValue(null);
        return;
      }
      setMasterValue(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.layoutDirectionPropTypeUtil.create({
        row: currentValue,
        column: currentValue
      }));
      return;
    }
    const currentValue = directionValue?.column ?? directionValue?.row ?? null;
    setMasterValue(currentValue);
  };
  const tooltipLabel = label.toLowerCase();
  const LinkedIcon = isLinked ? _elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LinkIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_3__.DetachIcon;
  // translators: %s: Tooltip title.
  const linkedLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Link %s', 'elementor').replace('%s', tooltipLabel);
  // translators: %s: Tooltip title.
  const unlinkedLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Unlink %s', 'elementor').replace('%s', tooltipLabel);
  const disabled = sizeDisabled || directionDisabled;
  const propProviderProps = {
    propType,
    value: directionValue ?? (!isLinked ? {
      row: directionPlaceholder?.row,
      column: directionPlaceholder?.column
    } : null),
    setValue: directions => {
      const entries = Object.entries(directions);
      const filtered = entries.filter(([, value]) => Boolean(value));
      setDirectionValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
    },
    placeholder: directionPlaceholder
  };
  const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
  const getEffectivePlaceholder = bind => {
    if (isLinked) {
      const linkedPlaceholder = directionPlaceholder?.column ?? directionPlaceholder?.row;
      return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil.extract(linkedPlaceholder);
    }
    return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil.extract(directionPlaceholder?.[bind]);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, propProviderProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_8__.ControlLabel, null, label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Tooltip, {
    title: isLinked ? unlinkedLabel : linkedLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_9__.StyledToggleButton, {
    "aria-label": isLinked ? unlinkedLabel : linkedLabel,
    size: 'tiny',
    value: 'check',
    selected: isLinked,
    sx: {
      marginLeft: 'auto'
    },
    onChange: onLinkToggle,
    disabled: disabled,
    isPlaceholder: hasPlaceholders
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(LinkedIcon, {
    fontSize: 'tiny'
  })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap",
    ref: stackRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Column', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: 'column',
    ariaLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Column gap', 'elementor'),
    isLinked: isLinked,
    anchorRef: stackRef,
    placeholder: getEffectivePlaceholder('column') ?? undefined
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Row', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: 'row',
    ariaLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Row gap', 'elementor'),
    isLinked: isLinked,
    anchorRef: stackRef,
    placeholder: getEffectivePlaceholder('row') ?? undefined
  })))));
};
const Control = ({
  bind,
  ariaLabel,
  isLinked,
  anchorRef,
  placeholder
}) => {
  if (isLinked) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__.UnstableSizeControl, {
      anchorRef: anchorRef,
      placeholder: placeholder,
      ariaLabel: ariaLabel
    });
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__.UnstableSizeControl, {
    anchorRef: anchorRef,
    placeholder: placeholder,
    ariaLabel: ariaLabel
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/grid-span-control.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/grid-span-control.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   GridSpanControl: function() { return /* binding */ GridSpanControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");






const GridSpanControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  placeholder: propPlaceholder,
  error,
  inputValue,
  inputDisabled,
  helperText,
  sx,
  ariaLabel
}) => {
  const {
    value,
    setValue,
    disabled,
    placeholder: boundPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.spanPropTypeUtil);
  const handleChange = event => {
    const next = event.target.value;
    setValue(next === '' ? null : next);
  };
  const placeholder = propPlaceholder ?? boundPlaceholder ?? `e.g: 'span 2' or '1 / 3'`;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, {
    size: "tiny",
    fullWidth: true,
    disabled: inputDisabled ?? disabled,
    value: inputValue ?? value ?? '',
    onChange: handleChange,
    placeholder: placeholder,
    error: error,
    helperText: helperText,
    sx: sx,
    inputProps: {
      ...(ariaLabel ? {
        'aria-label': ariaLabel
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/html-tag-control.tsx":
/*!**********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/html-tag-control.tsx ***!
  \**********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   HtmlTagControl: function() { return /* binding */ HtmlTagControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_conditional_control_infotip__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/conditional-control-infotip */ "./packages/packages/libs/editor-controls/src/components/conditional-control-infotip.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }










const StyledSelect = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Select)(() => ({
  '.MuiSelect-select.Mui-disabled': {
    cursor: 'not-allowed'
  }
}));
const HtmlTagControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_9__.createControl)(props => {
  const {
    options,
    onChange,
    fallbackLabels = {},
    context: {
      elementId
    }
  } = props;
  const {
    value,
    setValue,
    disabled,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil);
  const handleChange = event => {
    const newValue = event.target.value || null;
    onChange?.(newValue, value);
    setValue(newValue);
  };
  const elementLabel = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getElementLabel)(elementId) ?? 'element';
  const infoTipProps = {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('HTML Tag', 'elementor'),
    /* translators: %s is the element name. */
    description: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)(`The tag is locked to 'a' tag because this %s has a link. To pick a different tag, remove the link first.`, 'elementor').replace('%s', elementLabel),
    isEnabled: !!disabled
  };
  const renderValue = selectedValue => {
    if (selectedValue) {
      return findOptionByValue(selectedValue)?.label || fallbackLabels[selectedValue] || selectedValue;
    }
    if (!placeholder) {
      return '';
    }
    const placeholderOption = findOptionByValue(placeholder);
    const displayText = placeholderOption?.label || placeholder;
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Typography, {
      component: "span",
      variant: "caption",
      color: "text.tertiary"
    }, displayText);
  };
  const findOptionByValue = searchValue => options.find(opt => opt.value === searchValue);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_conditional_control_infotip__WEBPACK_IMPORTED_MODULE_7__.ConditionalControlInfotip, infoTipProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledSelect, {
    sx: {
      overflow: 'hidden',
      cursor: disabled ? 'not-allowed' : undefined
    },
    displayEmpty: true,
    size: "tiny",
    renderValue: renderValue,
    value: value ?? '',
    onChange: handleChange,
    disabled: disabled,
    fullWidth: true
  }, options.map(({
    label,
    ...itemProps
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_3__.MenuListItem, _extends({
    key: itemProps.value
  }, itemProps, {
    value: itemProps.value ?? ''
  }), label)))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/image-control.tsx":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/image-control.tsx ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ImageControl: function() { return /* binding */ ImageControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/use-unfiltered-files-upload */ "./packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts");
/* harmony import */ var _image_media_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./image-media-control */ "./packages/packages/libs/editor-controls/src/controls/image-media-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");











const ImageControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(({
  sizes,
  label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Image', 'elementor')
}) => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.imagePropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, propContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    gap: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_6__.ControlLabel, null, label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ImageSrcControl, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 1.5,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Resolution', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6,
    sx: {
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ImageSizeControl, {
    sizes: sizes
  })))));
});
const ImageSrcControl = () => {
  const {
    data: allowSvgUpload
  } = (0,_hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_8__.useUnfilteredFilesUpload)();
  const mediaTypes = allowSvgUpload ? ['image', 'svg'] : ['image'];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: 'src'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_image_media_control__WEBPACK_IMPORTED_MODULE_9__.ImageMediaControl, {
    mediaTypes: mediaTypes
  }));
};
const ImageSizeControl = ({
  sizes
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: 'size'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_10__.SelectControl, {
    options: sizes
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/image-media-control.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/image-media-control.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ImageMediaControl: function() { return /* binding */ ImageMediaControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/wp-media */ "@elementor/wp-media");
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");









const ImageMediaControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_8__.createControl)(({
  mediaTypes = ['image']
}) => {
  const {
    value,
    setValue,
    propType,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.imageSrcPropTypeUtil);
  const {
    id,
    url
  } = value ?? {};
  const {
    data: attachment,
    isFetching
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__.useWpMediaAttachment)(id?.value || null);
  const {
    data: placeholderAttachment
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__.useWpMediaAttachment)(placeholder?.id?.value || null);
  const src = attachment?.url ?? url?.value ?? placeholderAttachment?.url ?? null;
  const defaultUrl = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.imageSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
  const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : undefined;
  const currentAltForModal = value?.alt?.value;
  const {
    open
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__.useWpMediaFrame)({
    mediaTypes,
    multiple: false,
    selected: id?.value || null,
    allowUrlImport: true,
    onSelect: selectedAttachment => {
      setValue({
        id: {
          $$type: 'image-attachment-id',
          value: selectedAttachment.id
        },
        url: null
      });
    },
    onSelectUrl: (selectedUrl, alt) => {
      setValue({
        id: null,
        url: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.urlPropTypeUtil.create(selectedUrl),
        alt: alt ? _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(alt) : null
      });
    }
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Card, {
    variant: "outlined"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CardMedia, {
    image: src,
    sx: {
      height: propType.meta.isDynamic ? 134 : 150
    }
  }, isFetching ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, {
    justifyContent: "center",
    alignItems: "center",
    width: "100%",
    height: "100%"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CircularProgress, null)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CardOverlay, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, {
    gap: 1
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
    size: "tiny",
    color: "inherit",
    variant: "outlined",
    onClick: () => open({
      mode: 'browse'
    })
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Select image', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
    size: "tiny",
    variant: "text",
    color: "inherit",
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.UploadIcon, null),
    onClick: () => open({
      mode: 'upload'
    })
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Upload', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
    size: "tiny",
    variant: "text",
    color: "inherit",
    onClick: () => open({
      mode: 'url',
      currentUrl: currentUrlForModal,
      currentAlt: currentAltForModal
    })
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Insert from URL', 'elementor'))))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/inline-editing-control.tsx":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/inline-editing-control.tsx ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   InlineEditingControl: function() { return /* binding */ InlineEditingControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_inline_editor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/inline-editor */ "./packages/packages/libs/editor-controls/src/components/inline-editor.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const CHILDREN_PARSE_DEBOUNCE_MS = 300;
const InlineEditingControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(({
  sx,
  attributes,
  props
}) => {
  const {
    value,
    setValue,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.htmlV3PropTypeUtil);
  const content = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(value?.content ?? null) ?? '';
  const debouncedParse = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_3__.debounce)(html => {
    const parsed = (0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.parseHtmlChildren)(html);
    setValue({
      content: parsed.content ? _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(parsed.content) : null,
      children: parsed.children
    });
  }, CHILDREN_PARSE_DEBOUNCE_MS), [setValue]);
  const handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(newValue => {
    const html = newValue ?? '';
    setValue({
      content: html ? _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(html) : null,
      children: value?.children ?? []
    });
    debouncedParse(html);
  }, [setValue, value?.children, debouncedParse]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => () => debouncedParse.cancel(), [debouncedParse]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, _extends({
    sx: {
      p: 0.8,
      border: '1px solid',
      borderColor: 'grey.200',
      borderRadius: '8px',
      transition: 'border-color .2s ease, box-shadow .2s ease',
      '&:hover': {
        borderColor: 'black'
      },
      '&:focus-within': {
        borderColor: 'black',
        boxShadow: '0 0 0 1px black'
      },
      '& .ProseMirror:focus': {
        outline: 'none'
      },
      '& .ProseMirror': {
        minHeight: '70px',
        fontSize: '12px',
        '& a': {
          color: 'inherit'
        },
        '& .elementor-inline-editor-reset': {
          margin: 0,
          padding: 0
        },
        '&.is-empty::before': {
          content: 'attr(data-placeholder)',
          color: 'text.tertiary',
          pointerEvents: 'none',
          position: 'absolute',
          opacity: 0.6
        }
      },
      '.strip-styles *': {
        all: 'unset'
      },
      ...sx
    }
  }, attributes, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_inline_editor__WEBPACK_IMPORTED_MODULE_5__.InlineEditor, {
    value: content,
    setValue: handleChange,
    placeholder: placeholder?.content?.value ?? null
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/key-value-control.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/key-value-control.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   KeyValueControl: function() { return /* binding */ KeyValueControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _utils_escape_html_attr__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/escape-html-attr */ "./packages/packages/libs/editor-controls/src/utils/escape-html-attr.ts");
/* harmony import */ var _text_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./text-control */ "./packages/packages/libs/editor-controls/src/controls/text-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const getInitialFieldValue = fieldValue => {
  const transformableValue = fieldValue;
  if (!fieldValue || typeof fieldValue !== 'object' || transformableValue.$$type === 'dynamic') {
    return '';
  }
  return transformableValue.value || '';
};
const KeyValueControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)((props = {}) => {
  const {
    value,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.keyValuePropTypeUtil);
  const [keyError, setKeyError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
  const [valueError, setValueError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('');
  const [sessionState, setSessionState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({
    key: getInitialFieldValue(value?.key),
    value: getInitialFieldValue(value?.value)
  });
  const keyLabel = props.keyName || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Key', 'elementor');
  const valueLabel = props.valueName || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Value', 'elementor');
  const {
    keyHelper,
    valueHelper
  } = props.getHelperText?.(sessionState.key, sessionState.value) || {
    keyHelper: undefined,
    valueHelper: undefined
  };
  const [keyRegex, valueRegex, errMsg] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => [props.regexKey ? new RegExp(props.regexKey) : undefined, props.regexValue ? new RegExp(props.regexValue) : undefined, props.validationErrorMessage || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Invalid Format', 'elementor')], [props.regexKey, props.regexValue, props.validationErrorMessage]);
  const validate = (newValue, fieldType) => {
    if (fieldType === 'key' && keyRegex) {
      const isValid = keyRegex.test(newValue);
      setKeyError(isValid ? '' : errMsg);
      return isValid;
    } else if (fieldType === 'value' && valueRegex) {
      const isValid = valueRegex.test(newValue);
      setValueError(isValid ? '' : errMsg);
      return isValid;
    }
    return true;
  };
  const handleChange = (newValue, options, meta) => {
    const fieldType = meta?.bind;
    if (!fieldType) {
      return;
    }
    const newChangedValue = newValue[fieldType];
    if ((0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.isTransformable)(newChangedValue) && newChangedValue.$$type === 'dynamic') {
      setValue({
        ...value,
        [fieldType]: newChangedValue
      });
      return;
    }
    const extractedValue = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(newChangedValue);
    setSessionState(prev => ({
      ...prev,
      [fieldType]: extractedValue
    }));
    if (extractedValue && validate(extractedValue, fieldType)) {
      setValue({
        ...value,
        [fieldType]: newChangedValue
      });
    } else {
      setValue({
        ...value,
        [fieldType]: {
          value: '',
          $$type: 'string'
        }
      });
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: handleChange
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12,
    display: "flex",
    flexDirection: "column"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormLabel, {
    size: "tiny",
    sx: {
      pb: 1
    }
  }, keyLabel), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: 'key'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_text_control__WEBPACK_IMPORTED_MODULE_7__.TextControl, {
    inputValue: props.escapeHtml ? (0,_utils_escape_html_attr__WEBPACK_IMPORTED_MODULE_6__.escapeHtmlAttr)(sessionState.key) : sessionState.key,
    error: !!keyError,
    helperText: keyHelper
  })), !!keyError && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormHelperText, {
    error: true
  }, keyError)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12,
    display: "flex",
    flexDirection: "column"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormLabel, {
    size: "tiny",
    sx: {
      pb: 1
    }
  }, valueLabel), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: 'value'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_text_control__WEBPACK_IMPORTED_MODULE_7__.TextControl, {
    inputValue: props.escapeHtml ? (0,_utils_escape_html_attr__WEBPACK_IMPORTED_MODULE_6__.escapeHtmlAttr)(sessionState.value) : sessionState.value,
    error: !!valueError,
    inputDisabled: !!keyError,
    helperText: valueHelper
  })), !!valueError && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.FormHelperText, {
    error: true
  }, valueError))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/link-control.tsx":
/*!******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/link-control.tsx ***!
  \******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   LinkControl: function() { return /* binding */ LinkControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters");
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _elementor_session__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @elementor/session */ "@elementor/session");
/* harmony import */ var _elementor_session__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_elementor_session__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_restricted_link_infotip__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/restricted-link-infotip */ "./packages/packages/libs/editor-controls/src/components/restricted-link-infotip.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _query_control__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./query-control */ "./packages/packages/libs/editor-controls/src/controls/query-control.tsx");
/* harmony import */ var _switch_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./switch-control */ "./packages/packages/libs/editor-controls/src/controls/switch-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }

















const SIZE = 'tiny';
const LinkControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_13__.createControl)(props => {
  const {
    value,
    path,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_9__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.linkPropTypeUtil);
  const linkPlaceholder = propContext.placeholder;
  const [linkSessionValue, setLinkSessionValue] = (0,_elementor_session__WEBPACK_IMPORTED_MODULE_5__.useSessionStorage)(path.join('/'));
  const [isActive, setIsActive] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!!value || !!linkPlaceholder);
  const {
    allowCustomValues = true,
    queryOptions,
    placeholder,
    minInputLength = 2,
    context: {
      elementId
    },
    label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__.__)('Link', 'elementor'),
    ariaLabel
  } = props || {};
  const [linkInLinkRestriction, setLinkInLinkRestriction] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)((0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
  const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
  const debouncedCheckRestriction = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_7__.useDebouncedCallback)(() => {
    const newRestriction = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder);
    if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
      setIsActive(false);
      if (value !== null) {
        setValue(null);
      }
    }
    setLinkInLinkRestriction(prev => isSameRestriction(prev, newRestriction) ? prev : newRestriction);
  }, 300);
  (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_3__.__privateUseListenTo)((0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_3__.commandEndEvent)('document/elements/set-settings'), () => {
    debouncedCheckRestriction();
  }, [debouncedCheckRestriction]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    debouncedCheckRestriction();
    const handleInlineLinkChanged = () => {
      debouncedCheckRestriction();
    };
    window.addEventListener('elementor:inline-link-changed', handleInlineLinkChanged);
    return () => {
      window.removeEventListener('elementor:inline-link-changed', handleInlineLinkChanged);
    };
  }, [elementId, debouncedCheckRestriction]);
  const onEnabledChange = () => {
    setLinkInLinkRestriction((0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
    if (linkInLinkRestriction.shouldRestrict && !isActive) {
      return;
    }
    const newState = !isActive;
    setIsActive(newState);
    if (!newState && value !== null) {
      setValue(null);
    }
    if (newState && linkSessionValue?.value) {
      setValue(linkSessionValue.value);
    }
    setLinkSessionValue({
      value: linkSessionValue?.value,
      meta: {
        isEnabled: newState
      }
    });
  };
  const onSaveValueToSession = newValue => {
    const valueToSave = newValue ? {
      ...value,
      destination: newValue
    } : null;
    setLinkSessionValue({
      ...linkSessionValue,
      value: valueToSave
    });
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_9__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: setValue
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Stack, {
    gap: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Stack, {
    direction: "row",
    sx: {
      justifyContent: 'space-between',
      alignItems: 'center',
      marginInlineEnd: -0.75
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_11__.ControlLabel, null, label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_restricted_link_infotip__WEBPACK_IMPORTED_MODULE_12__.RestrictedLinkInfotip, {
    isVisible: !isActive,
    linkInLinkRestriction: linkInLinkRestriction
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.IconButton, {
    size: SIZE,
    onClick: onEnabledChange,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__.__)('Toggle link', 'elementor'),
    disabled: shouldDisableAddingLink
  }, isActive ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_4__.MinusIcon, {
    fontSize: SIZE
  }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_4__.PlusIcon, {
    fontSize: SIZE
  })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Collapse, {
    in: isActive,
    timeout: "auto",
    unmountOnExit: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Stack, {
    gap: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_9__.PropKeyProvider, {
    bind: 'destination'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_query_control__WEBPACK_IMPORTED_MODULE_14__.QueryControl, {
    queryOptions: queryOptions,
    allowCustomValues: allowCustomValues,
    minInputLength: minInputLength,
    placeholder: placeholder,
    onSetValue: onSaveValueToSession,
    ariaLabel: ariaLabel || label
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_9__.PropKeyProvider, {
    bind: 'isTargetBlank'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Grid, {
    container: true,
    alignItems: "center",
    flexWrap: "nowrap",
    justifyContent: "space-between"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Grid, {
    item: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_10__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__.__)('Open in a new tab', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_6__.Grid, {
    item: true,
    sx: {
      marginInlineEnd: -1
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_switch_control__WEBPACK_IMPORTED_MODULE_15__.SwitchControl, null))))))));
});
function isSameRestriction(a, b) {
  return a.shouldRestrict === b.shouldRestrict && a.reason === b.reason && a.elementId === b.elementId;
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/linked-dimensions-control.tsx":
/*!*******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/linked-dimensions-control.tsx ***!
  \*******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   LinkedDimensionsControl: function() { return /* binding */ LinkedDimensionsControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive");
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./size-control/unstable-size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx");












const LinkedDimensionsControl = ({
  label,
  isSiteRtl = false,
  min
}) => {
  const gridRowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  const {
    disabled: sizeDisabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const {
    value: dimensionsValue,
    setValue: setDimensionsValue,
    propType,
    placeholder: dimensionsPlaceholder,
    disabled: dimensionsDisabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil);
  const {
    value: masterValue,
    placeholder: masterPlaceholder,
    setValue: setMasterValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)();
  const inferIsLinked = () => {
    if (_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil.isValid(masterValue)) {
      return false;
    }
    if (!masterValue && _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil.isValid(masterPlaceholder)) {
      return false;
    }
    return true;
  };
  const [isLinked, setIsLinked] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(() => inferIsLinked());
  const activeBreakpoint = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__.useActiveBreakpoint)();
  const isCurrentlyDimensions = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => {
    setIsLinked(inferIsLinked);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [activeBreakpoint, isCurrentlyDimensions]);
  const onLinkToggle = () => {
    setIsLinked(prev => !prev);
    if (!_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil.isValid(masterValue)) {
      const value = masterValue ? masterValue : null;
      if (!value) {
        setMasterValue(null);
        return;
      }
      setMasterValue(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.dimensionsPropTypeUtil.create({
        'block-start': value,
        'block-end': value,
        'inline-start': value,
        'inline-end': value
      }));
      return;
    }
    const sizeValue = getFirstDefined(dimensionsValue) ?? null;
    if (!sizeValue) {
      setMasterValue(null);
      return;
    }
    setMasterValue(sizeValue);
  };
  const tooltipLabel = label.toLowerCase();
  const LinkedIcon = isLinked ? _elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LinkIcon : _elementor_icons__WEBPACK_IMPORTED_MODULE_3__.DetachIcon;
  // translators: %s: Tooltip title.
  const linkedLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Link %s', 'elementor').replace('%s', tooltipLabel);
  // translators: %s: Tooltip title.
  const unlinkedLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Unlink %s', 'elementor').replace('%s', tooltipLabel);
  const disabled = sizeDisabled || dimensionsDisabled;
  const effectiveDimensionsPlaceholder = dimensionsPlaceholder ?? (!isLinked ? {
    'block-start': masterPlaceholder,
    'block-end': masterPlaceholder,
    'inline-start': masterPlaceholder,
    'inline-end': masterPlaceholder
  } : null);
  const propProviderProps = {
    propType,
    value: dimensionsValue,
    placeholder: effectiveDimensionsPlaceholder,
    setValue: dimensions => {
      const entries = Object.entries(dimensions);
      const filtered = entries.filter(([, value]) => Boolean(value));
      setDimensionsValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
    },
    isDisabled: () => dimensionsDisabled
  };
  const hasPlaceholders = !masterValue && (dimensionsPlaceholder || masterPlaceholder);
  const getEffectivePlaceholder = bind => {
    if (isLinked) {
      const linkedPlaceholder = getFirstDefined(dimensionsPlaceholder);
      return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil.extract(linkedPlaceholder);
    }
    return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil.extract(dimensionsPlaceholder?.[bind]);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, propProviderProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, label), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Tooltip, {
    title: isLinked ? unlinkedLabel : linkedLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_9__.StyledToggleButton, {
    "aria-label": isLinked ? unlinkedLabel : linkedLabel,
    size: 'tiny',
    value: 'check',
    selected: isLinked,
    sx: {
      marginLeft: 'auto'
    },
    onChange: onLinkToggle,
    disabled: disabled,
    isPlaceholder: hasPlaceholders
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(LinkedIcon, {
    fontSize: 'tiny'
  })))), getCssDimensionProps(label, isSiteRtl).map((row, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap",
    key: index,
    ref: gridRowRefs[index]
  }, row.map(({
    icon,
    ...props
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center",
    key: props.bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, props)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: props.bind,
    ariaLabel: props.ariaLabel,
    startIcon: icon,
    isLinked: isLinked,
    placeholder: getEffectivePlaceholder(props.bind) ?? undefined,
    anchorRef: gridRowRefs[index],
    min: min
  })))))));
};
const Control = ({
  bind,
  ariaLabel,
  startIcon,
  isLinked,
  placeholder,
  anchorRef,
  min
}) => {
  if (isLinked) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__.UnstableSizeControl, {
      ariaLabel: ariaLabel,
      startIcon: startIcon,
      anchorRef: anchorRef,
      placeholder: placeholder,
      min: min
    });
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_10__.UnstableSizeControl, {
    ariaLabel: ariaLabel,
    startIcon: startIcon,
    anchorRef: anchorRef,
    min: min,
    placeholder: placeholder
  }));
};
const Label = ({
  label,
  bind
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_8__.ControlLabel, null, label));
};
const getFirstDefined = dimensions => {
  return dimensions?.['block-start'] ?? dimensions?.['inline-end'] ?? dimensions?.['block-end'] ?? dimensions?.['inline-start'];
};
function getCssDimensionProps(label, isSiteRtl) {
  return [[{
    bind: 'block-start',
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top', 'elementor'),
    /* translators: %s is the name of the main group (margin or padding) */
    ariaLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s top', 'elementor'), label),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideTopIcon, {
      fontSize: 'tiny'
    })
  }, {
    bind: 'inline-end',
    label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Left', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Right', 'elementor'),
    ariaLabel: isSiteRtl ? /* translators: %s is the name of the main group (margin or padding) */
    (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s left', 'elementor'), label) : /* translators: %s is the name of the main group (margin or padding) */
    (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s right', 'elementor'), label),
    icon: isSiteRtl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideLeftIcon, {
      fontSize: 'tiny'
    }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideRightIcon, {
      fontSize: 'tiny'
    })
  }], [{
    bind: 'block-end',
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom', 'elementor'),
    /* translators: %s is the name of the main group (margin or padding) */
    ariaLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s bottom', 'elementor'), label),
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideBottomIcon, {
      fontSize: 'tiny'
    })
  }, {
    bind: 'inline-start',
    label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Right', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Left', 'elementor'),
    ariaLabel: isSiteRtl ? /* translators: %s is the name of the main group (margin or padding) */
    (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s right', 'elementor'), label) : /* translators: %s is the name of the main group (margin or padding) */
    (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('%s left', 'elementor'), label),
    icon: isSiteRtl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideRightIcon, {
      fontSize: 'tiny'
    }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.SideLeftIcon, {
      fontSize: 'tiny'
    })
  }]];
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/mention-text-area-control.tsx":
/*!*******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/mention-text-area-control.tsx ***!
  \*******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   MentionTextAreaControl: function() { return /* binding */ MentionTextAreaControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var primereact_mention__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primereact/mention */ "./node_modules/primereact/mention/mention.esm.js");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const MentionWrapper = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.styled)('div')(({
  theme
}) => ({
  position: 'relative',
  '& .p-mention': {
    width: '100%',
    position: 'relative'
  },
  '& textarea': {
    width: '100%',
    boxSizing: 'border-box',
    fontFamily: 'inherit',
    fontSize: theme.typography.pxToRem(12),
    lineHeight: 1.4375,
    padding: '4px 8px',
    borderRadius: theme.shape.borderRadius,
    border: `1px solid ${theme.palette.divider}`,
    backgroundColor: 'transparent',
    color: 'inherit',
    resize: 'vertical',
    outline: 'none',
    transition: 'border-color 150ms ease-in-out',
    '&:hover': {
      borderColor: theme.palette.action.active
    },
    '&:focus': {
      borderColor: theme.palette.primary.main,
      borderWidth: 2,
      padding: '3px 7px'
    },
    '&:disabled': {
      opacity: 0.38,
      cursor: 'default'
    },
    '&::placeholder': {
      color: 'inherit',
      opacity: 0.5
    }
  },
  '& .p-mention-panel': {
    fontFamily: 'inherit',
    fontSize: theme.typography.pxToRem(12),
    backgroundColor: theme.palette.background.paper,
    border: `1px solid ${theme.palette.divider}`,
    borderRadius: theme.shape.borderRadius,
    boxShadow: theme.shadows[4],
    maxHeight: '200px',
    overflow: 'auto',
    zIndex: theme.zIndex.modal,
    maxWidth: '100%',
    right: 0,
    left: 'auto !important'
  },
  '& .p-mention-items': {
    listStyle: 'none',
    margin: 0,
    padding: '4px 0'
  },
  '& .p-mention-item': {
    padding: '6px 12px',
    cursor: 'pointer',
    color: theme.palette.text.primary,
    '&:hover': {
      backgroundColor: theme.palette.action.hover
    },
    '&.p-highlight': {
      backgroundColor: theme.palette.action.selected
    }
  },
  '&[data-single-line="true"] textarea': {
    resize: 'none'
  }
}));
function createMentionPattern(value, triggerPosition) {
  const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  const prefix = 'start' === triggerPosition ? '^' : '';
  return new RegExp(`${prefix}@${escaped}(?=\\s|$|[^a-zA-Z0-9_-])`, 'g');
}
const MentionTextAreaControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(({
  placeholder,
  ariaLabel,
  suggestions: allSuggestions,
  rows = 5,
  triggerPosition = 'auto'
}) => {
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil);
  const [filteredSuggestions, setFilteredSuggestions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);
  const transformMentionsToShortcodes = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(text => {
    let result = text;
    for (const suggestion of allSuggestions) {
      const pattern = createMentionPattern(suggestion.value, triggerPosition);
      result = result.replace(pattern, `[${suggestion.value}]`);
    }
    return result;
  }, [allSuggestions, triggerPosition]);
  const handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(e => {
    const rawValue = e.target.value;
    const transformed = transformMentionsToShortcodes(rawValue);
    setValue(transformed);
  }, [setValue, transformMentionsToShortcodes]);
  const handleSearch = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(event => {
    if ('start' === triggerPosition) {
      const target = event.originalEvent.target;
      const triggerIndex = target.selectionStart - event.query.length - event.trigger.length;
      if (triggerIndex !== 0) {
        setFilteredSuggestions([]);
        return;
      }
    }
    const query = event.query.toLowerCase();
    const filtered = allSuggestions.filter(item => item.label.toLowerCase().includes(query) || item.value.toLowerCase().includes(query));
    setFilteredSuggestions(filtered);
  }, [allSuggestions, triggerPosition]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(MentionWrapper, {
    "data-single-line": rows === 1 ? 'true' : undefined
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(primereact_mention__WEBPACK_IMPORTED_MODULE_1__.Mention, _extends({
    value: value ?? '',
    onChange: handleChange,
    suggestions: filteredSuggestions,
    onSearch: handleSearch,
    field: "value",
    trigger: "@",
    rows: rows,
    disabled: disabled,
    placeholder: placeholder,
    itemTemplate: SuggestionItem
  }, ariaLabel ? {
    'aria-label': ariaLabel
  } : {}))));
});
const SuggestionItem = suggestion => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, suggestion.label);

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/number-control.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/number-control.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   NumberControl: function() { return /* binding */ NumberControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_number_input__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/number-input */ "./packages/packages/libs/editor-controls/src/components/number-input.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");







const isEmptyOrNaN = value => value === null || value === undefined || value === '' || Number.isNaN(Number(value));
const renderSuffix = propType => {
  if (propType.meta?.suffix) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
      position: "end"
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, {
      variant: "caption",
      color: "text.secondary"
    }, propType.meta.suffix));
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);
};
const NumberControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(({
  placeholder: labelPlaceholder,
  max = Number.MAX_SAFE_INTEGER,
  min = -Number.MAX_SAFE_INTEGER,
  step = 1,
  shouldForceInt = false,
  startIcon,
  disabled: inputDisabled
}) => {
  const {
    value,
    setValue,
    placeholder,
    disabled,
    restoreValue,
    propType
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil);
  const handleChange = event => {
    const {
      value: eventValue,
      validity: {
        valid: isInputValid
      }
    } = event.target;
    let updatedValue;
    if (isEmptyOrNaN(eventValue)) {
      updatedValue = null;
    } else {
      const formattedValue = shouldForceInt ? +parseInt(eventValue) : Number(eventValue);
      updatedValue = Math.min(Math.max(formattedValue, min ?? Number.MIN_SAFE_INTEGER), max ?? Number.MAX_SAFE_INTEGER);
    }
    setValue(updatedValue, undefined, {
      validation: () => isInputValid
    });
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_number_input__WEBPACK_IMPORTED_MODULE_4__.NumberInput, {
    size: "tiny",
    type: "number",
    fullWidth: true,
    disabled: inputDisabled ?? disabled,
    value: isEmptyOrNaN(value) ? '' : value,
    onInput: handleChange,
    onBlur: restoreValue,
    placeholder: labelPlaceholder ?? (isEmptyOrNaN(placeholder) ? '' : String(placeholder)),
    inputProps: {
      step,
      min
    },
    InputProps: {
      startAdornment: startIcon ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
        position: "start",
        disabled: inputDisabled ?? disabled
      }, startIcon) : undefined,
      endAdornment: renderSuffix(propType)
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/position-control.tsx":
/*!**********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/position-control.tsx ***!
  \**********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PositionControl: function() { return /* binding */ PositionControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");










const positionOptions = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center center', 'elementor'),
  value: 'center center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center left', 'elementor'),
  value: 'center left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Center right', 'elementor'),
  value: 'center right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top center', 'elementor'),
  value: 'top center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top left', 'elementor'),
  value: 'top left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Top right', 'elementor'),
  value: 'top right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom center', 'elementor'),
  value: 'bottom center'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom left', 'elementor'),
  value: 'bottom left'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Bottom right', 'elementor'),
  value: 'bottom right'
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Custom', 'elementor'),
  value: 'custom'
}];
const PositionControl = () => {
  const positionContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.positionPropTypeUtil);
  const stringPropContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const isCustom = !!positionContext.value;
  const placeholder = positionContext.placeholder ? 'custom' : stringPropContext.placeholder ?? null;
  const handlePositionChange = event => {
    const value = event.target.value || null;
    if (value === 'custom') {
      positionContext.setValue({
        x: null,
        y: null
      });
    } else {
      stringPropContext.setValue(value);
    }
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    gap: 2,
    alignItems: "center",
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Object position', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6,
    sx: {
      overflow: 'hidden'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Select, {
    size: "tiny",
    displayEmpty: true,
    disabled: stringPropContext.disabled,
    value: (positionContext.value ? 'custom' : stringPropContext.value) ?? '',
    onChange: handlePositionChange,
    renderValue: selectedValue => (0,_select_control__WEBPACK_IMPORTED_MODULE_8__.getSelectRenderValue)(positionOptions, placeholder, selectedValue),
    fullWidth: true
  }, positionOptions.map(({
    label,
    value
  }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuListItem, {
    key: value,
    value: value ?? ''
  }, label)))))), isCustom && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, positionContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: 'x'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LetterXIcon, {
      fontSize: 'tiny'
    }),
    min: -Number.MAX_SAFE_INTEGER
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: 'y'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.LetterYIcon, {
      fontSize: 'tiny'
    }),
    min: -Number.MAX_SAFE_INTEGER
  })))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/query-chips-control.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/query-chips-control.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   QueryChipsControl: function() { return /* binding */ QueryChipsControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_chips_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/chips-list */ "./packages/packages/libs/editor-controls/src/components/chips-list.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_query_autocomplete__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/use-query-autocomplete */ "./packages/packages/libs/editor-controls/src/hooks/use-query-autocomplete.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }










const queryArrayPropTypeUtil = (0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.createArrayPropUtils)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.queryPropTypeUtil.key, _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.queryPropTypeUtil.schema);
const SIZE = 'tiny';
const QueryChipsControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(props => {
  const {
    queryOptions,
    placeholder,
    minInputLength = 2
  } = props;
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(queryArrayPropTypeUtil);
  const selectedChips = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => extractChips(value), [value]);
  const excludeIds = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => selectedChips.map(chip => Number(chip.id)).filter(id => Number.isFinite(id)), [selectedChips]);
  const {
    options,
    updateOptions
  } = (0,_hooks_use_query_autocomplete__WEBPACK_IMPORTED_MODULE_8__.useQueryAutocomplete)({
    url: queryOptions.url,
    params: queryOptions.params,
    minInputLength,
    excludeIds
  });
  const handleChange = (_, newValue) => {
    setValue(newValue.map(option => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.queryPropTypeUtil.create({
      id: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(Number(option.id)),
      label: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create(option.label)
    })));
  };
  const handleInputChange = (_, term) => {
    updateOptions(term || null);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Autocomplete, {
    multiple: true,
    fullWidth: true,
    disableClearable: true,
    forcePopupIcon: false,
    disabled: disabled,
    size: SIZE,
    value: selectedChips,
    options: options,
    onChange: handleChange,
    onInputChange: handleInputChange,
    getOptionLabel: option => option.label,
    isOptionEqualToValue: (option, val) => option.id === val.id,
    filterOptions: opts => opts,
    renderTags: (tagValues, getTagProps) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_chips_list__WEBPACK_IMPORTED_MODULE_5__.ChipsList, {
      getLabel: option => option.label,
      getTagProps: getTagProps,
      values: tagValues
    }),
    renderInput: params => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, _extends({}, params, {
      placeholder: placeholder ?? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Search', 'elementor')
    }))
  }));
});
function extractChips(value) {
  if (!value) {
    return [];
  }
  return value.map(item => (0,_hooks_use_query_autocomplete__WEBPACK_IMPORTED_MODULE_8__.extractFlatOptionFromQueryValue)(item?.value)).filter(chip => chip !== null);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/query-control.tsx":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/query-control.tsx ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   QueryControl: function() { return /* binding */ QueryControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_autocomplete__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/autocomplete */ "./packages/packages/libs/editor-controls/src/components/autocomplete.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_query_autocomplete__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/use-query-autocomplete */ "./packages/packages/libs/editor-controls/src/hooks/use-query-autocomplete.ts");









const QueryControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(props => {
  const {
    value: queryValue,
    setValue: setQueryValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.queryPropTypeUtil);
  const {
    value: urlValue,
    setValue: setUrlValue,
    placeholder: urlPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.urlPropTypeUtil);
  const {
    allowCustomValues = true,
    queryOptions: {
      url,
      params = {}
    },
    placeholder = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Search', 'elementor'),
    minInputLength = 2,
    onSetValue,
    ariaLabel
  } = props || {};
  const {
    options,
    updateOptions
  } = (0,_hooks_use_query_autocomplete__WEBPACK_IMPORTED_MODULE_8__.useQueryAutocomplete)({
    url,
    params,
    minInputLength,
    initialQueryValue: queryValue
  });
  const onOptionChange = newValue => {
    if (newValue === null) {
      setQueryValue(null);
      onSetValue?.(null);
      return;
    }
    const newQueryValue = {
      id: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.create(newValue),
      label: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.create((0,_components_autocomplete__WEBPACK_IMPORTED_MODULE_5__.findMatchingOption)(options, newValue)?.label || null)
    };
    setQueryValue(newQueryValue);
    onSetValue?.(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.queryPropTypeUtil.create(newQueryValue));
  };
  const onTextChange = newValue => {
    const trimmedValue = newValue?.trim() || '';
    if (!trimmedValue) {
      setUrlValue(null);
      onSetValue?.(null);
      return;
    }
    setUrlValue(trimmedValue);
    onSetValue?.(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.urlPropTypeUtil.create(trimmedValue));
    updateOptions(newValue);
  };
  const displayValue = queryValue?.id?.value ?? urlValue;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_6__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_autocomplete__WEBPACK_IMPORTED_MODULE_5__.Autocomplete, {
    options: options,
    allowCustomValues: allowCustomValues,
    placeholder: urlPlaceholder ?? placeholder,
    startAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.SearchIcon, {
      fontSize: "tiny"
    }),
    value: displayValue,
    onOptionChange: onOptionChange,
    onTextChange: onTextChange,
    minInputLength: minInputLength,
    disablePortal: false,
    inputProps: {
      ...(ariaLabel ? {
        'aria-label': ariaLabel
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/query-filter-repeater-control.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/query-filter-repeater-control.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   QueryFilterRepeaterControl: function() { return /* binding */ QueryFilterRepeaterControl; },
/* harmony export */   isKeyVisible: function() { return /* binding */ isKeyVisible; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/control-repeater/context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _chips_control__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./chips-control */ "./packages/packages/libs/editor-controls/src/controls/chips-control.tsx");
/* harmony import */ var _query_chips_control__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./query-chips-control */ "./packages/packages/libs/editor-controls/src/controls/query-chips-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




















const QueryFilterRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_15__.createControl)(({
  allowedKeys,
  keyConfig,
  label = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Filter', 'elementor'),
  chipsPlaceholder
}) => {
  const {
    propType,
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.queryFilterArrayPropTypeUtil);
  const {
    settings
  } = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_1__.useSelectedElementSettings)();
  const visibleKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => allowedKeys.filter(key => isKeyVisible(keyConfig[key]?.visibleWhen, settings)), [allowedKeys, keyConfig, settings]);
  const usedKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getUsedKeys(value ?? []), [value]);
  const nextAvailableKey = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => visibleKeys.find(key => !usedKeys.has(key)) ?? null, [visibleKeys, usedKeys]);
  const getKeySelectOptions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => currentKey => visibleKeys.map(itemKey => ({
    value: itemKey,
    label: keyConfig[itemKey]?.label ?? itemKey,
    disabled: itemKey !== currentKey && usedKeys.has(itemKey)
  })), [visibleKeys, keyConfig, usedKeys]);
  const initialFallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => createItemForKey(visibleKeys[0] ?? ''), [visibleKeys]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, {
    propType: propType,
    value: value,
    setValue: setValue
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_8__.ControlRepeater, {
    initial: initialFallback,
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.queryFilterArrayPropTypeUtil
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_14__.RepeaterHeader, {
    label: label
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(AddFilterItemAction, {
    nextAvailableKey: nextAvailableKey,
    ariaLabel: label
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_8__.ItemsContainer, {
    isSortable: false
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_8__.Item, {
    Icon: EmptyIcon,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_9__.RemoveItemAction, null),
    Label: ({
      value: itemValue
    }) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemLabel, {
      value: itemValue,
      keyConfig: keyConfig
    })
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_11__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ItemContent, {
    keyConfig: keyConfig,
    getKeySelectOptions: getKeySelectOptions,
    chipsPlaceholder: chipsPlaceholder
  }))));
});
const AddFilterItemAction = ({
  nextAvailableKey,
  ariaLabel
}) => {
  const {
    addItem
  } = (0,_components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_10__.useRepeaterContext)();
  const disabled = nextAvailableKey === null;
  const onClick = ev => {
    if (!nextAvailableKey) {
      return;
    }
    addItem(ev, {
      item: createItemForKey(nextAvailableKey),
      index: 0
    });
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Box, {
    component: "span",
    sx: {
      cursor: disabled ? 'not-allowed' : 'pointer'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.IconButton, {
    size: "tiny",
    disabled: disabled,
    onClick: onClick
    /* Translators: %s: Aria label. */,
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Add %s item', 'elementor'), ariaLabel.toLowerCase())
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.PlusIcon, {
    fontSize: "tiny"
  })));
};
const EmptyIcon = () => null;
const ItemLabel = ({
  value,
  keyConfig
}) => {
  const itemKey = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(value?.value?.key);
  const label = itemKey && keyConfig[itemKey]?.label || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Item', 'elementor');
  const chipLabels = extractChipLabels(value?.value?.values);
  const taxonomyLabels = extractTaxonomyLabels(value?.value?.taxonomies, itemKey ? keyConfig[itemKey] : undefined);
  const allLabels = [...chipLabels, ...taxonomyLabels];
  const suffix = allLabels.length > 0 ? `: ${allLabels.join(', ')}` : '';
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Box, {
    component: "span"
  }, label, suffix);
};
function extractChipLabels(chipsProp) {
  const chips = chipsProp?.value ?? [];
  return chips.map(chip => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(chip?.value?.label)).filter(label => !!label);
}
const ItemContent = ({
  keyConfig,
  getKeySelectOptions,
  chipsPlaceholder
}) => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.queryFilterPropTypeUtil);
  const snapshotsByKeyRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({});
  const handleValueChange = (nextValue, options, meta) => {
    if (meta?.bind !== 'key') {
      propContext.setValue(nextValue, options, meta);
      return;
    }
    const previousKey = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(propContext.value?.key);
    const newKey = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(nextValue?.key);
    if (previousKey) {
      snapshotsByKeyRef.current[previousKey] = {
        values: propContext.value?.values ?? null,
        taxonomies: propContext.value?.taxonomies ?? null
      };
    }
    const restored = newKey ? snapshotsByKeyRef.current[newKey] : undefined;
    propContext.setValue({
      ...nextValue,
      values: restored?.values ?? null,
      taxonomies: restored?.taxonomies ?? null
    }, options, meta);
  };
  const currentKey = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(propContext.value?.key);
  const currentKeyConfig = currentKey ? keyConfig[currentKey] : undefined;
  const valueType = currentKeyConfig?.valueType ?? 'chips';
  const keySelectOptions = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getKeySelectOptions(currentKey), [getKeySelectOptions, currentKey]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_12__.PopoverContent, {
    p: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropProvider, _extends({}, propContext, {
    setValue: handleValueChange
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_13__.PopoverGridContainer, {
    flexWrap: "wrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Type', 'elementor'))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: "key"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_18__.SelectControl, {
    options: keySelectOptions
  })))), valueType === 'taxonomies' && currentKeyConfig?.staticOptions && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_13__.PopoverGridContainer, {
    flexWrap: "wrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, currentKeyConfig.label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: "taxonomies"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_chips_control__WEBPACK_IMPORTED_MODULE_16__.ChipsControl, {
    options: currentKeyConfig.staticOptions
  })))), valueType !== 'taxonomies' && currentKeyConfig?.queryEndpoint && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_13__.PopoverGridContainer, {
    flexWrap: "wrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_7__.ControlFormLabel, null, currentKeyConfig.label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.PropKeyProvider, {
    bind: "values"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_query_chips_control__WEBPACK_IMPORTED_MODULE_17__.QueryChipsControl, {
    queryOptions: {
      url: currentKeyConfig.queryEndpoint.url,
      params: currentKeyConfig.queryEndpoint.params ?? {}
    },
    placeholder: currentKeyConfig.chipsPlaceholder ?? chipsPlaceholder
  }))))));
};
function isKeyVisible(rule, settings) {
  if (!rule) {
    return true;
  }
  if (!settings) {
    return false;
  }
  const extracted = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract((0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.extractValue)(rule.path, settings));
  return extracted !== null && rule.in.includes(extracted);
}
function extractTaxonomyLabels(taxonomiesProp, config) {
  const slugs = (_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringArrayPropTypeUtil.extract(taxonomiesProp) ?? []).map(item => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(item)).filter(slug => !!slug);
  if (!slugs.length) {
    return [];
  }
  const options = config?.staticOptions ?? [];
  return slugs.map(slug => options.find(opt => opt.value === slug)?.label ?? slug);
}
function createItemForKey(key) {
  return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.queryFilterPropTypeUtil.create({
    key: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.create(key),
    values: null,
    taxonomies: null
  });
}
function getUsedKeys(items) {
  const keys = items.map(item => _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.stringPropTypeUtil.extract(item?.value?.key)).filter(key => !!key);
  return new Set(keys);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/repeatable-control.tsx":
/*!************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/repeatable-control.tsx ***!
  \************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeatableControl: function() { return /* binding */ RepeatableControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-repeater/actions/disable-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/control-repeater/actions/duplicate-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_control_repeater_items_items_container__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/control-repeater/items/items-container */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/items-container.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../hooks/use-repeatable-control-context */ "./packages/packages/libs/editor-controls/src/hooks/use-repeatable-control-context.ts");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }

















const PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
const RepeatableControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_13__.createControl)(({
  repeaterLabel,
  childControlConfig,
  showDuplicate,
  showToggle,
  initialValues,
  patternLabel,
  placeholder,
  propKey,
  isSortable,
  addItemTooltipProps
}) => {
  const {
    propTypeUtil: childPropTypeUtil,
    isItemDisabled
  } = childControlConfig;
  if (!childPropTypeUtil) {
    return null;
  }
  const childArrayPropTypeUtil = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.createArrayPropUtils)(childPropTypeUtil.key, childPropTypeUtil.schema, propKey), [childPropTypeUtil.key, childPropTypeUtil.schema, propKey]);
  const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({
    ...childControlConfig,
    placeholder: placeholder || '',
    patternLabel: patternLabel || ''
  }), [childControlConfig, placeholder, patternLabel]);
  const {
    propType,
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(childArrayPropTypeUtil);
  const newItemIndex = addItemTooltipProps?.newItemIndex === null ? undefined : 0;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropProvider, {
    propType: propType,
    value: value,
    setValue: setValue
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_14__.RepeatableControlContext.Provider, {
    value: contextValue
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.ControlRepeater, {
    initial: childPropTypeUtil.create(initialValues || null),
    propTypeUtil: childArrayPropTypeUtil,
    isItemDisabled: isItemDisabled
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_12__.RepeaterHeader, {
    label: repeaterLabel
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.TooltipAddItemAction, _extends({}, addItemTooltipProps, {
    newItemIndex: newItemIndex,
    ariaLabel: repeaterLabel
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_items_container__WEBPACK_IMPORTED_MODULE_9__.ItemsContainer, {
    isSortable: isSortable
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_4__.Item, {
    Icon: ItemIcon,
    Label: ItemLabel,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, showDuplicate && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_duplicate_item_action__WEBPACK_IMPORTED_MODULE_6__.DuplicateItemAction, null), showToggle && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_5__.DisableItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_7__.RemoveItemAction, null))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_8__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Content, null)))));
});

// TODO: Configurable icon probably can be somehow part of the injected control and bubbled up to the repeater
const ItemIcon = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);
const Content = () => {
  const {
    component: ChildControl,
    props = {}
  } = (0,_hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_14__.useRepeatableControlContext)();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_10__.PopoverContent, {
    p: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_11__.PopoverGridContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ChildControl, props)));
};
const interpolate = (template, data) => {
  if (!data) {
    return template;
  }
  return template.replace(PLACEHOLDER_REGEX, (_, path) => {
    const value = getNestedValue(data, path);
    if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
      if ('name' in value && value.name) {
        return value.name;
      }
      return JSON.stringify(value);
    }
    if (Array.isArray(value)) {
      return value.join(', ');
    }
    return String(value ?? '');
  });
};
const getNestedValue = (obj, path) => {
  let parentObj = {};
  const pathKeys = path.split('.');
  const key = pathKeys.slice(-1)[0];
  let value = pathKeys.reduce((current, currentKey, currentIndex) => {
    if (currentIndex === pathKeys.length - 2) {
      parentObj = current;
    }
    if (current && typeof current === 'object') {
      return current[currentKey];
    }
    return {};
  }, obj);
  value = !!value ? value : '';
  const propType = parentObj?.$$type;
  const propValue = parentObj?.value;
  const doesValueRepresentCustomSize = key === 'unit' && propType === 'size' && propValue?.unit === 'custom';
  if (!doesValueRepresentCustomSize) {
    return value;
  }
  return propValue?.size ? '' : _size_control__WEBPACK_IMPORTED_MODULE_15__.CUSTOM_SIZE_LABEL;
};
const isEmptyValue = val => {
  if (typeof val === 'string') {
    return val.trim() === '';
  }
  if (Number.isNaN(val)) {
    return true;
  }
  if (Array.isArray(val)) {
    return val.length === 0;
  }
  if (typeof val === 'object' && val !== null) {
    return Object.keys(val).length === 0;
  }
  return false;
};
const shouldShowPlaceholder = (pattern, data) => {
  const propertyPaths = getAllProperties(pattern);
  const values = propertyPaths.map(path => getNestedValue(data, path));
  if (values.length === 0) {
    return false;
  }
  if (values.some(value => value === null || value === undefined)) {
    return true;
  }
  if (values.every(isEmptyValue)) {
    return true;
  }
  return false;
};
const getTextColor = (isReadOnly, showPlaceholder) => {
  if (isReadOnly) {
    return 'text.disabled';
  }
  return showPlaceholder ? 'text.tertiary' : 'text.primary';
};
const ItemLabel = ({
  value
}) => {
  const {
    placeholder,
    patternLabel,
    props: childProps
  } = (0,_hooks_use_repeatable_control_context__WEBPACK_IMPORTED_MODULE_14__.useRepeatableControlContext)();
  const showPlaceholder = shouldShowPlaceholder(patternLabel, value);
  const label = showPlaceholder ? placeholder : interpolate(patternLabel, value);
  const isReadOnly = !!childProps?.readOnly;
  const color = getTextColor(isReadOnly, showPlaceholder);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    component: "span",
    color: color
  }, label);
};
const getAllProperties = pattern => {
  const properties = pattern.match(PLACEHOLDER_REGEX)?.map(match => match.slice(2, -1)) || [];
  return properties;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/select-control-wrapper.tsx":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/select-control-wrapper.tsx ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectControlWrapper: function() { return /* binding */ SelectControlWrapper; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _select_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const getOffCanvasElements = () => {
  const extendedWindow = window;
  const documentId = extendedWindow.elementor.config.document.id;
  const offCanvasElements = extendedWindow.elementor.$previewContents[0].querySelectorAll(`[data-elementor-id="${documentId}"] .elementor-widget-off-canvas.elementor-element-edit-mode`);
  return Array.from(offCanvasElements).map(offCanvasElement => {
    return {
      label: offCanvasElement.querySelector('.e-off-canvas')?.getAttribute('aria-label') ?? '',
      value: offCanvasElement.dataset.id
    };
  });
};
const getFormElements = () => {
  const extendedWindow = window;
  const documentId = extendedWindow.elementor.config.document.id;
  const selectors = [`[data-elementor-id="${documentId}"] input[id]:not([type="hidden"]):not([type="reset"]):not([type="button"])`, `[data-elementor-id="${documentId}"] select[id]`, `[data-elementor-id="${documentId}"] textarea[id]`];
  const formElements = extendedWindow.elementor.$previewContents[0].querySelectorAll(selectors.join(', '));
  return Array.from(formElements).map(formElement => {
    const tagName = formElement.tagName.toLowerCase();
    return {
      label: `${formElement.id} (${tagName === 'input' ? formElement.getAttribute('type') : tagName})`,
      value: formElement.id
    };
  });
};
const collectionMethods = {
  'off-canvas': getOffCanvasElements,
  'form-elements': getFormElements
};
const useDynamicOptions = (collectionId, initialOptions) => {
  const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialOptions ?? []);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (!collectionId || !collectionMethods[collectionId]) {
      setOptions(initialOptions ?? []);
      return;
    }
    setOptions(collectionMethods[collectionId]());
  }, [collectionId, initialOptions]);
  return options;
};
const SelectControlWrapper = (0,_create_control__WEBPACK_IMPORTED_MODULE_1__.createControl)(({
  collectionId,
  options,
  ...props
}) => {
  const actualOptions = useDynamicOptions(collectionId, options);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_select_control__WEBPACK_IMPORTED_MODULE_2__.SelectControl, _extends({
    options: actualOptions
  }, props));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/select-control.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectControl: function() { return /* binding */ SelectControl; },
/* harmony export */   getSelectRenderValue: function() { return /* binding */ getSelectRenderValue; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }







const DEFAULT_MENU_PROPS = {
  MenuListProps: {
    sx: {
      maxHeight: '160px'
    }
  }
};
const SelectControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(({
  options = [],
  groups = [],
  onChange,
  MenuProps = DEFAULT_MENU_PROPS,
  ariaLabel
}) => {
  const {
    value,
    setValue,
    disabled,
    placeholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const handleChange = event => {
    const newValue = event.target.value || null;
    onChange?.(newValue, value);
    setValue(newValue);
  };
  const flatOptions = flattenGroupedOptions(options, groups);
  const isDisabled = disabled || flatOptions.length === 0;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_5__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Select, {
    sx: {
      overflow: 'hidden'
    },
    displayEmpty: true,
    size: "tiny",
    MenuProps: MenuProps,
    "aria-label": ariaLabel || placeholder,
    renderValue: selectedValue => getSelectRenderValue(flatOptions, placeholder, selectedValue),
    value: value ?? '',
    onChange: handleChange,
    disabled: isDisabled,
    fullWidth: true
  }, groups.length ? groups.flatMap(group => renderGroup(group)) : options.map(option => renderOption(option))));
});
const GROUPED_OPTION_INDENT = 3.5;
function renderGroup(group) {
  return [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.MenuSubheader, {
    key: `group-${group.label}`,
    sx: {
      fontWeight: 400,
      color: 'text.tertiary'
    }
  }, group.label), ...group.options.map(option => renderOption(option, true))];
}
function renderOption({
  label,
  ...props
}, isGrouped = false) {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuListItem, _extends({
    key: props.value
  }, props, {
    value: props.value ?? '',
    sx: isGrouped ? {
      pl: GROUPED_OPTION_INDENT
    } : undefined
  }), label);
}
function flattenGroupedOptions(options, groups) {
  if (!groups.length) {
    return options;
  }
  return groups.flatMap(group => group.options);
}
function getSelectRenderValue(options, placeholder, selectedValue) {
  const optionWithValue = v => options.find(({
    value
  }) => value === v);
  if (!isUnsetSelectValue(selectedValue)) {
    return optionWithValue(selectedValue)?.label ?? selectedValue;
  }
  if (placeholder) {
    const text = optionWithValue(placeholder)?.label ?? placeholder;
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Typography, {
      component: "span",
      variant: "inherit",
      color: "text.tertiary"
    }, text);
  }
  return options.find(({
    value
  }) => isUnsetSelectValue(value))?.label ?? '';
}
function isUnsetSelectValue(value) {
  return value === null || value === undefined || value === '';
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/selection-size-control.tsx":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/selection-size-control.tsx ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SelectionSizeControl: function() { return /* binding */ SelectionSizeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");








const SelectionSizeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  selectionLabel,
  sizeLabel,
  selectionConfig,
  sizeConfigMap
}) => {
  const {
    value,
    setValue,
    propType
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.selectionSizePropTypeUtil);
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const sizeFieldId = sizeLabel.replace(/\s+/g, '-').toLowerCase();
  const currentSizeConfig = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    switch (value.selection.$$type) {
      case 'key-value':
        return sizeConfigMap[value?.selection?.value.value.value || ''];
      case 'string':
        return sizeConfigMap[value?.selection?.value || ''];
      default:
        return null;
    }
  }, [value, sizeConfigMap]);
  const SelectionComponent = selectionConfig.component;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropProvider, {
    value: value,
    setValue: setValue,
    propType: propType
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    spacing: 1.5,
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      alignItems: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, null, selectionLabel)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropKeyProvider, {
    bind: "selection"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(SelectionComponent, selectionConfig.props))), currentSizeConfig && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6,
    sx: {
      display: 'flex',
      alignItems: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_4__.ControlFormLabel, {
    htmlFor: sizeFieldId
  }, sizeLabel)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.PropKeyProvider, {
    bind: "size"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_6__.SizeControl, {
    anchorRef: rowRef,
    variant: currentSizeConfig.variant,
    units: currentSizeConfig.units,
    defaultUnit: currentSizeConfig.defaultUnit,
    id: sizeFieldId
  }))))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx":
/*!******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control.tsx ***!
  \******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CUSTOM_SIZE_LABEL: function() { return /* binding */ CUSTOM_SIZE_LABEL; },
/* harmony export */   SizeControl: function() { return /* binding */ SizeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive");
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_size_control_size_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/size-control/size-input */ "./packages/packages/libs/editor-controls/src/components/size-control/size-input.tsx");
/* harmony import */ var _components_text_field_popover__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/text-field-popover */ "./packages/packages/libs/editor-controls/src/components/text-field-popover.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_size_extended_options__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/use-size-extended-options */ "./packages/packages/libs/editor-controls/src/hooks/use-size-extended-options.ts");
/* harmony import */ var _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../hooks/use-sync-external-state */ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx");
/* harmony import */ var _utils_size_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/size-control */ "./packages/packages/libs/editor-controls/src/utils/size-control.ts");
/* harmony import */ var _size_control_utils_settings_get_prop_type_settings__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./size-control/utils/settings/get-prop-type-settings */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts");













const defaultSelectedUnit = {
  length: 'px',
  angle: 'deg',
  time: 'ms'
};
const defaultUnits = {
  length: [..._utils_size_control__WEBPACK_IMPORTED_MODULE_10__.lengthUnits],
  angle: [..._utils_size_control__WEBPACK_IMPORTED_MODULE_10__.angleUnits],
  time: [..._utils_size_control__WEBPACK_IMPORTED_MODULE_10__.timeUnits]
};
const CUSTOM_SIZE_LABEL = 'fx';
const SizeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(({
  variant = 'length',
  defaultUnit,
  units,
  placeholder,
  startIcon,
  anchorRef,
  extendedOptions,
  disableCustom,
  min = 0,
  enablePropTypeUnits = false,
  id,
  ariaLabel
}) => {
  const {
    value: sizeValue,
    setValue: setSizeValue,
    disabled,
    restoreValue,
    placeholder: externalPlaceholder,
    propType
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const actualDefaultUnit = defaultUnit ?? externalPlaceholder?.unit ?? defaultSelectedUnit[variant];
  const activeBreakpoint = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_2__.useActiveBreakpoint)();
  const actualExtendedOptions = (0,_hooks_use_size_extended_options__WEBPACK_IMPORTED_MODULE_8__.useSizeExtendedOptions)(extendedOptions || [], disableCustom ?? false);
  const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units, actualExtendedOptions);
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({
    variant: 'popover'
  });
  const memorizedExternalState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => createStateFromSizeProp(sizeValue, actualDefaultUnit), [sizeValue, actualDefaultUnit]);
  const [state, setState] = (0,_hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_9__.useSyncExternalState)({
    external: memorizedExternalState,
    setExternal: (newState, options, meta) => setSizeValue(extractValueFromState(newState), options, meta),
    persistWhen: newState => !!extractValueFromState(newState),
    fallback: newState => ({
      unit: newState?.unit ?? actualDefaultUnit,
      numeric: newState?.numeric ?? _utils_size_control__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_SIZE,
      custom: newState?.custom ?? ''
    })
  });
  const {
    size: controlSize = _utils_size_control__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_SIZE,
    unit: controlUnit = actualDefaultUnit
  } = extractValueFromState(state, true) || {};
  const handleUnitChange = newUnit => {
    if (newUnit === 'custom') {
      popupState.open(anchorRef?.current);
    }
    setState(prev => ({
      ...prev,
      unit: newUnit
    }));
  };
  const handleSizeChange = event => {
    const size = event.target.value;
    const isInputValid = event.target.validity.valid;
    if (controlUnit === 'auto') {
      setState(prev => ({
        ...prev,
        unit: controlUnit
      }));
      return;
    }
    setState(prev => ({
      ...prev,
      [controlUnit === 'custom' ? 'custom' : 'numeric']: formatSize(size, controlUnit),
      unit: controlUnit
    }), undefined, {
      validation: () => isInputValid
    });
  };
  const onInputClick = event => {
    if (event.target.closest('input') && 'custom' === state.unit) {
      popupState.open(anchorRef?.current);
    }
  };
  const maybeClosePopup = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
    if (popupState && popupState.isOpen) {
      popupState.close();
    }
  }, [popupState]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    maybeClosePopup();
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [activeBreakpoint]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_size_control_size_input__WEBPACK_IMPORTED_MODULE_5__.SizeInput, {
    disabled: disabled,
    size: controlSize,
    unit: controlUnit,
    units: [...actualUnits],
    placeholder: placeholder,
    startIcon: startIcon,
    handleSizeChange: handleSizeChange,
    handleUnitChange: handleUnitChange,
    onBlur: restoreValue,
    onClick: onInputClick,
    popupState: popupState,
    min: min,
    id: id,
    ariaLabel: ariaLabel
  }), anchorRef?.current && popupState.isOpen && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_text_field_popover__WEBPACK_IMPORTED_MODULE_6__.TextFieldPopover, {
    popupState: popupState,
    anchorRef: anchorRef,
    restoreValue: restoreValue,
    value: controlSize,
    onChange: handleSizeChange
  }));
});
function resolveUnits(propType, enablePropTypeUnits, variant, externalUnits, actualExtendedOptions) {
  const fallback = [...defaultUnits[variant]];
  if (!enablePropTypeUnits) {
    return [...(externalUnits ?? fallback), ...(actualExtendedOptions || [])];
  }
  return (0,_size_control_utils_settings_get_prop_type_settings__WEBPACK_IMPORTED_MODULE_11__.getPropTypeSettings)(propType)?.available_units ?? fallback;
}
function formatSize(size, unit) {
  if ((0,_utils_size_control__WEBPACK_IMPORTED_MODULE_10__.isUnitExtendedOption)(unit)) {
    return unit === 'auto' ? '' : String(size ?? '');
  }
  return size || size === 0 ? Number(size) : NaN;
}
function createStateFromSizeProp(sizeValue, defaultUnit, defaultSize = '', customState = '') {
  const unit = sizeValue?.unit ?? defaultUnit;
  const size = sizeValue?.size ?? defaultSize;
  return {
    numeric: !(0,_utils_size_control__WEBPACK_IMPORTED_MODULE_10__.isUnitExtendedOption)(unit) && !isNaN(Number(size)) && (size || size === 0) ? Number(size) : _utils_size_control__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_SIZE,
    custom: unit === 'custom' ? String(size) : customState,
    unit
  };
}
function extractValueFromState(state, allowEmpty = false) {
  if (!state) {
    return null;
  }
  if (!state?.unit) {
    return {
      size: _utils_size_control__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_SIZE,
      unit: _utils_size_control__WEBPACK_IMPORTED_MODULE_10__.DEFAULT_UNIT
    };
  }
  const {
    unit
  } = state;
  if (unit === 'auto') {
    return {
      size: '',
      unit
    };
  }
  if (unit === 'custom') {
    return {
      size: state.custom ?? '',
      unit: 'custom'
    };
  }
  const numeric = state.numeric;
  if (!allowEmpty && (numeric === undefined || numeric === null || Number.isNaN(numeric))) {
    return null;
  }
  return {
    size: numeric,
    unit
  };
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-unit-keyboard.tsx":
/*!***********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-unit-keyboard.tsx ***!
  \***********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useSizeUnitKeyboard: function() { return /* binding */ useSizeUnitKeyboard; }
/* harmony export */ });
/* harmony import */ var _hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../hooks/use-typing-buffer */ "./packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts");
/* harmony import */ var _utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");


const UNIT_KEY_PATTERN = /^[a-zA-Z%]$/;
const useSizeUnitKeyboard = ({
  unit,
  units,
  onUnitChange
}) => {
  const {
    appendKey,
    startsWith
  } = (0,_hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_0__.useTypingBuffer)();
  const onUnitKeyDown = event => {
    if (units.length === 0) {
      return;
    }
    const {
      key,
      altKey,
      ctrlKey,
      metaKey
    } = event;
    if (altKey || ctrlKey || metaKey) {
      return;
    }
    if ((0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_1__.isExtendedUnit)(unit) && isNumericValue(key)) {
      const [defaultUnit] = units;
      if (defaultUnit) {
        onUnitChange(defaultUnit);
      }
      return;
    }
    if (!UNIT_KEY_PATTERN.test(key)) {
      return;
    }
    event.preventDefault();
    const updatedBuffer = appendKey(key.toLowerCase());
    const matchedUnit = units.find(u => startsWith(u, updatedBuffer));
    if (matchedUnit) {
      onUnitChange(matchedUnit);
    }
  };
  return {
    onUnitKeyDown
  };
};
const isNumericValue = value => {
  if (typeof value === 'number') {
    return !isNaN(value);
  }
  if (typeof value === 'string') {
    return value.trim() !== '' && !isNaN(Number(value));
  }
  return false;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-value.ts":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-value.ts ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useSizeValue: function() { return /* binding */ useSizeValue; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../hooks/use-sync-external-state */ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx");
/* harmony import */ var _utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");
/* harmony import */ var _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/resolve-size-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts");
/* harmony import */ var _use_unit_sync__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./use-unit-sync */ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-unit-sync.ts");





const useSizeValue = ({
  value,
  setValue,
  units,
  defaultUnit
}) => {
  const resolvedValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_3__.resolveSizeValue)(value, {
    units,
    defaultUnit
  }),
  // eslint-disable-next-line react-hooks/exhaustive-deps
  [value?.size, value?.unit, defaultUnit]);
  const [sizeValue, setSizeValue] = (0,_hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_1__.useSyncExternalState)({
    external: resolvedValue,
    setExternal: (newState, options, meta) => {
      if (newState !== null) {
        setValue(newState, options, meta);
      }
    },
    persistWhen: next => hasChanged(next, resolvedValue),
    fallback: () => (0,_utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_3__.createDefaultSizeValue)(units, defaultUnit)
  });
  const [unit, setUnit] = (0,_use_unit_sync__WEBPACK_IMPORTED_MODULE_4__.useUnitSync)({
    sizeValue,
    setUnit: newUnit => {
      setSizeValue({
        unit: newUnit,
        size: (0,_utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_3__.resolveSizeOnUnitChange)(sizeValue.size, newUnit)
      });
    },
    persistWhen: () => {
      return Boolean(sizeValue.size) || sizeValue.size !== '' || (0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_2__.isExtendedUnit)(sizeValue.unit);
    }
  });
  const setSize = (newSize, isInputValid = true) => {
    if ((0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_2__.isExtendedUnit)(unit)) {
      return;
    }
    const trimmed = newSize.trim();
    const parsed = Number(trimmed);
    const newState = {
      unit,
      size: trimmed && !isNaN(parsed) ? parsed : ''
    };
    setSizeValue(newState, undefined, {
      validation: () => isInputValid
    });
  };
  return {
    size: sizeValue.size,
    setSize,
    unit,
    setUnit
  };
};
const hasChanged = (next, current) => {
  return next?.size !== current?.size || next?.unit !== current?.unit;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-unit-sync.ts":
/*!*************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-unit-sync.ts ***!
  \*************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useUnitSync: function() { return /* binding */ useUnitSync; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");


const useUnitSync = ({
  sizeValue,
  setUnit,
  persistWhen
}) => {
  const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(sizeValue.unit);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (sizeValue.unit !== state) {
      setState(sizeValue.unit);
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [sizeValue.unit, sizeValue.size]);
  const setInternalValue = newUnit => {
    setState(newUnit);
    if ((0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_1__.isExtendedUnit)(newUnit) || persistWhen()) {
      setUnit(newUnit);
    }
  };
  return [state, setInternalValue];
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/size-component.tsx":
/*!*********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/size-component.tsx ***!
  \*********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SizeComponent: function() { return /* binding */ SizeComponent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive");
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _size_field__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./size-field */ "./packages/packages/libs/editor-controls/src/controls/size-control/size-field.tsx");
/* harmony import */ var _ui_text_field_popover__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ui/text-field-popover */ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/text-field-popover.tsx");
/* harmony import */ var _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/resolve-size-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }







const SizeComponent = ({
  anchorRef,
  SizeFieldWrapper = react__WEBPACK_IMPORTED_MODULE_0__.Fragment,
  ...sizeFieldProps
}) => {
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({
    variant: 'popover'
  });
  const activeBreakpoint = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__.useActiveBreakpoint)();
  const isCustomUnit = sizeFieldProps?.value?.unit === _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_5__.EXTENDED_UNITS.custom;
  const hasCustomUnitOption = sizeFieldProps.units.includes(_utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_5__.EXTENDED_UNITS.custom);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (popupState && popupState.isOpen) {
      popupState.close();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [activeBreakpoint]);
  const handleCustomSizeChange = event => {
    sizeFieldProps.setValue({
      size: event.target.value,
      unit: _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_5__.EXTENDED_UNITS.custom
    });
  };
  const handleSizeFieldClick = event => {
    if (event.target.closest('input') && isCustomUnit) {
      popupState.open(anchorRef?.current);
    }
  };
  const handleUnitChange = unit => {
    if (unit === _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_5__.EXTENDED_UNITS.custom && anchorRef?.current) {
      popupState.open(anchorRef.current);
    }
  };
  const popupAttributes = {
    'aria-controls': popupState.isOpen ? popupState.popupId : undefined,
    'aria-haspopup': true
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(SizeFieldWrapper, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_field__WEBPACK_IMPORTED_MODULE_3__.SizeField, _extends({
    focused: popupState.isOpen ? true : undefined,
    onUnitChange: handleUnitChange,
    InputProps: {
      ...popupAttributes,
      onClick: handleSizeFieldClick
    },
    unitSelectorProps: {
      menuItemsAttributes: hasCustomUnitOption ? {
        custom: popupAttributes
      } : undefined
    }
  }, sizeFieldProps)))), popupState.isOpen && anchorRef?.current && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_text_field_popover__WEBPACK_IMPORTED_MODULE_4__.TextFieldPopover, {
    popupState: popupState,
    anchorRef: anchorRef,
    value: String(sizeFieldProps?.value?.size ?? ''),
    onChange: handleCustomSizeChange,
    onClose: () => {}
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/size-field.tsx":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/size-field.tsx ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SizeField: function() { return /* binding */ SizeField; },
/* harmony export */   shouldHighlightUnit: function() { return /* binding */ shouldHighlightUnit; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks_use_size_unit_keyboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hooks/use-size-unit-keyboard */ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-unit-keyboard.tsx");
/* harmony import */ var _hooks_use_size_value__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hooks/use-size-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-value.ts");
/* harmony import */ var _ui_size_input__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ui/size-input */ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/size-input.tsx");
/* harmony import */ var _ui_unit_selector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ui/unit-selector */ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/unit-selector.tsx");
/* harmony import */ var _utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");
/* harmony import */ var _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/resolve-size-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const UNIT_DISPLAY_LABELS_OVERRIDES = {
  custom: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.MathFunctionIcon, {
    fontSize: "tiny"
  })
};
const SizeField = ({
  value,
  focused,
  disabled,
  InputProps,
  defaultUnit,
  placeholder,
  onUnitChange,
  startIcon,
  ariaLabel,
  onKeyDown,
  setValue,
  onBlur,
  units,
  min,
  unitSelectorProps
}) => {
  const {
    size,
    unit,
    setSize,
    setUnit
  } = (0,_hooks_use_size_value__WEBPACK_IMPORTED_MODULE_4__.useSizeValue)({
    value,
    setValue,
    units,
    defaultUnit
  });
  const handleUnitChange = newUnit => {
    setUnit(newUnit);
    onUnitChange?.(newUnit);
  };
  const {
    onUnitKeyDown
  } = (0,_hooks_use_size_unit_keyboard__WEBPACK_IMPORTED_MODULE_3__.useSizeUnitKeyboard)({
    unit,
    onUnitChange: handleUnitChange,
    units
  });
  const handleKeyDown = event => {
    onUnitKeyDown(event);
    onKeyDown?.(event);
  };
  const handleChange = event => {
    const newSize = event.target.value;
    const isInputValid = event.target.validity.valid;
    setSize(newSize, isInputValid);
  };
  const inputType = (0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_7__.isExtendedUnit)(unit) ? 'text' : 'number';
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_size_input__WEBPACK_IMPORTED_MODULE_5__.SizeInput, {
    disabled: disabled,
    focused: focused,
    type: inputType,
    value: size,
    placeholder: placeholder,
    onBlur: onBlur,
    onKeyDown: handleKeyDown,
    onChange: handleChange,
    InputProps: {
      ...InputProps,
      autoComplete: 'off',
      readOnly: (0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_7__.isExtendedUnit)(unit),
      startAdornment: startIcon && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
        position: "start",
        disabled: disabled
      }, startIcon),
      endAdornment: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.InputAdornment, {
        position: "end"
      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_unit_selector__WEBPACK_IMPORTED_MODULE_6__.UnitSelector, _extends({
        options: units,
        value: unit,
        onSelect: handleUnitChange,
        isUnitHighlighted: shouldHighlightUnit({
          size,
          unit
        })
      }, unitSelectorProps, {
        optionLabelOverrides: UNIT_DISPLAY_LABELS_OVERRIDES
      })))
    },
    inputProps: {
      min,
      step: 'any',
      'aria-label': ariaLabel
    }
  });
};
const shouldHighlightUnit = value => {
  if (!value) {
    return false;
  }
  if (value.unit === _utils_resolve_size_value__WEBPACK_IMPORTED_MODULE_8__.EXTENDED_UNITS.auto) {
    return true;
  }
  return Boolean(value.size) || value.size === 0;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/sync/get-units.ts":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/sync/get-units.ts ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getAngleUnits: function() { return /* binding */ getAngleUnits; },
/* harmony export */   getExtendedUnits: function() { return /* binding */ getExtendedUnits; },
/* harmony export */   getLengthUnits: function() { return /* binding */ getLengthUnits; },
/* harmony export */   getTimeUnits: function() { return /* binding */ getTimeUnits; }
/* harmony export */ });
const getLengthUnits = () => {
  return window.elementor?.config?.size_units?.length ?? [];
};
const getAngleUnits = () => {
  return window.elementor?.config?.size_units?.angle ?? [];
};
const getTimeUnits = () => {
  return window.elementor?.config?.size_units?.time ?? [];
};
const getExtendedUnits = () => {
  return window.elementor?.config?.size_units?.extended_units ?? [];
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/size-input.tsx":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/ui/size-input.tsx ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SizeInput: function() { return /* binding */ SizeInput; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _components_number_input__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../components/number-input */ "./packages/packages/libs/editor-controls/src/components/number-input.tsx");



const SizeInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  id,
  type,
  value,
  onBlur,
  onKeyUp,
  focused,
  disabled,
  onChange,
  onKeyDown,
  InputProps,
  inputProps,
  placeholder
}, ref) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_number_input__WEBPACK_IMPORTED_MODULE_1__.NumberInput, {
    id: id,
    ref: ref,
    size: "tiny",
    fullWidth: true,
    type: type,
    value: value,
    placeholder: placeholder,
    onKeyUp: onKeyUp,
    focused: focused,
    disabled: disabled,
    onKeyDown: onKeyDown,
    onInput: onChange,
    onBlur: onBlur,
    InputProps: InputProps,
    inputProps: inputProps,
    sx: getCursorStyle(InputProps?.readOnly ?? false)
  });
});
const getCursorStyle = readOnly => ({
  input: {
    cursor: readOnly ? 'default !important' : undefined
  }
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/text-field-popover.tsx":
/*!****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/ui/text-field-popover.tsx ***!
  \****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TextFieldPopover: function() { return /* binding */ TextFieldPopover; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }






const SIZE = 'tiny';
const TextFieldPopover = ({
  popupState,
  anchorRef,
  value,
  onChange,
  onClose
}) => {
  const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (popupState.isOpen) {
      requestAnimationFrame(() => {
        if (inputRef.current) {
          inputRef.current.focus();
        }
      });
    }
  }, [popupState.isOpen]);
  const handleKeyDown = event => {
    if (event.key.toLowerCase() === 'enter') {
      handleClose();
    }
  };
  const handleClose = () => {
    onClose?.();
    popupState.close();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Popover, _extends({
    disablePortal: true,
    slotProps: {
      paper: {
        sx: {
          borderRadius: 2,
          width: anchorRef.current?.offsetWidth + 'px'
        }
      }
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindPopover)(popupState), {
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'center'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'center'
    },
    onClose: handleClose
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverHeader, {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('CSS function', 'elementor'),
    onClose: handleClose,
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.MathFunctionIcon, {
      fontSize: SIZE
    })
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.TextField, {
    value: value,
    onChange: onChange,
    onKeyDown: handleKeyDown,
    size: "tiny",
    type: "text",
    fullWidth: true,
    inputProps: {
      ref: inputRef
    },
    sx: {
      pt: 0,
      pr: 1.5,
      pb: 1.5,
      pl: 1.5
    }
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/ui/unit-selector.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/ui/unit-selector.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UnitSelector: function() { return /* binding */ UnitSelector; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }




const menuItemContentStyles = {
  display: 'flex',
  flexDirection: 'column',
  justifyContent: 'center'
};
const UnitSelector = ({
  value,
  isUnitHighlighted,
  onSelect,
  options,
  disabled,
  menuItemsAttributes = {},
  optionLabelOverrides = {}
}) => {
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({
    variant: 'popover',
    popupId: (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)()
  });
  const handleMenuItemClick = option => {
    onSelect(option);
    popupState.close();
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledButton, _extends({
    isHighlighted: isUnitHighlighted,
    disabled: disabled,
    size: "small"
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popupState)), optionLabelOverrides[value] ?? value), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, _extends({
    MenuListProps: {
      dense: true
    }
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindMenu)(popupState)), options.map(option => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.MenuListItem, _extends({
    key: option,
    onClick: () => handleMenuItemClick(option)
  }, menuItemsAttributes?.[option], {
    primaryTypographyProps: {
      variant: 'caption',
      sx: {
        ...menuItemContentStyles,
        lineHeight: '1'
      }
    },
    menuItemTextProps: {
      sx: menuItemContentStyles
    }
  }), optionLabelOverrides[option] ?? option.toUpperCase()))));
};
const StyledButton = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, {
  shouldForwardProp: prop => prop !== 'isHighlighted'
})(({
  isHighlighted,
  theme
}) => ({
  color: isHighlighted ? theme.palette.text.primary : theme.palette.text.tertiary,
  font: 'inherit',
  minWidth: 'initial',
  textTransform: 'uppercase'
}));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx":
/*!****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx ***!
  \****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UnstableSizeControl: function() { return /* binding */ UnstableSizeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _size_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./size-component */ "./packages/packages/libs/editor-controls/src/controls/size-control/size-component.tsx");
/* harmony import */ var _utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");
/* harmony import */ var _utils_resolve_bound_prop_value__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/resolve-bound-prop-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-bound-prop-value.ts");
/* harmony import */ var _utils_settings_get_default_unit__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/settings/get-default-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-default-unit.ts");
/* harmony import */ var _utils_settings_get_size_units__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/settings/get-size-units */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-size-units.ts");
/* harmony import */ var _utils_should_nullify_value__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/should-nullify-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/should-nullify-value.ts");












const UnstableSizeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(({
  variant = 'length',
  placeholder: propPlaceholder,
  anchorRef,
  startIcon,
  ariaLabel,
  min
}) => {
  const {
    value,
    setValue,
    propType,
    placeholder: boundPropPlaceholder,
    restoreValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.sizePropTypeUtil);
  const lastNonAutoValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const {
    sizeValue,
    placeholder
  } = (0,_utils_resolve_bound_prop_value__WEBPACK_IMPORTED_MODULE_7__.resolveBoundPropValue)(value ?? lastNonAutoValue.current, boundPropPlaceholder, propPlaceholder);
  const units = (0,_utils_settings_get_size_units__WEBPACK_IMPORTED_MODULE_9__.getSizeUnits)(propType, variant);
  const defaultUnit = (0,_utils_settings_get_default_unit__WEBPACK_IMPORTED_MODULE_8__.getDefaultUnit)(propType);
  const handleBlur = () => {
    const isRequired = propType.settings.required;
    if ((0,_utils_should_nullify_value__WEBPACK_IMPORTED_MODULE_10__.shouldNullifyValue)(value) && !isRequired) {
      setValue(null);
    }
    if (isRequired) {
      restoreValue();
    }
  };
  const handleChange = (newValue, options, meta) => {
    if (isTransitioningFromExtendedUnit(newValue, value)) {
      lastNonAutoValue.current = newValue;
      setValue(null);
      return;
    }
    setValue(newValue, options, {
      ...meta,
      validation: () => {
        if (propType.settings.required) {
          return newValue.size !== '';
        }
        return meta?.validation ? meta.validation(newValue) : true;
      }
    });
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_component__WEBPACK_IMPORTED_MODULE_5__.SizeComponent, {
    units: units,
    value: sizeValue,
    anchorRef: anchorRef,
    placeholder: placeholder,
    defaultUnit: defaultUnit,
    onBlur: handleBlur,
    setValue: handleChange,
    SizeFieldWrapper: _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_3__["default"],
    startIcon: startIcon,
    ariaLabel: ariaLabel,
    min: min
  });
});
const isTransitioningFromExtendedUnit = (nextValue, previousValue) => {
  return !(0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_6__.isExtendedUnit)(nextValue.unit) && (0,_utils_is_extended_unit__WEBPACK_IMPORTED_MODULE_6__.isExtendedUnit)(previousValue?.unit) && nextValue.size === '';
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts":
/*!****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts ***!
  \****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   isExtendedUnit: function() { return /* binding */ isExtendedUnit; }
/* harmony export */ });
/* harmony import */ var _sync_get_units__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sync/get-units */ "./packages/packages/libs/editor-controls/src/controls/size-control/sync/get-units.ts");

const isExtendedUnit = unit => {
  return (0,_sync_get_units__WEBPACK_IMPORTED_MODULE_0__.getExtendedUnits)().includes(unit);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-bound-prop-value.ts":
/*!************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-bound-prop-value.ts ***!
  \************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   resolveBoundPropValue: function() { return /* binding */ resolveBoundPropValue; }
/* harmony export */ });
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__);

const resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
  const sizeValue = pickFirstValid([{
    candidate: value,
    resolve: v => v
  }, {
    candidate: propPlaceholder,
    resolve: toUnitPlaceholder
  }, {
    candidate: boundPropPlaceholder,
    resolve: toUnitPlaceholder
  }]);
  const placeholderSource = propPlaceholder ?? boundPropPlaceholder;
  const hasValue = Boolean(value);
  return {
    sizeValue,
    placeholder: hasValue ? undefined : resolvePlaceholder(placeholderSource)
  };
};
const toUnitPlaceholder = v => ({
  ...v,
  size: ''
});
const pickFirstValid = candidates => {
  const found = candidates.find(({
    candidate
  }) => validateSizeValue(candidate));
  return found ? found.resolve(found.candidate) : null;
};
const validateSizeValue = value => {
  if (!value || typeof value !== 'object') {
    return false;
  }
  const sizePropValue = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.sizePropTypeUtil.create(value);
  return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.sizePropTypeUtil.isValid(sizePropValue);
};
const resolvePlaceholder = placeholder => {
  if (typeof placeholder === 'string') {
    return placeholder;
  }
  const size = placeholder?.size;
  if (size === undefined) {
    return undefined;
  }
  return typeof size === 'number' ? size.toString() : size;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts":
/*!******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts ***!
  \******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EXTENDED_UNITS: function() { return /* binding */ EXTENDED_UNITS; },
/* harmony export */   createDefaultSizeValue: function() { return /* binding */ createDefaultSizeValue; },
/* harmony export */   resolveSizeOnUnitChange: function() { return /* binding */ resolveSizeOnUnitChange; },
/* harmony export */   resolveSizeValue: function() { return /* binding */ resolveSizeValue; }
/* harmony export */ });
/* harmony import */ var _is_extended_unit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-extended-unit */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts");

const DEFAULT_SIZE = '';
const EXTENDED_UNITS = {
  auto: 'auto',
  custom: 'custom'
};
const resolveSizeValue = (value, context) => {
  if (!value) {
    return value;
  }
  const {
    units,
    defaultUnit
  } = context;
  const unit = resolveFallbackUnit(value.unit, units, defaultUnit);
  if (unit === EXTENDED_UNITS.auto) {
    return {
      size: DEFAULT_SIZE,
      unit
    };
  }
  if (unit === EXTENDED_UNITS.custom) {
    return {
      size: String(value.size ?? DEFAULT_SIZE),
      unit
    };
  }
  return {
    size: sanitizeSize(value.size) ?? DEFAULT_SIZE,
    unit
  };
};
const resolveSizeOnUnitChange = (size, unit) => {
  return (0,_is_extended_unit__WEBPACK_IMPORTED_MODULE_0__.isExtendedUnit)(unit) ? DEFAULT_SIZE : size;
};
const createDefaultSizeValue = (units, defaultUnit) => {
  let [unit] = units;
  if (defaultUnit !== undefined) {
    unit = resolveFallbackUnit(defaultUnit, units);
  }
  return {
    size: DEFAULT_SIZE,
    unit
  };
};
const resolveFallbackUnit = (unit, units, defaultUnit) => {
  if (units.includes(unit)) {
    return unit;
  }
  if (defaultUnit && units.includes(defaultUnit)) {
    return defaultUnit;
  }
  return units[0] ?? '';
};
const sanitizeSize = size => {
  if (typeof size === 'number' && isNaN(size)) {
    return DEFAULT_SIZE;
  }
  return size;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-default-unit.ts":
/*!*************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-default-unit.ts ***!
  \*************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getDefaultUnit: function() { return /* binding */ getDefaultUnit; }
/* harmony export */ });
/* harmony import */ var _get_prop_type_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get-prop-type-settings */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts");

const getDefaultUnit = propType => {
  return (0,_get_prop_type_settings__WEBPACK_IMPORTED_MODULE_0__.getPropTypeSettings)(propType)?.default_unit;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts":
/*!*******************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts ***!
  \*******************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getPropTypeSettings: function() { return /* binding */ getPropTypeSettings; }
/* harmony export */ });
const getPropTypeSettings = propType => {
  return propType.settings;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-size-units.ts":
/*!***********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-size-units.ts ***!
  \***********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getSizeUnits: function() { return /* binding */ getSizeUnits; }
/* harmony export */ });
/* harmony import */ var _sync_get_units__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../sync/get-units */ "./packages/packages/libs/editor-controls/src/controls/size-control/sync/get-units.ts");
/* harmony import */ var _get_prop_type_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./get-prop-type-settings */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts");


const getVariantUnits = variant => {
  const map = {
    length: _sync_get_units__WEBPACK_IMPORTED_MODULE_0__.getLengthUnits,
    angle: _sync_get_units__WEBPACK_IMPORTED_MODULE_0__.getAngleUnits,
    time: _sync_get_units__WEBPACK_IMPORTED_MODULE_0__.getTimeUnits
  };
  return map[variant]();
};
const getSettingsUnits = propType => {
  return (0,_get_prop_type_settings__WEBPACK_IMPORTED_MODULE_1__.getPropTypeSettings)(propType)?.available_units;
};
const getSizeUnits = (propType, variant) => {
  return getSettingsUnits(propType) ?? getVariantUnits(variant);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/should-nullify-value.ts":
/*!********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/size-control/utils/should-nullify-value.ts ***!
  \********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   shouldNullifyValue: function() { return /* binding */ shouldNullifyValue; }
/* harmony export */ });
/* harmony import */ var _resolve_size_value__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./resolve-size-value */ "./packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts");

const conditions = [value => Boolean(value), value => value?.size === null || value?.size === undefined || value?.size === '', value => value?.unit !== _resolve_size_value__WEBPACK_IMPORTED_MODULE_0__.EXTENDED_UNITS.auto, value => value?.unit !== _resolve_size_value__WEBPACK_IMPORTED_MODULE_0__.EXTENDED_UNITS.custom];
const shouldNullifyValue = value => {
  return conditions.every(condition => condition(value));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/stroke-control.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/stroke-control.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   StrokeControl: function() { return /* binding */ StrokeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_section_content__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/section-content */ "./packages/packages/libs/editor-controls/src/components/section-content.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _color_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");











const units = ['px', 'em', 'rem'];
const StrokeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(() => {
  const propContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.strokePropTypeUtil);
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, propContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_section_content__WEBPACK_IMPORTED_MODULE_6__.SectionContent, {
    gap: 2
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "width",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Stroke width', 'elementor'),
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_9__.SizeControl, {
    units: units,
    anchorRef: rowRef
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Control, {
    bind: "color",
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Stroke color', 'elementor')
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_color_control__WEBPACK_IMPORTED_MODULE_8__.ColorControl, null))));
});
const Control = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(({
  bind,
  label,
  children
}, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: bind
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  container: true,
  gap: 2,
  alignItems: "center",
  flexWrap: "nowrap",
  ref: ref
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true,
  xs: 6
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
  item: true,
  xs: 6
}, children))));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/svg-media-control.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/svg-media-control.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SvgMediaControl: function() { return /* binding */ SvgMediaControl; },
/* harmony export */   TILES_GRADIENT_FORMULA: function() { return /* binding */ TILES_GRADIENT_FORMULA; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_current_user__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-current-user */ "@elementor/editor-current-user");
/* harmony import */ var _elementor_editor_current_user__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_current_user__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @elementor/wp-media */ "@elementor/wp-media");
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_elementor_wp_media__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_conditional_control_infotip__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/conditional-control-infotip */ "./packages/packages/libs/editor-controls/src/components/conditional-control-infotip.tsx");
/* harmony import */ var _components_enable_unfiltered_modal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/enable-unfiltered-modal */ "./packages/packages/libs/editor-controls/src/components/enable-unfiltered-modal.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../hooks/use-unfiltered-files-upload */ "./packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts");














const TILE_SIZE = 8;
const TILE_WHITE = 'transparent';
const TILE_BLACK = '#c1c1c1';
const TILES_GRADIENT_FORMULA = `linear-gradient(45deg, ${TILE_BLACK} 25%, ${TILE_WHITE} 0, ${TILE_WHITE} 75%, ${TILE_BLACK} 0, ${TILE_BLACK})`;
const StyledCard = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Card))`
	background-color: white;
	background-image: ${TILES_GRADIENT_FORMULA}, ${TILES_GRADIENT_FORMULA};
	background-size: ${TILE_SIZE}px ${TILE_SIZE}px;
	background-position:
		0 0,
		${TILE_SIZE / 2}px ${TILE_SIZE / 2}px;
	border: none;
`;
const StyledCardMediaContainer = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.styled)((0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack))`
	position: relative;
	height: 140px;
	object-fit: contain;
	padding: 5px;
	justify-content: center;
	align-items: center;
	background-color: rgba( 255, 255, 255, 0.37 );
`;
const MODE_BROWSE = {
  mode: 'browse'
};
const MODE_UPLOAD = {
  mode: 'upload'
};
const SvgMediaControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_11__.createControl)(() => {
  const {
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_7__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.svgSrcPropTypeUtil);
  const id = value?.id;
  const url = value?.url;
  const {
    data: attachment,
    isFetching
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_5__.useWpMediaAttachment)(id?.value || null);
  const src = attachment?.url ?? url?.value ?? null;
  const {
    data: allowSvgUpload
  } = (0,_hooks_use_unfiltered_files_upload__WEBPACK_IMPORTED_MODULE_12__.useUnfilteredFilesUpload)();
  const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const {
    isAdmin
  } = (0,_elementor_editor_current_user__WEBPACK_IMPORTED_MODULE_1__.useCurrentUserCapabilities)();
  const {
    open
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_5__.useWpMediaFrame)({
    mediaTypes: ['svg'],
    multiple: false,
    selected: id?.value || null,
    onSelect: selectedAttachment => {
      setValue({
        id: {
          $$type: 'image-attachment-id',
          value: selectedAttachment.id
        },
        url: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_2__.urlPropTypeUtil.create(selectedAttachment.url)
      });
    }
  });
  const onCloseUnfilteredModal = enabled => {
    setUnfilteredModalOpenState(false);
    if (enabled) {
      open(MODE_UPLOAD);
    }
  };
  const handleClick = openOptions => {
    if (!allowSvgUpload && openOptions === MODE_UPLOAD) {
      setUnfilteredModalOpenState(true);
    } else {
      open(openOptions);
    }
  };
  const infotipProps = {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Sorry, you can't upload that file yet.", 'elementor'),
    description: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('To upload them anyway, ask the site administrator to enable unfiltered', 'elementor'), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("br", null), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('file uploads.', 'elementor')),
    isEnabled: !isAdmin
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    gap: 1,
    "aria-label": "SVG Control"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_enable_unfiltered_modal__WEBPACK_IMPORTED_MODULE_9__.EnableUnfilteredModal, {
    open: unfilteredModalOpenState,
    onClose: onCloseUnfilteredModal
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_10__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledCard, {
    variant: "outlined"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(StyledCardMediaContainer, null, isFetching ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.CircularProgress, {
    role: "progressbar"
  }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.CardMedia, {
    component: "img",
    image: src,
    alt: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('Preview SVG', 'elementor'),
    sx: {
      maxHeight: '140px',
      width: '50px'
    }
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.CardOverlay, {
    sx: {
      '&:hover': {
        backgroundColor: 'rgba( 0, 0, 0, 0.75 )'
      }
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Stack, {
    gap: 1
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Button, {
    size: "tiny",
    color: "inherit",
    variant: "outlined",
    onClick: () => handleClick(MODE_BROWSE),
    "aria-label": "Select SVG"
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('Select SVG', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_conditional_control_infotip__WEBPACK_IMPORTED_MODULE_8__.ConditionalControlInfotip, infotipProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.ThemeProvider, {
    colorScheme: isAdmin ? 'light' : 'dark'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Button, {
    size: "tiny",
    variant: "text",
    color: "inherit",
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.UploadIcon, null),
    disabled: !isAdmin,
    onClick: () => isAdmin && handleClick(MODE_UPLOAD),
    "aria-label": "Upload SVG"
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('Upload', 'elementor'))))))))));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/switch-control.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/switch-control.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   SwitchControl: function() { return /* binding */ SwitchControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context_use_bound_prop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context/use-bound-prop */ "./packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");





const SwitchControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(() => {
  const {
    value,
    setValue,
    disabled,
    placeholder
  } = (0,_bound_prop_context_use_bound_prop__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.booleanPropTypeUtil);
  const handleChange = event => {
    setValue(event.target.checked);
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, {
    sx: {
      display: 'flex',
      justifyContent: 'flex-end'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Switch, {
    checked: !!(value || placeholder),
    onChange: handleChange,
    size: "small",
    disabled: disabled,
    inputProps: {
      ...(disabled ? {
        style: {
          opacity: 0
        }
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/text-area-control.tsx":
/*!***********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/text-area-control.tsx ***!
  \***********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TextAreaControl: function() { return /* binding */ TextAreaControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");






const TextAreaControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  placeholder: propPlaceholder,
  ariaLabel
}) => {
  const {
    value,
    setValue,
    disabled,
    placeholder: boundPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const handleChange = event => {
    setValue(event.target.value);
  };
  const placeholder = propPlaceholder ?? boundPlaceholder ?? undefined;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, {
    size: "tiny",
    multiline: true,
    fullWidth: true,
    minRows: 5,
    disabled: disabled,
    value: value ?? '',
    onChange: handleChange,
    placeholder: placeholder,
    inputProps: {
      ...(ariaLabel ? {
        'aria-label': ariaLabel
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/text-control.tsx":
/*!******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/text-control.tsx ***!
  \******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TextControl: function() { return /* binding */ TextControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");






const TextControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  placeholder: propPlaceholder,
  error,
  inputValue,
  inputDisabled,
  helperText,
  sx,
  ariaLabel
}) => {
  const {
    value,
    setValue,
    disabled,
    placeholder: boundPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const handleChange = event => setValue(event.target.value);
  const placeholder = propPlaceholder ?? boundPlaceholder ?? undefined;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, {
    size: "tiny",
    fullWidth: true,
    disabled: inputDisabled ?? disabled,
    value: inputValue ?? value ?? '',
    onChange: handleChange,
    placeholder: placeholder,
    error: error,
    helperText: helperText,
    sx: sx,
    inputProps: {
      ...(ariaLabel ? {
        'aria-label': ariaLabel
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/time-range-control.tsx":
/*!************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/time-range-control.tsx ***!
  \************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TimeRangeControl: function() { return /* binding */ TimeRangeControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _time_string_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./time-string-control */ "./packages/packages/libs/editor-controls/src/controls/time-string-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }








const RANGE_LABELS = {
  min: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Start time', 'elementor'),
  max: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('End time', 'elementor')
};
const TimeRangeControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_6__.createControl)(() => {
  const {
    value,
    setValue,
    ...propContext
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.timeRangePropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, _extends({}, propContext, {
    value: value,
    setValue: setValue
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "row",
    gap: 2,
    flexWrap: "nowrap"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, RANGE_LABELS.min)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BoundTimeStringControl, {
    bind: 'min',
    ariaLabel: RANGE_LABELS.min
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    container: true,
    gap: 0.75,
    alignItems: "center"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, RANGE_LABELS.max)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(BoundTimeStringControl, {
    bind: 'max',
    ariaLabel: RANGE_LABELS.max
  })))));
});
const BoundTimeStringControl = ({
  bind,
  ariaLabel
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_time_string_control__WEBPACK_IMPORTED_MODULE_7__.TimeStringControl, {
    ariaLabel: ariaLabel,
    coerceInvalidToNull: true
  }));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/time-string-control.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/time-string-control.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TimeStringControl: function() { return /* binding */ TimeStringControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _utils_date_time__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/date-time */ "./packages/packages/libs/editor-controls/src/utils/date-time.ts");







const TimeStringControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  inputDisabled,
  ariaLabel,
  error,
  coerceInvalidToNull = false
}) => {
  const {
    value,
    setValue,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.timeStringPropTypeUtil);
  const isDisabled = inputDisabled ?? disabled;
  const slotProps = {
    textField: {
      size: 'tiny',
      fullWidth: true,
      error,
      inputProps: ariaLabel ? {
        'aria-label': ariaLabel
      } : undefined
    },
    openPickerButton: {
      size: 'tiny'
    },
    openPickerIcon: {
      fontSize: 'tiny'
    }
  };
  const handleChange = (newValue, format) => {
    if (!newValue) {
      setValue(null);
      return;
    }
    if (coerceInvalidToNull && !(0,_utils_date_time__WEBPACK_IMPORTED_MODULE_6__.isValidDayjs)(newValue)) {
      setValue(null);
      return;
    }
    setValue(newValue.format(format));
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.LocalizationProvider, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TimePicker, {
    value: (0,_utils_date_time__WEBPACK_IMPORTED_MODULE_6__.parseTimeString)(value ?? ''),
    onChange: newValue => handleChange(newValue, _utils_date_time__WEBPACK_IMPORTED_MODULE_6__.TIME_FORMAT),
    disabled: isDisabled,
    slotProps: slotProps
  })));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/toggle-control.tsx":
/*!********************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/toggle-control.tsx ***!
  \********************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ToggleControl: function() { return /* binding */ ToggleControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _utils_convert_toggle_options_to_atomic__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/convert-toggle-options-to-atomic */ "./packages/packages/libs/editor-controls/src/utils/convert-toggle-options-to-atomic.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }






const ToggleControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_4__.createControl)(({
  options,
  fullWidth = false,
  size = 'tiny',
  exclusive = true,
  maxItems,
  convertOptions = false
}) => {
  const {
    value,
    setValue,
    placeholder,
    disabled
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil);
  const processedOptions = convertOptions ? (0,_utils_convert_toggle_options_to_atomic__WEBPACK_IMPORTED_MODULE_5__.convertToggleOptionsToAtomic)(options) : options;
  const exclusiveValues = processedOptions.filter(option => option.exclusive).map(option => option.value);
  const handleNonExclusiveToggle = selectedValues => {
    const newSelectedValue = selectedValues[selectedValues.length - 1];
    const isNewSelectedValueExclusive = exclusiveValues.includes(newSelectedValue);
    const updatedValues = isNewSelectedValueExclusive ? [newSelectedValue] : selectedValues?.filter(val => !exclusiveValues.includes(val));
    setValue(updatedValues?.join(' ') || null);
  };
  const toggleButtonGroupProps = {
    items: processedOptions,
    maxItems,
    fullWidth,
    size,
    placeholder
  };
  return exclusive ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_3__.ControlToggleButtonGroup, _extends({}, toggleButtonGroupProps, {
    value: value ?? null,
    onChange: setValue,
    disabled: disabled,
    exclusive: true
  })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_3__.ControlToggleButtonGroup, _extends({}, toggleButtonGroupProps, {
    value: value?.split(' ') ?? [],
    onChange: handleNonExclusiveToggle,
    disabled: disabled,
    exclusive: false
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx":
/*!******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx ***!
  \******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AxisRow: function() { return /* binding */ AxisRow; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");






const AxisRow = ({
  label,
  bind,
  startIcon,
  anchorRef,
  units,
  variant = 'angle'
}) => {
  const safeId = label.replace(/\s+/g, '-').toLowerCase();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_4__.PopoverGridContainer, {
    ref: anchorRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_3__.ControlLabel, {
    htmlFor: safeId
  }, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_5__.SizeControl, {
    anchorRef: anchorRef,
    startIcon: startIcon,
    units: units,
    variant: variant,
    min: -Number.MAX_SAFE_INTEGER,
    id: safeId
  })))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/move.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/move.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Move: function() { return /* binding */ Move; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _axis_row__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./axis-row */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const moveAxisControls = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Move X', 'elementor'),
  bind: 'x',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowRightIcon, {
    fontSize: 'tiny'
  }),
  units: ['px', '%', 'em', 'rem', 'vw']
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Move Y', 'elementor'),
  bind: 'y',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownSmallIcon, {
    fontSize: 'tiny'
  }),
  units: ['px', '%', 'em', 'rem', 'vh']
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Move Z', 'elementor'),
  bind: 'z',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownLeftIcon, {
    fontSize: 'tiny'
  }),
  units: ['px', '%', 'em', 'rem', 'vw', 'vh']
}];
const Move = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.moveTransformPropTypeUtil);
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: _initial_values__WEBPACK_IMPORTED_MODULE_6__.TransformFunctionKeys.move
  }, moveAxisControls.map((control, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_axis_row__WEBPACK_IMPORTED_MODULE_7__.AxisRow, _extends({
    key: control.bind
  }, control, {
    anchorRef: rowRefs[index],
    units: control.units,
    variant: "length"
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/rotate.tsx":
/*!****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/rotate.tsx ***!
  \****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Rotate: function() { return /* binding */ Rotate; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _axis_row__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./axis-row */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const rotateAxisControls = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Rotate X', 'elementor'),
  bind: 'x',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.Arrow360Icon, {
    fontSize: 'tiny'
  })
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Rotate Y', 'elementor'),
  bind: 'y',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.Arrow360Icon, {
    fontSize: "tiny",
    style: {
      transform: 'scaleX(-1) rotate(-90deg)'
    }
  })
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Rotate Z', 'elementor'),
  bind: 'z',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.RotateClockwiseIcon, {
    fontSize: 'tiny'
  })
}];
const rotateUnits = ['deg', 'rad', 'grad', 'turn'];
const Rotate = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.rotateTransformPropTypeUtil);
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: _initial_values__WEBPACK_IMPORTED_MODULE_6__.TransformFunctionKeys.rotate
  }, rotateAxisControls.map((control, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_axis_row__WEBPACK_IMPORTED_MODULE_7__.AxisRow, _extends({
    key: control.bind
  }, control, {
    anchorRef: rowRefs[index],
    units: rotateUnits
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale-axis-row.tsx":
/*!************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale-axis-row.tsx ***!
  \************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ScaleAxisRow: function() { return /* binding */ ScaleAxisRow; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_label__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../components/control-label */ "./packages/packages/libs/editor-controls/src/components/control-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _number_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../number-control */ "./packages/packages/libs/editor-controls/src/controls/number-control.tsx");






const ScaleAxisRow = ({
  label,
  bind,
  startIcon,
  anchorRef
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 12
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_4__.PopoverGridContainer, {
    ref: anchorRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_label__WEBPACK_IMPORTED_MODULE_3__.ControlLabel, null, label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_2__.PropKeyProvider, {
    bind: bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_number_control__WEBPACK_IMPORTED_MODULE_5__.NumberControl, {
    step: 0.1,
    placeholder: "1",
    startIcon: startIcon
  })))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale.tsx":
/*!***************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale.tsx ***!
  \***************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Scale: function() { return /* binding */ Scale; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _scale_axis_row__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./scale-axis-row */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale-axis-row.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const scaleAxisControls = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Scale X', 'elementor'),
  bind: 'x',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowRightIcon, {
    fontSize: 'tiny'
  })
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Scale Y', 'elementor'),
  bind: 'y',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownSmallIcon, {
    fontSize: 'tiny'
  })
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Scale Z', 'elementor'),
  bind: 'z',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowDownLeftIcon, {
    fontSize: 'tiny'
  })
}];
const Scale = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.scaleTransformPropTypeUtil);
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: _initial_values__WEBPACK_IMPORTED_MODULE_6__.TransformFunctionKeys.scale
  }, scaleAxisControls.map((control, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_scale_axis_row__WEBPACK_IMPORTED_MODULE_7__.ScaleAxisRow, _extends({
    key: control.bind
  }, control, {
    anchorRef: rowRefs[index]
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/skew.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/functions/skew.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Skew: function() { return /* binding */ Skew; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _axis_row__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./axis-row */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const skewAxisControls = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Skew X', 'elementor'),
  bind: 'x',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowRightIcon, {
    fontSize: 'tiny'
  })
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Skew Y', 'elementor'),
  bind: 'y',
  startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.ArrowLeftIcon, {
    fontSize: "tiny",
    style: {
      transform: 'scaleX(-1) rotate(-90deg)'
    }
  })
}];
const skewUnits = ['deg', 'rad', 'grad', 'turn'];
const Skew = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.skewTransformPropTypeUtil);
  const rowRefs = [(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null), (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null)];
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Grid, {
    container: true,
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: _initial_values__WEBPACK_IMPORTED_MODULE_6__.TransformFunctionKeys.skew
  }, skewAxisControls.map((control, index) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_axis_row__WEBPACK_IMPORTED_MODULE_7__.AxisRow, _extends({
    key: control.bind
  }, control, {
    anchorRef: rowRefs[index],
    units: skewUnits
  }))))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts":
/*!*************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts ***!
  \*************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformFunctionKeys: function() { return /* binding */ TransformFunctionKeys; },
/* harmony export */   defaultValues: function() { return /* binding */ defaultValues; },
/* harmony export */   initialRotateValue: function() { return /* binding */ initialRotateValue; },
/* harmony export */   initialScaleValue: function() { return /* binding */ initialScaleValue; },
/* harmony export */   initialSkewValue: function() { return /* binding */ initialSkewValue; },
/* harmony export */   initialTransformValue: function() { return /* binding */ initialTransformValue; }
/* harmony export */ });
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__);

const TransformFunctionKeys = {
  move: 'transform-move',
  scale: 'transform-scale',
  rotate: 'transform-rotate',
  skew: 'transform-skew'
};
const defaultValues = {
  move: {
    size: 0,
    unit: 'px'
  },
  scale: 1,
  rotate: {
    size: 0,
    unit: 'deg'
  },
  skew: {
    size: 0,
    unit: 'deg'
  }
};
const initialTransformValue = {
  $$type: TransformFunctionKeys.move,
  value: {
    x: {
      $$type: 'size',
      value: {
        size: defaultValues.move.size,
        unit: defaultValues.move.unit
      }
    },
    y: {
      $$type: 'size',
      value: {
        size: defaultValues.move.size,
        unit: defaultValues.move.unit
      }
    },
    z: {
      $$type: 'size',
      value: {
        size: defaultValues.move.size,
        unit: defaultValues.move.unit
      }
    }
  }
};
const initialScaleValue = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.scaleTransformPropTypeUtil.create({
  x: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.numberPropTypeUtil.create(defaultValues.scale),
  y: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.numberPropTypeUtil.create(defaultValues.scale),
  z: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.numberPropTypeUtil.create(defaultValues.scale)
});
const initialRotateValue = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.rotateTransformPropTypeUtil.create({
  x: {
    $$type: 'size',
    value: {
      size: defaultValues.rotate.size,
      unit: defaultValues.rotate.unit
    }
  },
  y: {
    $$type: 'size',
    value: {
      size: defaultValues.rotate.size,
      unit: defaultValues.rotate.unit
    }
  },
  z: {
    $$type: 'size',
    value: {
      size: defaultValues.rotate.size,
      unit: defaultValues.rotate.unit
    }
  }
});
const initialSkewValue = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_0__.skewTransformPropTypeUtil.create({
  x: {
    $$type: 'size',
    value: {
      size: defaultValues.skew.size,
      unit: defaultValues.skew.unit
    }
  },
  y: {
    $$type: 'size',
    value: {
      size: defaultValues.skew.size,
      unit: defaultValues.skew.unit
    }
  }
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx":
/*!****************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx ***!
  \****************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ChildrenPerspectiveControl: function() { return /* binding */ ChildrenPerspectiveControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");









const ORIGIN_UNITS = ['px', '%', 'em', 'rem'];
const PERSPECTIVE_CONTROL_FIELD = {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Perspective', 'elementor'),
  bind: 'perspective',
  units: ['px', 'em', 'rem', 'vw', 'vh']
};
const CHILDREN_PERSPECTIVE_FIELDS = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Origin X', 'elementor'),
  bind: 'x',
  units: ORIGIN_UNITS
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Origin Y', 'elementor'),
  bind: 'y',
  units: ORIGIN_UNITS
}];
const ChildrenPerspectiveControl = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "column",
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Children perspective', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PerspectiveControl, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PerspectiveOriginControl, null));
};
const PerspectiveControl = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: 'perspective'
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ControlFields, {
  control: PERSPECTIVE_CONTROL_FIELD,
  key: PERSPECTIVE_CONTROL_FIELD.bind
}));
const PerspectiveOriginControl = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
  bind: 'perspective-origin'
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(PerspectiveOriginControlProvider, null));
const PerspectiveOriginControlProvider = () => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.perspectiveOriginPropTypeUtil);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, context, CHILDREN_PERSPECTIVE_FIELDS.map(control => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: control.bind,
    key: control.bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ControlFields, {
    control: control
  }))));
};
const ControlFields = ({
  control
}) => {
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__.PopoverGridContainer, {
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, control.label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_7__.SizeControl, {
    variant: "length",
    units: control.units,
    anchorRef: rowRef,
    disableCustom: true
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx":
/*!************************************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx ***!
  \************************************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformOriginControl: function() { return /* binding */ TransformOriginControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");









const TRANSFORM_ORIGIN_UNITS = ['px', '%', 'em', 'rem'];
const TRANSFORM_ORIGIN_UNITS_Z_AXIS = TRANSFORM_ORIGIN_UNITS.filter(unit => unit !== '%');
const TRANSFORM_ORIGIN_FIELDS = [{
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Origin X', 'elementor'),
  bind: 'x',
  units: TRANSFORM_ORIGIN_UNITS
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Origin Y', 'elementor'),
  bind: 'y',
  units: TRANSFORM_ORIGIN_UNITS
}, {
  label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Origin Z', 'elementor'),
  bind: 'z',
  units: TRANSFORM_ORIGIN_UNITS_Z_AXIS
}];
const TransformOriginControl = () => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, {
    direction: "column",
    spacing: 1.5
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__.__)('Transform', 'elementor')), TRANSFORM_ORIGIN_FIELDS.map(control => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ControlFields, {
    control: control,
    key: control.bind
  })));
};
const ControlFields = ({
  control
}) => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.transformOriginPropTypeUtil);
  const rowRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_4__.PropKeyProvider, {
    bind: control.bind
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_grid_container__WEBPACK_IMPORTED_MODULE_6__.PopoverGridContainer, {
    ref: rowRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_form_label__WEBPACK_IMPORTED_MODULE_5__.ControlFormLabel, null, control.label)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Grid, {
    item: true,
    xs: 6
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_size_control__WEBPACK_IMPORTED_MODULE_7__.SizeControl, {
    variant: "length",
    units: control.units,
    anchorRef: rowRef
  })))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-content.tsx":
/*!*****************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-content.tsx ***!
  \*****************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformContent: function() { return /* binding */ TransformContent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _functions_move__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./functions/move */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/move.tsx");
/* harmony import */ var _functions_rotate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./functions/rotate */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/rotate.tsx");
/* harmony import */ var _functions_scale__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./functions/scale */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale.tsx");
/* harmony import */ var _functions_skew__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./functions/skew */ "./packages/packages/libs/editor-controls/src/controls/transform-control/functions/skew.tsx");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _use_transform_tabs_history__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./use-transform-tabs-history */ "./packages/packages/libs/editor-controls/src/controls/transform-control/use-transform-tabs-history.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }










const TransformContent = () => {
  const {
    getTabsProps,
    getTabProps,
    getTabPanelProps
  } = (0,_use_transform_tabs_history__WEBPACK_IMPORTED_MODULE_9__.useTransformTabsHistory)({
    move: _initial_values__WEBPACK_IMPORTED_MODULE_8__.initialTransformValue.value,
    scale: _initial_values__WEBPACK_IMPORTED_MODULE_8__.initialScaleValue.value,
    rotate: _initial_values__WEBPACK_IMPORTED_MODULE_8__.initialRotateValue.value,
    skew: _initial_values__WEBPACK_IMPORTED_MODULE_8__.initialSkewValue.value
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_3__.PopoverContent, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    sx: {
      width: '100%'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    sx: {
      borderBottom: 1,
      borderColor: 'divider'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tabs, _extends({
    size: "small",
    variant: "fullWidth",
    sx: {
      '& .MuiTab-root': {
        minWidth: '62px'
      }
    }
  }, getTabsProps(), {
    "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Transform', 'elementor')
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Move', 'elementor')
  }, getTabProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.move))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Scale', 'elementor')
  }, getTabProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.scale))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Rotate', 'elementor')
  }, getTabProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.rotate))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Tab, _extends({
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Skew', 'elementor')
  }, getTabProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.skew))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.move)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_functions_move__WEBPACK_IMPORTED_MODULE_4__.Move, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.scale)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_functions_scale__WEBPACK_IMPORTED_MODULE_6__.Scale, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.rotate)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_functions_rotate__WEBPACK_IMPORTED_MODULE_5__.Rotate, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.TabPanel, _extends({
    sx: {
      p: 1.5
    }
  }, getTabPanelProps(_initial_values__WEBPACK_IMPORTED_MODULE_8__.TransformFunctionKeys.skew)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_functions_skew__WEBPACK_IMPORTED_MODULE_7__.Skew, null))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-icon.tsx":
/*!**************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-icon.tsx ***!
  \**************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformIcon: function() { return /* binding */ TransformIcon; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");



const TransformIcon = ({
  value
}) => {
  switch (value.$$type) {
    case _initial_values__WEBPACK_IMPORTED_MODULE_2__.TransformFunctionKeys.move:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.ArrowsMaximizeIcon, {
        fontSize: "tiny"
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_2__.TransformFunctionKeys.scale:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.ArrowAutofitHeightIcon, {
        fontSize: "tiny"
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_2__.TransformFunctionKeys.rotate:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.RotateClockwise2Icon, {
        fontSize: "tiny"
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_2__.TransformFunctionKeys.skew:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__.SkewXIcon, {
        fontSize: "tiny"
      });
    default:
      return null;
  }
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-label.tsx":
/*!***************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-label.tsx ***!
  \***************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformLabel: function() { return /* binding */ TransformLabel; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _size_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");





const orderedAxis = ['x', 'y', 'z'];
const formatLabel = (value, functionType) => {
  return orderedAxis.map(axisKey => {
    const axis = value[axisKey];
    if (functionType === 'scale') {
      return axis?.value || _initial_values__WEBPACK_IMPORTED_MODULE_4__.defaultValues[functionType];
    }
    const defaults = _initial_values__WEBPACK_IMPORTED_MODULE_4__.defaultValues[functionType];
    const size = axis?.value?.size ?? defaults.size;
    const unit = axis?.value?.unit ?? defaults.unit;
    return unit === 'custom' ? size || _size_control__WEBPACK_IMPORTED_MODULE_3__.CUSTOM_SIZE_LABEL : `${size}${unit}`;
  }).join(', ');
};
const TransformLabel = props => {
  const {
    $$type,
    value
  } = props.value;
  switch ($$type) {
    case _initial_values__WEBPACK_IMPORTED_MODULE_4__.TransformFunctionKeys.move:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, {
        label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Move', 'elementor'),
        value: formatLabel(value, 'move')
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_4__.TransformFunctionKeys.scale:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, {
        label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Scale', 'elementor'),
        value: formatLabel(value, 'scale')
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_4__.TransformFunctionKeys.rotate:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, {
        label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Rotate', 'elementor'),
        value: formatLabel(value, 'rotate')
      });
    case _initial_values__WEBPACK_IMPORTED_MODULE_4__.TransformFunctionKeys.skew:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Label, {
        label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Skew', 'elementor'),
        value: formatLabel(value, 'skew')
      });
    default:
      return '';
  }
};
const Label = ({
  label,
  value
}) => {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.Box, {
    component: "span"
  }, label, ": ", value);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-repeater-control.tsx":
/*!**************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-repeater-control.tsx ***!
  \**************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformRepeaterControl: function() { return /* binding */ TransformRepeaterControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/control-repeater */ "./packages/packages/libs/editor-controls/src/components/control-repeater/index.ts");
/* harmony import */ var _components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/control-repeater/actions/disable-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx");
/* harmony import */ var _components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../components/control-repeater/actions/remove-item-action */ "./packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx");
/* harmony import */ var _components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../components/control-repeater/items/edit-item-popover */ "./packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx");
/* harmony import */ var _components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../components/repeater/repeater-header */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx");
/* harmony import */ var _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../control-adornments/control-adornments */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");
/* harmony import */ var _transform_content__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./transform-content */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-content.tsx");
/* harmony import */ var _transform_icon__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./transform-icon */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-icon.tsx");
/* harmony import */ var _transform_label__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./transform-label */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-label.tsx");
/* harmony import */ var _transform_settings_control__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./transform-settings-control */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-settings-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }



















const SIZE = 'tiny';
const TransformRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_12__.createControl)(({
  showChildrenPerspective
}) => {
  const context = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.transformPropTypeUtil);
  const headerRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.usePopupState)({
    variant: 'popover'
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, context, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_transform_settings_control__WEBPACK_IMPORTED_MODULE_17__.TransformSettingsControl, {
    popupState: popupState,
    anchorRef: headerRef,
    showChildrenPerspective: showChildrenPerspective
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'transform-functions'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Repeater, {
    headerRef: headerRef,
    propType: context.propType,
    popupState: popupState
  })));
});
const ToolTip = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
  component: "span",
  "aria-label": undefined,
  sx: {
    display: 'flex',
    gap: 0.5,
    p: 2,
    width: 320,
    borderRadius: 1
  }
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.InfoCircleFilledIcon, {
  sx: {
    color: 'secondary.main'
  }
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Typography, {
  variant: "body2",
  color: "text.secondary",
  fontSize: "14px"
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('You can use each kind of transform only once per element.', 'elementor')));
const Repeater = ({
  headerRef,
  propType,
  popupState
}) => {
  const transformFunctionsContext = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.transformFunctionsPropTypeUtil);
  const availableValues = [_initial_values__WEBPACK_IMPORTED_MODULE_13__.initialTransformValue, _initial_values__WEBPACK_IMPORTED_MODULE_13__.initialScaleValue, _initial_values__WEBPACK_IMPORTED_MODULE_13__.initialRotateValue, _initial_values__WEBPACK_IMPORTED_MODULE_13__.initialSkewValue];
  const {
    value: transformValues,
    bind
  } = transformFunctionsContext;
  const getInitialValue = () => {
    return availableValues.find(value => !transformValues?.some(item => item.$$type === value.$$type));
  };
  const shouldDisableAddItem = !getInitialValue();
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropProvider, transformFunctionsContext, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.ControlRepeater, {
    initial: getInitialValue() ?? _initial_values__WEBPACK_IMPORTED_MODULE_13__.initialTransformValue,
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.transformFunctionsPropTypeUtil
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_repeater_repeater_header__WEBPACK_IMPORTED_MODULE_10__.RepeaterHeader, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Transform', 'elementor'),
    adornment: () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_11__.ControlAdornments, {
      customContext: {
        path: ['transform'],
        propType
      }
    }),
    ref: headerRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(TransformBasePopoverTrigger, {
    popupState: popupState,
    repeaterBindKey: bind
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.TooltipAddItemAction, {
    disabled: shouldDisableAddItem,
    tooltipContent: ToolTip,
    enableTooltip: shouldDisableAddItem,
    ariaLabel: 'transform'
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.ItemsContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater__WEBPACK_IMPORTED_MODULE_6__.Item, {
    Icon: _transform_icon__WEBPACK_IMPORTED_MODULE_15__.TransformIcon,
    Label: _transform_label__WEBPACK_IMPORTED_MODULE_16__.TransformLabel,
    actions: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_disable_item_action__WEBPACK_IMPORTED_MODULE_7__.DisableItemAction, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_actions_remove_item_action__WEBPACK_IMPORTED_MODULE_8__.RemoveItemAction, null))
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_control_repeater_items_edit_item_popover__WEBPACK_IMPORTED_MODULE_9__.EditItemPopover, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_transform_content__WEBPACK_IMPORTED_MODULE_14__.TransformContent, null))));
};
const TransformBasePopoverTrigger = ({
  popupState,
  repeaterBindKey
}) => {
  const {
    bind
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.useBoundProp)();
  const titleLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Transform settings', 'elementor');
  return bind !== repeaterBindKey ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Tooltip, {
    title: titleLabel,
    placement: "top"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.IconButton, _extends({
    size: SIZE,
    "aria-label": titleLabel
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindTrigger)(popupState)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.AdjustmentsIcon, {
    fontSize: SIZE
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-settings-control.tsx":
/*!**************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/transform-settings-control.tsx ***!
  \**************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransformSettingsControl: function() { return /* binding */ TransformSettingsControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _transform_base_controls_children_perspective_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transform-base-controls/children-perspective-control */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx");
/* harmony import */ var _transform_base_controls_transform_origin_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./transform-base-controls/transform-origin-control */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }









const SIZE = 'tiny';
const TransformSettingsControl = ({
  popupState,
  anchorRef,
  showChildrenPerspective
}) => {
  const popupProps = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.bindPopover)({
    ...popupState,
    anchorEl: anchorRef.current ?? undefined
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Popover, _extends({
    disablePortal: true,
    anchorOrigin: {
      vertical: 'bottom',
      horizontal: 'left'
    },
    slotProps: {
      paper: {
        sx: {
          width: (anchorRef.current?.offsetWidth || 0) - 6 + 'px',
          mt: 0.5
        }
      }
    }
  }, popupProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_1__.PopoverHeader, {
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__.__)('Transform settings', 'elementor'),
    onClose: popupState.close,
    icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.AdjustmentsIcon, {
      fontSize: SIZE
    })
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_popover_content__WEBPACK_IMPORTED_MODULE_6__.PopoverContent, {
    sx: {
      px: 2,
      py: 1.5
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_bound_prop_context__WEBPACK_IMPORTED_MODULE_5__.PropKeyProvider, {
    bind: 'transform-origin'
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_transform_base_controls_transform_origin_control__WEBPACK_IMPORTED_MODULE_8__.TransformOriginControl, null)), showChildrenPerspective && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
    sx: {
      my: 0.5
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Divider, null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_transform_base_controls_children_perspective_control__WEBPACK_IMPORTED_MODULE_7__.ChildrenPerspectiveControl, null))));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transform-control/use-transform-tabs-history.tsx":
/*!**************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transform-control/use-transform-tabs-history.tsx ***!
  \**************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useTransformTabsHistory: function() { return /* binding */ useTransformTabsHistory; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../components/control-repeater/context/repeater-context */ "./packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx");
/* harmony import */ var _initial_values__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./initial-values */ "./packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts");






const useTransformTabsHistory = ({
  move: initialMove,
  scale: initialScale,
  rotate: initialRotate,
  skew: initialSkew
}) => {
  const {
    value: moveValue,
    setValue: setMoveValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.moveTransformPropTypeUtil);
  const {
    value: scaleValue,
    setValue: setScaleValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.scaleTransformPropTypeUtil);
  const {
    value: rotateValue,
    setValue: setRotateValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.rotateTransformPropTypeUtil);
  const {
    value: skewValue,
    setValue: setSkewValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.skewTransformPropTypeUtil);
  const {
    openItemIndex,
    items
  } = (0,_components_control_repeater_context_repeater_context__WEBPACK_IMPORTED_MODULE_4__.useRepeaterContext)();
  const getCurrentTransformType = () => {
    switch (true) {
      case !!scaleValue:
        return _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.scale;
      case !!rotateValue:
        return _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.rotate;
      case !!skewValue:
        return _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.skew;
      default:
        return _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.move;
    }
  };
  const {
    getTabsProps,
    getTabProps,
    getTabPanelProps
  } = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.useTabs)(getCurrentTransformType());
  const valuesHistory = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
    move: initialMove,
    scale: initialScale,
    rotate: initialRotate,
    skew: initialSkew
  });
  const saveToHistory = (key, value) => {
    if (value) {
      valuesHistory.current[key] = value;
    }
  };
  const onTabChange = (e, tabName) => {
    switch (tabName) {
      case _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.move:
        setMoveValue(valuesHistory.current.move);
        saveToHistory('scale', scaleValue);
        saveToHistory('rotate', rotateValue);
        saveToHistory('skew', skewValue);
        break;
      case _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.scale:
        setScaleValue(valuesHistory.current.scale);
        saveToHistory('move', moveValue);
        saveToHistory('rotate', rotateValue);
        saveToHistory('skew', skewValue);
        break;
      case _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.rotate:
        setRotateValue(valuesHistory.current.rotate);
        saveToHistory('move', moveValue);
        saveToHistory('scale', scaleValue);
        saveToHistory('skew', skewValue);
        break;
      case _initial_values__WEBPACK_IMPORTED_MODULE_5__.TransformFunctionKeys.skew:
        setSkewValue(valuesHistory.current.skew);
        saveToHistory('move', moveValue);
        saveToHistory('scale', scaleValue);
        saveToHistory('rotate', rotateValue);
        break;
    }
    return getTabsProps().onChange(e, tabName);
  };
  const isTabDisabled = tabKey => {
    return !!items.find(({
      item: {
        $$type: key
      }
    }, pos) => tabKey === key && pos !== openItemIndex);
  };
  return {
    getTabProps: value => ({
      ...getTabProps(value),
      disabled: isTabDisabled(value)
    }),
    getTabPanelProps,
    getTabsProps: () => ({
      ...getTabsProps(),
      onChange: onTabChange
    })
  };
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transition-control/data.ts":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transition-control/data.ts ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   initialTransitionValue: function() { return /* binding */ initialTransitionValue; },
/* harmony export */   transitionProperties: function() { return /* binding */ transitionProperties; },
/* harmony export */   transitionsItemsList: function() { return /* binding */ transitionsItemsList; }
/* harmony export */ });
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);


const initialTransitionValue = {
  selection: {
    $$type: 'key-value',
    value: {
      key: {
        value: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('All properties', 'elementor'),
        $$type: 'string'
      },
      value: {
        value: 'all',
        $$type: 'string'
      }
    }
  },
  size: {
    $$type: 'size',
    value: {
      size: 200,
      unit: 'ms'
    }
  }
};
const MIN_PRO_VERSION = '3.35';
const getIsSiteRtl = () => {
  return !!window.elementorFrontend?.config?.is_rtl;
};

// TODO: Remove this after version 4.01 is released
const shouldShowAllTransitionProperties = () => {
  if (!(0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.hasProInstalled)()) {
    return true;
  }
  const proVersion = window.elementorPro?.config?.version;
  if (!proVersion) {
    return false;
  }
  return (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_0__.isVersionGreaterOrEqual)(proVersion, MIN_PRO_VERSION);
};
const createTransitionPropertiesList = () => {
  const isSiteRtl = getIsSiteRtl();
  const baseProperties = [{
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Default', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('All properties', 'elementor'),
      value: 'all'
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin (all)', 'elementor'),
      value: 'margin',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin bottom', 'elementor'),
      value: 'margin-block-end',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin right', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin left', 'elementor'),
      value: 'margin-inline-start',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin left', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin right', 'elementor'),
      value: 'margin-inline-end',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Margin top', 'elementor'),
      value: 'margin-block-start',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding (all)', 'elementor'),
      value: 'padding',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding bottom', 'elementor'),
      value: 'padding-block-end',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding right', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding left', 'elementor'),
      value: 'padding-inline-start',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding left', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding right', 'elementor'),
      value: 'padding-inline-end',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Padding top', 'elementor'),
      value: 'padding-block-start',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Flex', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Flex (all)', 'elementor'),
      value: 'flex',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Flex grow', 'elementor'),
      value: 'flex-grow',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Flex shrink', 'elementor'),
      value: 'flex-shrink',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Flex basis', 'elementor'),
      value: 'flex-basis',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Size', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Width', 'elementor'),
      value: 'width',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Height', 'elementor'),
      value: 'height',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Max height', 'elementor'),
      value: 'max-height',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Max width', 'elementor'),
      value: 'max-width',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Min height', 'elementor'),
      value: 'min-height',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Min width', 'elementor'),
      value: 'min-width',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Position', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Top', 'elementor'),
      value: 'inset-block-start',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Right', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Left', 'elementor'),
      value: 'inset-inline-start',
      isDisabled: true
    }, {
      label: isSiteRtl ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Left', 'elementor') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Right', 'elementor'),
      value: 'inset-inline-end',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Bottom', 'elementor'),
      value: 'inset-block-end',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Z-index', 'elementor'),
      value: 'z-index',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Typography', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Font color', 'elementor'),
      value: 'color',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Font size', 'elementor'),
      value: 'font-size',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Line height', 'elementor'),
      value: 'line-height',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Letter spacing', 'elementor'),
      value: 'letter-spacing',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Word spacing', 'elementor'),
      value: 'word-spacing',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Font variations', 'elementor'),
      value: 'font-variation-settings',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Text stroke color', 'elementor'),
      value: '-webkit-text-stroke-color',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Background', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Background color', 'elementor'),
      value: 'background-color',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Background position', 'elementor'),
      value: 'background-position',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Box shadow', 'elementor'),
      value: 'box-shadow',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Border', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Border (all)', 'elementor'),
      value: 'border',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Border radius', 'elementor'),
      value: 'border-radius',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Border color', 'elementor'),
      value: 'border-color',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Border width', 'elementor'),
      value: 'border-width',
      isDisabled: true
    }]
  }, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Effects', 'elementor'),
    type: 'category',
    properties: [{
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Opacity', 'elementor'),
      value: 'opacity',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Transform (all)', 'elementor'),
      value: 'transform',
      isDisabled: true
    }, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Filter (all)', 'elementor'),
      value: 'filter',
      isDisabled: true
    }]
  }];
  return shouldShowAllTransitionProperties() ? baseProperties : [baseProperties[0]];
};
const transitionProperties = createTransitionPropertiesList();
const transitionsItemsList = transitionProperties.map(category => ({
  label: category.label,
  items: category.properties.map(property => property.label)
}));

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transition-control/trainsition-events.ts":
/*!******************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transition-control/trainsition-events.ts ***!
  \******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   subscribeToTransitionEvent: function() { return /* binding */ subscribeToTransitionEvent; }
/* harmony export */ });
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/events */ "@elementor/events");
/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_events__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _services_event_bus__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../services/event-bus */ "./packages/packages/libs/editor-controls/src/services/event-bus.ts");



const transitionRepeaterMixpanelEvent = {
  eventName: 'click_added_transition',
  location: 'V4 Style Tab',
  secondaryLocation: 'Transition control',
  trigger: 'click'
};
function subscribeToTransitionEvent() {
  _services_event_bus__WEBPACK_IMPORTED_MODULE_2__.eventBus.subscribe('transition-item-added', data => {
    const payload = data;
    const value = payload?.itemValue?.selection?.value?.value?.value;
    const selectedElements = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getSelectedElements)();
    const widgetType = selectedElements[0]?.type ?? null;
    (0,_elementor_events__WEBPACK_IMPORTED_MODULE_1__.trackEvent)({
      transition_type: value ?? 'unknown',
      ...transitionRepeaterMixpanelEvent,
      widget_type: widgetType
    });
  });
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transition-control/transition-repeater-control.tsx":
/*!****************************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transition-control/transition-repeater-control.tsx ***!
  \****************************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransitionRepeaterControl: function() { return /* binding */ TransitionRepeaterControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _repeatable_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../repeatable-control */ "./packages/packages/libs/editor-controls/src/controls/repeatable-control.tsx");
/* harmony import */ var _selection_size_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../selection-size-control */ "./packages/packages/libs/editor-controls/src/controls/selection-size-control.tsx");
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./data */ "./packages/packages/libs/editor-controls/src/controls/transition-control/data.ts");
/* harmony import */ var _trainsition_events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./trainsition-events */ "./packages/packages/libs/editor-controls/src/controls/transition-control/trainsition-events.ts");
/* harmony import */ var _transition_selector__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transition-selector */ "./packages/packages/libs/editor-controls/src/controls/transition-control/transition-selector.tsx");














const DURATION_CONFIG = {
  variant: 'time',
  units: ['s', 'ms'],
  defaultUnit: 'ms'
};
const childArrayPropTypeUtil = (0,_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.createArrayPropUtils)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.selectionSizePropTypeUtil.key, _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.selectionSizePropTypeUtil.schema, 'transition');
(0,_trainsition_events__WEBPACK_IMPORTED_MODULE_11__.subscribeToTransitionEvent)();
const areAllPropertiesUsed = (value = []) => {
  return value?.length ? _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties.every(category => {
    return category.properties.every(property => {
      return property.isDisabled || !!value?.find(item => {
        return item.value?.selection?.value?.value?.value === property.value;
      });
    });
  }) : false;
};

// this config needs to be loaded at runtime/render since it's the transitionProperties object will be mutated by the pro plugin.
// See: https://elementor.atlassian.net/browse/ED-20285
const getSelectionSizeProps = (recentlyUsedList, disabledItems, showPromotion) => {
  return {
    selectionLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Type', 'elementor'),
    sizeLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Duration', 'elementor'),
    selectionConfig: {
      component: _transition_selector__WEBPACK_IMPORTED_MODULE_12__.TransitionSelector,
      props: {
        recentlyUsedList,
        disabledItems,
        showPromotion
      }
    },
    sizeConfigMap: {
      ..._data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties.reduce((acc, category) => {
        category.properties.forEach(property => {
          acc[property.value] = DURATION_CONFIG;
        });
        return acc;
      }, {})
    }
  };
};
const isItemDisabled = item => {
  const property = (0,_transition_selector__WEBPACK_IMPORTED_MODULE_12__.getTransitionPropertyByValue)(item.value.selection.value?.value);
  return !property ? false : !!property.isDisabled;
};
const getChildControlConfig = (recentlyUsedList, disabledItems, showPromotion) => {
  return {
    propTypeUtil: _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.selectionSizePropTypeUtil,
    component: _selection_size_control__WEBPACK_IMPORTED_MODULE_9__.SelectionSizeControl,
    props: getSelectionSizeProps(recentlyUsedList, disabledItems, showPromotion),
    isItemDisabled: isItemDisabled
  };
};
const isPropertyUsed = (value, property) => {
  return (value ?? []).some(item => {
    return item?.value?.selection?.value?.value?.value === property.value;
  });
};
const getDisabledItemLabels = (values = []) => {
  const selectedLabels = (values || []).map(item => item.value?.selection?.value?.key?.value);
  const proDisabledLabels = [];
  _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties.forEach(category => {
    const disabledProperties = category.properties.filter(property => property.isDisabled && !selectedLabels.includes(property.label)).map(property => property.label);
    proDisabledLabels.push(...disabledProperties);
  });
  return {
    allDisabled: [...selectedLabels, ...proDisabledLabels],
    proDisabled: proDisabledLabels
  };
};
const getInitialValue = (values = []) => {
  if (!values?.length) {
    return _data__WEBPACK_IMPORTED_MODULE_10__.initialTransitionValue;
  }
  for (const category of _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties) {
    for (const property of category.properties) {
      if (isPropertyUsed(values, property)) {
        continue;
      }
      return {
        ..._data__WEBPACK_IMPORTED_MODULE_10__.initialTransitionValue,
        selection: {
          $$type: 'key-value',
          value: {
            key: {
              value: property.label,
              $$type: 'string'
            },
            value: {
              value: property.value,
              $$type: 'string'
            }
          }
        }
      };
    }
  }
  return _data__WEBPACK_IMPORTED_MODULE_10__.initialTransitionValue;
};
const disableAddItemTooltipContent = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Alert, {
  sx: {
    width: 280,
    gap: 0.5
  },
  color: "secondary",
  icon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.InfoCircleFilledIcon, null)
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.AlertTitle, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Transitions', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Box, {
  component: "span"
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Typography, {
  variant: "body2"
}, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)("Switch to 'Normal' state to add a transition.", 'elementor'))));
const TransitionRepeaterControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_7__.createControl)(({
  recentlyUsedListGetter,
  currentStyleState
}) => {
  const currentStyleIsNormal = currentStyleState === null;
  const [recentlyUsedList, setRecentlyUsedList] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);
  const proInstalled = (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_4__.hasProInstalled)();
  const {
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(childArrayPropTypeUtil);
  const {
    allDisabled: disabledItems,
    proDisabled: proDisabledItems
  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => getDisabledItemLabels(value), [value]);
  const allowedTransitionSet = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    const set = new Set();
    _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties.forEach(category => {
      category.properties.forEach(prop => {
        if (!prop.isDisabled || proInstalled) {
          set.add(prop.value);
        }
      });
    });
    return set;
  }, [proInstalled]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (!value || value.length === 0) {
      return;
    }
    const sanitized = value.filter(item => {
      const selectionValue = item?.value?.selection?.value?.value?.value ?? '';
      return allowedTransitionSet.has(selectionValue);
    });
    if (sanitized.length !== value.length) {
      setValue(sanitized);
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [allowedTransitionSet]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    recentlyUsedListGetter().then(setRecentlyUsedList);
  }, [recentlyUsedListGetter]);
  const allPropertiesUsed = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => areAllPropertiesUsed(value), [value]);
  const isAddItemDisabled = !currentStyleIsNormal || allPropertiesUsed;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_repeatable_control__WEBPACK_IMPORTED_MODULE_8__.RepeatableControl, {
    label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Transitions', 'elementor'),
    repeaterLabel: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Transitions', 'elementor'),
    patternLabel: "${value.selection.value.key.value}: ${value.size.value.size}${value.size.value.unit}",
    placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Empty Transition', 'elementor'),
    showDuplicate: false,
    showToggle: true,
    initialValues: getInitialValue(value),
    childControlConfig: getChildControlConfig(recentlyUsedList, disabledItems, proDisabledItems.length > 0),
    propKey: "transition",
    addItemTooltipProps: {
      disabled: isAddItemDisabled,
      enableTooltip: !currentStyleIsNormal,
      tooltipContent: disableAddItemTooltipContent
    }
  });
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/transition-control/transition-selector.tsx":
/*!********************************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/transition-control/transition-selector.tsx ***!
  \********************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   TransitionSelector: function() { return /* binding */ TransitionSelector; },
/* harmony export */   getTransitionPropertyByValue: function() { return /* binding */ getTransitionPropertyByValue; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-ui */ "@elementor/editor-ui");
/* harmony import */ var _elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _components_item_selector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../components/item-selector */ "./packages/packages/libs/editor-controls/src/components/item-selector.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _utils_tracking__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils/tracking */ "./packages/packages/libs/editor-controls/src/utils/tracking.ts");
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./data */ "./packages/packages/libs/editor-controls/src/controls/transition-control/data.ts");
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }












const toTransitionSelectorValue = label => {
  for (const category of _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties) {
    const property = category.properties.find(prop => prop.label === label);
    if (property) {
      return {
        key: {
          value: property.label,
          $$type: 'string'
        },
        value: {
          value: property.value,
          $$type: 'string'
        }
      };
    }
  }
  return null;
};
function getTransitionPropertyByValue(item) {
  if (!item?.value) {
    return null;
  }
  for (const category of _data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties) {
    for (const property of category.properties) {
      if (property.value === item.value) {
        return property;
      }
    }
  }
  return null;
}
const includeCurrentValueInOptions = (value, disabledItems) => {
  return disabledItems.filter(item => {
    return item !== value.key.value;
  });
};
const PRO_UPGRADE_URL = 'https://go.elementor.com/go-pro-transitions-modal/';
const TransitionSelector = ({
  recentlyUsedList = [],
  disabledItems = [],
  showPromotion = false
}) => {
  const {
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.keyValuePropTypeUtil);
  const {
    key: {
      value: transitionLabel
    }
  } = value;
  const defaultRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const popoverState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.usePopupState)({
    variant: 'popover'
  });
  const disabledCategories = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    return new Set(_data__WEBPACK_IMPORTED_MODULE_10__.transitionProperties.filter(cat => cat.properties.some(prop => prop.isDisabled)).map(cat => cat.label));
  }, []);
  const getItemList = () => {
    const recentItems = recentlyUsedList.map(item => getTransitionPropertyByValue({
      value: item,
      $$type: 'string'
    })?.label).filter(item => !!item);
    const filteredItems = _data__WEBPACK_IMPORTED_MODULE_10__.transitionsItemsList.map(category => {
      return {
        ...category,
        items: category.items.filter(item => !recentItems.includes(item))
      };
    });
    if (recentItems.length === 0) {
      return filteredItems;
    }
    const [first, ...rest] = filteredItems;
    return [first, {
      label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Recently Used', 'elementor'),
      items: recentItems
    }, ...rest];
  };
  const handleTransitionPropertyChange = newLabel => {
    const newValue = toTransitionSelectorValue(newLabel);
    if (!newValue) {
      return;
    }
    setValue(newValue);
    popoverState.close();
  };
  const getAnchorPosition = () => {
    if (!defaultRef.current) {
      return undefined;
    }
    const rect = defaultRef.current.getBoundingClientRect();
    return {
      top: rect.top,
      left: rect.right + 36
    };
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Box, {
    ref: defaultRef
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_8__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.UnstableTag, _extends({
    variant: "outlined",
    label: transitionLabel,
    endIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_3__.ChevronDownIcon, {
      fontSize: "tiny"
    })
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.bindTrigger)(popoverState), {
    fullWidth: true
  }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Popover, _extends({
    disablePortal: true,
    disableScrollLock: true
  }, (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.bindPopover)(popoverState), {
    anchorReference: "anchorPosition",
    anchorPosition: getAnchorPosition(),
    anchorOrigin: {
      vertical: 'top',
      horizontal: 'right'
    },
    transformOrigin: {
      vertical: 'top',
      horizontal: 'left'
    }
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components_item_selector__WEBPACK_IMPORTED_MODULE_7__.ItemSelector, {
    itemsList: getItemList(),
    selectedItem: transitionLabel,
    onItemChange: handleTransitionPropertyChange,
    onClose: popoverState.close,
    sectionWidth: 268,
    title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Transition Property', 'elementor'),
    icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_3__.VariationsIcon,
    disabledItems: includeCurrentValueInOptions(value, disabledItems),
    categoryItemContentTemplate: item => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_4__.Box, {
      sx: {
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'space-between',
        width: '100%'
      }
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, item.value), showPromotion && disabledCategories.has(item.value) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.PromotionChip, null)),
    footer: showPromotion ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_editor_ui__WEBPACK_IMPORTED_MODULE_2__.PromotionAlert, {
      message: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Upgrade to customize transition properties and control effects.', 'elementor'),
      upgradeUrl: PRO_UPGRADE_URL,
      onCtaClick: () => (0,_utils_tracking__WEBPACK_IMPORTED_MODULE_9__.trackUpgradePromotionClick)({
        target_name: 'transition_property',
        location_l2: 'style'
      })
    }) : null
  })));
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/url-control.tsx":
/*!*****************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/url-control.tsx ***!
  \*****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UrlControl: function() { return /* binding */ UrlControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");






const UrlControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_5__.createControl)(({
  placeholder: propPlaceholder,
  ariaLabel
}) => {
  const {
    value,
    setValue,
    disabled,
    placeholder: boundPlaceholder
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_3__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.urlPropTypeUtil);
  const handleChange = event => setValue(event.target.value);
  const placeholder = propPlaceholder ?? boundPlaceholder ?? undefined;
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_4__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, {
    size: "tiny",
    fullWidth: true,
    value: value ?? '',
    disabled: disabled,
    onChange: handleChange,
    placeholder: placeholder,
    inputProps: {
      ...(ariaLabel ? {
        'aria-label': ariaLabel
      } : {})
    }
  }));
});

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/controls/video-media-control.tsx":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/controls/video-media-control.tsx ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   VideoMediaControl: function() { return /* binding */ VideoMediaControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @elementor/wp-media */ "@elementor/wp-media");
/* harmony import */ var _elementor_wp_media__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _svg_media_control__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./svg-media-control */ "./packages/packages/libs/editor-controls/src/controls/svg-media-control.tsx");










const PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + '/shapes/play-triangle.svg';
const VideoMediaControl = (0,_create_control__WEBPACK_IMPORTED_MODULE_8__.createControl)(() => {
  const {
    value,
    setValue
  } = (0,_bound_prop_context__WEBPACK_IMPORTED_MODULE_6__.useBoundProp)(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.videoSrcPropTypeUtil);
  const {
    id,
    url
  } = value ?? {};
  const {
    data: attachment,
    isFetching
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__.useWpMediaAttachment)(id?.value || null);
  const videoUrl = attachment?.url ?? url?.value ?? null;
  const {
    open
  } = (0,_elementor_wp_media__WEBPACK_IMPORTED_MODULE_4__.useWpMediaFrame)({
    mediaTypes: ['video'],
    multiple: false,
    selected: id?.value || null,
    onSelect: selectedAttachment => {
      setValue({
        id: {
          $$type: 'video-attachment-id',
          value: selectedAttachment.id
        },
        url: null
      });
    }
  });
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_control_actions_control_actions__WEBPACK_IMPORTED_MODULE_7__["default"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Card, {
    variant: "outlined"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CardMedia, {
    sx: {
      height: 140,
      backgroundColor: 'white',
      backgroundSize: '8px 8px',
      backgroundPosition: '0 0, 4px 4px',
      backgroundRepeat: 'repeat',
      backgroundImage: `${_svg_media_control__WEBPACK_IMPORTED_MODULE_9__.TILES_GRADIENT_FORMULA}, ${_svg_media_control__WEBPACK_IMPORTED_MODULE_9__.TILES_GRADIENT_FORMULA}`,
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center'
    }
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(VideoPreview, {
    isFetching: isFetching,
    videoUrl: videoUrl
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CardOverlay, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Stack, {
    gap: 1
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
    size: "tiny",
    color: "inherit",
    variant: "outlined",
    onClick: () => open({
      mode: 'browse'
    })
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Select video', 'elementor')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.Button, {
    size: "tiny",
    variant: "text",
    color: "inherit",
    startIcon: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_2__.UploadIcon, null),
    onClick: () => open({
      mode: 'upload'
    })
  }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_5__.__)('Upload', 'elementor'))))));
});
const VideoPreview = ({
  isFetching = false,
  videoUrl
}) => {
  if (isFetching) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_3__.CircularProgress, null);
  }
  if (videoUrl) {
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("video", {
      src: videoUrl,
      muted: true,
      preload: "metadata",
      style: {
        width: '100%',
        height: '100%',
        objectFit: 'cover',
        pointerEvents: 'none'
      }
    });
  }
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", {
    src: PLACEHOLDER_IMAGE,
    alt: "No video selected"
  });
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/create-control.tsx":
/*!***********************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/create-control.tsx ***!
  \***********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   createControl: function() { return /* binding */ createControl; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _control_replacements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./control-replacements */ "./packages/packages/libs/editor-controls/src/control-replacements.tsx");




// eslint-disable-next-line @typescript-eslint/no-explicit-any

const brandSymbol = Symbol('control');
function createControl(Control) {
  return props => {
    const {
      ControlToRender,
      OriginalControl,
      isReplaced
    } = (0,_control_replacements__WEBPACK_IMPORTED_MODULE_2__.useControlReplacement)(Control);
    const controlProps = isReplaced ? {
      ...props,
      OriginalControl
    } : props;
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_1__.ErrorBoundary, {
      fallback: null
    }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ControlToRender, controlProps));
  };
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/env.ts":
/*!***********************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/env.ts ***!
  \***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   env: function() { return /* binding */ env; }
/* harmony export */ });
/* harmony import */ var _elementor_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/env */ "@elementor/env");
/* harmony import */ var _elementor_env__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_env__WEBPACK_IMPORTED_MODULE_0__);

const {
  env
} = (0,_elementor_env__WEBPACK_IMPORTED_MODULE_0__.parseEnv)('@elementor/editor-controls');

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-filtered-items-list.ts":
/*!*************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-filtered-items-list.ts ***!
  \*************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useFilteredItemsList: function() { return /* binding */ useFilteredItemsList; }
/* harmony export */ });
const useFilteredItemsList = (itemsList, searchValue, disabledItems) => {
  return itemsList.reduce((acc, category) => {
    const filteredItems = category.items.filter(item => item.toLowerCase().includes(searchValue.toLowerCase()));
    if (filteredItems.length) {
      acc.push({
        type: 'category',
        value: category.label
      });
      filteredItems.forEach(item => {
        acc.push({
          type: 'item',
          value: item,
          disabled: disabledItems?.includes(item) ?? false
        });
      });
    }
    return acc;
  }, []);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-font-families.ts":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-font-families.ts ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useFontFamilies: function() { return /* binding */ useFontFamilies; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters");
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__);


const getFontControlConfig = () => {
  const {
    controls
  } = (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.getElementorConfig)();
  return controls?.font ?? {};
};
const useFontFamilies = () => {
  const {
    groups,
    options
  } = getFontControlConfig();
  return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    if (!groups || !options) {
      return [];
    }
    const groupKeys = Object.keys(groups);
    const groupIndexMap = new Map(groupKeys.map((key, index) => [key, index]));
    return Object.entries(options).reduce((acc, [font, category]) => {
      const groupIndex = groupIndexMap.get(category);
      if (groupIndex === undefined) {
        return acc;
      }
      if (!acc[groupIndex]) {
        acc[groupIndex] = {
          label: groups[category],
          fonts: []
        };
      }
      acc[groupIndex].fonts.push(font);
      return acc;
    }, []).filter(Boolean);
  }, [groups, options]);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-form-field-suggestions.ts":
/*!****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-form-field-suggestions.ts ***!
  \****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useFormFieldSuggestions: function() { return /* binding */ useFormFieldSuggestions; }
/* harmony export */ });
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters");
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__);



const FORM_FIELD_WIDGET_TYPES = ['e-form-input', 'e-form-textarea', 'e-form-checkbox', 'e-form-radio-button', 'e-form-select', 'e-form-date-picker', 'e-form-time-picker'];
const FORM_ELEMENT_TYPE = 'e-form';
const CSS_ID_PROP_KEY = '_cssid';
function isFormFieldWidgetType(widgetType) {
  return FORM_FIELD_WIDGET_TYPES.includes(widgetType);
}
function extractStringPropValue(value) {
  return _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(value);
}
function getSettingWithDefault(child, widgetType, key) {
  const fromGet = child.settings.get(key);
  if (fromGet !== null && fromGet !== undefined) {
    return fromGet;
  }
  const schema = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getWidgetsCache)()?.[widgetType]?.atomic_props_schema;
  return schema?.[key]?.default ?? null;
}
function getFieldCssId(child, widgetType) {
  return extractStringPropValue(getSettingWithDefault(child, widgetType, CSS_ID_PROP_KEY));
}
function getFormContainer(elementId) {
  let container = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getContainer)(elementId);
  while (container) {
    if (container.model.get('elType') === FORM_ELEMENT_TYPE) {
      return container;
    }
    container = container.parent ?? null;
  }
  return null;
}
function useFormFieldSuggestions(options) {
  return (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.__privateUseListenTo)([(0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.v1ReadyEvent)(), (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.commandEndEvent)('document/elements/create'), (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.commandEndEvent)('document/elements/delete'), (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_2__.commandEndEvent)('document/elements/set-settings')], () => {
    const selectedElements = (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getSelectedElements)();
    const selectedElement = selectedElements[0];
    if (!selectedElement) {
      return [];
    }
    const formContainer = getFormContainer(selectedElement.id);
    if (!formContainer?.children) {
      return [];
    }
    const suggestions = [];
    const seenCssIds = new Set();
    formContainer.children.forEachRecursive?.(child => {
      const widgetType = child.model.get('widgetType');
      if (!widgetType || !isFormFieldWidgetType(widgetType)) {
        return;
      }
      if (options?.inputType) {
        const typeValue = extractStringPropValue(getSettingWithDefault(child, widgetType, 'type'));
        if (typeValue !== options.inputType) {
          return;
        }
      }
      const cssId = getFieldCssId(child, widgetType);
      if (!cssId || seenCssIds.has(cssId)) {
        return;
      }
      seenCssIds.add(cssId);
      suggestions.push({
        label: cssId,
        value: cssId
      });
    });
    return suggestions;
  }, []);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-query-autocomplete.ts":
/*!************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-query-autocomplete.ts ***!
  \************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   extractFlatOptionFromQueryValue: function() { return /* binding */ extractFlatOptionFromQueryValue; },
/* harmony export */   useQueryAutocomplete: function() { return /* binding */ useQueryAutocomplete; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-props */ "@elementor/editor-props");
/* harmony import */ var _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _elementor_http_client__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/http-client */ "@elementor/http-client");
/* harmony import */ var _elementor_http_client__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_elementor_http_client__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/utils */ "@elementor/utils");
/* harmony import */ var _elementor_utils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_elementor_utils__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_autocomplete__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/autocomplete */ "./packages/packages/libs/editor-controls/src/components/autocomplete.tsx");





function useQueryAutocomplete({
  url,
  params = {},
  minInputLength = 2,
  initialQueryValue = null,
  excludeIds
}) {
  const excludeIdSet = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => new Set((excludeIds ?? []).map(String)), [excludeIds]);
  const [options, setOptions] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(generateFirstLoadedOption(initialQueryValue));
  const debounceFetch = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => (0,_elementor_utils__WEBPACK_IMPORTED_MODULE_3__.debounce)(queryParams => fetchOptions(url, queryParams).then(newOptions => {
    setOptions(formatOptions(filterExcludedOptions(newOptions, excludeIdSet)));
  }), 400), [url, excludeIdSet]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (minInputLength === 0 && url) {
      fetchOptions(url, {
        ...params,
        term: ''
      }).then(newOptions => {
        setOptions(formatOptions(filterExcludedOptions(newOptions, excludeIdSet)));
      });
    }
  }, [url, minInputLength, excludeIdSet, params]);
  const updateOptions = term => {
    const termStr = term ?? '';
    if (!url || termStr.length < minInputLength) {
      return;
    }
    debounceFetch({
      ...params,
      term: termStr
    });
  };
  return {
    options,
    updateOptions
  };
}
async function fetchOptions(ajaxUrl, params) {
  if (!params || !ajaxUrl) {
    return [];
  }
  try {
    const {
      data: response
    } = await (0,_elementor_http_client__WEBPACK_IMPORTED_MODULE_2__.httpService)().get(ajaxUrl, {
      params
    });
    return response.data.value;
  } catch {
    return [];
  }
}
function formatOptions(options) {
  const compareKey = (0,_components_autocomplete__WEBPACK_IMPORTED_MODULE_4__.isCategorizedOptionPool)(options) ? 'groupLabel' : 'label';
  return options.sort((a, b) => a[compareKey] && b[compareKey] ? a[compareKey].localeCompare(b[compareKey]) : 0);
}
function filterExcludedOptions(options, excludeIdSet) {
  if (excludeIdSet.size === 0) {
    return options;
  }
  return options.filter(option => !excludeIdSet.has(String(option.id)));
}
function extractFlatOptionFromQueryValue(queryValue) {
  const id = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.numberPropTypeUtil.extract(queryValue?.id);
  const label = _elementor_editor_props__WEBPACK_IMPORTED_MODULE_1__.stringPropTypeUtil.extract(queryValue?.label);
  if (id === null) {
    return null;
  }
  return {
    id: String(id),
    label: label || String(id)
  };
}
function generateFirstLoadedOption(queryValue) {
  const option = extractFlatOptionFromQueryValue(queryValue);
  return option ? [option] : [];
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-repeatable-control-context.ts":
/*!********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-repeatable-control-context.ts ***!
  \********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   RepeatableControlContext: function() { return /* binding */ RepeatableControlContext; },
/* harmony export */   useRepeatableControlContext: function() { return /* binding */ useRepeatableControlContext; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

const RepeatableControlContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined);
const useRepeatableControlContext = () => {
  const context = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(RepeatableControlContext);
  if (!context) {
    throw new Error('useRepeatableControlContext must be used within RepeatableControl');
  }
  return context;
};


/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-repeater-popover-dismiss.ts":
/*!******************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-repeater-popover-dismiss.ts ***!
  \******************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   usePopoverDismiss: function() { return /* binding */ usePopoverDismiss; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-responsive */ "@elementor/editor-responsive");
/* harmony import */ var _elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__);


const serializeBreakpoints = breakpoints => breakpoints.map(b => [b.id, b.width ?? '', b.type ?? ''].join(':')).join('|');
const usePopoverDismiss = ({
  isOpen,
  onClose
}) => {
  const onCloseRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onClose);
  onCloseRef.current = onClose;
  const activeBreakpoint = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__.useActiveBreakpoint)();
  const breakpoints = (0,_elementor_editor_responsive__WEBPACK_IMPORTED_MODULE_1__.useBreakpoints)();
  const breakpointsSignature = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => serializeBreakpoints(breakpoints), [breakpoints]);
  const prevActiveBreakpointRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(undefined);
  const prevBreakpointsSignatureRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (!isOpen) {
      prevActiveBreakpointRef.current = activeBreakpoint;
      prevBreakpointsSignatureRef.current = breakpointsSignature;
      return;
    }
    const previousBreakpoint = prevActiveBreakpointRef.current;
    const previousSignature = prevBreakpointsSignatureRef.current;
    const breakpointChanged = previousBreakpoint !== undefined && previousBreakpoint !== activeBreakpoint;
    const breakpointsChanged = previousSignature !== null && previousSignature !== breakpointsSignature;
    if (breakpointChanged || breakpointsChanged) {
      onCloseRef.current();
    }
    prevActiveBreakpointRef.current = activeBreakpoint;
    prevBreakpointsSignatureRef.current = breakpointsSignature;
  }, [activeBreakpoint, breakpointsSignature, isOpen]);
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    if (!isOpen) {
      return;
    }
    const onKeyDown = event => {
      if (event.key === 'Escape' && !event.defaultPrevented) {
        onCloseRef.current();
      }
    };
    document.addEventListener('keydown', onKeyDown);
    return () => {
      document.removeEventListener('keydown', onKeyDown);
    };
  }, [isOpen]);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-size-extended-options.ts":
/*!***************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-size-extended-options.ts ***!
  \***************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useSizeExtendedOptions: function() { return /* binding */ useSizeExtendedOptions; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

function useSizeExtendedOptions(options, disableCustom) {
  return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => {
    const extendedOptions = [...options];
    if (!disableCustom && !extendedOptions.includes('custom')) {
      extendedOptions.push('custom');
    } else if (options.includes('custom')) {
      extendedOptions.splice(extendedOptions.indexOf('custom'), 1);
    }
    return extendedOptions;
  }, [options, disableCustom]);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-size-value.ts":
/*!****************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-size-value.ts ***!
  \****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useSizeValue: function() { return /* binding */ useSizeValue; }
/* harmony export */ });
/* harmony import */ var _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../hooks/use-sync-external-state */ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx");

const DEFAULT_UNIT = 'px';
const DEFAULT_SIZE = '';
const useSizeValue = (externalValue, onChange, defaultUnit) => {
  const [sizeValue, setSizeValue] = (0,_hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalState)({
    external: externalValue,
    setExternal: newState => {
      if (newState !== null) {
        onChange(newState);
      }
    },
    persistWhen: newState => differsFromExternal(newState, externalValue),
    fallback: () => ({
      size: DEFAULT_SIZE,
      unit: defaultUnit ?? DEFAULT_UNIT
    })
  });
  const setSize = value => {
    const newState = {
      ...sizeValue,
      size: value.trim() === '' ? null : Number(value)
    };
    setSizeValue(newState);
  };
  const setUnit = unit => {
    const newState = {
      ...sizeValue,
      unit
    };
    setSizeValue(newState);
  };
  return {
    size: sizeValue.size,
    unit: sizeValue.unit,
    setSize,
    setUnit
  };
};
const differsFromExternal = (newState, externalState) => {
  return newState?.size !== externalState?.size || newState?.unit !== externalState?.unit;
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx":
/*!**************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx ***!
  \**************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useSyncExternalState: function() { return /* binding */ useSyncExternalState; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

const useSyncExternalState = ({
  external,
  setExternal,
  persistWhen,
  fallback
}) => {
  function toExternal(internalValue) {
    if (persistWhen(internalValue)) {
      return internalValue;
    }
    return null;
  }
  function toInternal(externalValue, internalValue) {
    if (!externalValue) {
      return fallback(internalValue);
    }
    return externalValue;
  }
  const [internal, setInternal] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(toInternal(external, null));
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    setInternal(prevInternal => toInternal(external, prevInternal));

    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [external]);
  const setInternalValue = (setter, options, meta) => {
    const setterFn = typeof setter === 'function' ? setter : () => setter;
    const updated = setterFn(internal);
    setInternal(updated);
    setExternal(toExternal(updated), options, meta);
  };
  return [internal, setInternalValue];
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts":
/*!*******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts ***!
  \*******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   useTypingBuffer: function() { return /* binding */ useTypingBuffer; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

function useTypingBuffer(options = {}) {
  const {
    limit = 3,
    timeout = 600
  } = options;
  const inputBufferRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)('');
  const timeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  const appendKey = key => {
    inputBufferRef.current = (inputBufferRef.current + key).slice(-limit);
    if (timeoutRef.current) {
      clearTimeout(timeoutRef.current);
    }
    timeoutRef.current = setTimeout(() => {
      inputBufferRef.current = '';
      timeoutRef.current = null;
    }, timeout);
    return inputBufferRef.current;
  };
  const startsWith = (haystack, needle) => {
    // At least 2 characters in needle for longer haystack.
    if (3 < haystack.length && 2 > needle.length) {
      return false;
    }
    return haystack.startsWith(needle);
  };
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
    return () => {
      inputBufferRef.current = '';
      if (timeoutRef.current) {
        clearTimeout(timeoutRef.current);
        timeoutRef.current = null;
      }
    };
  }, []);
  return {
    buffer: inputBufferRef.current,
    appendKey,
    startsWith
  };
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts":
/*!*****************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts ***!
  \*****************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   UNFILTERED_FILES_UPLOAD_KEY: function() { return /* binding */ UNFILTERED_FILES_UPLOAD_KEY; },
/* harmony export */   useUnfilteredFilesUpload: function() { return /* binding */ useUnfilteredFilesUpload; },
/* harmony export */   useUpdateUnfilteredFilesUpload: function() { return /* binding */ useUpdateUnfilteredFilesUpload; }
/* harmony export */ });
/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/query */ "@elementor/query");
/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_query__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api */ "./packages/packages/libs/editor-controls/src/api.ts");


const UNFILTERED_FILES_UPLOAD_KEY = 'elementor_unfiltered_files_upload';
const unfilteredFilesQueryKey = {
  queryKey: [UNFILTERED_FILES_UPLOAD_KEY]
};
const useUnfilteredFilesUpload = () => (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({
  ...unfilteredFilesQueryKey,
  queryFn: () => _api__WEBPACK_IMPORTED_MODULE_1__.apiClient.getElementorSetting(UNFILTERED_FILES_UPLOAD_KEY).then(res => {
    return formatResponse(res);
  }),
  staleTime: Infinity
});
function useUpdateUnfilteredFilesUpload() {
  const queryClient = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useQueryClient)();
  const mutate = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_0__.useMutation)({
    mutationFn: ({
      allowUnfilteredFilesUpload
    }) => _api__WEBPACK_IMPORTED_MODULE_1__.apiClient.updateElementorSetting(UNFILTERED_FILES_UPLOAD_KEY, allowUnfilteredFilesUpload ? '1' : '0'),
    onSuccess: () => queryClient.invalidateQueries(unfilteredFilesQueryKey)
  });
  return mutate;
}
const formatResponse = response => {
  return Boolean(response === '1');
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/services/event-bus.ts":
/*!**************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/services/event-bus.ts ***!
  \**************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   eventBus: function() { return /* binding */ eventBus; }
/* harmony export */ });
class EventBus {
  listeners = new Map();
  subscribe(eventName, callback) {
    if (!this.listeners.has(eventName)) {
      this.listeners.set(eventName, new Set());
    }
    const eventListeners = this.listeners.get(eventName);
    if (eventListeners) {
      eventListeners.add(callback);
    }
  }
  unsubscribe(eventName, callback) {
    const eventListeners = this.listeners.get(eventName);
    if (!eventListeners) {
      return;
    }
    eventListeners.delete(callback);
    if (eventListeners.size === 0) {
      this.listeners.delete(eventName);
    }
  }
  emit(eventName, data) {
    const eventListeners = this.listeners.get(eventName);
    if (eventListeners) {
      eventListeners.forEach(callback => callback(data));
    }
  }
  clearAll() {
    this.listeners.clear();
  }
}
const eventBus = new EventBus();

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/convert-toggle-options-to-atomic.tsx":
/*!***********************************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/convert-toggle-options-to-atomic.tsx ***!
  \***********************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   convertToggleOptionsToAtomic: function() { return /* binding */ convertToggleOptionsToAtomic; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_icons__WEBPACK_IMPORTED_MODULE_1__);


const convertToggleOptionsToAtomic = options => {
  return options.map(option => {
    const iconName = option.icon;
    const IconComponent = _elementor_icons__WEBPACK_IMPORTED_MODULE_1__[iconName];
    return {
      value: option.value,
      label: option.label,
      renderContent: ({
        size
      }) => {
        if (IconComponent) {
          return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(IconComponent, {
            fontSize: size
          });
        }
        return option.label;
      },
      showTooltip: option.showTooltip,
      exclusive: option.exclusive
    };
  });
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/date-time.ts":
/*!***********************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/date-time.ts ***!
  \***********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DATE_FORMAT: function() { return /* binding */ DATE_FORMAT; },
/* harmony export */   TIME_FORMAT: function() { return /* binding */ TIME_FORMAT; },
/* harmony export */   isValidDayjs: function() { return /* binding */ isValidDayjs; },
/* harmony export */   parseDateString: function() { return /* binding */ parseDateString; },
/* harmony export */   parseTimeString: function() { return /* binding */ parseTimeString; }
/* harmony export */ });
/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");
/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);

const DATE_FORMAT = 'YYYY-MM-DD';
const TIME_FORMAT = 'HH:mm';
function isValidDayjs(value) {
  return !!value && typeof value.isValid === 'function' && value.isValid();
}
function parseDateString(raw) {
  if (!raw) {
    return null;
  }
  const parsed = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(raw);
  return isValidDayjs(parsed) ? parsed : null;
}
function parseTimeString(raw) {
  if (!raw) {
    return null;
  }
  const [hours, minutes, seconds] = raw.split(':');
  const h = Number.parseInt(hours ?? '', 10);
  const m = Number.parseInt(minutes ?? '', 10);
  const s = Number.parseInt(seconds ?? '0', 10);
  if (Number.isNaN(h) || Number.isNaN(m)) {
    return null;
  }
  const base = dayjs__WEBPACK_IMPORTED_MODULE_0___default()();
  return base.hour(h).minute(m).second(Number.isNaN(s) ? 0 : s).millisecond(0);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/escape-html-attr.ts":
/*!******************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/escape-html-attr.ts ***!
  \******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   escapeHtmlAttr: function() { return /* binding */ escapeHtmlAttr; }
/* harmony export */ });
const escapeHtmlAttr = value => {
  const specialChars = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    "'": '&#39;',
    '"': '&quot;'
  };
  return value.replace(/[&<>'"]/g, char => specialChars[char] || char);
};

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/inline-editing.ts":
/*!****************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/inline-editing.ts ***!
  \****************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   htmlToPlainText: function() { return /* binding */ htmlToPlainText; },
/* harmony export */   isEmpty: function() { return /* binding */ isEmpty; }
/* harmony export */ });
function isEmpty(value = '') {
  if (!value) {
    return true;
  }
  const pseudoElement = document.createElement('div');
  pseudoElement.innerHTML = value;
  return !pseudoElement.textContent?.length;
}
function htmlToPlainText(html) {
  if (!html) {
    return '';
  }
  const normalizedHtml = html.replace(/<br\s*\/?>/gi, '\n').replace(/<\/p>\s*<p[^>]*>/gi, '\n');
  const doc = new DOMParser().parseFromString(normalizedHtml, 'text/html');
  return doc.body.textContent ?? '';
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/size-control.ts":
/*!**************************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/size-control.ts ***!
  \**************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DEFAULT_SIZE: function() { return /* binding */ DEFAULT_SIZE; },
/* harmony export */   DEFAULT_UNIT: function() { return /* binding */ DEFAULT_UNIT; },
/* harmony export */   angleUnits: function() { return /* binding */ angleUnits; },
/* harmony export */   isUnitExtendedOption: function() { return /* binding */ isUnitExtendedOption; },
/* harmony export */   lengthUnits: function() { return /* binding */ lengthUnits; },
/* harmony export */   timeUnits: function() { return /* binding */ timeUnits; }
/* harmony export */ });
const lengthUnits = ['px', '%', 'em', 'rem', 'vw', 'vh', 'ch'];
const angleUnits = ['deg', 'rad', 'grad', 'turn'];
const timeUnits = ['s', 'ms'];
const DEFAULT_UNIT = 'px';
const DEFAULT_SIZE = NaN;
const extendedOptions = ['auto', 'custom'];
function isUnitExtendedOption(unit) {
  return extendedOptions.includes(unit);
}

/***/ }),

/***/ "./packages/packages/libs/editor-controls/src/utils/tracking.ts":
/*!**********************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/utils/tracking.ts ***!
  \**********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   trackUpgradePromotionClick: function() { return /* binding */ trackUpgradePromotionClick; },
/* harmony export */   trackViewPromotion: function() { return /* binding */ trackViewPromotion; }
/* harmony export */ });
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/editor-elements */ "@elementor/editor-elements");
/* harmony import */ var _elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/events */ "@elementor/events");
/* harmony import */ var _elementor_events__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_elementor_events__WEBPACK_IMPORTED_MODULE_1__);


const getBaseEventProperties = (data, config) => ({
  app_type: config?.appTypes?.editor ?? 'editor',
  window_name: config?.appTypes?.editor ?? 'editor',
  interaction_type: config?.triggers?.click ?? 'Click',
  target_name: data.target_name,
  target_location: data.target_location ?? 'widget_panel',
  location_l1: data.location_l1 ?? (0,_elementor_editor_elements__WEBPACK_IMPORTED_MODULE_0__.getSelectedElements)()[0]?.type ?? '',
  ...(data.location_l2 && {
    location_l2: data.location_l2
  })
});
const dispatchPromotionEvent = (data, resolveOptions) => {
  const {
    dispatchEvent,
    config
  } = (0,_elementor_events__WEBPACK_IMPORTED_MODULE_1__.getMixpanel)();
  const {
    eventName,
    interactionResult,
    interactionDescription
  } = resolveOptions(config);
  if (!eventName) {
    return;
  }
  dispatchEvent?.(eventName, {
    ...getBaseEventProperties(data, config),
    interaction_result: interactionResult,
    interaction_description: interactionDescription
  });
};
const trackViewPromotion = data => {
  dispatchPromotionEvent(data, config => ({
    eventName: config?.names?.promotions?.viewPromotion,
    interactionResult: config?.interactionResults?.promotionViewed ?? 'promotion_viewed',
    interactionDescription: 'user_viewed_promotion'
  }));
};
const trackUpgradePromotionClick = data => {
  dispatchPromotionEvent(data, config => ({
    eventName: config?.names?.promotions?.upgradePromotionClick,
    interactionResult: config?.interactionResults?.upgradeNow ?? 'upgrade_now',
    interactionDescription: 'user_clicked_upgrade_now'
  }));
};

/***/ }),

/***/ "@elementor/editor-current-user":
/*!****************************************************!*\
  !*** external ["elementorV2","editorCurrentUser"] ***!
  \****************************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorCurrentUser"];

/***/ }),

/***/ "@elementor/editor-elements":
/*!*************************************************!*\
  !*** external ["elementorV2","editorElements"] ***!
  \*************************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorElements"];

/***/ }),

/***/ "@elementor/editor-props":
/*!**********************************************!*\
  !*** external ["elementorV2","editorProps"] ***!
  \**********************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorProps"];

/***/ }),

/***/ "@elementor/editor-responsive":
/*!***************************************************!*\
  !*** external ["elementorV2","editorResponsive"] ***!
  \***************************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorResponsive"];

/***/ }),

/***/ "@elementor/editor-ui":
/*!*******************************************!*\
  !*** external ["elementorV2","editorUi"] ***!
  \*******************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorUi"];

/***/ }),

/***/ "@elementor/editor-v1-adapters":
/*!***************************************************!*\
  !*** external ["elementorV2","editorV1Adapters"] ***!
  \***************************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["editorV1Adapters"];

/***/ }),

/***/ "@elementor/env":
/*!**************************************!*\
  !*** external ["elementorV2","env"] ***!
  \**************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["env"];

/***/ }),

/***/ "@elementor/events":
/*!*****************************************!*\
  !*** external ["elementorV2","events"] ***!
  \*****************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["events"];

/***/ }),

/***/ "@elementor/http-client":
/*!*********************************************!*\
  !*** external ["elementorV2","httpClient"] ***!
  \*********************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["httpClient"];

/***/ }),

/***/ "@elementor/icons":
/*!****************************************!*\
  !*** external ["elementorV2","icons"] ***!
  \****************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["icons"];

/***/ }),

/***/ "@elementor/locations":
/*!********************************************!*\
  !*** external ["elementorV2","locations"] ***!
  \********************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["locations"];

/***/ }),

/***/ "@elementor/query":
/*!****************************************!*\
  !*** external ["elementorV2","query"] ***!
  \****************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["query"];

/***/ }),

/***/ "@elementor/schema":
/*!*****************************************!*\
  !*** external ["elementorV2","schema"] ***!
  \*****************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["schema"];

/***/ }),

/***/ "@elementor/session":
/*!******************************************!*\
  !*** external ["elementorV2","session"] ***!
  \******************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["session"];

/***/ }),

/***/ "@elementor/ui":
/*!*************************************!*\
  !*** external ["elementorV2","ui"] ***!
  \*************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["ui"];

/***/ }),

/***/ "@elementor/utils":
/*!****************************************!*\
  !*** external ["elementorV2","utils"] ***!
  \****************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["utils"];

/***/ }),

/***/ "@elementor/wp-media":
/*!******************************************!*\
  !*** external ["elementorV2","wpMedia"] ***!
  \******************************************/
/***/ (function(module) {

"use strict";
module.exports = window["elementorV2"]["wpMedia"];

/***/ }),

/***/ "@wordpress/i18n":
/*!******************************!*\
  !*** external ["wp","i18n"] ***!
  \******************************/
/***/ (function(module) {

"use strict";
module.exports = window["wp"]["i18n"];

/***/ }),

/***/ "react":
/*!**************************!*\
  !*** external ["React"] ***!
  \**************************/
/***/ (function(module) {

"use strict";
module.exports = window["React"];

/***/ }),

/***/ "react-dom":
/*!*****************************!*\
  !*** external ["ReactDOM"] ***!
  \*****************************/
/***/ (function(module) {

"use strict";
module.exports = window["ReactDOM"];

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
!function() {
"use strict";
/*!*************************************************************!*\
  !*** ./packages/packages/libs/editor-controls/src/index.ts ***!
  \*************************************************************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AspectRatioControl: function() { return /* reexport safe */ _controls_aspect_ratio_control__WEBPACK_IMPORTED_MODULE_25__.AspectRatioControl; },
/* harmony export */   AttachmentTypeControl: function() { return /* reexport safe */ _controls_attachment_type_control__WEBPACK_IMPORTED_MODULE_45__.AttachmentTypeControl; },
/* harmony export */   AttributesControl: function() { return /* reexport safe */ _components_promotions_attributes_control__WEBPACK_IMPORTED_MODULE_50__.AttributesControl; },
/* harmony export */   BackgroundControl: function() { return /* reexport safe */ _controls_background_control_background_control__WEBPACK_IMPORTED_MODULE_28__.BackgroundControl; },
/* harmony export */   BoxShadowRepeaterControl: function() { return /* reexport safe */ _controls_box_shadow_repeater_control__WEBPACK_IMPORTED_MODULE_6__.BoxShadowRepeaterControl; },
/* harmony export */   ChipsControl: function() { return /* reexport safe */ _controls_chips_control__WEBPACK_IMPORTED_MODULE_10__.ChipsControl; },
/* harmony export */   ClearIconButton: function() { return /* reexport safe */ _components_icon_buttons_clear_icon_button__WEBPACK_IMPORTED_MODULE_53__.ClearIconButton; },
/* harmony export */   ColorControl: function() { return /* reexport safe */ _controls_color_control__WEBPACK_IMPORTED_MODULE_11__.ColorControl; },
/* harmony export */   ControlActions: function() { return /* reexport safe */ _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_65__["default"]; },
/* harmony export */   ControlActionsProvider: function() { return /* reexport safe */ _control_actions_control_actions_context__WEBPACK_IMPORTED_MODULE_64__.ControlActionsProvider; },
/* harmony export */   ControlAdornments: function() { return /* reexport safe */ _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_68__.ControlAdornments; },
/* harmony export */   ControlAdornmentsProvider: function() { return /* reexport safe */ _control_adornments_control_adornments_context__WEBPACK_IMPORTED_MODULE_67__.ControlAdornmentsProvider; },
/* harmony export */   ControlFormLabel: function() { return /* reexport safe */ _components_control_form_label__WEBPACK_IMPORTED_MODULE_48__.ControlFormLabel; },
/* harmony export */   ControlReplacementsProvider: function() { return /* reexport safe */ _control_replacements__WEBPACK_IMPORTED_MODULE_63__.ControlReplacementsProvider; },
/* harmony export */   ControlToggleButtonGroup: function() { return /* reexport safe */ _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_52__.ControlToggleButtonGroup; },
/* harmony export */   DateRangeControl: function() { return /* reexport safe */ _controls_date_range_control__WEBPACK_IMPORTED_MODULE_40__.DateRangeControl; },
/* harmony export */   DateTimeControl: function() { return /* reexport safe */ _controls_date_time_control__WEBPACK_IMPORTED_MODULE_39__.DateTimeControl; },
/* harmony export */   DisplayConditionsControl: function() { return /* reexport safe */ _components_promotions_display_conditions_control__WEBPACK_IMPORTED_MODULE_49__.DisplayConditionsControl; },
/* harmony export */   EmailFormActionControl: function() { return /* reexport safe */ _controls_email_form_action_control__WEBPACK_IMPORTED_MODULE_44__.EmailFormActionControl; },
/* harmony export */   EqualUnequalSizesControl: function() { return /* reexport safe */ _controls_equal_unequal_sizes_control__WEBPACK_IMPORTED_MODULE_14__.EqualUnequalSizesControl; },
/* harmony export */   FilterRepeaterControl: function() { return /* reexport safe */ _controls_filter_control_filter_repeater_control__WEBPACK_IMPORTED_MODULE_7__.FilterRepeaterControl; },
/* harmony export */   FontFamilyControl: function() { return /* reexport safe */ _controls_font_family_control_font_family_control__WEBPACK_IMPORTED_MODULE_16__.FontFamilyControl; },
/* harmony export */   GapControl: function() { return /* reexport safe */ _controls_gap_control__WEBPACK_IMPORTED_MODULE_24__.GapControl; },
/* harmony export */   GridSpanControl: function() { return /* reexport safe */ _controls_grid_span_control__WEBPACK_IMPORTED_MODULE_47__.GridSpanControl; },
/* harmony export */   HtmlTagControl: function() { return /* reexport safe */ _controls_html_tag_control__WEBPACK_IMPORTED_MODULE_20__.HtmlTagControl; },
/* harmony export */   ImageControl: function() { return /* reexport safe */ _controls_image_control__WEBPACK_IMPORTED_MODULE_0__.ImageControl; },
/* harmony export */   InlineEditingControl: function() { return /* reexport safe */ _controls_inline_editing_control__WEBPACK_IMPORTED_MODULE_43__.InlineEditingControl; },
/* harmony export */   InlineEditor: function() { return /* reexport safe */ _components_inline_editor__WEBPACK_IMPORTED_MODULE_56__.InlineEditor; },
/* harmony export */   InlineEditorToolbar: function() { return /* reexport safe */ _components_inline_editor_toolbar__WEBPACK_IMPORTED_MODULE_57__.InlineEditorToolbar; },
/* harmony export */   ItemSelector: function() { return /* reexport safe */ _components_item_selector__WEBPACK_IMPORTED_MODULE_17__.ItemSelector; },
/* harmony export */   KeyValueControl: function() { return /* reexport safe */ _controls_key_value_control__WEBPACK_IMPORTED_MODULE_31__.KeyValueControl; },
/* harmony export */   LinkControl: function() { return /* reexport safe */ _controls_link_control__WEBPACK_IMPORTED_MODULE_19__.LinkControl; },
/* harmony export */   LinkedDimensionsControl: function() { return /* reexport safe */ _controls_linked_dimensions_control__WEBPACK_IMPORTED_MODULE_15__.LinkedDimensionsControl; },
/* harmony export */   MentionTextAreaControl: function() { return /* reexport safe */ _controls_mention_text_area_control__WEBPACK_IMPORTED_MODULE_3__.MentionTextAreaControl; },
/* harmony export */   NumberControl: function() { return /* reexport safe */ _controls_number_control__WEBPACK_IMPORTED_MODULE_13__.NumberControl; },
/* harmony export */   NumberInput: function() { return /* reexport safe */ _components_number_input__WEBPACK_IMPORTED_MODULE_59__.NumberInput; },
/* harmony export */   PopoverContent: function() { return /* reexport safe */ _components_popover_content__WEBPACK_IMPORTED_MODULE_36__.PopoverContent; },
/* harmony export */   PopoverGridContainer: function() { return /* reexport safe */ _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_55__.PopoverGridContainer; },
/* harmony export */   PositionControl: function() { return /* reexport safe */ _controls_position_control__WEBPACK_IMPORTED_MODULE_32__.PositionControl; },
/* harmony export */   PromotionTrigger: function() { return /* reexport safe */ _components_promotions_promotion_trigger__WEBPACK_IMPORTED_MODULE_51__.PromotionTrigger; },
/* harmony export */   PropKeyProvider: function() { return /* reexport safe */ _bound_prop_context__WEBPACK_IMPORTED_MODULE_66__.PropKeyProvider; },
/* harmony export */   PropProvider: function() { return /* reexport safe */ _bound_prop_context__WEBPACK_IMPORTED_MODULE_66__.PropProvider; },
/* harmony export */   QueryChipsControl: function() { return /* reexport safe */ _controls_query_chips_control__WEBPACK_IMPORTED_MODULE_21__.QueryChipsControl; },
/* harmony export */   QueryControl: function() { return /* reexport safe */ _controls_query_control__WEBPACK_IMPORTED_MODULE_22__.QueryControl; },
/* harmony export */   QueryFilterRepeaterControl: function() { return /* reexport safe */ _controls_query_filter_repeater_control__WEBPACK_IMPORTED_MODULE_23__.QueryFilterRepeaterControl; },
/* harmony export */   RepeatableControl: function() { return /* reexport safe */ _controls_repeatable_control__WEBPACK_IMPORTED_MODULE_30__.RepeatableControl; },
/* harmony export */   Repeater: function() { return /* reexport safe */ _components_repeater_repeater__WEBPACK_IMPORTED_MODULE_54__.Repeater; },
/* harmony export */   SelectControl: function() { return /* reexport safe */ _controls_select_control__WEBPACK_IMPORTED_MODULE_8__.SelectControl; },
/* harmony export */   SelectControlWrapper: function() { return /* reexport safe */ _controls_select_control_wrapper__WEBPACK_IMPORTED_MODULE_9__.SelectControlWrapper; },
/* harmony export */   SizeComponent: function() { return /* reexport safe */ _controls_size_control_size_component__WEBPACK_IMPORTED_MODULE_60__.SizeComponent; },
/* harmony export */   SizeControl: function() { return /* reexport safe */ _controls_size_control__WEBPACK_IMPORTED_MODULE_4__.SizeControl; },
/* harmony export */   StrokeControl: function() { return /* reexport safe */ _controls_stroke_control__WEBPACK_IMPORTED_MODULE_5__.StrokeControl; },
/* harmony export */   StyledToggleButton: function() { return /* reexport safe */ _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_52__.StyledToggleButton; },
/* harmony export */   StyledToggleButtonGroup: function() { return /* reexport safe */ _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_52__.StyledToggleButtonGroup; },
/* harmony export */   SvgMediaControl: function() { return /* reexport safe */ _controls_svg_media_control__WEBPACK_IMPORTED_MODULE_26__.SvgMediaControl; },
/* harmony export */   SwitchControl: function() { return /* reexport safe */ _controls_switch_control__WEBPACK_IMPORTED_MODULE_29__.SwitchControl; },
/* harmony export */   TextAreaControl: function() { return /* reexport safe */ _controls_text_area_control__WEBPACK_IMPORTED_MODULE_2__.TextAreaControl; },
/* harmony export */   TextControl: function() { return /* reexport safe */ _controls_text_control__WEBPACK_IMPORTED_MODULE_1__.TextControl; },
/* harmony export */   TimeRangeControl: function() { return /* reexport safe */ _controls_time_range_control__WEBPACK_IMPORTED_MODULE_42__.TimeRangeControl; },
/* harmony export */   TimeStringControl: function() { return /* reexport safe */ _controls_time_string_control__WEBPACK_IMPORTED_MODULE_41__.TimeStringControl; },
/* harmony export */   ToggleButtonGroupUi: function() { return /* reexport safe */ _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_52__.ToggleButtonGroupUi; },
/* harmony export */   ToggleControl: function() { return /* reexport safe */ _controls_toggle_control__WEBPACK_IMPORTED_MODULE_12__.ToggleControl; },
/* harmony export */   TransformRepeaterControl: function() { return /* reexport safe */ _controls_transform_control_transform_repeater_control__WEBPACK_IMPORTED_MODULE_33__.TransformRepeaterControl; },
/* harmony export */   TransformSettingsControl: function() { return /* reexport safe */ _controls_transform_control_transform_settings_control__WEBPACK_IMPORTED_MODULE_34__.TransformSettingsControl; },
/* harmony export */   TransitionRepeaterControl: function() { return /* reexport safe */ _controls_transition_control_transition_repeater_control__WEBPACK_IMPORTED_MODULE_35__.TransitionRepeaterControl; },
/* harmony export */   UnstableSizeControl: function() { return /* reexport safe */ _controls_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_46__.UnstableSizeControl; },
/* harmony export */   UnstableSizeField: function() { return /* reexport safe */ _components_size_unstable_size_field__WEBPACK_IMPORTED_MODULE_58__.UnstableSizeField; },
/* harmony export */   UrlControl: function() { return /* reexport safe */ _controls_url_control__WEBPACK_IMPORTED_MODULE_18__.UrlControl; },
/* harmony export */   VideoMediaControl: function() { return /* reexport safe */ _controls_video_media_control__WEBPACK_IMPORTED_MODULE_27__.VideoMediaControl; },
/* harmony export */   createControl: function() { return /* reexport safe */ _create_control__WEBPACK_IMPORTED_MODULE_69__.createControl; },
/* harmony export */   createControlReplacementsRegistry: function() { return /* reexport safe */ _control_replacements__WEBPACK_IMPORTED_MODULE_63__.createControlReplacementsRegistry; },
/* harmony export */   enqueueFont: function() { return /* reexport safe */ _controls_font_family_control_enqueue_font__WEBPACK_IMPORTED_MODULE_37__.enqueueFont; },
/* harmony export */   getControlReplacements: function() { return /* reexport safe */ _control_replacements__WEBPACK_IMPORTED_MODULE_63__.getControlReplacements; },
/* harmony export */   injectIntoRepeaterItemActions: function() { return /* reexport safe */ _components_control_repeater_locations__WEBPACK_IMPORTED_MODULE_70__.injectIntoRepeaterItemActions; },
/* harmony export */   injectIntoRepeaterItemIcon: function() { return /* reexport safe */ _components_control_repeater_locations__WEBPACK_IMPORTED_MODULE_70__.injectIntoRepeaterItemIcon; },
/* harmony export */   injectIntoRepeaterItemLabel: function() { return /* reexport safe */ _components_control_repeater_locations__WEBPACK_IMPORTED_MODULE_70__.injectIntoRepeaterItemLabel; },
/* harmony export */   isUnitExtendedOption: function() { return /* reexport safe */ _utils_size_control__WEBPACK_IMPORTED_MODULE_61__.isUnitExtendedOption; },
/* harmony export */   registerControlReplacement: function() { return /* reexport safe */ _control_replacements__WEBPACK_IMPORTED_MODULE_63__.registerControlReplacement; },
/* harmony export */   trackUpgradePromotionClick: function() { return /* reexport safe */ _utils_tracking__WEBPACK_IMPORTED_MODULE_62__.trackUpgradePromotionClick; },
/* harmony export */   trackViewPromotion: function() { return /* reexport safe */ _utils_tracking__WEBPACK_IMPORTED_MODULE_62__.trackViewPromotion; },
/* harmony export */   transitionProperties: function() { return /* reexport safe */ _controls_transition_control_data__WEBPACK_IMPORTED_MODULE_38__.transitionProperties; },
/* harmony export */   transitionsItemsList: function() { return /* reexport safe */ _controls_transition_control_data__WEBPACK_IMPORTED_MODULE_38__.transitionsItemsList; },
/* harmony export */   useBoundProp: function() { return /* reexport safe */ _bound_prop_context__WEBPACK_IMPORTED_MODULE_66__.useBoundProp; },
/* harmony export */   useControlActions: function() { return /* reexport safe */ _control_actions_control_actions_context__WEBPACK_IMPORTED_MODULE_64__.useControlActions; },
/* harmony export */   useControlReplacement: function() { return /* reexport safe */ _control_replacements__WEBPACK_IMPORTED_MODULE_63__.useControlReplacement; },
/* harmony export */   useFontFamilies: function() { return /* reexport safe */ _hooks_use_font_families__WEBPACK_IMPORTED_MODULE_72__.useFontFamilies; },
/* harmony export */   useSyncExternalState: function() { return /* reexport safe */ _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_71__.useSyncExternalState; },
/* harmony export */   useTypingBuffer: function() { return /* reexport safe */ _hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_73__.useTypingBuffer; }
/* harmony export */ });
/* harmony import */ var _controls_image_control__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./controls/image-control */ "./packages/packages/libs/editor-controls/src/controls/image-control.tsx");
/* harmony import */ var _controls_text_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./controls/text-control */ "./packages/packages/libs/editor-controls/src/controls/text-control.tsx");
/* harmony import */ var _controls_text_area_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./controls/text-area-control */ "./packages/packages/libs/editor-controls/src/controls/text-area-control.tsx");
/* harmony import */ var _controls_mention_text_area_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./controls/mention-text-area-control */ "./packages/packages/libs/editor-controls/src/controls/mention-text-area-control.tsx");
/* harmony import */ var _controls_size_control__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./controls/size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control.tsx");
/* harmony import */ var _controls_stroke_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./controls/stroke-control */ "./packages/packages/libs/editor-controls/src/controls/stroke-control.tsx");
/* harmony import */ var _controls_box_shadow_repeater_control__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./controls/box-shadow-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/box-shadow-repeater-control.tsx");
/* harmony import */ var _controls_filter_control_filter_repeater_control__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./controls/filter-control/filter-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/filter-control/filter-repeater-control.tsx");
/* harmony import */ var _controls_select_control__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./controls/select-control */ "./packages/packages/libs/editor-controls/src/controls/select-control.tsx");
/* harmony import */ var _controls_select_control_wrapper__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./controls/select-control-wrapper */ "./packages/packages/libs/editor-controls/src/controls/select-control-wrapper.tsx");
/* harmony import */ var _controls_chips_control__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./controls/chips-control */ "./packages/packages/libs/editor-controls/src/controls/chips-control.tsx");
/* harmony import */ var _controls_color_control__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./controls/color-control */ "./packages/packages/libs/editor-controls/src/controls/color-control.tsx");
/* harmony import */ var _controls_toggle_control__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./controls/toggle-control */ "./packages/packages/libs/editor-controls/src/controls/toggle-control.tsx");
/* harmony import */ var _controls_number_control__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./controls/number-control */ "./packages/packages/libs/editor-controls/src/controls/number-control.tsx");
/* harmony import */ var _controls_equal_unequal_sizes_control__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./controls/equal-unequal-sizes-control */ "./packages/packages/libs/editor-controls/src/controls/equal-unequal-sizes-control.tsx");
/* harmony import */ var _controls_linked_dimensions_control__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./controls/linked-dimensions-control */ "./packages/packages/libs/editor-controls/src/controls/linked-dimensions-control.tsx");
/* harmony import */ var _controls_font_family_control_font_family_control__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./controls/font-family-control/font-family-control */ "./packages/packages/libs/editor-controls/src/controls/font-family-control/font-family-control.tsx");
/* harmony import */ var _components_item_selector__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./components/item-selector */ "./packages/packages/libs/editor-controls/src/components/item-selector.tsx");
/* harmony import */ var _controls_url_control__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./controls/url-control */ "./packages/packages/libs/editor-controls/src/controls/url-control.tsx");
/* harmony import */ var _controls_link_control__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./controls/link-control */ "./packages/packages/libs/editor-controls/src/controls/link-control.tsx");
/* harmony import */ var _controls_html_tag_control__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./controls/html-tag-control */ "./packages/packages/libs/editor-controls/src/controls/html-tag-control.tsx");
/* harmony import */ var _controls_query_chips_control__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./controls/query-chips-control */ "./packages/packages/libs/editor-controls/src/controls/query-chips-control.tsx");
/* harmony import */ var _controls_query_control__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./controls/query-control */ "./packages/packages/libs/editor-controls/src/controls/query-control.tsx");
/* harmony import */ var _controls_query_filter_repeater_control__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./controls/query-filter-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/query-filter-repeater-control.tsx");
/* harmony import */ var _controls_gap_control__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./controls/gap-control */ "./packages/packages/libs/editor-controls/src/controls/gap-control.tsx");
/* harmony import */ var _controls_aspect_ratio_control__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./controls/aspect-ratio-control */ "./packages/packages/libs/editor-controls/src/controls/aspect-ratio-control.tsx");
/* harmony import */ var _controls_svg_media_control__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./controls/svg-media-control */ "./packages/packages/libs/editor-controls/src/controls/svg-media-control.tsx");
/* harmony import */ var _controls_video_media_control__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./controls/video-media-control */ "./packages/packages/libs/editor-controls/src/controls/video-media-control.tsx");
/* harmony import */ var _controls_background_control_background_control__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./controls/background-control/background-control */ "./packages/packages/libs/editor-controls/src/controls/background-control/background-control.tsx");
/* harmony import */ var _controls_switch_control__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./controls/switch-control */ "./packages/packages/libs/editor-controls/src/controls/switch-control.tsx");
/* harmony import */ var _controls_repeatable_control__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./controls/repeatable-control */ "./packages/packages/libs/editor-controls/src/controls/repeatable-control.tsx");
/* harmony import */ var _controls_key_value_control__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./controls/key-value-control */ "./packages/packages/libs/editor-controls/src/controls/key-value-control.tsx");
/* harmony import */ var _controls_position_control__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./controls/position-control */ "./packages/packages/libs/editor-controls/src/controls/position-control.tsx");
/* harmony import */ var _controls_transform_control_transform_repeater_control__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./controls/transform-control/transform-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-repeater-control.tsx");
/* harmony import */ var _controls_transform_control_transform_settings_control__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./controls/transform-control/transform-settings-control */ "./packages/packages/libs/editor-controls/src/controls/transform-control/transform-settings-control.tsx");
/* harmony import */ var _controls_transition_control_transition_repeater_control__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./controls/transition-control/transition-repeater-control */ "./packages/packages/libs/editor-controls/src/controls/transition-control/transition-repeater-control.tsx");
/* harmony import */ var _components_popover_content__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./components/popover-content */ "./packages/packages/libs/editor-controls/src/components/popover-content.tsx");
/* harmony import */ var _controls_font_family_control_enqueue_font__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./controls/font-family-control/enqueue-font */ "./packages/packages/libs/editor-controls/src/controls/font-family-control/enqueue-font.tsx");
/* harmony import */ var _controls_transition_control_data__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./controls/transition-control/data */ "./packages/packages/libs/editor-controls/src/controls/transition-control/data.ts");
/* harmony import */ var _controls_date_time_control__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./controls/date-time-control */ "./packages/packages/libs/editor-controls/src/controls/date-time-control.tsx");
/* harmony import */ var _controls_date_range_control__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./controls/date-range-control */ "./packages/packages/libs/editor-controls/src/controls/date-range-control.tsx");
/* harmony import */ var _controls_time_string_control__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./controls/time-string-control */ "./packages/packages/libs/editor-controls/src/controls/time-string-control.tsx");
/* harmony import */ var _controls_time_range_control__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./controls/time-range-control */ "./packages/packages/libs/editor-controls/src/controls/time-range-control.tsx");
/* harmony import */ var _controls_inline_editing_control__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./controls/inline-editing-control */ "./packages/packages/libs/editor-controls/src/controls/inline-editing-control.tsx");
/* harmony import */ var _controls_email_form_action_control__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./controls/email-form-action-control */ "./packages/packages/libs/editor-controls/src/controls/email-form-action-control/index.tsx");
/* harmony import */ var _controls_attachment_type_control__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./controls/attachment-type-control */ "./packages/packages/libs/editor-controls/src/controls/attachment-type-control.tsx");
/* harmony import */ var _controls_size_control_unstable_size_control__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./controls/size-control/unstable-size-control */ "./packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx");
/* harmony import */ var _controls_grid_span_control__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./controls/grid-span-control */ "./packages/packages/libs/editor-controls/src/controls/grid-span-control.tsx");
/* harmony import */ var _components_control_form_label__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./components/control-form-label */ "./packages/packages/libs/editor-controls/src/components/control-form-label.tsx");
/* harmony import */ var _components_promotions_display_conditions_control__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./components/promotions/display-conditions-control */ "./packages/packages/libs/editor-controls/src/components/promotions/display-conditions-control.tsx");
/* harmony import */ var _components_promotions_attributes_control__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./components/promotions/attributes-control */ "./packages/packages/libs/editor-controls/src/components/promotions/attributes-control.tsx");
/* harmony import */ var _components_promotions_promotion_trigger__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./components/promotions/promotion-trigger */ "./packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx");
/* harmony import */ var _components_control_toggle_button_group__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./components/control-toggle-button-group */ "./packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx");
/* harmony import */ var _components_icon_buttons_clear_icon_button__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./components/icon-buttons/clear-icon-button */ "./packages/packages/libs/editor-controls/src/components/icon-buttons/clear-icon-button.tsx");
/* harmony import */ var _components_repeater_repeater__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./components/repeater/repeater */ "./packages/packages/libs/editor-controls/src/components/repeater/repeater.tsx");
/* harmony import */ var _components_popover_grid_container__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./components/popover-grid-container */ "./packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx");
/* harmony import */ var _components_inline_editor__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./components/inline-editor */ "./packages/packages/libs/editor-controls/src/components/inline-editor.tsx");
/* harmony import */ var _components_inline_editor_toolbar__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./components/inline-editor-toolbar */ "./packages/packages/libs/editor-controls/src/components/inline-editor-toolbar.tsx");
/* harmony import */ var _components_size_unstable_size_field__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./components/size/unstable-size-field */ "./packages/packages/libs/editor-controls/src/components/size/unstable-size-field.tsx");
/* harmony import */ var _components_number_input__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./components/number-input */ "./packages/packages/libs/editor-controls/src/components/number-input.tsx");
/* harmony import */ var _controls_size_control_size_component__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./controls/size-control/size-component */ "./packages/packages/libs/editor-controls/src/controls/size-control/size-component.tsx");
/* harmony import */ var _utils_size_control__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./utils/size-control */ "./packages/packages/libs/editor-controls/src/utils/size-control.ts");
/* harmony import */ var _utils_tracking__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./utils/tracking */ "./packages/packages/libs/editor-controls/src/utils/tracking.ts");
/* harmony import */ var _control_replacements__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./control-replacements */ "./packages/packages/libs/editor-controls/src/control-replacements.tsx");
/* harmony import */ var _control_actions_control_actions_context__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./control-actions/control-actions-context */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions-context.tsx");
/* harmony import */ var _control_actions_control_actions__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./control-actions/control-actions */ "./packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx");
/* harmony import */ var _bound_prop_context__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./bound-prop-context */ "./packages/packages/libs/editor-controls/src/bound-prop-context/index.ts");
/* harmony import */ var _control_adornments_control_adornments_context__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./control-adornments/control-adornments-context */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments-context.tsx");
/* harmony import */ var _control_adornments_control_adornments__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./control-adornments/control-adornments */ "./packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx");
/* harmony import */ var _create_control__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./create-control */ "./packages/packages/libs/editor-controls/src/create-control.tsx");
/* harmony import */ var _components_control_repeater_locations__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./components/control-repeater/locations */ "./packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts");
/* harmony import */ var _hooks_use_sync_external_state__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./hooks/use-sync-external-state */ "./packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx");
/* harmony import */ var _hooks_use_font_families__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./hooks/use-font-families */ "./packages/packages/libs/editor-controls/src/hooks/use-font-families.ts");
/* harmony import */ var _hooks_use_typing_buffer__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./hooks/use-typing-buffer */ "./packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts");
// control types

















































// components
















// types



// providers









// hooks



}();
(window.elementorV2 = window.elementorV2 || {}).editorControls = __webpack_exports__;
/******/ })()
;
window.elementorV2.editorControls?.init?.();
//# sourceMappingURL=editor-controls.js.map