@dialpad/dialtone-vue 3.207.0 → 3.208.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/component-documentation.json +1 -1
  2. package/dist/lib/editor/EditorToolbarButton.cjs +2 -0
  3. package/dist/lib/editor/EditorToolbarButton.cjs.map +1 -0
  4. package/dist/lib/editor/EditorToolbarButton.js +103 -0
  5. package/dist/lib/editor/EditorToolbarButton.js.map +1 -0
  6. package/dist/lib/editor/EditorToolbarDropdownButton.cjs +2 -0
  7. package/dist/lib/editor/EditorToolbarDropdownButton.cjs.map +1 -0
  8. package/dist/lib/editor/EditorToolbarDropdownButton.js +106 -0
  9. package/dist/lib/editor/EditorToolbarDropdownButton.js.map +1 -0
  10. package/dist/lib/editor/EditorToolbarPopoverButton.cjs +2 -0
  11. package/dist/lib/editor/EditorToolbarPopoverButton.cjs.map +1 -0
  12. package/dist/lib/editor/EditorToolbarPopoverButton.js +107 -0
  13. package/dist/lib/editor/EditorToolbarPopoverButton.js.map +1 -0
  14. package/dist/lib/editor/editor-constants.cjs +1 -1
  15. package/dist/lib/editor/editor-constants.cjs.map +1 -1
  16. package/dist/lib/editor/editor-constants.js +5 -3
  17. package/dist/lib/editor/editor-constants.js.map +1 -1
  18. package/dist/lib/editor/editor.cjs +1 -1
  19. package/dist/lib/editor/editor.cjs.map +1 -1
  20. package/dist/lib/editor/editor.js +550 -312
  21. package/dist/lib/editor/editor.js.map +1 -1
  22. package/dist/lib/input/input-constants.cjs +1 -1
  23. package/dist/lib/input/input-constants.cjs.map +1 -1
  24. package/dist/lib/input/input-constants.js +2 -1
  25. package/dist/lib/input/input-constants.js.map +1 -1
  26. package/dist/lib/input/input.cjs.map +1 -1
  27. package/dist/lib/input/input.js +1 -1
  28. package/dist/lib/input/input.js.map +1 -1
  29. package/dist/lib/rich-text-editor/rich-text-editor.cjs +2 -2
  30. package/dist/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  31. package/dist/lib/rich-text-editor/rich-text-editor.js +9 -2
  32. package/dist/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  33. package/dist/localization/en-US.cjs +5 -0
  34. package/dist/localization/en-US.cjs.map +1 -1
  35. package/dist/localization/en-US.js +5 -0
  36. package/dist/localization/en-US.js.map +1 -1
  37. package/dist/style.css +1 -0
  38. package/dist/types/components/input/input_constants.d.ts +1 -0
  39. package/dist/types/recipes/conversation_view/editor/EditorToolbarButton.vue.d.ts +314 -0
  40. package/dist/types/recipes/conversation_view/editor/EditorToolbarButton.vue.d.ts.map +1 -0
  41. package/dist/types/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts +1614 -0
  42. package/dist/types/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts.map +1 -0
  43. package/dist/types/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts +1340 -0
  44. package/dist/types/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts.map +1 -0
  45. package/dist/types/recipes/conversation_view/editor/editor_constants.d.ts +2 -0
  46. package/dist/types/recipes/conversation_view/editor/editor_constants.d.ts.map +1 -1
  47. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../../components/input/input.vue"],"sourcesContent":["<template>\n <div\n ref=\"container\"\n :class=\"[rootClass, 'd-input__root', { 'd-input--hidden': hidden }]\"\n v-bind=\"addClassStyleAttrs($attrs)\"\n data-qa=\"dt-input\"\n >\n <label\n class=\"d-input__label\"\n :aria-details=\"$slots.description || description ? descriptionKey : undefined\"\n data-qa=\"dt-input-label-wrapper\"\n >\n <!-- @slot Slot for label, defaults to label prop -->\n <slot name=\"labelSlot\">\n <div\n v-if=\"labelVisible && label\"\n ref=\"label\"\n data-qa=\"dt-input-label\"\n :class=\"[\n 'd-input__label-text',\n 'd-label',\n labelSizeClasses[size],\n ]\"\n >\n {{ label }}\n </div>\n </slot>\n <div\n v-if=\"hasSlotContent($slots.description) || description || shouldValidateLength\"\n :id=\"descriptionKey\"\n ref=\"description\"\n :class=\"[\n 'd-input__description',\n 'd-description',\n descriptionSizeClasses[size],\n ]\"\n data-qa=\"dt-input-description\"\n >\n <div\n v-if=\"hasSlotContent($slots.description) || description\"\n >\n <!-- @slot Slot for description, defaults to description prop -->\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <div\n v-if=\"shouldValidateLength\"\n data-qa=\"dt-input-length-description\"\n class=\"d-input__length-description\"\n >\n {{ validationProps.length.description }}\n </div>\n </div>\n <div\n :class=\"inputWrapperClasses()\"\n :read-only=\"disabled === true ? true : undefined\"\n >\n <span\n class=\"d-input-icon d-input-icon--left\"\n data-qa=\"dt-input-left-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for left icon -->\n <slot\n name=\"leftIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <textarea\n v-if=\"isTextarea\"\n ref=\"input\"\n :name=\"name\"\n :disabled=\"disabled\"\n :autocomplete=\"$attrs.autocomplete ?? 'off'\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n data-qa=\"dt-input-input\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n v-on=\"inputListeners\"\n />\n <input\n v-else\n ref=\"input\"\n :value=\"modelValue\"\n :name=\"name\"\n :type=\"type\"\n :disabled=\"disabled\"\n :autocomplete=\"$attrs.autocomplete ?? 'off'\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n data-qa=\"dt-input-input\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n v-on=\"inputListeners\"\n >\n <span\n class=\"d-input-icon d-input-icon--right\"\n data-qa=\"dt-input-right-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for right icon -->\n <slot\n name=\"rightIcon\"\n :icon-size=\"iconSize\"\n :clear=\"clearInput\"\n />\n </span>\n </div>\n </label>\n <dt-validation-messages\n :validation-messages=\"validationMessages\"\n :show-messages=\"showMessages\"\n :class=\"messagesClass\"\n v-bind=\"messagesChildProps\"\n data-qa=\"dt-input-messages\"\n />\n </div>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DESCRIPTION_SIZE_TYPES, VALIDATION_MESSAGE_TYPES } from '@/common/constants';\nimport {\n INPUT_TYPES,\n INPUT_SIZES,\n INPUT_SIZE_CLASSES,\n INPUT_ICON_SIZES,\n INPUT_STATE_CLASSES,\n DESCRIPTION_SIZE_CLASSES,\n LABEL_SIZE_CLASSES,\n} from './input_constants';\nimport {\n getUniqueString,\n getValidationState,\n hasSlotContent,\n removeClassStyleAttrs,\n addClassStyleAttrs,\n} from '@/common/utils';\nimport { DtValidationMessages } from '@/components/validation_messages';\nimport { MessagesMixin } from '@/common/mixins/input';\n\n/**\n * An input field is an input control that allows users to enter alphanumeric information.\n * It can have a range of options and supports single line and multi-line lengths,\n * as well as varying formats, including numbers, masked passwords, etc.\n * @property {Boolean} placeholder attribute\n * @see https://dialtone.dialpad.com/components/input.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtInput',\n\n components: { DtValidationMessages },\n\n mixins: [MessagesMixin],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Name property of the input element\n */\n name: {\n type: String,\n default: '',\n },\n\n /**\n * Type of the input.\n * When `textarea` a `<textarea>` element will be rendered instead of an `<input>` element.\n * @values text, password, email, number, textarea, date, time, file, tel, search\n * @default 'text'\n */\n type: {\n type: String,\n default: INPUT_TYPES.TEXT,\n validator: (t) => Object.values(INPUT_TYPES).includes(t),\n },\n\n /**\n * Value of the input\n */\n modelValue: {\n type: [String, Number],\n default: '',\n },\n\n /**\n * Disables the input\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Label for the input\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (t) => Object.values(INPUT_SIZES).includes(t),\n },\n\n /**\n * Additional class name for the input element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n inputClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the input wrapper element.\n * Can accept all of: String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n inputWrapperClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the root element.\n * Can accept all of: String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n rootClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * The current character length that the user has entered into the input.\n * This will only need to be used if you are using `validate.length` and\n * the string contains abnormal characters.\n * For example, an emoji could take up many characters in the input, but should only count as 1 character.\n * If no number is provided, a built-in length calculation will be used for the length validation.\n */\n currentLength: {\n type: Number,\n default: null,\n },\n\n /**\n * Whether the input will continue to display a warning validation message even if the input has lost focus.\n */\n retainWarning: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Validation for the input. Supports maximum length validation with the structure:\n * `{ \"length\": {\"description\": string, \"max\": number, \"warn\": number, \"message\": string,\n * \"limitMaxLength\": boolean }}`\n */\n validate: {\n type: Object,\n default: null,\n },\n\n /**\n * hidden allows to use input without the element visually present in DOM\n */\n hidden: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String}\n */\n 'input',\n\n /**\n * Native input blur event\n *\n * @event blur\n * @type {FocusEvent}\n */\n 'blur',\n\n /**\n * Input clear event\n *\n * @event clear\n */\n 'clear',\n\n /**\n * Native input focus event\n *\n * @event focus\n * @type {FocusEvent}\n */\n 'focus',\n\n /**\n * Native input focusin event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native input focusout event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n\n /**\n * Event fired to sync the modelValue prop with the parent component\n * @event update:modelValue\n */\n 'update:modelValue',\n\n /**\n * Length of the input when currentLength prop is not passed\n *\n * @event update:length\n * @type {Number}\n */\n 'update:length',\n\n /**\n * Result of the input validation\n *\n * @event update:invalid\n * @type {Boolean}\n */\n 'update:invalid',\n ],\n\n data () {\n return {\n isInputFocused: false,\n isInvalid: false,\n defaultLength: 0,\n hasSlotContent,\n isComposing: false,\n };\n },\n\n computed: {\n\n isTextarea () {\n return this.type === INPUT_TYPES.TEXTAREA;\n },\n\n isDefaultSize () {\n return this.size === INPUT_SIZES.DEFAULT;\n },\n\n iconSize () {\n return INPUT_ICON_SIZES[this.size];\n },\n\n isValidSize () {\n return Object.values(INPUT_SIZES).includes(this.size);\n },\n\n isValidDescriptionSize () {\n return Object.values(DESCRIPTION_SIZE_TYPES).includes(this.size);\n },\n\n inputComponent () {\n if (this.isTextarea) {\n return 'textarea';\n }\n\n return 'input';\n },\n\n inputListeners () {\n return {\n compositionstart: () => {\n this.isComposing = true;\n },\n\n compositionend: () => {\n this.isComposing = false;\n },\n\n input: async event => {\n if (this.isComposing) return;\n let val = event.target.value;\n if (this.type === INPUT_TYPES.FILE) {\n const files = Array.from(event.target.files);\n val = files.map(file => file.name);\n }\n this.$emit('input', val);\n this.$emit('update:modelValue', val);\n },\n\n blur: event => {\n this.isInputFocused = false;\n this.onBlur(event);\n },\n\n focus: event => {\n this.isInputFocused = true;\n this.$emit('focus', event);\n },\n\n focusin: event => this.$emit('focusin', event),\n focusout: event => this.$emit('focusout', event),\n };\n },\n\n descriptionKey () {\n return `input-description-${getUniqueString()}`;\n },\n\n inputState () {\n return getValidationState(this.validationMessages);\n },\n\n defaultLengthCalculation () {\n return this.calculateLength(this.modelValue);\n },\n\n validationProps () {\n return {\n length: {\n description: this?.validate?.length?.description,\n max: this?.validate?.length?.max,\n warn: this?.validate?.length?.warn,\n message: this?.validate?.length?.message,\n limitMaxLength: this?.validate?.length?.limitMaxLength ? this.validate.length.limitMaxLength : false,\n },\n };\n },\n\n validationMessages () {\n // Add length validation message if exists\n if (this.showLengthLimitValidation) {\n return this.formattedMessages.concat([this.inputLengthErrorMessage()]);\n }\n\n return this.formattedMessages;\n },\n\n showInputState () {\n return this.showMessages && this.inputState;\n },\n\n inputLength () {\n return this.currentLength ? this.currentLength : this.defaultLengthCalculation;\n },\n\n inputLengthState () {\n if (this.inputLength < this.validationProps.length.warn) {\n return null;\n } else if (this.inputLength <= this.validationProps.length.max) {\n return this.validationProps.length.warn ? VALIDATION_MESSAGE_TYPES.WARNING : null;\n } else {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n },\n\n shouldValidateLength () {\n return !!(\n this.validationProps.length.description &&\n this.validationProps.length.max\n );\n },\n\n shouldLimitMaxLength () {\n return this.shouldValidateLength && this.validationProps.length.limitMaxLength;\n },\n\n showLengthLimitValidation () {\n return (\n this.shouldValidateLength &&\n this.inputLengthState !== null &&\n this.validationProps.length.message &&\n (this.retainWarning || this.isInputFocused || this.isInvalid)\n );\n },\n\n sizeModifierClass () {\n if (this.isDefaultSize || !this.isValidSize) {\n return '';\n }\n\n return INPUT_SIZE_CLASSES[this.inputComponent][this.size];\n },\n\n stateClass () {\n return [INPUT_STATE_CLASSES[this.inputState]];\n },\n },\n\n watch: {\n isInvalid (val) {\n this.$emit('update:invalid', val);\n },\n\n modelValue: {\n immediate: true,\n handler (newValue) {\n if (this.shouldValidateLength) {\n this.validateLength(this.inputLength);\n }\n\n if (this.currentLength == null) {\n this.$emit('update:length', this.calculateLength(newValue));\n }\n\n // Set textarea value programmatically to avoid attribute binding\n // Skip during IME composition to avoid interrupting in-progress input\n if (this.isTextarea && this.$refs.input && this.$refs.input.value !== newValue && !this.isComposing) {\n this.$refs.input.value = newValue;\n }\n },\n },\n },\n\n beforeMount () {\n this.descriptionSizeClasses = DESCRIPTION_SIZE_CLASSES;\n this.labelSizeClasses = LABEL_SIZE_CLASSES;\n },\n\n mounted () {\n // Set initial textarea value programmatically\n if (this.isTextarea && this.$refs.input) {\n this.$refs.input.value = this.modelValue;\n }\n },\n\n methods: {\n removeClassStyleAttrs,\n addClassStyleAttrs,\n inputClasses () {\n return [\n 'd-input__input',\n this.inputComponent === 'input' ? 'd-input' : 'd-textarea',\n {\n [this.stateClass]: this.showInputState,\n 'd-input-icon--left': this.$slots.leftIcon,\n 'd-input-icon--right': this.$slots.rightIcon,\n },\n this.sizeModifierClass,\n this.inputClass,\n ];\n },\n\n inputWrapperClasses () {\n if (this.hidden) {\n return [];\n }\n return [\n 'd-input__wrapper',\n { [this.stateClass]: this.showInputState },\n this.inputWrapperClass,\n ];\n },\n\n calculateLength (value) {\n if (typeof value !== 'string') {\n return 0;\n }\n\n return [...value].length;\n },\n\n inputLengthErrorMessage () {\n return {\n message: this.validationProps.length.message,\n type: this.inputLengthState,\n };\n },\n\n onBlur (e) {\n // Do not emit a blur event if the target element is a child of this component\n if (!this.$refs.container?.contains(e.relatedTarget)) {\n this.$emit('blur', e);\n }\n },\n\n emitClearEvents () {\n this.$emit('input', '');\n this.$emit('clear');\n this.$emit('update:modelValue', '');\n },\n\n blur () {\n this.$refs.input.blur();\n },\n\n focus () {\n this.$refs.input.focus();\n },\n\n select () {\n this.$refs.input.select();\n },\n\n getMessageKey (type, index) {\n return `message-${type}-${index}`;\n },\n\n validateLength (length) {\n this.isInvalid = (length > this.validationProps.length.max);\n },\n\n clearInput () {\n this.$refs.input.value = '';\n this.$refs.input.focus();\n this.emitClearEvents();\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtValidationMessages","MessagesMixin","INPUT_TYPES","INPUT_SIZES","hasSlotContent","INPUT_ICON_SIZES","DESCRIPTION_SIZE_TYPES","event","val","file","getUniqueString","getValidationState","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","VALIDATION_MESSAGE_TYPES","INPUT_SIZE_CLASSES","INPUT_STATE_CLASSES","newValue","DESCRIPTION_SIZE_CLASSES","LABEL_SIZE_CLASSES","removeClassStyleAttrs","addClassStyleAttrs","value","e","type","index","length","_openBlock","_createElementBlock","_mergeProps","$props","$options","_ctx","_createElementVNode","_renderSlot","_normalizeClass","$data","_hoisted_3","_hoisted_4","_toDisplayString","args","_toHandlers","_hoisted_6","_hoisted_7","_createVNode","_component_dt_validation_messages"],"mappings":";;;;;;;AAkJA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY,EAAE,sBAAAC;EAEd,QAAQ,CAACC,CAAa;AAAA,EAEtB,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;IASX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAASC,EAAY;AAAA,MACrB,WAAW,CAAC,MAAM,OAAO,OAAOA,CAAW,EAAE,SAAS,CAAC;AAAA;;;;IAMzD,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAAC,MAAM,OAAO,OAAOC,CAAW,EAAE,SAAS,CAAC;AAAA;;;;;;IAQzD,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,QAAQ,KAAK;AAAA,MAC5B,SAAS;AAAA;;;;;;IAQX,mBAAmB;AAAA,MACjB,MAAM,CAAC,QAAQ,QAAQ,KAAK;AAAA,MAC5B,SAAS;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C,EAAA,MAAM,GACpCS,EAAqBV,EAAf,gBAAc,EAAA,CAAA,GAAA,MAAA,IAAAW,CAAA,MAEtBf,KAAAC,EAaC,SAbDC,EAaC;AAAA;UAXC,KAAI;AAAA,UACH,OAAOC,EAAA;AAAA,UACP,MAAMA,EAAA;AAAA,UACN,MAAMA,EAAA;AAAA,UACN,UAAUA,EAAA;AAAA,UACV,cAAcE,EAAA,OAAO,gBAAY;AAAA,UACjC,OAAOD,EAAA,aAAY;AAAA,UACnB,WAAWA,EAAA,uBAAuBA,kBAAgB,OAAO,MAAG;AAAA,UAC7D,WAAQ;AAAA,QACA,GAAAA,EAAA,sBAAsBC,EAAA,MAAM,GACpCS,EAAqBV,EAAf,gBAAc,EAAA,CAAA,GAAA,MAAA,IAAAY,CAAA;AAAA,QAEtBV,EAWO,QAAA;AAAA,UAVL,OAAM;AAAA,UACN,WAAQ;AAAA,UACP,sCAAUF,EAAA,UAAAA,EAAA,OAAA,GAAAS,CAAA;AAAA;UAGXN,EAIEF,EAAA,QAAA,aAAA;AAAA,YAFC,UAAWD,EAAA;AAAA,YACX,OAAOA,EAAA;AAAA;;;;IAKhBa,EAMEC,GANFhB,EAME;AAAA,MALC,uBAAqBE,EAAA;AAAA,MACrB,iBAAeC,EAAA;AAAA,MACf,OAAOA,EAAA;AAAA,OACAA,EAAA,oBAAkB,EAC1B,WAAQ,oBAAmB,CAAA,GAAA,MAAA,IAAA,CAAA,uBAAA,iBAAA,OAAA,CAAA;AAAA;;;"}
1
+ {"version":3,"file":"input.js","sources":["../../../components/input/input.vue"],"sourcesContent":["<template>\n <div\n ref=\"container\"\n :class=\"[rootClass, 'd-input__root', { 'd-input--hidden': hidden }]\"\n v-bind=\"addClassStyleAttrs($attrs)\"\n data-qa=\"dt-input\"\n >\n <label\n class=\"d-input__label\"\n :aria-details=\"$slots.description || description ? descriptionKey : undefined\"\n data-qa=\"dt-input-label-wrapper\"\n >\n <!-- @slot Slot for label, defaults to label prop -->\n <slot name=\"labelSlot\">\n <div\n v-if=\"labelVisible && label\"\n ref=\"label\"\n data-qa=\"dt-input-label\"\n :class=\"[\n 'd-input__label-text',\n 'd-label',\n labelSizeClasses[size],\n ]\"\n >\n {{ label }}\n </div>\n </slot>\n <div\n v-if=\"hasSlotContent($slots.description) || description || shouldValidateLength\"\n :id=\"descriptionKey\"\n ref=\"description\"\n :class=\"[\n 'd-input__description',\n 'd-description',\n descriptionSizeClasses[size],\n ]\"\n data-qa=\"dt-input-description\"\n >\n <div\n v-if=\"hasSlotContent($slots.description) || description\"\n >\n <!-- @slot Slot for description, defaults to description prop -->\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <div\n v-if=\"shouldValidateLength\"\n data-qa=\"dt-input-length-description\"\n class=\"d-input__length-description\"\n >\n {{ validationProps.length.description }}\n </div>\n </div>\n <div\n :class=\"inputWrapperClasses()\"\n :read-only=\"disabled === true ? true : undefined\"\n >\n <span\n class=\"d-input-icon d-input-icon--left\"\n data-qa=\"dt-input-left-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for left icon -->\n <slot\n name=\"leftIcon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <textarea\n v-if=\"isTextarea\"\n ref=\"input\"\n :name=\"name\"\n :disabled=\"disabled\"\n :autocomplete=\"$attrs.autocomplete ?? 'off'\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n data-qa=\"dt-input-input\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n v-on=\"inputListeners\"\n />\n <input\n v-else\n ref=\"input\"\n :value=\"modelValue\"\n :name=\"name\"\n :type=\"type\"\n :disabled=\"disabled\"\n :autocomplete=\"$attrs.autocomplete ?? 'off'\"\n :class=\"inputClasses()\"\n :maxlength=\"shouldLimitMaxLength ? validationProps.length.max : null\"\n data-qa=\"dt-input-input\"\n v-bind=\"removeClassStyleAttrs($attrs)\"\n v-on=\"inputListeners\"\n >\n <span\n class=\"d-input-icon d-input-icon--right\"\n data-qa=\"dt-input-right-icon-wrapper\"\n @focusout=\"onBlur\"\n >\n <!-- @slot Slot for right icon -->\n <slot\n name=\"rightIcon\"\n :icon-size=\"iconSize\"\n :clear=\"clearInput\"\n />\n </span>\n </div>\n </label>\n <dt-validation-messages\n :validation-messages=\"validationMessages\"\n :show-messages=\"showMessages\"\n :class=\"messagesClass\"\n v-bind=\"messagesChildProps\"\n data-qa=\"dt-input-messages\"\n />\n </div>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DESCRIPTION_SIZE_TYPES, VALIDATION_MESSAGE_TYPES } from '@/common/constants';\nimport {\n INPUT_TYPES,\n INPUT_SIZES,\n INPUT_SIZE_CLASSES,\n INPUT_ICON_SIZES,\n INPUT_STATE_CLASSES,\n DESCRIPTION_SIZE_CLASSES,\n LABEL_SIZE_CLASSES,\n} from './input_constants';\nimport {\n getUniqueString,\n getValidationState,\n hasSlotContent,\n removeClassStyleAttrs,\n addClassStyleAttrs,\n} from '@/common/utils';\nimport { DtValidationMessages } from '@/components/validation_messages';\nimport { MessagesMixin } from '@/common/mixins/input';\n\n/**\n * An input field is an input control that allows users to enter alphanumeric information.\n * It can have a range of options and supports single line and multi-line lengths,\n * as well as varying formats, including numbers, masked passwords, etc.\n * @property {Boolean} placeholder attribute\n * @see https://dialtone.dialpad.com/components/input.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtInput',\n\n components: { DtValidationMessages },\n\n mixins: [MessagesMixin],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Name property of the input element\n */\n name: {\n type: String,\n default: '',\n },\n\n /**\n * Type of the input.\n * When `textarea` a `<textarea>` element will be rendered instead of an `<input>` element.\n * @values text, password, email, number, textarea, date, time, file, tel, search, color\n * @default 'text'\n */\n type: {\n type: String,\n default: INPUT_TYPES.TEXT,\n validator: (t) => Object.values(INPUT_TYPES).includes(t),\n },\n\n /**\n * Value of the input\n */\n modelValue: {\n type: [String, Number],\n default: '',\n },\n\n /**\n * Disables the input\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Label for the input\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * Determines visibility of input label.\n * @values true, false\n */\n labelVisible: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Description for the input\n */\n description: {\n type: String,\n default: '',\n },\n\n /**\n * Size of the input, one of `xs`, `sm`, `md`, `lg`, `xl`\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (t) => Object.values(INPUT_SIZES).includes(t),\n },\n\n /**\n * Additional class name for the input element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n inputClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the input wrapper element.\n * Can accept all of: String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n inputWrapperClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the root element.\n * Can accept all of: String, Object, and Array, i.e. has the\n * same api as Vue's built-in handling of the class attribute.\n */\n rootClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * The current character length that the user has entered into the input.\n * This will only need to be used if you are using `validate.length` and\n * the string contains abnormal characters.\n * For example, an emoji could take up many characters in the input, but should only count as 1 character.\n * If no number is provided, a built-in length calculation will be used for the length validation.\n */\n currentLength: {\n type: Number,\n default: null,\n },\n\n /**\n * Whether the input will continue to display a warning validation message even if the input has lost focus.\n */\n retainWarning: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Validation for the input. Supports maximum length validation with the structure:\n * `{ \"length\": {\"description\": string, \"max\": number, \"warn\": number, \"message\": string,\n * \"limitMaxLength\": boolean }}`\n */\n validate: {\n type: Object,\n default: null,\n },\n\n /**\n * hidden allows to use input without the element visually present in DOM\n */\n hidden: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native input event\n *\n * @event input\n * @type {String}\n */\n 'input',\n\n /**\n * Native input blur event\n *\n * @event blur\n * @type {FocusEvent}\n */\n 'blur',\n\n /**\n * Input clear event\n *\n * @event clear\n */\n 'clear',\n\n /**\n * Native input focus event\n *\n * @event focus\n * @type {FocusEvent}\n */\n 'focus',\n\n /**\n * Native input focusin event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native input focusout event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n\n /**\n * Event fired to sync the modelValue prop with the parent component\n * @event update:modelValue\n */\n 'update:modelValue',\n\n /**\n * Length of the input when currentLength prop is not passed\n *\n * @event update:length\n * @type {Number}\n */\n 'update:length',\n\n /**\n * Result of the input validation\n *\n * @event update:invalid\n * @type {Boolean}\n */\n 'update:invalid',\n ],\n\n data () {\n return {\n isInputFocused: false,\n isInvalid: false,\n defaultLength: 0,\n hasSlotContent,\n isComposing: false,\n };\n },\n\n computed: {\n\n isTextarea () {\n return this.type === INPUT_TYPES.TEXTAREA;\n },\n\n isDefaultSize () {\n return this.size === INPUT_SIZES.DEFAULT;\n },\n\n iconSize () {\n return INPUT_ICON_SIZES[this.size];\n },\n\n isValidSize () {\n return Object.values(INPUT_SIZES).includes(this.size);\n },\n\n isValidDescriptionSize () {\n return Object.values(DESCRIPTION_SIZE_TYPES).includes(this.size);\n },\n\n inputComponent () {\n if (this.isTextarea) {\n return 'textarea';\n }\n\n return 'input';\n },\n\n inputListeners () {\n return {\n compositionstart: () => {\n this.isComposing = true;\n },\n\n compositionend: () => {\n this.isComposing = false;\n },\n\n input: async event => {\n if (this.isComposing) return;\n let val = event.target.value;\n if (this.type === INPUT_TYPES.FILE) {\n const files = Array.from(event.target.files);\n val = files.map(file => file.name);\n }\n this.$emit('input', val);\n this.$emit('update:modelValue', val);\n },\n\n blur: event => {\n this.isInputFocused = false;\n this.onBlur(event);\n },\n\n focus: event => {\n this.isInputFocused = true;\n this.$emit('focus', event);\n },\n\n focusin: event => this.$emit('focusin', event),\n focusout: event => this.$emit('focusout', event),\n };\n },\n\n descriptionKey () {\n return `input-description-${getUniqueString()}`;\n },\n\n inputState () {\n return getValidationState(this.validationMessages);\n },\n\n defaultLengthCalculation () {\n return this.calculateLength(this.modelValue);\n },\n\n validationProps () {\n return {\n length: {\n description: this?.validate?.length?.description,\n max: this?.validate?.length?.max,\n warn: this?.validate?.length?.warn,\n message: this?.validate?.length?.message,\n limitMaxLength: this?.validate?.length?.limitMaxLength ? this.validate.length.limitMaxLength : false,\n },\n };\n },\n\n validationMessages () {\n // Add length validation message if exists\n if (this.showLengthLimitValidation) {\n return this.formattedMessages.concat([this.inputLengthErrorMessage()]);\n }\n\n return this.formattedMessages;\n },\n\n showInputState () {\n return this.showMessages && this.inputState;\n },\n\n inputLength () {\n return this.currentLength ? this.currentLength : this.defaultLengthCalculation;\n },\n\n inputLengthState () {\n if (this.inputLength < this.validationProps.length.warn) {\n return null;\n } else if (this.inputLength <= this.validationProps.length.max) {\n return this.validationProps.length.warn ? VALIDATION_MESSAGE_TYPES.WARNING : null;\n } else {\n return VALIDATION_MESSAGE_TYPES.ERROR;\n }\n },\n\n shouldValidateLength () {\n return !!(\n this.validationProps.length.description &&\n this.validationProps.length.max\n );\n },\n\n shouldLimitMaxLength () {\n return this.shouldValidateLength && this.validationProps.length.limitMaxLength;\n },\n\n showLengthLimitValidation () {\n return (\n this.shouldValidateLength &&\n this.inputLengthState !== null &&\n this.validationProps.length.message &&\n (this.retainWarning || this.isInputFocused || this.isInvalid)\n );\n },\n\n sizeModifierClass () {\n if (this.isDefaultSize || !this.isValidSize) {\n return '';\n }\n\n return INPUT_SIZE_CLASSES[this.inputComponent][this.size];\n },\n\n stateClass () {\n return [INPUT_STATE_CLASSES[this.inputState]];\n },\n },\n\n watch: {\n isInvalid (val) {\n this.$emit('update:invalid', val);\n },\n\n modelValue: {\n immediate: true,\n handler (newValue) {\n if (this.shouldValidateLength) {\n this.validateLength(this.inputLength);\n }\n\n if (this.currentLength == null) {\n this.$emit('update:length', this.calculateLength(newValue));\n }\n\n // Set textarea value programmatically to avoid attribute binding\n // Skip during IME composition to avoid interrupting in-progress input\n if (this.isTextarea && this.$refs.input && this.$refs.input.value !== newValue && !this.isComposing) {\n this.$refs.input.value = newValue;\n }\n },\n },\n },\n\n beforeMount () {\n this.descriptionSizeClasses = DESCRIPTION_SIZE_CLASSES;\n this.labelSizeClasses = LABEL_SIZE_CLASSES;\n },\n\n mounted () {\n // Set initial textarea value programmatically\n if (this.isTextarea && this.$refs.input) {\n this.$refs.input.value = this.modelValue;\n }\n },\n\n methods: {\n removeClassStyleAttrs,\n addClassStyleAttrs,\n inputClasses () {\n return [\n 'd-input__input',\n this.inputComponent === 'input' ? 'd-input' : 'd-textarea',\n {\n [this.stateClass]: this.showInputState,\n 'd-input-icon--left': this.$slots.leftIcon,\n 'd-input-icon--right': this.$slots.rightIcon,\n },\n this.sizeModifierClass,\n this.inputClass,\n ];\n },\n\n inputWrapperClasses () {\n if (this.hidden) {\n return [];\n }\n return [\n 'd-input__wrapper',\n { [this.stateClass]: this.showInputState },\n this.inputWrapperClass,\n ];\n },\n\n calculateLength (value) {\n if (typeof value !== 'string') {\n return 0;\n }\n\n return [...value].length;\n },\n\n inputLengthErrorMessage () {\n return {\n message: this.validationProps.length.message,\n type: this.inputLengthState,\n };\n },\n\n onBlur (e) {\n // Do not emit a blur event if the target element is a child of this component\n if (!this.$refs.container?.contains(e.relatedTarget)) {\n this.$emit('blur', e);\n }\n },\n\n emitClearEvents () {\n this.$emit('input', '');\n this.$emit('clear');\n this.$emit('update:modelValue', '');\n },\n\n blur () {\n this.$refs.input.blur();\n },\n\n focus () {\n this.$refs.input.focus();\n },\n\n select () {\n this.$refs.input.select();\n },\n\n getMessageKey (type, index) {\n return `message-${type}-${index}`;\n },\n\n validateLength (length) {\n this.isInvalid = (length > this.validationProps.length.max);\n },\n\n clearInput () {\n this.$refs.input.value = '';\n this.$refs.input.focus();\n this.emitClearEvents();\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtValidationMessages","MessagesMixin","INPUT_TYPES","INPUT_SIZES","hasSlotContent","INPUT_ICON_SIZES","DESCRIPTION_SIZE_TYPES","event","val","file","getUniqueString","getValidationState","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","VALIDATION_MESSAGE_TYPES","INPUT_SIZE_CLASSES","INPUT_STATE_CLASSES","newValue","DESCRIPTION_SIZE_CLASSES","LABEL_SIZE_CLASSES","removeClassStyleAttrs","addClassStyleAttrs","value","e","type","index","length","_openBlock","_createElementBlock","_mergeProps","$props","$options","_ctx","_createElementVNode","_renderSlot","_normalizeClass","$data","_hoisted_3","_hoisted_4","_toDisplayString","args","_toHandlers","_hoisted_6","_hoisted_7","_createVNode","_component_dt_validation_messages"],"mappings":";;;;;;;AAkJA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY,EAAE,sBAAAC;EAEd,QAAQ,CAACC,CAAa;AAAA,EAEtB,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;IASX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAASC,EAAY;AAAA,MACrB,WAAW,CAAC,MAAM,OAAO,OAAOA,CAAW,EAAE,SAAS,CAAC;AAAA;;;;IAMzD,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAAC,MAAM,OAAO,OAAOC,CAAW,EAAE,SAAS,CAAC;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A;AAAA,UACV,cAAcE,EAAA,OAAO,gBAAY;AAAA,UACjC,OAAOD,EAAA,aAAY;AAAA,UACnB,WAAWA,EAAA,uBAAuBA,kBAAgB,OAAO,MAAG;AAAA,UAC7D,WAAQ;AAAA,QACA,GAAAA,EAAA,sBAAsBC,EAAA,MAAM,GACpCS,EAAqBV,EAAf,gBAAc,EAAA,CAAA,GAAA,MAAA,IAAAW,CAAA,MAEtBf,KAAAC,EAaC,SAbDC,EAaC;AAAA;UAXC,KAAI;AAAA,UACH,OAAOC,EAAA;AAAA,UACP,MAAMA,EAAA;AAAA,UACN,MAAMA,EAAA;AAAA,UACN,UAAUA,EAAA;AAAA,UACV,cAAcE,EAAA,OAAO,gBAAY;AAAA,UACjC,OAAOD,EAAA,aAAY;AAAA,UACnB,WAAWA,EAAA,uBAAuBA,kBAAgB,OAAO,MAAG;AAAA,UAC7D,WAAQ;AAAA,QACA,GAAAA,EAAA,sBAAsBC,EAAA,MAAM,GACpCS,EAAqBV,EAAf,gBAAc,EAAA,CAAA,GAAA,MAAA,IAAAY,CAAA;AAAA,QAEtBV,EAWO,QAAA;AAAA,UAVL,OAAM;AAAA,UACN,WAAQ;AAAA,UACP,sCAAUF,EAAA,UAAAA,EAAA,OAAA,GAAAS,CAAA;AAAA;UAGXN,EAIEF,EAAA,QAAA,aAAA;AAAA,YAFC,UAAWD,EAAA;AAAA,YACX,OAAOA,EAAA;AAAA;;;;IAKhBa,EAMEC,GANFhB,EAME;AAAA,MALC,uBAAqBE,EAAA;AAAA,MACrB,iBAAeC,EAAA;AAAA,MACf,OAAOA,EAAA;AAAA,OACAA,EAAA,oBAAkB,EAC1B,WAAQ,oBAAmB,CAAA,GAAA,MAAA,IAAA,CAAA,uBAAA,iBAAA,OAAA,CAAA;AAAA;;;"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("../../node_modules/@tiptap/vue-3.cjs"),T=require("@tiptap/core"),j=require("@tiptap/pm/state"),_t=require("@tiptap/pm/tables"),a=require("vue"),Tt=require("@tiptap/extension-blockquote"),kt=require("@tiptap/extension-code-block"),Ct=require("@tiptap/extension-code"),Et=require("@tiptap/extension-document"),be=require("@tiptap/extensions"),Ot=require("@tiptap/extension-hard-break"),Ye=require("@tiptap/extension-paragraph"),St=require("@tiptap/extension-bold"),ve=require("@tiptap/extension-list"),Lt=require("@tiptap/extension-italic"),Dt=require("@tiptap/extension-link"),It=require("@tiptap/extension-strike"),Rt=require("@tiptap/extension-underline"),At=require("@tiptap/extension-text"),Bt=require("@tiptap/extension-text-align"),ce=require("@tiptap/extension-table"),Mt=require("@tiptap/extension-text-style"),Nt=require("@tiptap/suggestion"),Ge=require("regex-combined-emojis"),F=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),Je=require("../emoji/emoji.cjs"),ee=require("../../common/emoji/index.cjs"),Ht=require("../list-item/list-item.cjs"),ae=require("../stack/stack.cjs"),se=require("../../common/utils/index.cjs"),Vt=require("@tiptap/extension-image"),ke=require("@tiptap/extension-mention"),Ze=require("../link/link.cjs"),$t=require("@dialpad/dialtone-icons/vue3"),Qe=require("../../localization/index.cjs"),Pt=require("../input/input.cjs"),Ut=require("../popover/popover.cjs"),et=require("../button/button.cjs"),jt=require("../badge/badge.cjs"),de=require("./rich-text-editor-constants.cjs"),qt=require("../avatar/avatar.cjs"),zt=require("@dialpad/dialtone-icons/vue3/hash"),Ft=require("@dialpad/dialtone-icons/vue3/lock"),Kt=require("deep-equal"),tt=["top","right","bottom","left"],Be=["start","end"],Me=tt.reduce((e,t)=>e.concat(t,t+"-"+Be[0],t+"-"+Be[1]),[]),X=Math.min,R=Math.max,ue=Math.round,W=e=>({x:e,y:e}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function _e(e,t,o){return R(e,X(t,o))}function G(e,t){return typeof e=="function"?e(t):e}function $(e){return e.split("-")[0]}function U(e){return e.split("-")[1]}function nt(e){return e==="x"?"y":"x"}function Ce(e){return e==="y"?"height":"width"}const Yt=new Set(["top","bottom"]);function K(e){return Yt.has($(e))?"y":"x"}function Ee(e){return nt(K(e))}function ot(e,t,o){o===void 0&&(o=!1);const n=U(e),i=Ee(e),s=Ce(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=fe(r)),[r,fe(r)]}function Gt(e){const t=fe(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>Xt[t])}const Ne=["left","right"],He=["right","left"],Jt=["top","bottom"],Zt=["bottom","top"];function Qt(e,t,o){switch(e){case"top":case"bottom":return o?t?He:Ne:t?Ne:He;case"left":case"right":return t?Jt:Zt;default:return[]}}function en(e,t,o,n){const i=U(e);let s=Qt($(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(he)))),s}function fe(e){return e.replace(/left|right|bottom|top/g,t=>Wt[t])}function tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oe(e){return typeof e!="number"?tn(e):{top:e,right:e,bottom:e,left:e}}function ne(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Ve(e,t,o){let{reference:n,floating:i}=e;const s=K(t),r=Ee(t),l=Ce(r),c=$(t),h=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[l]/2-i[l]/2;let p;switch(c){case"top":p={x:u,y:n.y-i.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-i.width,y:d};break;default:p={x:n.x,y:n.y}}switch(U(t)){case"start":p[r]-=f*(o&&h?-1:1);break;case"end":p[r]+=f*(o&&h?-1:1);break}return p}async function nn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:l,strategy:c}=e,{boundary:h="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=G(t,e),m=Oe(p),w=l[f?d==="floating"?"reference":"floating":d],y=ne(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:h,rootBoundary:u,strategy:c})),v=d==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),_=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},C=ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-C.top+m.top)/_.y,bottom:(C.bottom-y.bottom+m.bottom)/_.y,left:(y.left-C.left+m.left)/_.x,right:(C.right-y.right+m.right)/_.x}}const on=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,l=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let h=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ve(h,n,c),f=n,p={},m=0;for(let w=0;w<l.length;w++){var g;const{name:y,fn:v}=l[w],{x,y:_,data:C,reset:k}=await v({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:h,platform:{...r,detectOverflow:(g=r.detectOverflow)!=null?g:nn},elements:{reference:e,floating:t}});u=x??u,d=_??d,p={...p,[y]:{...p[y],...C}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(h=k.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ve(h,f,c)),w=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},sn=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:l,middlewareData:c}=t,{element:h,padding:u=0}=G(e,t)||{};if(h==null)return{};const d=Oe(u),f={x:o,y:n},p=Ee(i),m=Ce(p),g=await r.getDimensions(h),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(h));let L=k?k[x]:0;(!L||!await(r.isElement==null?void 0:r.isElement(k)))&&(L=l.floating[x]||s.floating[m]);const H=_/2-C/2,D=L/2-g[m]/2-1,b=X(d[y],D),E=X(d[v],D),I=b,A=L-g[m]-E,O=L/2-g[m]/2+H,P=_e(I,O,A),V=!c.arrow&&U(i)!=null&&O!==P&&s.reference[m]/2-(O<I?b:E)-g[m]/2<0,B=V?O<I?O-I:O-A:0;return{[p]:f[p]+B,data:{[p]:P,centerOffset:O-P-B,...V&&{alignmentOffset:B}},reset:V}}});function rn(e,t,o){return(e?[...o.filter(i=>U(i)===e),...o.filter(i=>U(i)!==e)]:o.filter(i=>$(i)===i)).filter(i=>e?U(i)===e||(t?he(i)!==i:!1):!0)}const an=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var o,n,i;const{rects:s,middlewareData:r,placement:l,platform:c,elements:h}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=Me,autoAlignment:p=!0,...m}=G(e,t),g=d!==void 0||f===Me?rn(d||null,p,f):f,w=await c.detectOverflow(t,m),y=((o=r.autoPlacement)==null?void 0:o.index)||0,v=g[y];if(v==null)return{};const x=ot(v,s,await(c.isRTL==null?void 0:c.isRTL(h.floating)));if(l!==v)return{reset:{placement:g[0]}};const _=[w[$(v)],w[x[0]],w[x[1]]],C=[...((n=r.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:_}],k=g[y+1];if(k)return{data:{index:y+1,overflows:C},reset:{placement:k}};const L=C.map(b=>{const E=U(b.placement);return[b.placement,E&&u?b.overflows.slice(0,2).reduce((I,A)=>I+A,0):b.overflows[0],b.overflows]}).sort((b,E)=>b[1]-E[1]),D=((i=L.filter(b=>b[2].slice(0,U(b[0])?2:3).every(E=>E<=0))[0])==null?void 0:i[0])||L[0][0];return D!==l?{data:{index:y+1,overflows:C},reset:{placement:D}}:{}}}},ln=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:c,elements:h}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=G(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const y=$(i),v=K(l),x=$(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(h.floating)),C=f||(x||!g?[fe(l)]:Gt(l)),k=m!=="none";!f&&k&&C.push(...en(l,g,m,_));const L=[l,...C],H=await c.detectOverflow(t,w),D=[];let b=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&D.push(H[y]),d){const O=ot(i,r,_);D.push(H[O[0]],H[O[1]])}if(b=[...b,{placement:i,overflows:D}],!D.every(O=>O<=0)){var E,I;const O=(((E=s.flip)==null?void 0:E.index)||0)+1,P=L[O];if(P&&(!(d==="alignment"?v!==K(P):!1)||b.every(M=>K(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:O,overflows:b},reset:{placement:P}};let V=(I=b.filter(B=>B.overflows[0]<=0).sort((B,M)=>B.overflows[1]-M.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(p){case"bestFit":{var A;const B=(A=b.filter(M=>{if(k){const Z=K(M.placement);return Z===v||Z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Z=>Z>0).reduce((Z,xt)=>Z+xt,0)]).sort((M,Z)=>M[1]-Z[1])[0])==null?void 0:A[0];B&&(V=B);break}case"initialPlacement":V=l;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function $e(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return tt.some(t=>e[t]>=0)}const cn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=G(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=$e(r,o.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Pe(l)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),l=$e(r,o.floating);return{data:{escapedOffsets:l,escaped:Pe(l)}}}default:return{}}}}};function it(e){const t=X(...e.map(s=>s.left)),o=X(...e.map(s=>s.top)),n=R(...e.map(s=>s.right)),i=R(...e.map(s=>s.bottom));return{x:t,y:o,width:n-t,height:i-o}}function dn(e){const t=e.slice().sort((i,s)=>i.y-s.y),o=[];let n=null;for(let i=0;i<t.length;i++){const s=t[i];!n||s.y-n.y>n.height/2?o.push([s]):o[o.length-1].push(s),n=s}return o.map(i=>ne(it(i)))}const un=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:n,rects:i,platform:s,strategy:r}=t,{padding:l=2,x:c,y:h}=G(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=dn(u),f=ne(it(u)),p=Oe(l);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&h!=null)return d.find(w=>c>w.left-p.left&&c<w.right+p.right&&h>w.top-p.top&&h<w.bottom+p.bottom)||f;if(d.length>=2){if(K(o)==="y"){const b=d[0],E=d[d.length-1],I=$(o)==="top",A=b.top,O=E.bottom,P=I?b.left:E.left,V=I?b.right:E.right,B=V-P,M=O-A;return{top:A,bottom:O,left:P,right:V,width:B,height:M,x:P,y:A}}const w=$(o)==="left",y=R(...d.map(b=>b.right)),v=X(...d.map(b=>b.left)),x=d.filter(b=>w?b.left===v:b.right===y),_=x[0].top,C=x[x.length-1].bottom,k=v,L=y,H=L-k,D=C-_;return{top:_,bottom:C,left:k,right:L,width:H,height:D,x:k,y:_}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:r});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},hn=new Set(["left","top"]);async function fn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=$(o),l=U(o),c=K(o)==="y",h=hn.has(r)?-1:1,u=s&&c?-1:1,d=G(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*u,y:f*h}:{x:f*h,y:p*u}}const pn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:l}=t,c=await fn(t,e);return r===((o=l.offset)==null?void 0:o.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:r}}}}},mn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...h}=G(e,t),u={x:o,y:n},d=await s.detectOverflow(t,h),f=K($(i)),p=nt(f);let m=u[p],g=u[f];if(r){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+d[y],_=m-d[v];m=_e(x,m,_)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[y],_=g-d[v];g=_e(x,g,_)}const w=c.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-o,y:w.y-n,enabled:{[p]:r,[f]:l}}}}}},gn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:l}=t,{apply:c=()=>{},...h}=G(e,t),u=await r.detectOverflow(t,h),d=$(i),f=U(i),p=K(i)==="y",{width:m,height:g}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=f===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,w=f==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=m-u.left-u.right,_=X(g-u[w],v),C=X(m-u[y],x),k=!t.middlewareData.shift;let L=_,H=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(H=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(L=v),k&&!f){const b=R(u.left,0),E=R(u.right,0),I=R(u.top,0),A=R(u.bottom,0);p?H=m-2*(b!==0||E!==0?b+E:R(u.left,u.right)):L=g-2*(I!==0||A!==0?I+A:R(u.top,u.bottom))}await c({...t,availableWidth:H,availableHeight:L});const D=await r.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function pe(){return typeof window<"u"}function ie(e){return st(e)?(e.nodeName||"").toLowerCase():"#document"}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){var t;return(t=(st(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function st(e){return pe()?e instanceof Node||e instanceof N(e).Node:!1}function q(e){return pe()?e instanceof Element||e instanceof N(e).Element:!1}function Y(e){return pe()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ue(e){return!pe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}const wn=new Set(["inline","contents"]);function le(e){const{overflow:t,overflowX:o,overflowY:n,display:i}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+o)&&!wn.has(i)}const yn=new Set(["table","td","th"]);function bn(e){return yn.has(ie(e))}const vn=[":popover-open",":modal"];function me(e){return vn.some(t=>{try{return e.matches(t)}catch{return!1}})}const xn=["transform","translate","scale","rotate","perspective"],_n=["transform","translate","scale","rotate","perspective","filter"],Tn=["paint","layout","strict","content"];function Se(e){const t=Le(),o=q(e)?z(e):e;return xn.some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||_n.some(n=>(o.willChange||"").includes(n))||Tn.some(n=>(o.contain||"").includes(n))}function kn(e){let t=Q(e);for(;Y(t)&&!oe(t);){if(Se(t))return t;if(me(t))return null;t=Q(t)}return null}function Le(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Cn=new Set(["html","body","#document"]);function oe(e){return Cn.has(ie(e))}function z(e){return N(e).getComputedStyle(e)}function ge(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(ie(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ue(e)&&e.host||J(e);return Ue(t)?t.host:t}function rt(e){const t=Q(e);return oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&le(t)?t:rt(t)}function at(e,t,o){var n;t===void 0&&(t=[]);const i=rt(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),r=N(i);return s?t.concat(r,r.visualViewport||[],le(i)?i:[],[]):t.concat(i,at(i,[]))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lt(e){const t=z(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Y(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,l=ue(o)!==s||ue(n)!==r;return l&&(o=s,n=r),{width:o,height:n,$:l}}function ct(e){return q(e)?e:e.contextElement}function te(e){const t=ct(e);if(!Y(t))return W(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=lt(t);let r=(s?ue(o.width):o.width)/n,l=(s?ue(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const En=W(0);function dt(e){const t=N(e);return!Le()||!t.visualViewport?En:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function On(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==N(e)?!1:t}function re(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=ct(e);let r=W(1);t&&(n?q(n)&&(r=te(n)):r=te(e));const l=On(s,o,n)?dt(s):W(0);let c=(i.left+l.x)/r.x,h=(i.top+l.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s){const f=N(s),p=n&&q(n)?N(n):n;let m=f,g=je(m);for(;g&&n&&p!==m;){const w=te(g),y=g.getBoundingClientRect(),v=z(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,h*=w.y,u*=w.x,d*=w.y,c+=x,h+=_,m=N(g),g=je(m)}}return ne({width:u,height:d,x:c,y:h})}function we(e,t){const o=ge(e).scrollLeft;return t?t.left+o:re(J(e)).left+o}function ut(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-we(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function Sn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=J(n),l=t?me(t.floating):!1;if(n===r||l&&s)return o;let c={scrollLeft:0,scrollTop:0},h=W(1);const u=W(0),d=Y(n);if((d||!d&&!s)&&((ie(n)!=="body"||le(r))&&(c=ge(n)),Y(n))){const p=re(n);h=te(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const f=r&&!d&&!s?ut(r,c):W(0);return{width:o.width*h.x,height:o.height*h.y,x:o.x*h.x-c.scrollLeft*h.x+u.x+f.x,y:o.y*h.y-c.scrollTop*h.y+u.y+f.y}}function Ln(e){return Array.from(e.getClientRects())}function Dn(e){const t=J(e),o=ge(e),n=e.ownerDocument.body,i=R(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=R(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+we(e);const l=-o.scrollTop;return z(n).direction==="rtl"&&(r+=R(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:l}}const qe=25;function In(e,t){const o=N(e),n=J(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;const u=Le();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const h=we(n);if(h<=0){const u=n.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=qe&&(s-=m)}else h<=qe&&(s+=h);return{width:s,height:r,x:l,y:c}}const Rn=new Set(["absolute","fixed"]);function An(e,t){const o=re(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=Y(e)?te(e):W(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,h=n*s.y;return{width:r,height:l,x:c,y:h}}function ze(e,t,o){let n;if(t==="viewport")n=In(e,o);else if(t==="document")n=Dn(J(e));else if(q(t))n=An(t,o);else{const i=dt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ne(n)}function ht(e,t){const o=Q(e);return o===t||!q(o)||oe(o)?!1:z(o).position==="fixed"||ht(o,t)}function Bn(e,t){const o=t.get(e);if(o)return o;let n=at(e,[]).filter(l=>q(l)&&ie(l)!=="body"),i=null;const s=z(e).position==="fixed";let r=s?Q(e):e;for(;q(r)&&!oe(r);){const l=z(r),c=Se(r);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&Rn.has(i.position)||le(r)&&!c&&ht(e,r))?n=n.filter(u=>u!==r):i=l,r=Q(r)}return t.set(e,n),n}function Mn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?me(t)?[]:Bn(t,this._c):[].concat(o),n],l=r[0],c=r.reduce((h,u)=>{const d=ze(t,u,i);return h.top=R(d.top,h.top),h.right=X(d.right,h.right),h.bottom=X(d.bottom,h.bottom),h.left=R(d.left,h.left),h},ze(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nn(e){const{width:t,height:o}=lt(e);return{width:t,height:o}}function Hn(e,t,o){const n=Y(t),i=J(t),s=o==="fixed",r=re(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=W(0);function h(){c.x=we(i)}if(n||!n&&!s)if((ie(t)!=="body"||le(i))&&(l=ge(t)),n){const p=re(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&h();s&&!n&&i&&h();const u=i&&!n&&!s?ut(i,l):W(0),d=r.left+l.scrollLeft-c.x-u.x,f=r.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:r.width,height:r.height}}function xe(e){return z(e).position==="static"}function Fe(e,t){if(!Y(e)||z(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return J(e)===o&&(o=o.ownerDocument.body),o}function ft(e,t){const o=N(e);if(me(e))return o;if(!Y(e)){let i=Q(e);for(;i&&!oe(i);){if(q(i)&&!xe(i))return i;i=Q(i)}return o}let n=Fe(e,t);for(;n&&bn(n)&&xe(n);)n=Fe(n,t);return n&&oe(n)&&xe(n)&&!Se(n)?o:n||kn(e)||o}const Vn=async function(e){const t=this.getOffsetParent||ft,o=this.getDimensions,n=await o(e.floating);return{reference:Hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function $n(e){return z(e).direction==="rtl"}const Pn={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:J,getClippingRect:Mn,getOffsetParent:ft,getElementRects:Vn,getClientRects:Ln,getDimensions:Nn,getScale:te,isElement:q,isRTL:$n},De=pn,pt=an,Ie=mn,Re=ln,mt=gn,gt=cn,wt=sn,yt=un,Ae=(e,t,o)=>{const n=new Map,i={platform:Pn,...o},s={...i.platform,_c:n};return on(e,t,{...i,platform:s})};function Un(e,t){const o=Math.min(e.top,t.top),n=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),r=Math.max(e.right,t.right)-i,l=n-o,c=i,h=o;return new DOMRect(c,h,r,l)}var jn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:r,getReferencedVirtualElement:l,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:f,to:p})=>{const{doc:m,selection:g}=d,{empty:w}=g,y=!m.textBetween(f,p).length&&T.isTextSelection(d.selection),v=this.element.contains(document.activeElement);return!(!(u.hasFocus()||v)||w||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const f=!(d!=null&&d.selection.eq(u.state.selection)),p=!(d!=null&&d.doc.eq(u.state.doc));!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,f,p,d)},this.updateDelay))},this.updateHandler=(u,d,f,p)=>{const{composing:m}=u;if(m||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var h;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(h=c==null?void 0:c.scrollTarget)!=null?h:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Re(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,o;const{selection:n}=this.editor.state,i=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(i)return i;if(!((o=(t=this.view)==null?void 0:t.dom)!=null&&o.parentNode))return;const s=T.posToDOMRect(this.view,n.from,n.to);let r={getBoundingClientRect:()=>s,getClientRects:()=>[s]};if(n instanceof j.NodeSelection){let l=this.view.nodeDOM(n.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof _t.CellSelection){const{$anchorCell:l,$headCell:c}=n,h=l?l.pos:c.pos,u=c?c.pos:l.pos,d=this.view.nodeDOM(h),f=this.view.nodeDOM(u);if(!d||!f)return;const p=d===f?d.getBoundingClientRect():Un(d.getBoundingClientRect(),f.getBoundingClientRect());r={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return r}updatePosition(){const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:o,strategy:n,middlewareData:i})=>{var s,r;if((s=i.hide)!=null&&s.referenceHidden||(r=i.hide)!=null&&r.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:o}=e,n=o.selection.from!==o.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:e,from:s,to:r}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},qn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new jn({view:t,...e})}),zn=a.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{editor:i,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}=e,f=n.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),a.nextTick(()=>{i.registerPlugin(qn({editor:i,element:f,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}))}))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}}),Fn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,options:s,appendTo:r,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:d}=u,{$anchor:f,empty:p}=d,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!h.hasFocus()||!p||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,d,f)=>{const{composing:p}=h;if(p||!u&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta("floatingMenu");u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"&&this.updateOptions(u.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var c;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(c=s==null?void 0:s.scrollTarget)!=null?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Re(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:o,oldState:e,from:s,to:r})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to);Ae({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s,middlewareData:r})=>{var l,c;if((l=r.hide)!=null&&l.referenceHidden||(c=r.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const o=!(t!=null&&t.selection.eq(e.state.selection)),n=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,n,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Kn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Fn({view:t,...e})});a.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:i,editor:s,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u}=e,d=n.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),s.registerPlugin(Kn({pluginKey:i,editor:s,element:d,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u})))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}});const Wn={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtEmoji:Je.default},props:S.nodeViewProps};function Xn(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:a.withCtx(()=>[a.createVNode(r,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const Yn=F._(Wn,[["render",Xn]]),Gn={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:Ht.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},Jn={class:"d-popover__dialog d-suggestion-list__container"},Zn={ref:"suggestionList",class:"d-suggestion-list"};function Qn(e,t,o,n,i,s){const r=a.resolveComponent("dt-list-item");return a.openBlock(),a.createElementBlock("div",Jn,[a.withDirectives(a.createElementVNode("ul",Zn,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.items,(l,c)=>(a.openBlock(),a.createBlock(r,{key:l.id,class:a.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":c===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:h=>s.selectItem(c),onKeydown:a.withModifiers(s.onKeyDown,["prevent"])},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[a.vShow,o.items.length]])])}const eo=F._(Gn,[["render",Qn]]),bt="top-start",vt="650";function to(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function Ke(e){return{getBoundingClientRect:e}}async function no(e,t,o={}){if(!e||!(t!=null&&t.getBoundingClientRect))return;const{placement:n=bt,middleware:i=[De(0),Re(),Ie({padding:8})]}=o,{x:s,y:r}=await Ae(t,e,{placement:n,middleware:i});Object.assign(e.style,{left:`${s}px`,top:`${r}px`})}function oo(e,t={}){const{zIndex:o=vt}=t;e.style.position="absolute",e.style.zIndex=o,e.style.display="none"}function io(e){e&&(e.style.display="block")}function so(e){e&&(e.style.display="none")}function ro(e,t){return o=>{o.key==="Escape"&&t()&&e()}}function ao(e){document.addEventListener("keydown",e)}function lo(e){document.removeEventListener("keydown",e)}function co(e,t,o,n){return new S.VueRenderer(e,{props:{itemComponent:a.markRaw(t),itemType:o,...n},editor:n.editor})}function uo(e){var t,o;e.escHandler&&lo(e.escHandler),(t=e.floatingEl)==null||t.remove(),(o=e.component)==null||o.destroy()}function ye(e,t,o={}){const{listComponent:n=eo,placement:i=bt,zIndex:s=vt}=o;return()=>{let r=null,l=null,c=!1,h=to(),u=null;function d(){no(l,h,{placement:i})}function f(){l&&(io(l),c=!0,d())}function p(){l&&(so(l),c=!1)}return{onStart:m=>{r=co(n,e,t,m),m.clientRect&&(l=r.element,oo(l,{zIndex:s}),document.body.appendChild(l),h=Ke(m.clientRect),u=ro(p,()=>c),ao(u),m.items.length>0&&f())},onUpdate(m){r==null||r.updateProps(m),m.items.length>0?f():p(),m.clientRect&&(h=Ke(m.clientRect),d())},onKeyDown(m){var g;if(c)return(g=r==null?void 0:r.ref)==null?void 0:g.onKeyDown(m)},onExit(){uo({escHandler:u,floatingEl:l,component:r}),u=null,l=null,r=null}}}}const ho={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:Je.default,DtStack:ae.default},props:{item:{type:Object,required:!0}}};function fo(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{size:"200",code:o.item.code},null,8,["code"]),a.createTextVNode(" "+a.toDisplayString(o.item.code),1)]),_:1})}const po=F._(ho,[["render",fo]]),mo=20,go=(e,t,o)=>{var l,c;const n=(l=e.shortname)==null?void 0:l.replaceAll(":",""),i=(c=t.shortname)==null?void 0:c.replaceAll(":",""),s=n.startsWith(o),r=i.startsWith(o);return s&&!r?-1:!s&&r?1:n.localeCompare(i)},wo={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(ee.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var i;return[n.name,(i=n.shortname)==null?void 0:i.replaceAll(":",""),...n.keywords||[]].some(s=>s&&s.startsWith(e))}).splice(0,mo).sort((n,i)=>go(n,i,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:o})=>{var s,r;const n=e.view.state.selection.$to.nodeAfter;((s=n==null?void 0:n.text)==null?void 0:s.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:o}]).run(),(r=window.getSelection())==null||r.collapseToEnd()},render:ye(po,"emoji")},yo=/(:\w+:)$/,bo=new RegExp(Ge.emojiPattern+"$"),vo=e=>{if(e&&ee.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},xo=e=>[...e.matchAll(ee.emojiShortCodeRegex)].filter(o=>ee.codeToEmojiData(o[0])).map(o=>({index:o.index,text:o[0],match:o})),_o=T.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return S.VueNodeViewRenderer(Yn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return ee.stringToUnicode(ee.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new T.InputRule({find:e=>{const t=e.match(yo)||e.match(bo);if(t)return vo(t)},handler:({state:e,range:t,match:o})=>{const{tr:n}=e,i=t.from,s=t.to;n.replaceWith(i,s,this.type.create({code:o[0]}))}})]},addPasteRules(){return[T.nodePasteRule({find:xo,type:this.type,getAttributes(e){return{code:e[0]}}}),T.nodePasteRule({find:ee.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[Nt({char:":",pluginKey:new j.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...wo})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=!1;const{selection:n}=t,{empty:i,anchor:s}=n;return i?(t.doc.nodesBetween(s-1,s,(r,l)=>{if(r.type.name===this.name)return o=!0,e.insertText("",l,l+r.nodeSize),!1}),o):!1})}}});function To(e,t,o=()=>!0){const n=[];t.lastIndex=0;let i;for(;i=t.exec(e);)o(e,i)&&n.push(i);return n}function ko(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Co(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function Eo(e,t){const o=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const i=e.slice(o);return{text:i,from:o,to:o+i.length}}return{text:e.slice(o,n+t),from:o,to:n+t}}function Te(e,t,o,n){const i=Eo(e,t);if(n.lastIndex=0,!n.test(i.text))return i;const s=o==="left"?i.from-1:i.to+1;return s<=0||s>=e.length||s===t?i:Te(e,s,o,n)}function Oo(e,t,o,n){const i=Math.max(e.from-1,0),s=Math.min(e.to+1,t.content.size),r=T.getMarksBetween(i,s,t);for(const l of r)l.mark.type===n&&o.removeMark(l.from,l.to,n)}const We=se.getPhoneNumberRegex(1,15);function Xe(e,t,o,n,i,s){if(!e)return;let r=o-t-1;r=r<0?0:r;const l=n-t,c=Te(e,r,"left",We),h=Te(e,l,"right",We),u=e.slice(c.from,h.to);To(u,se.linkRegex,ko).forEach(f=>{const p=Co(f[0]),m=t+c.from+f.index+1,g=m+p.length;i.addMark(m,g,s.create())})}function So(e){let t=!1;return new j.Plugin({key:new j.PluginKey("autolink"),appendTransaction:(o,n,i)=>{const s=o.some(u=>u.docChanged)&&!n.doc.eq(i.doc);if(t&&!s)return;const{tr:r}=i,{textContent:l}=i.doc;t||Xe(l,0,0,l.length,r,e.type),t=!0;const c=T.combineTransactionSteps(n.doc,[...o]);return T.getChangedRanges(c).forEach(({oldRange:u,newRange:d})=>{Oo(d,i.doc,r,e.type),T.findChildrenInRange(i.doc,d,p=>p.isTextblock).forEach(({node:p,pos:m})=>{Xe(p.textContent,m,u.from,d.to,r,e.type)})}),r}})}const Lo={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Do=T.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",T.mergeAttributes(this.options.HTMLAttributes,e,Lo)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[So({type:this.type})]}}),Io=Vt.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ro=Ye.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",T.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Ao={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default},props:S.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit("mention-click",this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit("mention-hover",{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit("mention-leave",{...this.getMentionData(),event:e})}}};function Bo(e,t,o,n,i,s){const r=a.resolveComponent("dt-link"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(r,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"]),onMouseenter:s.handleMouseEnter,onMouseleave:s.handleMouseLeave,onFocusin:s.handleMouseEnter,onFocusout:s.handleMouseLeave},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1},8,["onClick","onMouseenter","onMouseleave","onFocusin","onFocusout"])]),_:1})}const Mo=F._(Ao,[["render",Bo]]),No=ke.extend({addNodeView(){return S.VueNodeViewRenderer(Mo)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new j.PluginKey("mentionSuggestion")}}),Ho={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default,DtIconLock:$t.DtIconLock,DtStack:ae.default},props:S.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Vo(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-lock"),l=a.resolveComponent("dt-stack"),c=a.resolveComponent("dt-link"),h=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(h,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(c,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"])},{default:a.withCtx(()=>[a.createVNode(l,{direction:"row",gap:"0"},{default:a.withCtx(()=>[e.$props.node.attrs.locked?(a.openBlock(),a.createBlock(r,{key:0,size:"200"})):a.createCommentVNode("",!0),a.createElementVNode("span",null,a.toDisplayString(s.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const $o=F._(Ho,[["render",Vo]]),Po=ke.extend({name:"channel",addNodeView(){return S.VueNodeViewRenderer($o)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new j.PluginKey("channelSuggestion")}}),Uo={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:S.NodeViewWrapper},props:{...S.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var o,n,i;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(i=(n=(o=this.editor)==null?void 0:o.storage)==null?void 0:n["slash-commands"])==null?void 0:i.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function jo(e,t,o,n,i,s){const r=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(r,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1})}const qo=F._(Uo,[["render",jo]]),zo=(e,t)=>[...e.matchAll(t)].map(n=>{let i=n[2];return i.endsWith(" ")||(i+=" "),{index:n.index,text:i,match:n}}),Fo=ke.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return S.VueNodeViewRenderer(qo)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return["command-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[T.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[T.nodePasteRule({find:n=>zo(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new j.PluginKey("slashCommandSuggestion")}}),Ko=100,Wo={name:"VariableComponent",components:{DtBadge:jt.default,DtButton:et.default,DtPopover:Ut.default,DtInput:Pt.default,NodeViewWrapper:S.NodeViewWrapper},props:S.nodeViewProps,data(){return{i18n:new Qe.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:Ko}},computed:{altText:{get(){var e,t;return((t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.altText)||""},set(e){this.updateAttributes({altText:e})}},variableId(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.id},placeholder(){var e;return((e=this.variableData)==null?void 0:e.placeholder)||""},variableItems(){var e,t;return((t=(e=this.extension)==null?void 0:e.options)==null?void 0:t.variableItems)||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function Xo(e,t,o,n,i,s){const r=a.resolveComponent("dt-badge"),l=a.resolveComponent("dt-button"),c=a.resolveComponent("dt-input"),h=a.resolveComponent("dt-popover"),u=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(u,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(h,{padding:"small","navigation-type":"arrow-keys",placement:"top-start",modal:!1},{anchor:a.withCtx(({attrs:d})=>[a.createVNode(l,a.mergeProps(d,{kind:"unstyled"}),{default:a.withCtx(()=>[a.createVNode(r,{text:s.badgeLabel,contenteditable:"false"},null,8,["text"])]),_:1},16)]),content:a.withCtx(({close:d})=>[a.createVNode(c,{modelValue:s.altText,"onUpdate:modelValue":t[0]||(t[0]=f=>s.altText=f),"root-class":"d-p8 d-w332",label:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),placeholder:s.placeholderText,validate:{length:{description:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),message:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:a.withKeys(f=>d(),["enter"])},null,8,["modelValue","label","placeholder","validate","onKeyup"])]),_:1})]),_:1})}const Yo=F._(Wo,[["render",Xo]]),Go=T.Node.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return S.VueNodeViewRenderer(Yo)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-variable-id"),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:"",parseHTML:e=>e.getAttribute("data-alt-text"),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}}}},parseHTML(){return[{tag:"variable"}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return["variable",T.mergeAttributes(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||""}})}}}),Jo={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:qt.default,DtStack:ae.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}},Zo={class:"d-mention-suggestion__name"},Qo={key:1,class:"d-mention-suggestion__divider"},ei={key:2,class:"d-mention-suggestion__status"};function ti(e,t,o,n,i,s){const r=a.resolveComponent("dt-avatar"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,"show-presence":s.showDetails,presence:s.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),a.createVNode(l,{class:"d-mention-suggestion__details-container",gap:"100"},{default:a.withCtx(()=>[a.createElementVNode("span",Zo,a.toDisplayString(s.name),1),s.showDetails?(a.openBlock(),a.createBlock(l,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:a.withCtx(()=>[s.presenceText?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["d-mention-suggestion__presence",[s.presenceFontColorClass]])},a.toDisplayString(s.presenceText),3)):a.createCommentVNode("",!0),s.status&&s.presenceText?(a.openBlock(),a.createElementBlock("div",Qo," • ")):a.createCommentVNode("",!0),s.status?(a.openBlock(),a.createElementBlock("div",ei,a.toDisplayString(s.status),1)):a.createCommentVNode("",!0)]),_:1})):a.createCommentVNode("",!0)]),_:1})]),_:1})}const ni=F._(Jo,[["render",ti]]),oi={allowSpaces:!0,render:ye(ni,"mention")},ii={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:ae.default,DtIconHash:zt,DtIconLock:Ft},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function si(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-hash"),l=a.resolveComponent("dt-icon-lock"),c=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(c,{direction:"row",gap:"400"},{default:a.withCtx(()=>[o.item.locked?(a.openBlock(),a.createBlock(l,{key:1,size:"300"})):(a.openBlock(),a.createBlock(r,{key:0,size:"300"})),a.createElementVNode("span",null,a.toDisplayString(s.name),1)]),_:1})}const ri=F._(ii,[["render",si]]),ai={allowSpaces:!0,render:ye(ri,"channel")},li={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},ci={class:"d-body--md-compact"},di={key:0},ui={class:"d-body--sm d-fc-tertiary"};function hi(e,t,o,n,i,s){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",ci,[a.createElementVNode("span",null,"/"+a.toDisplayString(s.command),1),s.parametersExample?(a.openBlock(),a.createElementBlock("span",di,a.toDisplayString(s.parametersExample),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",ui,a.toDisplayString(s.description),1)])}const fi=F._(li,[["render",hi]]),pi={allowSpaces:!0,startOfLine:!0,render:ye(fi,"slash-command")},mi={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:S.EditorContent,BubbleMenu:zn,DtButton:et.default,DtStack:ae.default},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?de.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return de.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","mention-hover","mention-leave","channel-click"],data(){return{editor:null,appendTo:()=>{var e;return(e=se.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},floatingOptions:{placement:"top-start"},i18n:new Qe.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const o={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n),variable:n=>this.processVariableNode(n)}[e.type];return o?o(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("../../node_modules/@tiptap/vue-3.cjs"),T=require("@tiptap/core"),j=require("@tiptap/pm/state"),_t=require("@tiptap/pm/tables"),a=require("vue"),Tt=require("@tiptap/extension-blockquote"),kt=require("@tiptap/extension-code-block"),Ct=require("@tiptap/extension-code"),Et=require("@tiptap/extension-document"),be=require("@tiptap/extensions"),Ot=require("@tiptap/extension-hard-break"),Ye=require("@tiptap/extension-paragraph"),St=require("@tiptap/extension-bold"),ve=require("@tiptap/extension-list"),Lt=require("@tiptap/extension-italic"),Dt=require("@tiptap/extension-link"),It=require("@tiptap/extension-strike"),Rt=require("@tiptap/extension-underline"),At=require("@tiptap/extension-text"),Bt=require("@tiptap/extension-text-align"),ce=require("@tiptap/extension-table"),Mt=require("@tiptap/extension-text-style"),Nt=require("@tiptap/suggestion"),Ge=require("regex-combined-emojis"),F=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),Je=require("../emoji/emoji.cjs"),ee=require("../../common/emoji/index.cjs"),Ht=require("../list-item/list-item.cjs"),ae=require("../stack/stack.cjs"),se=require("../../common/utils/index.cjs"),Vt=require("@tiptap/extension-image"),ke=require("@tiptap/extension-mention"),Ze=require("../link/link.cjs"),$t=require("@dialpad/dialtone-icons/vue3"),Qe=require("../../localization/index.cjs"),Pt=require("../input/input.cjs"),Ut=require("../popover/popover.cjs"),et=require("../button/button.cjs"),jt=require("../badge/badge.cjs"),de=require("./rich-text-editor-constants.cjs"),qt=require("../avatar/avatar.cjs"),zt=require("@dialpad/dialtone-icons/vue3/hash"),Ft=require("@dialpad/dialtone-icons/vue3/lock"),Kt=require("deep-equal"),tt=["top","right","bottom","left"],Be=["start","end"],Me=tt.reduce((e,t)=>e.concat(t,t+"-"+Be[0],t+"-"+Be[1]),[]),X=Math.min,R=Math.max,ue=Math.round,W=e=>({x:e,y:e}),Wt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function _e(e,t,o){return R(e,X(t,o))}function G(e,t){return typeof e=="function"?e(t):e}function $(e){return e.split("-")[0]}function U(e){return e.split("-")[1]}function nt(e){return e==="x"?"y":"x"}function Ce(e){return e==="y"?"height":"width"}const Yt=new Set(["top","bottom"]);function K(e){return Yt.has($(e))?"y":"x"}function Ee(e){return nt(K(e))}function ot(e,t,o){o===void 0&&(o=!1);const n=U(e),i=Ee(e),s=Ce(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=fe(r)),[r,fe(r)]}function Gt(e){const t=fe(e);return[he(e),t,he(t)]}function he(e){return e.replace(/start|end/g,t=>Xt[t])}const Ne=["left","right"],He=["right","left"],Jt=["top","bottom"],Zt=["bottom","top"];function Qt(e,t,o){switch(e){case"top":case"bottom":return o?t?He:Ne:t?Ne:He;case"left":case"right":return t?Jt:Zt;default:return[]}}function en(e,t,o,n){const i=U(e);let s=Qt($(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(he)))),s}function fe(e){return e.replace(/left|right|bottom|top/g,t=>Wt[t])}function tn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oe(e){return typeof e!="number"?tn(e):{top:e,right:e,bottom:e,left:e}}function ne(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Ve(e,t,o){let{reference:n,floating:i}=e;const s=K(t),r=Ee(t),l=Ce(r),c=$(t),h=s==="y",u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[l]/2-i[l]/2;let p;switch(c){case"top":p={x:u,y:n.y-i.height};break;case"bottom":p={x:u,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-i.width,y:d};break;default:p={x:n.x,y:n.y}}switch(U(t)){case"start":p[r]-=f*(o&&h?-1:1);break;case"end":p[r]+=f*(o&&h?-1:1);break}return p}async function nn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:l,strategy:c}=e,{boundary:h="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=G(t,e),m=Oe(p),w=l[f?d==="floating"?"reference":"floating":d],y=ne(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:h,rootBoundary:u,strategy:c})),v=d==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),_=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},C=ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-C.top+m.top)/_.y,bottom:(C.bottom-y.bottom+m.bottom)/_.y,left:(y.left-C.left+m.left)/_.x,right:(C.right-y.right+m.right)/_.x}}const on=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,l=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let h=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ve(h,n,c),f=n,p={},m=0;for(let w=0;w<l.length;w++){var g;const{name:y,fn:v}=l[w],{x,y:_,data:C,reset:k}=await v({x:u,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:p,rects:h,platform:{...r,detectOverflow:(g=r.detectOverflow)!=null?g:nn},elements:{reference:e,floating:t}});u=x??u,d=_??d,p={...p,[y]:{...p[y],...C}},k&&m<=50&&(m++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(h=k.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ve(h,f,c)),w=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},sn=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:l,middlewareData:c}=t,{element:h,padding:u=0}=G(e,t)||{};if(h==null)return{};const d=Oe(u),f={x:o,y:n},p=Ee(i),m=Ce(p),g=await r.getDimensions(h),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(r.getOffsetParent==null?void 0:r.getOffsetParent(h));let L=k?k[x]:0;(!L||!await(r.isElement==null?void 0:r.isElement(k)))&&(L=l.floating[x]||s.floating[m]);const H=_/2-C/2,D=L/2-g[m]/2-1,b=X(d[y],D),E=X(d[v],D),I=b,A=L-g[m]-E,O=L/2-g[m]/2+H,P=_e(I,O,A),V=!c.arrow&&U(i)!=null&&O!==P&&s.reference[m]/2-(O<I?b:E)-g[m]/2<0,B=V?O<I?O-I:O-A:0;return{[p]:f[p]+B,data:{[p]:P,centerOffset:O-P-B,...V&&{alignmentOffset:B}},reset:V}}});function rn(e,t,o){return(e?[...o.filter(i=>U(i)===e),...o.filter(i=>U(i)!==e)]:o.filter(i=>$(i)===i)).filter(i=>e?U(i)===e||(t?he(i)!==i:!1):!0)}const an=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var o,n,i;const{rects:s,middlewareData:r,placement:l,platform:c,elements:h}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=Me,autoAlignment:p=!0,...m}=G(e,t),g=d!==void 0||f===Me?rn(d||null,p,f):f,w=await c.detectOverflow(t,m),y=((o=r.autoPlacement)==null?void 0:o.index)||0,v=g[y];if(v==null)return{};const x=ot(v,s,await(c.isRTL==null?void 0:c.isRTL(h.floating)));if(l!==v)return{reset:{placement:g[0]}};const _=[w[$(v)],w[x[0]],w[x[1]]],C=[...((n=r.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:_}],k=g[y+1];if(k)return{data:{index:y+1,overflows:C},reset:{placement:k}};const L=C.map(b=>{const E=U(b.placement);return[b.placement,E&&u?b.overflows.slice(0,2).reduce((I,A)=>I+A,0):b.overflows[0],b.overflows]}).sort((b,E)=>b[1]-E[1]),D=((i=L.filter(b=>b[2].slice(0,U(b[0])?2:3).every(E=>E<=0))[0])==null?void 0:i[0])||L[0][0];return D!==l?{data:{index:y+1,overflows:C},reset:{placement:D}}:{}}}},ln=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:c,elements:h}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...w}=G(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const y=$(i),v=K(l),x=$(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(h.floating)),C=f||(x||!g?[fe(l)]:Gt(l)),k=m!=="none";!f&&k&&C.push(...en(l,g,m,_));const L=[l,...C],H=await c.detectOverflow(t,w),D=[];let b=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&D.push(H[y]),d){const O=ot(i,r,_);D.push(H[O[0]],H[O[1]])}if(b=[...b,{placement:i,overflows:D}],!D.every(O=>O<=0)){var E,I;const O=(((E=s.flip)==null?void 0:E.index)||0)+1,P=L[O];if(P&&(!(d==="alignment"?v!==K(P):!1)||b.every(M=>K(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:O,overflows:b},reset:{placement:P}};let V=(I=b.filter(B=>B.overflows[0]<=0).sort((B,M)=>B.overflows[1]-M.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(p){case"bestFit":{var A;const B=(A=b.filter(M=>{if(k){const Z=K(M.placement);return Z===v||Z==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Z=>Z>0).reduce((Z,xt)=>Z+xt,0)]).sort((M,Z)=>M[1]-Z[1])[0])==null?void 0:A[0];B&&(V=B);break}case"initialPlacement":V=l;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function $e(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return tt.some(t=>e[t]>=0)}const cn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=G(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=$e(r,o.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Pe(l)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),l=$e(r,o.floating);return{data:{escapedOffsets:l,escaped:Pe(l)}}}default:return{}}}}};function it(e){const t=X(...e.map(s=>s.left)),o=X(...e.map(s=>s.top)),n=R(...e.map(s=>s.right)),i=R(...e.map(s=>s.bottom));return{x:t,y:o,width:n-t,height:i-o}}function dn(e){const t=e.slice().sort((i,s)=>i.y-s.y),o=[];let n=null;for(let i=0;i<t.length;i++){const s=t[i];!n||s.y-n.y>n.height/2?o.push([s]):o[o.length-1].push(s),n=s}return o.map(i=>ne(it(i)))}const un=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:n,rects:i,platform:s,strategy:r}=t,{padding:l=2,x:c,y:h}=G(e,t),u=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=dn(u),f=ne(it(u)),p=Oe(l);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&h!=null)return d.find(w=>c>w.left-p.left&&c<w.right+p.right&&h>w.top-p.top&&h<w.bottom+p.bottom)||f;if(d.length>=2){if(K(o)==="y"){const b=d[0],E=d[d.length-1],I=$(o)==="top",A=b.top,O=E.bottom,P=I?b.left:E.left,V=I?b.right:E.right,B=V-P,M=O-A;return{top:A,bottom:O,left:P,right:V,width:B,height:M,x:P,y:A}}const w=$(o)==="left",y=R(...d.map(b=>b.right)),v=X(...d.map(b=>b.left)),x=d.filter(b=>w?b.left===v:b.right===y),_=x[0].top,C=x[x.length-1].bottom,k=v,L=y,H=L-k,D=C-_;return{top:_,bottom:C,left:k,right:L,width:H,height:D,x:k,y:_}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:r});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},hn=new Set(["left","top"]);async function fn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=$(o),l=U(o),c=K(o)==="y",h=hn.has(r)?-1:1,u=s&&c?-1:1,d=G(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof m=="number"&&(p=l==="end"?m*-1:m),c?{x:p*u,y:f*h}:{x:f*h,y:p*u}}const pn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:l}=t,c=await fn(t,e);return r===((o=l.offset)==null?void 0:o.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:r}}}}},mn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...h}=G(e,t),u={x:o,y:n},d=await s.detectOverflow(t,h),f=K($(i)),p=nt(f);let m=u[p],g=u[f];if(r){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+d[y],_=m-d[v];m=_e(x,m,_)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[y],_=g-d[v];g=_e(x,g,_)}const w=c.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-o,y:w.y-n,enabled:{[p]:r,[f]:l}}}}}},gn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:l}=t,{apply:c=()=>{},...h}=G(e,t),u=await r.detectOverflow(t,h),d=$(i),f=U(i),p=K(i)==="y",{width:m,height:g}=s.floating;let w,y;d==="top"||d==="bottom"?(w=d,y=f===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,w=f==="end"?"top":"bottom");const v=g-u.top-u.bottom,x=m-u.left-u.right,_=X(g-u[w],v),C=X(m-u[y],x),k=!t.middlewareData.shift;let L=_,H=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(H=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(L=v),k&&!f){const b=R(u.left,0),E=R(u.right,0),I=R(u.top,0),A=R(u.bottom,0);p?H=m-2*(b!==0||E!==0?b+E:R(u.left,u.right)):L=g-2*(I!==0||A!==0?I+A:R(u.top,u.bottom))}await c({...t,availableWidth:H,availableHeight:L});const D=await r.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function pe(){return typeof window<"u"}function ie(e){return st(e)?(e.nodeName||"").toLowerCase():"#document"}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){var t;return(t=(st(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function st(e){return pe()?e instanceof Node||e instanceof N(e).Node:!1}function q(e){return pe()?e instanceof Element||e instanceof N(e).Element:!1}function Y(e){return pe()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ue(e){return!pe()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}const wn=new Set(["inline","contents"]);function le(e){const{overflow:t,overflowX:o,overflowY:n,display:i}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+o)&&!wn.has(i)}const yn=new Set(["table","td","th"]);function bn(e){return yn.has(ie(e))}const vn=[":popover-open",":modal"];function me(e){return vn.some(t=>{try{return e.matches(t)}catch{return!1}})}const xn=["transform","translate","scale","rotate","perspective"],_n=["transform","translate","scale","rotate","perspective","filter"],Tn=["paint","layout","strict","content"];function Se(e){const t=Le(),o=q(e)?z(e):e;return xn.some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||_n.some(n=>(o.willChange||"").includes(n))||Tn.some(n=>(o.contain||"").includes(n))}function kn(e){let t=Q(e);for(;Y(t)&&!oe(t);){if(Se(t))return t;if(me(t))return null;t=Q(t)}return null}function Le(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Cn=new Set(["html","body","#document"]);function oe(e){return Cn.has(ie(e))}function z(e){return N(e).getComputedStyle(e)}function ge(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(ie(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ue(e)&&e.host||J(e);return Ue(t)?t.host:t}function rt(e){const t=Q(e);return oe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Y(t)&&le(t)?t:rt(t)}function at(e,t,o){var n;t===void 0&&(t=[]);const i=rt(e),s=i===((n=e.ownerDocument)==null?void 0:n.body),r=N(i);return s?t.concat(r,r.visualViewport||[],le(i)?i:[],[]):t.concat(i,at(i,[]))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lt(e){const t=z(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=Y(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,l=ue(o)!==s||ue(n)!==r;return l&&(o=s,n=r),{width:o,height:n,$:l}}function ct(e){return q(e)?e:e.contextElement}function te(e){const t=ct(e);if(!Y(t))return W(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=lt(t);let r=(s?ue(o.width):o.width)/n,l=(s?ue(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const En=W(0);function dt(e){const t=N(e);return!Le()||!t.visualViewport?En:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function On(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==N(e)?!1:t}function re(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=ct(e);let r=W(1);t&&(n?q(n)&&(r=te(n)):r=te(e));const l=On(s,o,n)?dt(s):W(0);let c=(i.left+l.x)/r.x,h=(i.top+l.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s){const f=N(s),p=n&&q(n)?N(n):n;let m=f,g=je(m);for(;g&&n&&p!==m;){const w=te(g),y=g.getBoundingClientRect(),v=z(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,h*=w.y,u*=w.x,d*=w.y,c+=x,h+=_,m=N(g),g=je(m)}}return ne({width:u,height:d,x:c,y:h})}function we(e,t){const o=ge(e).scrollLeft;return t?t.left+o:re(J(e)).left+o}function ut(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-we(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function Sn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=J(n),l=t?me(t.floating):!1;if(n===r||l&&s)return o;let c={scrollLeft:0,scrollTop:0},h=W(1);const u=W(0),d=Y(n);if((d||!d&&!s)&&((ie(n)!=="body"||le(r))&&(c=ge(n)),Y(n))){const p=re(n);h=te(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}const f=r&&!d&&!s?ut(r,c):W(0);return{width:o.width*h.x,height:o.height*h.y,x:o.x*h.x-c.scrollLeft*h.x+u.x+f.x,y:o.y*h.y-c.scrollTop*h.y+u.y+f.y}}function Ln(e){return Array.from(e.getClientRects())}function Dn(e){const t=J(e),o=ge(e),n=e.ownerDocument.body,i=R(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=R(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+we(e);const l=-o.scrollTop;return z(n).direction==="rtl"&&(r+=R(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:l}}const qe=25;function In(e,t){const o=N(e),n=J(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,l=0,c=0;if(i){s=i.width,r=i.height;const u=Le();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const h=we(n);if(h<=0){const u=n.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=qe&&(s-=m)}else h<=qe&&(s+=h);return{width:s,height:r,x:l,y:c}}const Rn=new Set(["absolute","fixed"]);function An(e,t){const o=re(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=Y(e)?te(e):W(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,h=n*s.y;return{width:r,height:l,x:c,y:h}}function ze(e,t,o){let n;if(t==="viewport")n=In(e,o);else if(t==="document")n=Dn(J(e));else if(q(t))n=An(t,o);else{const i=dt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ne(n)}function ht(e,t){const o=Q(e);return o===t||!q(o)||oe(o)?!1:z(o).position==="fixed"||ht(o,t)}function Bn(e,t){const o=t.get(e);if(o)return o;let n=at(e,[]).filter(l=>q(l)&&ie(l)!=="body"),i=null;const s=z(e).position==="fixed";let r=s?Q(e):e;for(;q(r)&&!oe(r);){const l=z(r),c=Se(r);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&Rn.has(i.position)||le(r)&&!c&&ht(e,r))?n=n.filter(u=>u!==r):i=l,r=Q(r)}return t.set(e,n),n}function Mn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?me(t)?[]:Bn(t,this._c):[].concat(o),n],l=r[0],c=r.reduce((h,u)=>{const d=ze(t,u,i);return h.top=R(d.top,h.top),h.right=X(d.right,h.right),h.bottom=X(d.bottom,h.bottom),h.left=R(d.left,h.left),h},ze(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Nn(e){const{width:t,height:o}=lt(e);return{width:t,height:o}}function Hn(e,t,o){const n=Y(t),i=J(t),s=o==="fixed",r=re(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=W(0);function h(){c.x=we(i)}if(n||!n&&!s)if((ie(t)!=="body"||le(i))&&(l=ge(t)),n){const p=re(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&h();s&&!n&&i&&h();const u=i&&!n&&!s?ut(i,l):W(0),d=r.left+l.scrollLeft-c.x-u.x,f=r.top+l.scrollTop-c.y-u.y;return{x:d,y:f,width:r.width,height:r.height}}function xe(e){return z(e).position==="static"}function Fe(e,t){if(!Y(e)||z(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return J(e)===o&&(o=o.ownerDocument.body),o}function ft(e,t){const o=N(e);if(me(e))return o;if(!Y(e)){let i=Q(e);for(;i&&!oe(i);){if(q(i)&&!xe(i))return i;i=Q(i)}return o}let n=Fe(e,t);for(;n&&bn(n)&&xe(n);)n=Fe(n,t);return n&&oe(n)&&xe(n)&&!Se(n)?o:n||kn(e)||o}const Vn=async function(e){const t=this.getOffsetParent||ft,o=this.getDimensions,n=await o(e.floating);return{reference:Hn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function $n(e){return z(e).direction==="rtl"}const Pn={convertOffsetParentRelativeRectToViewportRelativeRect:Sn,getDocumentElement:J,getClippingRect:Mn,getOffsetParent:ft,getElementRects:Vn,getClientRects:Ln,getDimensions:Nn,getScale:te,isElement:q,isRTL:$n},De=pn,pt=an,Ie=mn,Re=ln,mt=gn,gt=cn,wt=sn,yt=un,Ae=(e,t,o)=>{const n=new Map,i={platform:Pn,...o},s={...i.platform,_c:n};return on(e,t,{...i,platform:s})};function Un(e,t){const o=Math.min(e.top,t.top),n=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),r=Math.max(e.right,t.right)-i,l=n-o,c=i,h=o;return new DOMRect(c,h,r,l)}var jn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:r,getReferencedVirtualElement:l,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:u,state:d,from:f,to:p})=>{const{doc:m,selection:g}=d,{empty:w}=g,y=!m.textBetween(f,p).length&&T.isTextSelection(d.selection),v=this.element.contains(document.activeElement);return!(!(u.hasFocus()||v)||w||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(u,d)=>{const f=!(d!=null&&d.selection.eq(u.state.selection)),p=!(d!=null&&d.doc.eq(u.state.doc));!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(u,f,p,d)},this.updateDelay))},this.updateHandler=(u,d,f,p)=>{const{composing:m}=u;if(m||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:u})=>{const d=u.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var h;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(h=c==null?void 0:c.scrollTarget)!=null?h:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Re(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}get virtualElement(){var e,t,o;const{selection:n}=this.editor.state,i=(e=this.getReferencedVirtualElement)==null?void 0:e.call(this);if(i)return i;if(!((o=(t=this.view)==null?void 0:t.dom)!=null&&o.parentNode))return;const s=T.posToDOMRect(this.view,n.from,n.to);let r={getBoundingClientRect:()=>s,getClientRects:()=>[s]};if(n instanceof j.NodeSelection){let l=this.view.nodeDOM(n.from);const c=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");c&&(l=c),l&&(r={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(n instanceof _t.CellSelection){const{$anchorCell:l,$headCell:c}=n,h=l?l.pos:c.pos,u=c?c.pos:l.pos,d=this.view.nodeDOM(h),f=this.view.nodeDOM(u);if(!d||!f)return;const p=d===f?d.getBoundingClientRect():Un(d.getBoundingClientRect(),f.getBoundingClientRect());r={getBoundingClientRect:()=>p,getClientRects:()=>[p]}}return r}updatePosition(){const e=this.virtualElement;e&&Ae(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:t,y:o,strategy:n,middlewareData:i})=>{var s,r;if((s=i.hide)!=null&&s.referenceHidden||(r=i.hide)!=null&&r.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${t}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const{state:o}=e,n=o.selection.from!==o.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(e,t);return}const i=!(t!=null&&t.selection.eq(e.state.selection)),s=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,i,s,t)}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return((t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:e,from:s,to:r}))||!1}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},qn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new jn({view:t,...e})}),zn=a.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{editor:i,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}=e,f=n.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),a.nextTick(()=>{i.registerPlugin(qn({editor:i,element:f,options:s,pluginKey:r,resizeDelay:l,appendTo:c,shouldShow:h,getReferencedVirtualElement:u,updateDelay:d}))}))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}}),Fn=class{constructor({editor:e,element:t,view:o,updateDelay:n=250,resizeDelay:i=60,options:s,appendTo:r,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:h,state:u})=>{const{selection:d}=u,{$anchor:f,empty:p}=d,m=f.depth===1,g=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!h.hasFocus()||!p||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(h,u,d,f)=>{const{composing:p}=h;if(p||!u&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.preventHide){this.preventHide=!1;return}h!=null&&h.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(h.relatedTarget))||(h==null?void 0:h.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:h})=>{const u=h.getMeta("floatingMenu");u==="updatePosition"?this.updatePosition():u&&typeof u=="object"&&u.type==="updateOptions"&&this.updateOptions(u.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var c;this.editor=e,this.element=t,this.view=o,this.updateDelay=n,this.resizeDelay=i,this.appendTo=r,this.scrollTarget=(c=s==null?void 0:s.scrollTarget)!=null?c:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return T.getText(e,{textSerializers:T.getTextSerializersFromSchema(this.editor.schema)})}get middlewares(){const e=[];return this.floatingUIOptions.flip&&e.push(Re(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&e.push(Ie(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&e.push(De(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&e.push(wt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(mt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&e.push(pt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&e.push(gt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&e.push(yt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),e}getShouldShow(e){var t;const{state:o}=this.view,{selection:n}=o,{ranges:i}=n,s=Math.min(...i.map(c=>c.$from.pos)),r=Math.max(...i.map(c=>c.$to.pos));return(t=this.shouldShow)==null?void 0:t.call(this,{editor:this.editor,view:this.view,state:o,oldState:e,from:s,to:r})}updateOptions(e){var t;if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){const o=(t=e.options.scrollTarget)!=null?t:window;o!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=o,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){const{selection:e}=this.editor.state,t=T.posToDOMRect(this.view,e.from,e.to);Ae({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s,middlewareData:r})=>{var l,c;if((l=r.hide)!=null&&l.referenceHidden||(c=r.hide)!=null&&c.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){const o=!(t!=null&&t.selection.eq(e.state.selection)),n=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,n,t)}show(){var e;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const t=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(e=t??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Kn=e=>new j.Plugin({key:typeof e.pluginKey=="string"?new j.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Fn({view:t,...e})});a.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:o}){const n=a.ref(null);return a.onMounted(()=>{const{pluginKey:i,editor:s,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u}=e,d=n.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),s.registerPlugin(Kn({pluginKey:i,editor:s,element:d,updateDelay:r,resizeDelay:l,options:c,appendTo:h,shouldShow:u})))}),a.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=e;s.unregisterPlugin(i)}),()=>{var i;return a.h("div",{ref:n,...o},(i=t.default)==null?void 0:i.call(t))}}});const Wn={compatConfig:{MODE:3},name:"EmojiComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtEmoji:Je.default},props:S.nodeViewProps};function Xn(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:a.withCtx(()=>[a.createVNode(r,{size:"500",code:e.node.attrs.code},null,8,["code"])]),_:1})}const Yn=F._(Wn,[["render",Xn]]),Gn={compatConfig:{MODE:3},name:"SuggestionList",components:{DtListItem:Ht.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case"channel":this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case"slash-command":this.command({command:t.command});break}}}},Jn={class:"d-popover__dialog d-suggestion-list__container"},Zn={ref:"suggestionList",class:"d-suggestion-list"};function Qn(e,t,o,n,i,s){const r=a.resolveComponent("dt-list-item");return a.openBlock(),a.createElementBlock("div",Jn,[a.withDirectives(a.createElementVNode("ul",Zn,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.items,(l,c)=>(a.openBlock(),a.createBlock(r,{key:l.id,class:a.normalizeClass(["d-suggestion-list__item",{"d-list-item--highlighted":c===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:h=>s.selectItem(c),onKeydown:a.withModifiers(s.onKeyDown,["prevent"])},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(o.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[a.vShow,o.items.length]])])}const eo=F._(Gn,[["render",Qn]]),bt="top-start",vt="650";function to(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function Ke(e){return{getBoundingClientRect:e}}async function no(e,t,o={}){if(!e||!(t!=null&&t.getBoundingClientRect))return;const{placement:n=bt,middleware:i=[De(0),Re(),Ie({padding:8})]}=o,{x:s,y:r}=await Ae(t,e,{placement:n,middleware:i});Object.assign(e.style,{left:`${s}px`,top:`${r}px`})}function oo(e,t={}){const{zIndex:o=vt}=t;e.style.position="absolute",e.style.zIndex=o,e.style.display="none"}function io(e){e&&(e.style.display="block")}function so(e){e&&(e.style.display="none")}function ro(e,t){return o=>{o.key==="Escape"&&t()&&e()}}function ao(e){document.addEventListener("keydown",e)}function lo(e){document.removeEventListener("keydown",e)}function co(e,t,o,n){return new S.VueRenderer(e,{props:{itemComponent:a.markRaw(t),itemType:o,...n},editor:n.editor})}function uo(e){var t,o;e.escHandler&&lo(e.escHandler),(t=e.floatingEl)==null||t.remove(),(o=e.component)==null||o.destroy()}function ye(e,t,o={}){const{listComponent:n=eo,placement:i=bt,zIndex:s=vt}=o;return()=>{let r=null,l=null,c=!1,h=to(),u=null;function d(){no(l,h,{placement:i})}function f(){l&&(io(l),c=!0,d())}function p(){l&&(so(l),c=!1)}return{onStart:m=>{r=co(n,e,t,m),m.clientRect&&(l=r.element,oo(l,{zIndex:s}),document.body.appendChild(l),h=Ke(m.clientRect),u=ro(p,()=>c),ao(u),m.items.length>0&&f())},onUpdate(m){r==null||r.updateProps(m),m.items.length>0?f():p(),m.clientRect&&(h=Ke(m.clientRect),d())},onKeyDown(m){var g;if(c)return(g=r==null?void 0:r.ref)==null?void 0:g.onKeyDown(m)},onExit(){uo({escHandler:u,floatingEl:l,component:r}),u=null,l=null,r=null}}}}const ho={compatConfig:{MODE:3},name:"EmojiSuggestion",components:{DtEmoji:Je.default,DtStack:ae.default},props:{item:{type:Object,required:!0}}};function fo(e,t,o,n,i,s){const r=a.resolveComponent("dt-emoji"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{size:"200",code:o.item.code},null,8,["code"]),a.createTextVNode(" "+a.toDisplayString(o.item.code),1)]),_:1})}const po=F._(ho,[["render",fo]]),mo=20,go=(e,t,o)=>{var l,c;const n=(l=e.shortname)==null?void 0:l.replaceAll(":",""),i=(c=t.shortname)==null?void 0:c.replaceAll(":",""),s=n.startsWith(o),r=i.startsWith(o);return s&&!r?-1:!s&&r?1:n.localeCompare(i)},wo={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(ee.getEmojiData());return e=e.toLowerCase(),t.filter(n=>{var i;return[n.name,(i=n.shortname)==null?void 0:i.replaceAll(":",""),...n.keywords||[]].some(s=>s&&s.startsWith(e))}).splice(0,mo).sort((n,i)=>go(n,i,e)).map(n=>({code:n.shortname}))},command:({editor:e,range:t,props:o})=>{var s,r;const n=e.view.state.selection.$to.nodeAfter;((s=n==null?void 0:n.text)==null?void 0:s.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:o}]).run(),(r=window.getSelection())==null||r.collapseToEnd()},render:ye(po,"emoji")},yo=/(:\w+:)$/,bo=new RegExp(Ge.emojiPattern+"$"),vo=e=>{if(e&&ee.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},xo=e=>[...e.matchAll(ee.emojiShortCodeRegex)].filter(o=>ee.codeToEmojiData(o[0])).map(o=>({index:o.index,text:o[0],match:o})),_o=T.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return S.VueNodeViewRenderer(Yn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return ee.stringToUnicode(ee.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new T.InputRule({find:e=>{const t=e.match(yo)||e.match(bo);if(t)return vo(t)},handler:({state:e,range:t,match:o})=>{const{tr:n}=e,i=t.from,s=t.to;n.replaceWith(i,s,this.type.create({code:o[0]}))}})]},addPasteRules(){return[T.nodePasteRule({find:xo,type:this.type,getAttributes(e){return{code:e[0]}}}),T.nodePasteRule({find:ee.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[Nt({char:":",pluginKey:new j.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...wo})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let o=!1;const{selection:n}=t,{empty:i,anchor:s}=n;return i?(t.doc.nodesBetween(s-1,s,(r,l)=>{if(r.type.name===this.name)return o=!0,e.insertText("",l,l+r.nodeSize),!1}),o):!1})}}});function To(e,t,o=()=>!0){const n=[];t.lastIndex=0;let i;for(;i=t.exec(e);)o(e,i)&&n.push(i);return n}function ko(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Co(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function Eo(e,t){const o=e.slice(0,t+1).search(/\S+\s*$/),n=e.slice(t).search(/\s/);if(n<0){const i=e.slice(o);return{text:i,from:o,to:o+i.length}}return{text:e.slice(o,n+t),from:o,to:n+t}}function Te(e,t,o,n){const i=Eo(e,t);if(n.lastIndex=0,!n.test(i.text))return i;const s=o==="left"?i.from-1:i.to+1;return s<=0||s>=e.length||s===t?i:Te(e,s,o,n)}function Oo(e,t,o,n){const i=Math.max(e.from-1,0),s=Math.min(e.to+1,t.content.size),r=T.getMarksBetween(i,s,t);for(const l of r)l.mark.type===n&&o.removeMark(l.from,l.to,n)}const We=se.getPhoneNumberRegex(1,15);function Xe(e,t,o,n,i,s){if(!e)return;let r=o-t-1;r=r<0?0:r;const l=n-t,c=Te(e,r,"left",We),h=Te(e,l,"right",We),u=e.slice(c.from,h.to);To(u,se.linkRegex,ko).forEach(f=>{const p=Co(f[0]),m=t+c.from+f.index+1,g=m+p.length;i.addMark(m,g,s.create())})}function So(e){let t=!1;return new j.Plugin({key:new j.PluginKey("autolink"),appendTransaction:(o,n,i)=>{const s=o.some(u=>u.docChanged)&&!n.doc.eq(i.doc);if(t&&!s)return;const{tr:r}=i,{textContent:l}=i.doc;t||Xe(l,0,0,l.length,r,e.type),t=!0;const c=T.combineTransactionSteps(n.doc,[...o]);return T.getChangedRanges(c).forEach(({oldRange:u,newRange:d})=>{Oo(d,i.doc,r,e.type),T.findChildrenInRange(i.doc,d,p=>p.isTextblock).forEach(({node:p,pos:m})=>{Xe(p.textContent,m,u.from,d.to,r,e.type)})}),r}})}const Lo={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Do=T.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",T.mergeAttributes(this.options.HTMLAttributes,e,Lo)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[So({type:this.type})]}}),Io=Vt.extend({name:"ConfigurableImage",addAttributes(){return{src:{default:""},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),Ro=Ye.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",T.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Ao={compatConfig:{MODE:3},name:"MentionComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default},props:S.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit("mention-click",this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit("mention-hover",{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit("mention-leave",{...this.getMentionData(),event:e})}}};function Bo(e,t,o,n,i,s){const r=a.resolveComponent("dt-link"),l=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(l,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(r,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"]),onMouseenter:s.handleMouseEnter,onMouseleave:s.handleMouseLeave,onFocusin:s.handleMouseEnter,onFocusout:s.handleMouseLeave},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1},8,["onClick","onMouseenter","onMouseleave","onFocusin","onFocusout"])]),_:1})}const Mo=F._(Ao,[["render",Bo]]),No=ke.extend({addNodeView(){return S.VueNodeViewRenderer(Mo)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""},contactKey:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new j.PluginKey("mentionSuggestion")}}),Ho={compatConfig:{MODE:3},name:"ChannelComponent",components:{NodeViewWrapper:S.NodeViewWrapper,DtLink:Ze.default,DtIconLock:$t.DtIconLock,DtStack:ae.default},props:S.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:"#"+this.$props.node.attrs.name}},methods:{handleClick(){const e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit("channel-click",e)}}};function Vo(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-lock"),l=a.resolveComponent("dt-stack"),c=a.resolveComponent("dt-link"),h=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(h,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(c,{kind:"mention",onClick:a.withModifiers(s.handleClick,["prevent"])},{default:a.withCtx(()=>[a.createVNode(l,{direction:"row",gap:"0"},{default:a.withCtx(()=>[e.$props.node.attrs.locked?(a.openBlock(),a.createBlock(r,{key:0,size:"200"})):a.createCommentVNode("",!0),a.createElementVNode("span",null,a.toDisplayString(s.text),1)]),_:1})]),_:1},8,["onClick"])]),_:1})}const $o=F._(Ho,[["render",Vo]]),Po=ke.extend({name:"channel",addNodeView(){return S.VueNodeViewRenderer($o)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1},channelKey:{default:""}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",T.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new j.PluginKey("channelSuggestion")}}),Uo={compatConfig:{MODE:3},name:"SlashCommandsComponent",components:{NodeViewWrapper:S.NodeViewWrapper},props:{...S.nodeViewProps},emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){var o,n,i;const e=this.$props.node.attrs.command;this.$emit("selected-command",e);const t=(i=(n=(o=this.editor)==null?void 0:o.storage)==null?void 0:n["slash-commands"])==null?void 0:i.onSelectedCommand;t&&typeof t=="function"&&t(e)}};function jo(e,t,o,n,i,s){const r=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(r,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(s.text),1)]),_:1})}const qo=F._(Uo,[["render",jo]]),zo=(e,t)=>[...e.matchAll(t)].map(n=>{let i=n[2];return i.endsWith(" ")||(i+=" "),{index:n.index,text:i,match:n}}),Fo=ke.extend({name:"slash-commands",group:"inline",inline:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return S.VueNodeViewRenderer(qo)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return["command-component",T.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[T.nodeInputRule({find:t,type:this.type,getAttributes(n){return{command:n[2]}}})]},addPasteRules(){var o;const e=(o=this.options.suggestion)==null?void 0:o.items({query:""}).map(n=>n.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[T.nodePasteRule({find:n=>zo(n,t),type:this.type,getAttributes(n){return{command:n[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new j.PluginKey("slashCommandSuggestion")}}),Ko=100,Wo={name:"VariableComponent",components:{DtBadge:jt.default,DtButton:et.default,DtPopover:Ut.default,DtInput:Pt.default,NodeViewWrapper:S.NodeViewWrapper},props:S.nodeViewProps,data(){return{i18n:new Qe.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:Ko}},computed:{altText:{get(){var e,t;return((t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.altText)||""},set(e){this.updateAttributes({altText:e})}},variableId(){var e,t;return(t=(e=this.node)==null?void 0:e.attrs)==null?void 0:t.id},placeholder(){var e;return((e=this.variableData)==null?void 0:e.placeholder)||""},variableItems(){var e,t;return((t=(e=this.extension)==null?void 0:e.options)==null?void 0:t.variableItems)||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function Xo(e,t,o,n,i,s){const r=a.resolveComponent("dt-badge"),l=a.resolveComponent("dt-button"),c=a.resolveComponent("dt-input"),h=a.resolveComponent("dt-popover"),u=a.resolveComponent("node-view-wrapper");return a.openBlock(),a.createBlock(u,{class:"d-d-inline-block"},{default:a.withCtx(()=>[a.createVNode(h,{padding:"small","navigation-type":"arrow-keys",placement:"top-start",modal:!1},{anchor:a.withCtx(({attrs:d})=>[a.createVNode(l,a.mergeProps(d,{kind:"unstyled"}),{default:a.withCtx(()=>[a.createVNode(r,{text:s.badgeLabel,contenteditable:"false"},null,8,["text"])]),_:1},16)]),content:a.withCtx(({close:d})=>[a.createVNode(c,{modelValue:s.altText,"onUpdate:modelValue":t[0]||(t[0]=f=>s.altText=f),"root-class":"d-p8 d-w332",label:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),placeholder:s.placeholderText,validate:{length:{description:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),message:i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:a.withKeys(f=>d(),["enter"])},null,8,["modelValue","label","placeholder","validate","onKeyup"])]),_:1})]),_:1})}const Yo=F._(Wo,[["render",Xo]]),Go=T.Node.create({name:"variable",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return S.VueNodeViewRenderer(Yo)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-variable-id"),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:"",parseHTML:e=>e.getAttribute("data-alt-text"),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}}}},parseHTML(){return[{tag:"variable"}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return["variable",T.mergeAttributes(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||""}})}}}),Jo={compatConfig:{MODE:3},name:"MentionSuggestion",components:{DtAvatar:qt.default,DtStack:ae.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}},Zo={class:"d-mention-suggestion__name"},Qo={key:1,class:"d-mention-suggestion__divider"},ei={key:2,class:"d-mention-suggestion__status"};function ti(e,t,o,n,i,s){const r=a.resolveComponent("dt-avatar"),l=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(l,{direction:"row",class:"d-mention-suggestion__container",gap:"400"},{default:a.withCtx(()=>[a.createVNode(r,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,"show-presence":s.showDetails,presence:s.presence,size:"sm"},null,8,["full-name","image-src","image-alt","show-presence","presence"]),a.createVNode(l,{class:"d-mention-suggestion__details-container",gap:"100"},{default:a.withCtx(()=>[a.createElementVNode("span",Zo,a.toDisplayString(s.name),1),s.showDetails?(a.openBlock(),a.createBlock(l,{key:0,direction:"row",gap:"300",class:"d-label--sm-plain"},{default:a.withCtx(()=>[s.presenceText?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["d-mention-suggestion__presence",[s.presenceFontColorClass]])},a.toDisplayString(s.presenceText),3)):a.createCommentVNode("",!0),s.status&&s.presenceText?(a.openBlock(),a.createElementBlock("div",Qo," • ")):a.createCommentVNode("",!0),s.status?(a.openBlock(),a.createElementBlock("div",ei,a.toDisplayString(s.status),1)):a.createCommentVNode("",!0)]),_:1})):a.createCommentVNode("",!0)]),_:1})]),_:1})}const ni=F._(Jo,[["render",ti]]),oi={allowSpaces:!0,render:ye(ni,"mention")},ii={compatConfig:{MODE:3},name:"ChannelSuggestion",components:{DtStack:ae.default,DtIconHash:zt,DtIconLock:Ft},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function si(e,t,o,n,i,s){const r=a.resolveComponent("dt-icon-hash"),l=a.resolveComponent("dt-icon-lock"),c=a.resolveComponent("dt-stack");return a.openBlock(),a.createBlock(c,{direction:"row",gap:"400"},{default:a.withCtx(()=>[o.item.locked?(a.openBlock(),a.createBlock(l,{key:1,size:"300"})):(a.openBlock(),a.createBlock(r,{key:0,size:"300"})),a.createElementVNode("span",null,a.toDisplayString(s.name),1)]),_:1})}const ri=F._(ii,[["render",si]]),ai={allowSpaces:!0,render:ye(ri,"channel")},li={compatConfig:{MODE:3},name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},ci={class:"d-body--md-compact"},di={key:0},ui={class:"d-body--sm d-fc-tertiary"};function hi(e,t,o,n,i,s){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",ci,[a.createElementVNode("span",null,"/"+a.toDisplayString(s.command),1),s.parametersExample?(a.openBlock(),a.createElementBlock("span",di,a.toDisplayString(s.parametersExample),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",ui,a.toDisplayString(s.description),1)])}const fi=F._(li,[["render",hi]]),pi={allowSpaces:!0,startOfLine:!0,render:ye(fi,"slash-command")},mi={compatConfig:{MODE:3},name:"DtRichTextEditor",components:{EditorContent:S.EditorContent,BubbleMenu:zn,DtButton:et.default,DtStack:ae.default},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?de.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return de.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","markdown-input","update:modelValue","blur","focus","enter","edit-link","selected","selected-command","mention-click","mention-hover","mention-leave","channel-click"],data(){return{editor:null,appendTo:()=>{var e;return(e=se.returnFirstEl(this.$refs.editor.$el).getRootNode())==null?void 0:e.querySelector("body")},floatingOptions:{placement:"top-start"},i18n:new Qe.DialtoneLocalization,jsonToMarkdownConverter:{convertToMarkdown(e){return this.processNode(e)},processNodeContent(e){return e.content?e.content.map(t=>this.processNode(t)).join(""):""},processNode(e){if(!e)return"";const o={doc:n=>this.processDocNode(n),paragraph:n=>this.processParagraphNode(n),text:n=>this.processTextNode(n),hardBreak:()=>this.processHardBreakNode(),blockquote:n=>this.processBlockquoteNode(n),bulletList:n=>this.processBulletListNode(n),orderedList:n=>this.processOrderedListNode(n),listItem:n=>this.processListItemNode(n),codeBlock:n=>this.processCodeBlockNode(n),mention:n=>this.processMentionNode(n),channel:n=>this.processChannelNode(n),"slash-commands":n=>this.processSlashCommandsNode(n),emoji:n=>this.processEmojiNode(n),variable:n=>this.processVariableNode(n)}[e.type];return o?o(e):this.processUnknownNode(e)},processDocNode(e){return this.processNodeContent(e)},processParagraphNode(e){const t=this.processNodeContent(e);return t?t+`
2
2
  `:`
3
3
  `},processTextNode(e){let t=e.text||"";return e.marks&&(t=this.applyMarks(t,e.marks)),t},processHardBreakNode(){return`
4
4
  `},processBlockquoteNode(e){return this.processNodeContent(e).split(`
@@ -9,7 +9,7 @@
9
9
  ${this.processNodeContent(e)}
10
10
  \`\`\``},processMentionNode(e){var i,s,r;const t=((i=e.attrs)==null?void 0:i.name)||"",o=((s=e.attrs)==null?void 0:s.id)||"",n=((r=e.attrs)==null?void 0:r.contactKey)||"";return`<!-- @mention: {"id": "${o}", "contactKey": "${n}", "name": "${t}"} -->`},processChannelNode(e){var s,r,l,c;const t=((s=e.attrs)==null?void 0:s.name)||"",o=((r=e.attrs)==null?void 0:r.id)||"",n=((l=e.attrs)==null?void 0:l.locked.toString())||"",i=((c=e.attrs)==null?void 0:c.channelKey)||"";return`<!-- @channel: {"id": "${o}", "channelKey": "${i}", "name": "${t}", "locked": "${n}"} -->`},processSlashCommandsNode(e){var n,i;const t=((n=e.attrs)==null?void 0:n.command)||"",o=((i=e.attrs)==null?void 0:i.parameters)||"";return`/${t}${o?` ${o}`:""}`},processEmojiNode(e){var t;return((t=e.attrs)==null?void 0:t.code)||""},processVariableNode(e){var n,i;const t=((n=e.attrs)==null?void 0:n.id)||"",o=((i=e.attrs)==null?void 0:i.altText)||"";return`{{${t}=${o}}}`},processUnknownNode(e){return this.processNodeContent(e)},applyMarks(e,t){let o=e;return[...t].sort((i,s)=>{const r={link:0,bold:1,italic:2,strike:3,code:4};return(r[i.type]||5)-(r[s.type]||5)}).forEach(i=>{var s;switch(i.type){case"bold":o=`**${o}**`;break;case"italic":o=`*${o}*`;break;case"strike":o=`~~${o}~~`;break;case"code":o=`\`${o}\``;break;case"link":{const r=((s=i.attrs)==null?void 0:s.href)||"";o=`[${o}](${r})`;break}}}),o}}}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){const e=[Et,At,be.UndoRedo,Ot];e.push(this.useDivTags?Ro:Ye),this.allowBold&&e.push(St),this.allowBlockquote&&e.push(Tt),this.allowBulletList&&(e.push(ve.BulletList),e.push(ve.ListItem.extend({renderText({node:n}){return n.textContent}})),e.push(ve.OrderedList)),this.allowItalic&&e.push(Lt),this.allowStrike&&e.push(It),this.allowUnderline&&e.push(Rt),this.placeholder&&e.push(be.Placeholder.configure({placeholder:this.placeholder}));const t=this,o=T.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:n})=>t.allowLineBreaks?!1:(n.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>t.allowBulletList&&i.splitListItem("listItem"),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit("enter"),!0)}}});if(e.push(o),this.link&&e.push(Dt.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit("edit-link"),!0)}}}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:de.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Do,this.customLink)),this.mentionSuggestion){const n={...this.mentionSuggestion,...oi};e.push(No.configure({suggestion:n}))}if(this.channelSuggestion){const n={...this.channelSuggestion,...ai};e.push(Po.configure({suggestion:n}))}if(this.slashCommandSuggestion){const n={...this.slashCommandSuggestion,...pi};e.push(Fo.configure({suggestion:n,onSelectedCommand:i=>{this.$emit("selected-command",i)}}))}return this.allowVariable&&e.push(Go.configure({variableItems:this.variableItems})),e.push(_o),e.push(Bt.configure({types:["paragraph"]})),this.allowCode&&e.push(Ct),this.allowCodeblock&&e.push(kt.extend({renderText({node:n}){return`\`\`\`
11
11
  ${n.textContent}
12
- \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Io),(this.allowFontFamily||this.allowFontColor)&&e.push(Mt.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:!1,fontFamily:this.allowFontFamily,fontSize:!1,lineHeight:!1})),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(ce.Table.configure({resizable:!0}),ce.TableRow,ce.TableHeader,ce.TableCell,be.Gapcursor),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){se.warnIfUnmounted(se.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new S.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(!this.preventTyping)return!1;const o=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&o.push("Enter"),!o.includes(t.key)},handlePaste:(e,t)=>{const o=t.clipboardData||window.clipboardData,n=o.getData("text/plain"),i=o.getData("text/html");return this.processPasteData(e,n,i)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var l,c,h;const{view:t,state:o}=e,{from:n,to:i}=t.state.selection,s=o.doc.textBetween(n,i,""),r=this.editor.state.doc.nodeAt(n);return r&&((h=(c=(l=r.marks)==null?void 0:l.at(0))==null?void 0:c.type)==null?void 0:h.name)==="link"?r.textContent:s},editLink(){const e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes("link").href,text:e};this.$emit("edit-link",t)},removeLink(){var e,t,o,n;(n=(o=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:o.unsetLink())==null||n.run()},openLink(){var t,o;(o=(t=this.editor)==null?void 0:t.chain())==null||o.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,o,n=de.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){var l,c,h;if(!e){this.removeLink();return}n.find(u=>u.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const r=(h=(c=(l=this.editor)==null?void 0:l.view)==null?void 0:c.state)==null?void 0:h.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:r.from,to:r.from+t.length}).setLink({href:e,class:o.class}).run()},processValue(e,t=!0){if(!this.editor)return;const o=this.getOutput();if(!(t&&Kt(e,o))){if(typeof e=="string"&&this.outputFormat==="text"){const n=new RegExp(`(${Ge.emojiPattern})`,"g");e=e==null?void 0:e.replace(n,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:"full"}})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const i=(this.pasteRichText?t:t.replace(/\r\n/g,`
12
+ \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(Io),(this.allowFontFamily||this.allowFontColor||this.allowFontSize)&&e.push(Mt.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:!1,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:!1})),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(ce.Table.configure({resizable:!0}),ce.TableRow,ce.TableHeader,ce.TableCell,be.Gapcursor),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){se.warnIfUnmounted(se.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new S.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(!this.preventTyping)return!1;const o=["Backspace"];return!this.allowLineBreaks&&!t.shiftKey&&o.push("Enter"),!o.includes(t.key)},handlePaste:(e,t)=>{const o=t.clipboardData||window.clipboardData,n=o.getData("text/plain"),i=o.getData("text/html");return this.processPasteData(e,n,i)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return e.isActive("link")},getSelectedLinkText(e){var l,c,h;const{view:t,state:o}=e,{from:n,to:i}=t.state.selection,s=o.doc.textBetween(n,i,""),r=this.editor.state.doc.nodeAt(n);return r&&((h=(c=(l=r.marks)==null?void 0:l.at(0))==null?void 0:c.type)==null?void 0:h.name)==="link"?r.textContent:s},editLink(){const e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes("link").href,text:e};this.$emit("edit-link",t)},removeLink(){var e,t,o,n;(n=(o=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:o.unsetLink())==null||n.run()},openLink(){var t,o;(o=(t=this.editor)==null?void 0:t.chain())==null||o.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,o,n=de.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){var l,c,h;if(!e){this.removeLink();return}n.find(u=>u.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const r=(h=(c=(l=this.editor)==null?void 0:l.view)==null?void 0:c.state)==null?void 0:h.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:r.from,to:r.from+t.length}).setLink({href:e,class:o.class}).run()},processValue(e,t=!0){if(!this.editor)return;const o=this.getOutput();if(!(t&&Kt(e,o))){if(typeof e=="string"&&this.outputFormat==="text"){const n=new RegExp(`(${Ge.emojiPattern})`,"g");e=e==null?void 0:e.replace(n,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:"full"}})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const i=(this.pasteRichText?t:t.replace(/\r\n/g,`
13
13
  `).replace(/\n\n/g,`
14
14
  `)).replace(/[\r\n]+$/,"").split(/\r?\n/),s=[];for(let r=0;r<i.length;r++)r>0&&s.push({type:"hardBreak"}),i[r]&&s.push({type:"text",text:i[r]});this.editor.chain().focus().insertContent(s).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,o){if(this.shouldPreserveLineBreaks(t,o))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(o)){const n=this.extractPreformattedText(o);if(n&&n.includes(`
15
15
  `))return this.insertPlainTextWithHardBreaks(e,n),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){const t=document.createElement("div");t.innerHTML=e;const o=t.querySelectorAll("*");for(const n of o)if(this.hasPreWhitespace(n)&&this.hasLineBreaks(n))return!0;return!1},hasPreWhitespace(e){const t=e.getAttribute("style")||"",o=e.style.whiteSpace||"",n=o==="pre"||o==="pre-wrap",i=t.includes("white-space: pre");return n||i},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`