@dialpad/dialtone-vue 4.6.0 → 4.6.1
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.
- package/dist/{RichTextEditor-DaOHmXD_.js → RichTextEditor-D8DfONFm.js} +7 -7
- package/dist/{RichTextEditor-DaOHmXD_.js.map → RichTextEditor-D8DfONFm.js.map} +1 -1
- package/dist/{RichTextEditor-7eY8gy9u.cjs → RichTextEditor-DMUDJKVn.cjs} +2 -2
- package/dist/{RichTextEditor-7eY8gy9u.cjs.map → RichTextEditor-DMUDJKVn.cjs.map} +1 -1
- package/dist/common/sr_only_close_button.vue.d.ts +4 -1
- package/dist/component-documentation.json +1 -1
- package/dist/components/Avatar/Avatar.vue.d.ts +12 -8
- package/dist/components/Avatar/Avatar.vue.d.ts.map +1 -1
- package/dist/components/Badge/Badge.vue.d.ts +1 -2
- package/dist/components/Banner/Banner.vue.d.ts +8 -2
- package/dist/components/Banner/Banner.vue.d.ts.map +1 -1
- package/dist/components/Button/Button.vue.d.ts +4 -1
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Chip/Chip.vue.d.ts +4 -1
- package/dist/components/Chip/Chip.vue.d.ts.map +1 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts +4 -1
- package/dist/components/Collapsible/Collapsible.vue.d.ts.map +1 -1
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts +8 -2
- package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +8 -2
- package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/FilterPill/FilterPill.vue.d.ts +20 -5
- package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
- package/dist/components/Hovercard/Hovercard.vue.d.ts +16 -4
- package/dist/components/Hovercard/Hovercard.vue.d.ts.map +1 -1
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts +8 -2
- package/dist/components/ImageViewer/ImageViewer.vue.d.ts.map +1 -1
- package/dist/components/Loader/Loader.vue.d.ts +4 -1
- package/dist/components/Loader/Loader.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +9 -3
- package/dist/components/Modal/Modal.vue.d.ts.map +1 -1
- package/dist/components/Notice/Notice.vue.d.ts +8 -2
- package/dist/components/Notice/Notice.vue.d.ts.map +1 -1
- package/dist/components/Notice/NoticeAction.vue.d.ts +8 -2
- package/dist/components/Notice/NoticeAction.vue.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.vue.d.ts +4 -1
- package/dist/components/Pagination/Pagination.vue.d.ts.map +1 -1
- package/dist/components/Popover/Popover.vue.d.ts +8 -2
- package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
- package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts +4 -1
- package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts.map +1 -1
- package/dist/components/RichTextEditor/Extensions/Mentions/MentionSuggestion.vue.d.ts +12 -8
- package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts +13 -5
- package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControlItem.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButton.vue.d.ts +16 -4
- package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts +4 -1
- package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButtonStart.vue.d.ts +4 -1
- package/dist/components/Tab/Tab.vue.d.ts +4 -1
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts +8 -2
- package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts.map +1 -1
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts +8 -2
- package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts.map +1 -1
- package/dist/components/Toast/Toast.vue.d.ts +32 -8
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +7 -7
- package/dist/lib/avatar/avatar.cjs +1 -1
- package/dist/lib/avatar/avatar.cjs.map +1 -1
- package/dist/lib/avatar/avatar.js +50 -47
- package/dist/lib/avatar/avatar.js.map +1 -1
- package/dist/lib/badge/badge.cjs +1 -1
- package/dist/lib/badge/badge.cjs.map +1 -1
- package/dist/lib/badge/badge.js +12 -14
- package/dist/lib/badge/badge.js.map +1 -1
- package/dist/lib/button/button.cjs +1 -1
- package/dist/lib/button/button.js +21 -21
- package/dist/lib/dropdown/dropdown.cjs.map +1 -1
- package/dist/lib/dropdown/dropdown.js.map +1 -1
- package/dist/lib/filter-pill/filter-pill.cjs +1 -1
- package/dist/lib/filter-pill/filter-pill.js +5 -5
- package/dist/lib/loader/loader.cjs +3 -3
- package/dist/lib/loader/loader.cjs.map +1 -1
- package/dist/lib/loader/loader.js +28 -20
- package/dist/lib/loader/loader.js.map +1 -1
- package/dist/lib/modal/modal.cjs +1 -1
- package/dist/lib/modal/modal.cjs.map +1 -1
- package/dist/lib/modal/modal.js +6 -5
- package/dist/lib/modal/modal.js.map +1 -1
- package/dist/lib/rich-text-editor/index.cjs +1 -1
- package/dist/lib/rich-text-editor/index.js +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
- package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/lib/segmented-control/segmented-control-item.cjs.map +1 -1
- package/dist/lib/segmented-control/segmented-control-item.js.map +1 -1
- package/dist/lib/text/text.cjs.map +1 -1
- package/dist/lib/text/text.js.map +1 -1
- package/dist/localization/index.cjs +1 -1
- package/dist/localization/index.cjs.map +1 -1
- package/dist/localization/index.js +50 -33
- package/dist/localization/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`./common/emoji/index.cjs`),i=require(`./lib/avatar/avatar.cjs`),a=require(`./lib/badge/badge.cjs`),o=require(`./lib/text/text.cjs`),s=require(`./lib/link/link.cjs`),c=require(`./localization/index.cjs`),l=require(`./lib/button/button.cjs`),u=require(`./lib/list-item/list-item.cjs`),d=require(`./lib/stack/stack.cjs`),f=require(`./lib/popover/popover.cjs`),p=require(`./lib/emoji/emoji.cjs`),ee=require(`./lib/input/input.cjs`),m=require(`./node_modules/@tiptap/vue-3.cjs`),h=require(`./floating-ui.dom-D2zQ_96p.cjs`),te=require(`./ForceLinkify-kQ_kWKVm.cjs`),g=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),_=require(`./MarkdownRenderer-C5wdjC5_.cjs`);let v=require(`vue`),ne=require(`@dialpad/dialtone-icons/vue`),y=require(`regex-combined-emojis`),b=require(`@tiptap/core`),x=require(`@tiptap/pm/state`),re=require(`@tiptap/pm/tables`),S=require(`@tiptap/extension-blockquote`);S=e.t(S);let C=require(`@tiptap/extension-code-block`);C=e.t(C);let w=require(`@tiptap/extension-code`);w=e.t(w);let T=require(`@tiptap/extension-document`);T=e.t(T);let E=require(`@tiptap/extensions`),D=require(`@tiptap/extension-hard-break`);D=e.t(D);let O=require(`@tiptap/extension-paragraph`);O=e.t(O);let k=require(`@tiptap/extension-bold`);k=e.t(k);let A=require(`@tiptap/extension-list`),j=require(`@tiptap/extension-italic`);j=e.t(j);let M=require(`@tiptap/extension-link`);M=e.t(M);let N=require(`@tiptap/extension-strike`);N=e.t(N);let P=require(`@tiptap/extension-underline`);P=e.t(P);let F=require(`@tiptap/extension-text`);F=e.t(F);let I=require(`@tiptap/extension-text-align`);I=e.t(I);let L=require(`@tiptap/extension-table`),R=require(`@tiptap/extension-text-style`),z=require(`@tiptap/suggestion`);z=e.t(z);let B=require(`@tiptap/extension-image`);B=e.t(B);let V=require(`@tiptap/extension-mention`);V=e.t(V);let H=require(`@dialpad/dialtone-icons/vue/hash`);H=e.t(H);let U=require(`@dialpad/dialtone-icons/vue/lock`);U=e.t(U);let W=require(`deep-equal`);W=e.t(W);function ie(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var ae=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,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:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&(0,b.isTextSelection)(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!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:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`bubbleMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=c?.scrollTarget??window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,a&&(this.shouldShow=a),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(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(h.a(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(h.l(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(h.c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h.t(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(h.u(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(h.n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(h.o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(h.s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=(0,b.posToDOMRect)(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof x.NodeSelection){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof re.CellSelection){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():ie(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){let e=this.virtualElement;e&&h.i(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.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=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??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){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){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,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()}},oe=e=>new x.Plugin({key:typeof e.pluginKey==`string`?new x.PluginKey(e.pluginKey):e.pluginKey,view:t=>new ae({view:t,...e})}),se=(0,v.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:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{editor:t,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),(0,v.nextTick)(()=>{t.registerPlugin(oe({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}}),ce=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,options:a,appendTo:o,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!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=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`floatingMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=a?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),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(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return(0,b.getText)(e,{textSerializers:(0,b.getTextSerializersFromSchema)(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(h.a(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(h.l(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(h.c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h.t(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(h.u(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(h.n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(h.o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(h.s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){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){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=(0,b.posToDOMRect)(this.view,e.from,e.to);h.i({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.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=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??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()}},le=e=>new x.Plugin({key:typeof e.pluginKey==`string`?new x.PluginKey(e.pluginKey):e.pluginKey,view:t=>new ce({view:t,...e})});(0,v.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:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{pluginKey:t,editor:n,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),n.registerPlugin(le({pluginKey:t,editor:n,element:l,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}});var G=e=>({default:null,parseHTML:t=>t.getAttribute(e),renderHTML:t=>t[e]?{[e]:t[e]}:{}}),ue=()=>{let e=G(`style`);return e.renderHTML=e=>e.style?{style:de(e.style)}:{},e};function de(e){return e.replace(/(?<![a-z-])width\s*:\s*([^;]+);?/gi,(e,t)=>/^\s*0\s*[a-z%]*\s*(!important)?\s*$/i.test(t)?`width: 100%;`:e)}var fe=L.Table.extend({addAttributes(){return{...this.parent?.(),border:G(`border`),cellpadding:G(`cellpadding`),cellspacing:G(`cellspacing`),style:ue()}},renderHTML({HTMLAttributes:e}){return[`table`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e),[`tbody`,0]]}}),pe=L.TableRow.extend({addAttributes(){return{...this.parent?.(),style:G(`style`)}}}),K={style:G(`style`),valign:G(`valign`),width:G(`width`)},me=L.TableCell.extend({addAttributes(){return{...this.parent?.(),...K}}}),he=L.TableHeader.extend({addAttributes(){return{...this.parent?.(),...K}}}),ge=R.TextStyle.extend({parseHTML(){return[...this.parent?.()||[],{tag:`div`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1},{tag:`a`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1}]}}),_e={name:`EmojiComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtEmoji:p.default},props:m.nodeViewProps};function ve(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block d-va-bottom d-lh0`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`500`,code:e.node.attrs.code},null,8,[`code`])]),_:1})}var ye=n.t(_e,[[`render`,ve]]),be={name:`SuggestionList`,components:{DtListItem:u.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();let e=this.$refs.suggestionList.querySelector(`.d-list-item--highlighted`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){let 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}}}},xe={class:`d-popover__dialog d-suggestion-list__container`},Se={ref:`suggestionList`,class:`d-suggestion-list`};function Ce(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-list-item`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,xe,[(0,v.withDirectives)((0,v.createElementVNode)(`ul`,Se,[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(n.items,(e,t)=>((0,v.openBlock)(),(0,v.createBlock)(o,{key:e.id,class:(0,v.normalizeClass)([`d-suggestion-list__item`,{"d-list-item--highlighted":t===i.selectedIndex}]),"navigation-type":`arrow-keys`,onClick:e=>a.selectItem(t),onKeydown:(0,v.withModifiers)(a.onKeyDown,[`prevent`])},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)((0,v.resolveDynamicComponent)(n.itemComponent),{item:e},null,8,[`item`]))]),_:2},1032,[`class`,`onClick`,`onKeydown`]))),128))],512),[[v.vShow,n.items.length]])])}var we=n.t(be,[[`render`,Ce]]),q=`top-start`;function Te(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function J(e){return{getBoundingClientRect:e}}async function Ee(e,t,n={}){if(!e||!t?.getBoundingClientRect)return;let{placement:r=q,middleware:i=[h.c(0),h.a(),h.l({padding:8})]}=n,{x:a,y:o}=await h.i(t,e,{placement:r,middleware:i});Object.assign(e.style,{left:`${a}px`,top:`${o}px`})}function De(e,t={}){let{zIndex:n=`650`}=t;e.style.position=`absolute`,e.style.zIndex=n,e.style.display=`none`}function Oe(e){e&&(e.style.display=`block`)}function ke(e){e&&(e.style.display=`none`)}function Ae(e,t){return n=>{n.key===`Escape`&&t()&&e()}}function je(e){document.addEventListener(`keydown`,e)}function Me(e){document.removeEventListener(`keydown`,e)}function Ne(e,t,n,r){return new m.VueRenderer(e,{props:{itemComponent:(0,v.markRaw)(t),itemType:n,...r},editor:r.editor})}function Pe(e){e.escHandler&&Me(e.escHandler),e.floatingEl?.remove(),e.component?.destroy()}function Y(e,t,n={}){let{listComponent:r=we,placement:i=q,zIndex:a=`650`}=n;return()=>{let n=null,o=null,s=!1,c=Te(),l=null;function u(){Ee(o,c,{placement:i})}function d(){o&&(Oe(o),s=!0,u())}function f(){o&&(ke(o),s=!1)}return{onStart:i=>{n=Ne(r,e,t,i),i.clientRect&&(o=n.element,De(o,{zIndex:a}),document.body.appendChild(o),c=J(i.clientRect),l=Ae(f,()=>s),je(l),i.items.length>0&&d())},onUpdate(e){n?.updateProps(e),e.items.length>0?d():f(),e.clientRect&&(c=J(e.clientRect),u())},onKeyDown(e){if(s)return n?.ref?.onKeyDown(e)},onExit(){Pe({escHandler:l,floatingEl:o,component:n}),l=null,o=null,n=null}}}}var Fe={name:`EmojiSuggestion`,components:{DtEmoji:p.default,DtStack:d.default},props:{item:{type:Object,required:!0}}};function Ie(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(s,{direction:`row`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`200`,code:n.item.code},null,8,[`code`]),(0,v.createTextVNode)(` `+(0,v.toDisplayString)(n.item.code),1)]),_:1})}var Le=n.t(Fe,[[`render`,Ie]]),Re=20,ze=(e,t,n)=>{let r=e.shortname?.replaceAll(`:`,``),i=t.shortname?.replaceAll(`:`,``),a=r.startsWith(n),o=i.startsWith(n);return a&&!o?-1:!a&&o?1:r.localeCompare(i)},Be={items:({query:e})=>{if(e.length<2)return[];let t=Object.values(r.getEmojiData());return e=e.toLowerCase(),t.filter(t=>[t.name,t.shortname?.replaceAll(`:`,``),...t.keywords||[]].some(t=>t&&t.startsWith(e))).splice(0,Re).sort((t,n)=>ze(t,n,e)).map(e=>({code:e.shortname}))},command:({editor:e,range:t,props:n})=>{e.view.state.selection.$to.nodeAfter?.text?.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:`emoji`,attrs:n}]).run(),window.getSelection()?.collapseToEnd()},render:Y(Le,`emoji`)},Ve=/(:\w+:)$/,He=RegExp(y.emojiPattern+`$`),Ue=e=>{if(e&&r.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},We=e=>[...e.matchAll(r.emojiShortCodeRegex)].filter(e=>r.codeToEmojiData(e[0])).map(e=>({index:e.index,text:e[0],match:e})),Ge=b.Node.create({name:`emoji`,addOptions(){return{HTMLAttributes:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addNodeView(){return m.VueNodeViewRenderer(ye)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:`emoji-component`}]},renderText({node:e}){let t=e.attrs.code??``,n=t?r.codeToEmojiData(t):void 0;return n?r.stringToUnicode(n.unicode_output):t},renderHTML({HTMLAttributes:e}){return[`emoji-component`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){return[new b.InputRule({find:e=>{let t=e.match(Ve)||e.match(He);if(t)return Ue(t)},handler:({state:e,range:t,match:n})=>{let{tr:r}=e,i=t.from,a=t.to;r.replaceWith(i,a,this.type.create({code:n[0]}))}})]},addPasteRules(){return[(0,b.nodePasteRule)({find:We,type:this.type,getAttributes(e){return{code:e[0]}}}),(0,b.nodePasteRule)({find:r.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[(0,z.default)({char:`:`,pluginKey:new x.PluginKey(`emoji`),editor:this.editor,...this.options.suggestion,...Be})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;return i?(t.doc.nodesBetween(a-1,a,(t,r)=>{if(t.type.name===this.name)return n=!0,e.insertText(``,r,r+t.nodeSize),!1}),n):!1})}}});function Ke(e,t,n=()=>!0){let r=[];t.lastIndex=0;let i;for(;i=t.exec(e);)n(e,i)&&r.push(i);return r}function qe(e,t){return![`#`,`@`].includes(e.charAt(t.index))&&![`#`,`@`].includes(e.charAt(t.index-1))}function Je(e){let t=RegExp(`(?:`+[`[!?.,:;'"]`,`(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$`].join(`|`),`g`);return e.replace(t,``)}function Ye(e,t){let n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){let t=e.slice(n);return{text:t,from:n,to:n+t.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function X(e,t,n,r){let i=Ye(e,t);if(r.lastIndex=0,!r.test(i.text))return i;let a=n===`left`?i.from-1:i.to+1;return a<=0||a>=e.length||a===t?i:X(e,a,n,r)}function Xe(e,t,n,r){let i=(0,b.getMarksBetween)(Math.max(e.from-1,0),Math.min(e.to+1,t.content.size),t);for(let e of i)e.mark.type===r&&n.removeMark(e.from,e.to,r)}var Z=t.getPhoneNumberRegex(1,15);function Q(e,n,r,i,a,o){if(!e)return;let s=r-n-1;s=s<0?0:s;let c=i-n,l=X(e,s,`left`,Z),u=X(e,c,`right`,Z);Ke(e.slice(l.from,u.to),t.linkRegex,qe).forEach(e=>{let t=Je(e[0]),r=n+l.from+e.index+1,i=r+t.length;a.addMark(r,i,o.create())})}function Ze(e){let t=!1;return new x.Plugin({key:new x.PluginKey(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc);if(t&&!a)return;let{tr:o}=i,{textContent:s}=i.doc;if(!t||!r.doc.textContent)return Q(s,0,0,s.length,o,e.type),t=!0,o;t=!0;let c=(0,b.getChangedRanges)((0,b.combineTransactionSteps)(r.doc,[...n]));return c.length?(c.forEach(({oldRange:t,newRange:n})=>{if(n.from===n.to){Q(s,0,0,s.length,o,e.type);return}Xe(n,i.doc,o,e.type),(0,b.findChildrenInRange)(i.doc,n,e=>e.isTextblock).forEach(({node:r,pos:i})=>{Q(r.textContent,i,t.from,n.to,o,e.type)})}),o):(Q(s,0,0,s.length,o,e.type),o)}})}var Qe={class:`d-link d-c-text d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`},$e=b.Mark.create({name:`CustomLink`,renderHTML({HTMLAttributes:e}){return[`a`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e,Qe)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Ze({type:this.type})]}}),et=b.Mark.create({name:`LinkPhoneNumbers`,renderHTML({HTMLAttributes:e}){return[`a`,(0,b.mergeAttributes)(e,{class:`d-link d-c-pointer d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`})]},addProseMirrorPlugins(){let e=this.editor,t=this.type;return[new x.Plugin({key:new x.PluginKey(`phoneClick`),props:{handleClick(n,r,i){let{state:a}=n,o=a.doc.resolve(r);if(!o.marks().some(e=>e.type===t))return!1;let s=(0,b.getMarkRange)(o,t),c=s?a.doc.textBetween(s.from,s.to):``;return i.preventDefault(),e.emit(`phone-click`,{phoneNumber:c}),!0}}})]}}),tt=B.default.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}),nt=new Set(`address.article.aside.blockquote.dd.details.dialog.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),rt=O.default.extend({parseHTML(){return[{tag:`div`,getAttrs:e=>{for(let t of e.children)if(nt.has(t.tagName.toLowerCase()))return!1;return null}}]},renderHTML({HTMLAttributes:e}){return[`div`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),it={name:`MentionComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtLink:s.default},props:m.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 at(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-link`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{tone:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`]),onMouseenter:a.handleMouseEnter,onMouseleave:a.handleMouseLeave,onFocusin:a.handleMouseEnter,onFocusout:a.handleMouseLeave},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1},8,[`onClick`,`onMouseenter`,`onMouseleave`,`onFocusin`,`onFocusout`])]),_:1})}var ot=n.t(it,[[`render`,at]]),st=V.default.extend({addNodeView(){return m.VueNodeViewRenderer(ot)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`@`,pluginKey:new x.PluginKey(`mentionSuggestion`)}}),ct={name:`ChannelComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtLink:s.default,DtIconLock:ne.DtIconLock,DtStack:d.default},props:m.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:`#`+this.$props.node.attrs.name}},methods:{handleClick(){let 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 lt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-lock`),s=(0,v.resolveComponent)(`dt-stack`),c=(0,v.resolveComponent)(`dt-link`),l=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(l,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(c,{tone:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`])},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(s,{direction:`row`,gap:`0`},{default:(0,v.withCtx)(()=>[e.$props.node.attrs.locked?((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`200`})):(0,v.createCommentVNode)(``,!0),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.text),1)]),_:1})]),_:1},8,[`onClick`])]),_:1})}var ut=n.t(ct,[[`render`,lt]]),dt=V.default.extend({name:`channel`,addNodeView(){return m.VueNodeViewRenderer(ut)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`#`,pluginKey:new x.PluginKey(`channelSuggestion`)}}),ft={name:`SlashCommandsComponent`,components:{NodeViewWrapper:m.NodeViewWrapper},props:{...m.nodeViewProps},emits:[`selected-command`],computed:{text(){return`/`+this.$props.node.attrs.command}},created(){let e=this.$props.node.attrs.command;this.$emit(`selected-command`,e);let t=this.editor?.storage?.[`slash-commands`]?.onSelectedCommand;t&&typeof t==`function`&&t(e)}};function pt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(o,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1})}var mt=n.t(ft,[[`render`,pt]]),ht=(e,t)=>[...e.matchAll(t)].map(e=>{let t=e[2];return t.endsWith(` `)||(t+=` `),{index:e.index,text:t,match:e}}),gt=V.default.extend({name:`slash-commands`,group:`inline`,inline:!0,addOptions(){return{...this.parent?.(),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return m.VueNodeViewRenderer(mt)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command);return[(0,b.nodeInputRule)({find:RegExp(`^((?:\\/)(${e.join(`|`)})) $`),type:this.type,getAttributes(e){return{command:e[2]}}})]},addPasteRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command),t=RegExp(`^((?:\\/)(${e.join(`|`)})) ?$`,`g`);return[(0,b.nodePasteRule)({find:e=>ht(e,t),type:this.type,getAttributes(e){return{command:e[0].trim()}}})]}}).configure({suggestion:{char:`/`,pluginKey:new x.PluginKey(`slashCommandSuggestion`)}}),_t=100,vt={name:`VariableComponent`,components:{DtBadge:a.default,DtButton:l.default,DtPopover:f.default,DtInput:ee.default,NodeViewWrapper:m.NodeViewWrapper},props:m.nodeViewProps,data(){return{i18n:new c.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:_t}},computed:{altText:{get(){return this.node?.attrs?.altText||``},set(e){this.updateAttributes({altText:e})}},variableId(){return this.node?.attrs?.id},placeholder(){return this.variableData?.placeholder||``},variableItems(){return this.extension?.options?.variableItems||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){return this.node?.attrs?.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function yt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-badge`),s=(0,v.resolveComponent)(`dt-button`),c=(0,v.resolveComponent)(`dt-input`),l=(0,v.resolveComponent)(`dt-popover`),u=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(u,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[a.enableAltText?((0,v.openBlock)(),(0,v.createBlock)(l,{key:0,padding:`small`,"navigation-type":`arrow-keys`,placement:`top-start`,modal:!1},{anchor:(0,v.withCtx)(({attrs:e})=>[(0,v.createVNode)(s,(0,v.mergeProps)(e,{kind:`unstyled`}),{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{text:a.badgeLabel,contenteditable:`false`},null,8,[`text`])]),_:1},16)]),content:(0,v.withCtx)(({close:e})=>[(0,v.createVNode)(c,{modelValue:a.altText,"onUpdate:modelValue":t[0]||(t[0]=e=>a.altText=e),class:`d-p-100 d-w332`,label:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_LABEL`),placeholder:a.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:(0,v.withKeys)(t=>e(),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`validate`,`onKeyup`])]),_:1})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:1,text:a.badgeLabel,contenteditable:`false`},null,8,[`text`]))]),_:1})}var bt=n.t(vt,[[`render`,yt]]),xt=b.Node.create({name:`variable`,group:`inline`,inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return m.VueNodeViewRenderer(bt)},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}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute(`data-enable-alt-text`)===`true`,renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:`variable`}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return[`variable`,(0,b.mergeAttributes)(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||``,enableAltText:e.enableAltText}})}}}),St={name:`MentionSuggestion`,components:{DtAvatar:i.default,DtStack:d.default,DtText:o.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-mention-suggestion__presence--active`,busy:`d-mention-suggestion__presence--busy`,away:`d-mention-suggestion__presence--away`,offline:`d-mention-suggestion__presence--busy`}[this.presence]},showDetails(){return this.item.showDetails}}},Ct={class:`d-mention-suggestion__name`};function wt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-avatar`),s=(0,v.resolveComponent)(`dt-text`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,class:`d-mention-suggestion__container`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{"full-name":a.name,"image-src":a.avatarSrc,"image-alt":a.name,"show-presence":a.showDetails,presence:a.presence,size:200},null,8,[`full-name`,`image-src`,`image-alt`,`show-presence`,`presence`]),(0,v.createVNode)(c,{class:`d-mention-suggestion__details-container`,gap:`1`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,Ct,(0,v.toDisplayString)(a.name),1),a.showDetails?((0,v.openBlock)(),(0,v.createBlock)(c,{key:0,direction:`row`,gap:`50`},{default:(0,v.withCtx)(()=>[a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:0,kind:`label`,size:200,strength:`normal`,class:(0,v.normalizeClass)([`d-mention-suggestion__presence`,[a.presenceFontColorClass]])},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.presenceText),1)]),_:1},8,[`class`])):(0,v.createCommentVNode)(``,!0),a.status&&a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__divider`},{default:(0,v.withCtx)(()=>[...t[0]||(t[0]=[(0,v.createTextVNode)(` • `,-1)])]),_:1})):(0,v.createCommentVNode)(``,!0),a.status?((0,v.openBlock)(),(0,v.createBlock)(s,{key:2,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__status`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.status),1)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})]),_:1})}var Tt={allowSpaces:!0,render:Y(n.t(St,[[`render`,wt]]),`mention`)},Et={name:`ChannelSuggestion`,components:{DtStack:d.default,DtIconHash:H.default,DtIconLock:U.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function $(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-hash`),s=(0,v.resolveComponent)(`dt-icon-lock`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,gap:`100`},{default:(0,v.withCtx)(()=>[n.item.locked?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,size:`300`})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`300`})),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.name),1)]),_:1})}var Dt={allowSpaces:!0,render:Y(n.t(Et,[[`render`,$]]),`channel`)},Ot={name:`SlashCommandSuggestion`,components:{DtText:o.default},props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},kt={key:0};function At(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-text`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,null,[(0,v.createVNode)(o,{kind:`body`,size:300,density:300,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,null,`/`+(0,v.toDisplayString)(a.command),1),a.parametersExample?((0,v.openBlock)(),(0,v.createElementBlock)(`span`,kt,(0,v.toDisplayString)(a.parametersExample),1)):(0,v.createCommentVNode)(``,!0)]),_:1}),(0,v.createVNode)(o,{kind:`body`,size:200,tone:`tertiary`,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.description),1)]),_:1})])}var jt={allowSpaces:!0,startOfLine:!0,render:Y(n.t(Ot,[[`render`,At]]),`slash-command`)},Mt={name:`DtRichTextEditor`,components:{EditorContent:m.EditorContent,BubbleMenu:se,DtButton:l.default,DtStack:d.default},props:{modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},allowTyping:{type:Boolean,default:!0},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`?g.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`html`,validator(e){return g.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},linkPhoneNumbers:{type:Array,default:null},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},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},showLinkBubbleMenu:{type:Boolean,default:!0},preserveWhitespace:{type:[Boolean,String],default:`full`},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowTextAlign:{type:Boolean,default:!0},allowImageResize:{type:Boolean,default:!1}},emits:[`update:modelValue`,`json-input`,`html-input`,`text-input`,`markdown-input`,`blur`,`focus`,`enter`,`edit-link`,`selected`,`selected-command`,`mention-click`,`mention-hover`,`mention-leave`,`channel-click`,`phone-click`,`link-click`],data(){return{editor:null,appendTo:()=>t.returnFirstEl(this.$refs.editor.$el).getRootNode()?.querySelector(`body`),floatingOptions:{placement:`top-start`},i18n:new c.DialtoneLocalization}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){let e=[T.default,F.default,E.UndoRedo,D.default];e.push(this.useDivTags?rt:O.default),this.allowBold&&e.push(k.default),this.allowBlockquote&&e.push(S.default),this.allowBulletList&&(e.push(A.BulletList),e.push(A.ListItem.extend({renderText({node:e}){return e.textContent}})),e.push(A.OrderedList)),this.allowItalic&&e.push(j.default),this.allowStrike&&e.push(N.default),this.allowUnderline&&e.push(P.default),this.placeholder&&e.push(E.Placeholder.configure({placeholder:this.placeholder}));let t=this,n=b.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:e})=>t.allowLineBreaks?!1:(e.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>t.allowBulletList&&e.splitListItem(`listItem`),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit(`enter`),!0)}}});if(e.push(n),this.link&&e.push(M.default.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit(`edit-link`),!0)}}}).configure({HTMLAttributes:{class:`d-link d-wb-break-all`},openOnClick:!1,autolink:!this.customLink,protocols:g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension($e,this.customLink)),this.linkPhoneNumbers!==null&&e.push(et),this.mentionSuggestion){let t={...this.mentionSuggestion,...Tt};e.push(st.configure({suggestion:t}))}if(this.channelSuggestion){let t={...this.channelSuggestion,...Dt};e.push(dt.configure({suggestion:t}))}if(this.slashCommandSuggestion){let t={...this.slashCommandSuggestion,...jt};e.push(gt.configure({suggestion:t,onSelectedCommand:e=>{this.$emit(`selected-command`,e)}}))}return this.allowVariable&&e.push(xt.configure({variableItems:this.variableItems})),e.push(Ge),this.allowTextAlign&&e.push(I.default.configure({types:[`paragraph`]})),this.allowCode&&e.push(w.default),this.allowCodeblock&&e.push(C.default.extend({renderText({node:e,pos:t,range:n}){let r=n?.from??0,i=n?.to??t+e.nodeSize;if(r<=t&&i>=t+e.nodeSize)return`\`\`\`\n${e.textContent}\n\`\`\``;let a=Math.max(0,r-t-1),o=Math.min(e.textContent.length,i-t-1);return e.textContent.slice(a,o)},addCommands(){return{...this.parent?.(),toggleCodeBlock:(e={})=>({state:t,chain:n,commands:r})=>{let i=t.schema.nodes[this.name],{$from:a,$to:o}=t.selection,s=[];return t.doc.nodesBetween(a.pos,o.pos,(e,t)=>{if(e.isTextblock)return s.push({node:e,pos:t}),!1}),s.length<=1?r.toggleNode(this.name,`paragraph`,e):s.every(({node:e})=>e.type===i)?r.toggleNode(this.name,`paragraph`):n().setNode(this.name,e).command(({tr:e})=>{for(let n=s.length-1;n>0;n--){let r=e.mapping.map(s[n].pos),a=r-1;e.doc.resolve(a).parent.type===i&&e.replaceWith(a,r+1,t.schema.text(`
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`./common/emoji/index.cjs`),i=require(`./lib/avatar/avatar.cjs`),a=require(`./lib/badge/badge.cjs`),o=require(`./lib/text/text.cjs`),s=require(`./localization/index.cjs`),c=require(`./lib/link/link.cjs`),l=require(`./lib/button/button.cjs`),u=require(`./lib/list-item/list-item.cjs`),d=require(`./lib/stack/stack.cjs`),f=require(`./lib/popover/popover.cjs`),p=require(`./lib/emoji/emoji.cjs`),ee=require(`./lib/input/input.cjs`),m=require(`./node_modules/@tiptap/vue-3.cjs`),h=require(`./floating-ui.dom-D2zQ_96p.cjs`),te=require(`./ForceLinkify-kQ_kWKVm.cjs`),g=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),_=require(`./MarkdownRenderer-C5wdjC5_.cjs`);let v=require(`vue`),ne=require(`@dialpad/dialtone-icons/vue`),y=require(`regex-combined-emojis`),b=require(`@tiptap/core`),x=require(`@tiptap/pm/state`),re=require(`@tiptap/pm/tables`),S=require(`@tiptap/extension-blockquote`);S=e.t(S);let C=require(`@tiptap/extension-code-block`);C=e.t(C);let w=require(`@tiptap/extension-code`);w=e.t(w);let T=require(`@tiptap/extension-document`);T=e.t(T);let E=require(`@tiptap/extensions`),D=require(`@tiptap/extension-hard-break`);D=e.t(D);let O=require(`@tiptap/extension-paragraph`);O=e.t(O);let k=require(`@tiptap/extension-bold`);k=e.t(k);let A=require(`@tiptap/extension-list`),j=require(`@tiptap/extension-italic`);j=e.t(j);let M=require(`@tiptap/extension-link`);M=e.t(M);let N=require(`@tiptap/extension-strike`);N=e.t(N);let P=require(`@tiptap/extension-underline`);P=e.t(P);let F=require(`@tiptap/extension-text`);F=e.t(F);let I=require(`@tiptap/extension-text-align`);I=e.t(I);let L=require(`@tiptap/extension-table`),R=require(`@tiptap/extension-text-style`),z=require(`@tiptap/suggestion`);z=e.t(z);let B=require(`@tiptap/extension-image`);B=e.t(B);let V=require(`@tiptap/extension-mention`);V=e.t(V);let H=require(`@dialpad/dialtone-icons/vue/hash`);H=e.t(H);let U=require(`@dialpad/dialtone-icons/vue/lock`);U=e.t(U);let W=require(`deep-equal`);W=e.t(W);function ie(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var ae=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,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:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&(0,b.isTextSelection)(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!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:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`bubbleMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=c?.scrollTarget??window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,a&&(this.shouldShow=a),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(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(h.a(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(h.l(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(h.c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h.t(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(h.u(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(h.n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(h.o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(h.s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=(0,b.posToDOMRect)(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof x.NodeSelection){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof re.CellSelection){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():ie(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){let e=this.virtualElement;e&&h.i(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.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=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??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){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){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,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()}},oe=e=>new x.Plugin({key:typeof e.pluginKey==`string`?new x.PluginKey(e.pluginKey):e.pluginKey,view:t=>new ae({view:t,...e})}),se=(0,v.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:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{editor:t,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),(0,v.nextTick)(()=>{t.registerPlugin(oe({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}}),ce=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,options:a,appendTo:o,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!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=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`floatingMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=a?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),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(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return(0,b.getText)(e,{textSerializers:(0,b.getTextSerializersFromSchema)(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(h.a(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(h.l(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(h.c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(h.t(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(h.u(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(h.n(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(h.o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(h.s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){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){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=(0,b.posToDOMRect)(this.view,e.from,e.to);h.i({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.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=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??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()}},le=e=>new x.Plugin({key:typeof e.pluginKey==`string`?new x.PluginKey(e.pluginKey):e.pluginKey,view:t=>new ce({view:t,...e})});(0,v.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:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{pluginKey:t,editor:n,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),n.registerPlugin(le({pluginKey:t,editor:n,element:l,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}});var G=e=>({default:null,parseHTML:t=>t.getAttribute(e),renderHTML:t=>t[e]?{[e]:t[e]}:{}}),ue=()=>{let e=G(`style`);return e.renderHTML=e=>e.style?{style:de(e.style)}:{},e};function de(e){return e.replace(/(?<![a-z-])width\s*:\s*([^;]+);?/gi,(e,t)=>/^\s*0\s*[a-z%]*\s*(!important)?\s*$/i.test(t)?`width: 100%;`:e)}var fe=L.Table.extend({addAttributes(){return{...this.parent?.(),border:G(`border`),cellpadding:G(`cellpadding`),cellspacing:G(`cellspacing`),style:ue()}},renderHTML({HTMLAttributes:e}){return[`table`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e),[`tbody`,0]]}}),pe=L.TableRow.extend({addAttributes(){return{...this.parent?.(),style:G(`style`)}}}),K={style:G(`style`),valign:G(`valign`),width:G(`width`)},me=L.TableCell.extend({addAttributes(){return{...this.parent?.(),...K}}}),he=L.TableHeader.extend({addAttributes(){return{...this.parent?.(),...K}}}),ge=R.TextStyle.extend({parseHTML(){return[...this.parent?.()||[],{tag:`div`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1},{tag:`a`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1}]}}),_e={name:`EmojiComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtEmoji:p.default},props:m.nodeViewProps};function ve(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block d-va-bottom d-lh0`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`500`,code:e.node.attrs.code},null,8,[`code`])]),_:1})}var ye=n.t(_e,[[`render`,ve]]),be={name:`SuggestionList`,components:{DtListItem:u.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();let e=this.$refs.suggestionList.querySelector(`.d-list-item--highlighted`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){let 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}}}},xe={class:`d-popover__dialog d-suggestion-list__container`},Se={ref:`suggestionList`,class:`d-suggestion-list`};function Ce(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-list-item`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,xe,[(0,v.withDirectives)((0,v.createElementVNode)(`ul`,Se,[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(n.items,(e,t)=>((0,v.openBlock)(),(0,v.createBlock)(o,{key:e.id,class:(0,v.normalizeClass)([`d-suggestion-list__item`,{"d-list-item--highlighted":t===i.selectedIndex}]),"navigation-type":`arrow-keys`,onClick:e=>a.selectItem(t),onKeydown:(0,v.withModifiers)(a.onKeyDown,[`prevent`])},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)((0,v.resolveDynamicComponent)(n.itemComponent),{item:e},null,8,[`item`]))]),_:2},1032,[`class`,`onClick`,`onKeydown`]))),128))],512),[[v.vShow,n.items.length]])])}var we=n.t(be,[[`render`,Ce]]),q=`top-start`;function Te(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function J(e){return{getBoundingClientRect:e}}async function Ee(e,t,n={}){if(!e||!t?.getBoundingClientRect)return;let{placement:r=q,middleware:i=[h.c(0),h.a(),h.l({padding:8})]}=n,{x:a,y:o}=await h.i(t,e,{placement:r,middleware:i});Object.assign(e.style,{left:`${a}px`,top:`${o}px`})}function De(e,t={}){let{zIndex:n=`650`}=t;e.style.position=`absolute`,e.style.zIndex=n,e.style.display=`none`}function Oe(e){e&&(e.style.display=`block`)}function ke(e){e&&(e.style.display=`none`)}function Ae(e,t){return n=>{n.key===`Escape`&&t()&&e()}}function je(e){document.addEventListener(`keydown`,e)}function Me(e){document.removeEventListener(`keydown`,e)}function Ne(e,t,n,r){return new m.VueRenderer(e,{props:{itemComponent:(0,v.markRaw)(t),itemType:n,...r},editor:r.editor})}function Pe(e){e.escHandler&&Me(e.escHandler),e.floatingEl?.remove(),e.component?.destroy()}function Y(e,t,n={}){let{listComponent:r=we,placement:i=q,zIndex:a=`650`}=n;return()=>{let n=null,o=null,s=!1,c=Te(),l=null;function u(){Ee(o,c,{placement:i})}function d(){o&&(Oe(o),s=!0,u())}function f(){o&&(ke(o),s=!1)}return{onStart:i=>{n=Ne(r,e,t,i),i.clientRect&&(o=n.element,De(o,{zIndex:a}),document.body.appendChild(o),c=J(i.clientRect),l=Ae(f,()=>s),je(l),i.items.length>0&&d())},onUpdate(e){n?.updateProps(e),e.items.length>0?d():f(),e.clientRect&&(c=J(e.clientRect),u())},onKeyDown(e){if(s)return n?.ref?.onKeyDown(e)},onExit(){Pe({escHandler:l,floatingEl:o,component:n}),l=null,o=null,n=null}}}}var Fe={name:`EmojiSuggestion`,components:{DtEmoji:p.default,DtStack:d.default},props:{item:{type:Object,required:!0}}};function Ie(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(s,{direction:`row`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`200`,code:n.item.code},null,8,[`code`]),(0,v.createTextVNode)(` `+(0,v.toDisplayString)(n.item.code),1)]),_:1})}var Le=n.t(Fe,[[`render`,Ie]]),Re=20,ze=(e,t,n)=>{let r=e.shortname?.replaceAll(`:`,``),i=t.shortname?.replaceAll(`:`,``),a=r.startsWith(n),o=i.startsWith(n);return a&&!o?-1:!a&&o?1:r.localeCompare(i)},Be={items:({query:e})=>{if(e.length<2)return[];let t=Object.values(r.getEmojiData());return e=e.toLowerCase(),t.filter(t=>[t.name,t.shortname?.replaceAll(`:`,``),...t.keywords||[]].some(t=>t&&t.startsWith(e))).splice(0,Re).sort((t,n)=>ze(t,n,e)).map(e=>({code:e.shortname}))},command:({editor:e,range:t,props:n})=>{e.view.state.selection.$to.nodeAfter?.text?.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:`emoji`,attrs:n}]).run(),window.getSelection()?.collapseToEnd()},render:Y(Le,`emoji`)},Ve=/(:\w+:)$/,He=RegExp(y.emojiPattern+`$`),Ue=e=>{if(e&&r.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},We=e=>[...e.matchAll(r.emojiShortCodeRegex)].filter(e=>r.codeToEmojiData(e[0])).map(e=>({index:e.index,text:e[0],match:e})),Ge=b.Node.create({name:`emoji`,addOptions(){return{HTMLAttributes:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addNodeView(){return m.VueNodeViewRenderer(ye)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:`emoji-component`}]},renderText({node:e}){let t=e.attrs.code??``,n=t?r.codeToEmojiData(t):void 0;return n?r.stringToUnicode(n.unicode_output):t},renderHTML({HTMLAttributes:e}){return[`emoji-component`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){return[new b.InputRule({find:e=>{let t=e.match(Ve)||e.match(He);if(t)return Ue(t)},handler:({state:e,range:t,match:n})=>{let{tr:r}=e,i=t.from,a=t.to;r.replaceWith(i,a,this.type.create({code:n[0]}))}})]},addPasteRules(){return[(0,b.nodePasteRule)({find:We,type:this.type,getAttributes(e){return{code:e[0]}}}),(0,b.nodePasteRule)({find:r.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[(0,z.default)({char:`:`,pluginKey:new x.PluginKey(`emoji`),editor:this.editor,...this.options.suggestion,...Be})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;return i?(t.doc.nodesBetween(a-1,a,(t,r)=>{if(t.type.name===this.name)return n=!0,e.insertText(``,r,r+t.nodeSize),!1}),n):!1})}}});function Ke(e,t,n=()=>!0){let r=[];t.lastIndex=0;let i;for(;i=t.exec(e);)n(e,i)&&r.push(i);return r}function qe(e,t){return![`#`,`@`].includes(e.charAt(t.index))&&![`#`,`@`].includes(e.charAt(t.index-1))}function Je(e){let t=RegExp(`(?:`+[`[!?.,:;'"]`,`(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$`].join(`|`),`g`);return e.replace(t,``)}function Ye(e,t){let n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){let t=e.slice(n);return{text:t,from:n,to:n+t.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function X(e,t,n,r){let i=Ye(e,t);if(r.lastIndex=0,!r.test(i.text))return i;let a=n===`left`?i.from-1:i.to+1;return a<=0||a>=e.length||a===t?i:X(e,a,n,r)}function Xe(e,t,n,r){let i=(0,b.getMarksBetween)(Math.max(e.from-1,0),Math.min(e.to+1,t.content.size),t);for(let e of i)e.mark.type===r&&n.removeMark(e.from,e.to,r)}var Z=t.getPhoneNumberRegex(1,15);function Q(e,n,r,i,a,o){if(!e)return;let s=r-n-1;s=s<0?0:s;let c=i-n,l=X(e,s,`left`,Z),u=X(e,c,`right`,Z);Ke(e.slice(l.from,u.to),t.linkRegex,qe).forEach(e=>{let t=Je(e[0]),r=n+l.from+e.index+1,i=r+t.length;a.addMark(r,i,o.create())})}function Ze(e){let t=!1;return new x.Plugin({key:new x.PluginKey(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc);if(t&&!a)return;let{tr:o}=i,{textContent:s}=i.doc;if(!t||!r.doc.textContent)return Q(s,0,0,s.length,o,e.type),t=!0,o;t=!0;let c=(0,b.getChangedRanges)((0,b.combineTransactionSteps)(r.doc,[...n]));return c.length?(c.forEach(({oldRange:t,newRange:n})=>{if(n.from===n.to){Q(s,0,0,s.length,o,e.type);return}Xe(n,i.doc,o,e.type),(0,b.findChildrenInRange)(i.doc,n,e=>e.isTextblock).forEach(({node:r,pos:i})=>{Q(r.textContent,i,t.from,n.to,o,e.type)})}),o):(Q(s,0,0,s.length,o,e.type),o)}})}var Qe={class:`d-link d-c-text d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`},$e=b.Mark.create({name:`CustomLink`,renderHTML({HTMLAttributes:e}){return[`a`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e,Qe)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Ze({type:this.type})]}}),et=b.Mark.create({name:`LinkPhoneNumbers`,renderHTML({HTMLAttributes:e}){return[`a`,(0,b.mergeAttributes)(e,{class:`d-link d-c-pointer d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`})]},addProseMirrorPlugins(){let e=this.editor,t=this.type;return[new x.Plugin({key:new x.PluginKey(`phoneClick`),props:{handleClick(n,r,i){let{state:a}=n,o=a.doc.resolve(r);if(!o.marks().some(e=>e.type===t))return!1;let s=(0,b.getMarkRange)(o,t),c=s?a.doc.textBetween(s.from,s.to):``;return i.preventDefault(),e.emit(`phone-click`,{phoneNumber:c}),!0}}})]}}),tt=B.default.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}),nt=new Set(`address.article.aside.blockquote.dd.details.dialog.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),rt=O.default.extend({parseHTML(){return[{tag:`div`,getAttrs:e=>{for(let t of e.children)if(nt.has(t.tagName.toLowerCase()))return!1;return null}}]},renderHTML({HTMLAttributes:e}){return[`div`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),it={name:`MentionComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtLink:c.default},props:m.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 at(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-link`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{tone:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`]),onMouseenter:a.handleMouseEnter,onMouseleave:a.handleMouseLeave,onFocusin:a.handleMouseEnter,onFocusout:a.handleMouseLeave},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1},8,[`onClick`,`onMouseenter`,`onMouseleave`,`onFocusin`,`onFocusout`])]),_:1})}var ot=n.t(it,[[`render`,at]]),st=V.default.extend({addNodeView(){return m.VueNodeViewRenderer(ot)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`@`,pluginKey:new x.PluginKey(`mentionSuggestion`)}}),ct={name:`ChannelComponent`,components:{NodeViewWrapper:m.NodeViewWrapper,DtLink:c.default,DtIconLock:ne.DtIconLock,DtStack:d.default},props:m.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:`#`+this.$props.node.attrs.name}},methods:{handleClick(){let 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 lt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-lock`),s=(0,v.resolveComponent)(`dt-stack`),c=(0,v.resolveComponent)(`dt-link`),l=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(l,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(c,{tone:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`])},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(s,{direction:`row`,gap:`0`},{default:(0,v.withCtx)(()=>[e.$props.node.attrs.locked?((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`200`})):(0,v.createCommentVNode)(``,!0),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.text),1)]),_:1})]),_:1},8,[`onClick`])]),_:1})}var ut=n.t(ct,[[`render`,lt]]),dt=V.default.extend({name:`channel`,addNodeView(){return m.VueNodeViewRenderer(ut)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`#`,pluginKey:new x.PluginKey(`channelSuggestion`)}}),ft={name:`SlashCommandsComponent`,components:{NodeViewWrapper:m.NodeViewWrapper},props:{...m.nodeViewProps},emits:[`selected-command`],computed:{text(){return`/`+this.$props.node.attrs.command}},created(){let e=this.$props.node.attrs.command;this.$emit(`selected-command`,e);let t=this.editor?.storage?.[`slash-commands`]?.onSelectedCommand;t&&typeof t==`function`&&t(e)}};function pt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(o,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1})}var mt=n.t(ft,[[`render`,pt]]),ht=(e,t)=>[...e.matchAll(t)].map(e=>{let t=e[2];return t.endsWith(` `)||(t+=` `),{index:e.index,text:t,match:e}}),gt=V.default.extend({name:`slash-commands`,group:`inline`,inline:!0,addOptions(){return{...this.parent?.(),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return m.VueNodeViewRenderer(mt)},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`,(0,b.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command);return[(0,b.nodeInputRule)({find:RegExp(`^((?:\\/)(${e.join(`|`)})) $`),type:this.type,getAttributes(e){return{command:e[2]}}})]},addPasteRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command),t=RegExp(`^((?:\\/)(${e.join(`|`)})) ?$`,`g`);return[(0,b.nodePasteRule)({find:e=>ht(e,t),type:this.type,getAttributes(e){return{command:e[0].trim()}}})]}}).configure({suggestion:{char:`/`,pluginKey:new x.PluginKey(`slashCommandSuggestion`)}}),_t=100,vt={name:`VariableComponent`,components:{DtBadge:a.default,DtButton:l.default,DtPopover:f.default,DtInput:ee.default,NodeViewWrapper:m.NodeViewWrapper},props:m.nodeViewProps,data(){return{i18n:new s.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:_t}},computed:{altText:{get(){return this.node?.attrs?.altText||``},set(e){this.updateAttributes({altText:e})}},variableId(){return this.node?.attrs?.id},placeholder(){return this.variableData?.placeholder||``},variableItems(){return this.extension?.options?.variableItems||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){return this.node?.attrs?.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function yt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-badge`),s=(0,v.resolveComponent)(`dt-button`),c=(0,v.resolveComponent)(`dt-input`),l=(0,v.resolveComponent)(`dt-popover`),u=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(u,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[a.enableAltText?((0,v.openBlock)(),(0,v.createBlock)(l,{key:0,padding:`small`,"navigation-type":`arrow-keys`,placement:`top-start`,modal:!1},{anchor:(0,v.withCtx)(({attrs:e})=>[(0,v.createVNode)(s,(0,v.mergeProps)(e,{kind:`unstyled`}),{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{text:a.badgeLabel,contenteditable:`false`},null,8,[`text`])]),_:1},16)]),content:(0,v.withCtx)(({close:e})=>[(0,v.createVNode)(c,{modelValue:a.altText,"onUpdate:modelValue":t[0]||(t[0]=e=>a.altText=e),class:`d-p-100 d-w332`,label:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_LABEL`),placeholder:a.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:(0,v.withKeys)(t=>e(),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`validate`,`onKeyup`])]),_:1})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:1,text:a.badgeLabel,contenteditable:`false`},null,8,[`text`]))]),_:1})}var bt=n.t(vt,[[`render`,yt]]),xt=b.Node.create({name:`variable`,group:`inline`,inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return m.VueNodeViewRenderer(bt)},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}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute(`data-enable-alt-text`)===`true`,renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:`variable`}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return[`variable`,(0,b.mergeAttributes)(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||``,enableAltText:e.enableAltText}})}}}),St={name:`MentionSuggestion`,components:{DtAvatar:i.default,DtStack:d.default,DtText:o.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-mention-suggestion__presence--active`,busy:`d-mention-suggestion__presence--busy`,away:`d-mention-suggestion__presence--away`,offline:`d-mention-suggestion__presence--busy`}[this.presence]},showDetails(){return this.item.showDetails}}},Ct={class:`d-mention-suggestion__name`};function wt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-avatar`),s=(0,v.resolveComponent)(`dt-text`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,class:`d-mention-suggestion__container`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{"full-name":a.name,"image-src":a.avatarSrc,"image-alt":a.name,"show-presence":a.showDetails,presence:a.presence,size:200},null,8,[`full-name`,`image-src`,`image-alt`,`show-presence`,`presence`]),(0,v.createVNode)(c,{class:`d-mention-suggestion__details-container`,gap:`1`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,Ct,(0,v.toDisplayString)(a.name),1),a.showDetails?((0,v.openBlock)(),(0,v.createBlock)(c,{key:0,direction:`row`,gap:`50`},{default:(0,v.withCtx)(()=>[a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:0,kind:`label`,size:200,strength:`normal`,class:(0,v.normalizeClass)([`d-mention-suggestion__presence`,[a.presenceFontColorClass]])},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.presenceText),1)]),_:1},8,[`class`])):(0,v.createCommentVNode)(``,!0),a.status&&a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__divider`},{default:(0,v.withCtx)(()=>[...t[0]||(t[0]=[(0,v.createTextVNode)(` • `,-1)])]),_:1})):(0,v.createCommentVNode)(``,!0),a.status?((0,v.openBlock)(),(0,v.createBlock)(s,{key:2,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__status`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.status),1)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})]),_:1})}var Tt={allowSpaces:!0,render:Y(n.t(St,[[`render`,wt]]),`mention`)},Et={name:`ChannelSuggestion`,components:{DtStack:d.default,DtIconHash:H.default,DtIconLock:U.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function $(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-hash`),s=(0,v.resolveComponent)(`dt-icon-lock`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,gap:`100`},{default:(0,v.withCtx)(()=>[n.item.locked?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,size:`300`})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`300`})),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.name),1)]),_:1})}var Dt={allowSpaces:!0,render:Y(n.t(Et,[[`render`,$]]),`channel`)},Ot={name:`SlashCommandSuggestion`,components:{DtText:o.default},props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},kt={key:0};function At(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-text`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,null,[(0,v.createVNode)(o,{kind:`body`,size:300,density:300,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,null,`/`+(0,v.toDisplayString)(a.command),1),a.parametersExample?((0,v.openBlock)(),(0,v.createElementBlock)(`span`,kt,(0,v.toDisplayString)(a.parametersExample),1)):(0,v.createCommentVNode)(``,!0)]),_:1}),(0,v.createVNode)(o,{kind:`body`,size:200,tone:`tertiary`,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.description),1)]),_:1})])}var jt={allowSpaces:!0,startOfLine:!0,render:Y(n.t(Ot,[[`render`,At]]),`slash-command`)},Mt={name:`DtRichTextEditor`,components:{EditorContent:m.EditorContent,BubbleMenu:se,DtButton:l.default,DtStack:d.default},props:{modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},allowTyping:{type:Boolean,default:!0},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`?g.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`html`,validator(e){return g.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},linkPhoneNumbers:{type:Array,default:null},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},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},showLinkBubbleMenu:{type:Boolean,default:!0},preserveWhitespace:{type:[Boolean,String],default:`full`},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowTextAlign:{type:Boolean,default:!0},allowImageResize:{type:Boolean,default:!1}},emits:[`update:modelValue`,`json-input`,`html-input`,`text-input`,`markdown-input`,`blur`,`focus`,`enter`,`edit-link`,`selected`,`selected-command`,`mention-click`,`mention-hover`,`mention-leave`,`channel-click`,`phone-click`,`link-click`],data(){return{editor:null,appendTo:()=>t.returnFirstEl(this.$refs.editor.$el).getRootNode()?.querySelector(`body`),floatingOptions:{placement:`top-start`},i18n:new s.DialtoneLocalization}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){let e=[T.default,F.default,E.UndoRedo,D.default];e.push(this.useDivTags?rt:O.default),this.allowBold&&e.push(k.default),this.allowBlockquote&&e.push(S.default),this.allowBulletList&&(e.push(A.BulletList),e.push(A.ListItem.extend({renderText({node:e}){return e.textContent}})),e.push(A.OrderedList)),this.allowItalic&&e.push(j.default),this.allowStrike&&e.push(N.default),this.allowUnderline&&e.push(P.default),this.placeholder&&e.push(E.Placeholder.configure({placeholder:this.placeholder}));let t=this,n=b.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:e})=>t.allowLineBreaks?!1:(e.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>t.allowBulletList&&e.splitListItem(`listItem`),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit(`enter`),!0)}}});if(e.push(n),this.link&&e.push(M.default.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit(`edit-link`),!0)}}}).configure({HTMLAttributes:{class:`d-link d-wb-break-all`},openOnClick:!1,autolink:!this.customLink,protocols:g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension($e,this.customLink)),this.linkPhoneNumbers!==null&&e.push(et),this.mentionSuggestion){let t={...this.mentionSuggestion,...Tt};e.push(st.configure({suggestion:t}))}if(this.channelSuggestion){let t={...this.channelSuggestion,...Dt};e.push(dt.configure({suggestion:t}))}if(this.slashCommandSuggestion){let t={...this.slashCommandSuggestion,...jt};e.push(gt.configure({suggestion:t,onSelectedCommand:e=>{this.$emit(`selected-command`,e)}}))}return this.allowVariable&&e.push(xt.configure({variableItems:this.variableItems})),e.push(Ge),this.allowTextAlign&&e.push(I.default.configure({types:[`paragraph`]})),this.allowCode&&e.push(w.default),this.allowCodeblock&&e.push(C.default.extend({renderText({node:e,pos:t,range:n}){let r=n?.from??0,i=n?.to??t+e.nodeSize;if(r<=t&&i>=t+e.nodeSize)return`\`\`\`\n${e.textContent}\n\`\`\``;let a=Math.max(0,r-t-1),o=Math.min(e.textContent.length,i-t-1);return e.textContent.slice(a,o)},addCommands(){return{...this.parent?.(),toggleCodeBlock:(e={})=>({state:t,chain:n,commands:r})=>{let i=t.schema.nodes[this.name],{$from:a,$to:o}=t.selection,s=[];return t.doc.nodesBetween(a.pos,o.pos,(e,t)=>{if(e.isTextblock)return s.push({node:e,pos:t}),!1}),s.length<=1?r.toggleNode(this.name,`paragraph`,e):s.every(({node:e})=>e.type===i)?r.toggleNode(this.name,`paragraph`):n().setNode(this.name,e).command(({tr:e})=>{for(let n=s.length-1;n>0;n--){let r=e.mapping.map(s[n].pos),a=r-1;e.doc.resolve(a).parent.type===i&&e.replaceWith(a,r+1,t.schema.text(`
|
|
2
2
|
`))}return!0}).run()}}}}).configure({HTMLAttributes:{class:`d-rich-text-editor__code-block`}})),this.allowInlineImages&&e.push(tt.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&(e.push(R.TextStyleKit.configure({textStyle:!1,color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),e.push(ge)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(fe.configure({resizable:!0}),pe,he,me,E.Gapcursor),e},inputAttrs(){let 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)},linkPhoneNumbers(){this._applyPhoneMarks()}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new m.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleDOMEvents:{click:(e,t)=>{if(!this.link||t.button!==0)return!1;let n=t.target?.closest?.(`a`);return n?(this.editor.emit(`link-click`,{href:n.href,text:n.textContent,event:t}),t.defaultPrevented):!1}},handleKeyDown:(e,t)=>{if(this.allowTyping)return!1;let n=[`Backspace`];return!this.allowLineBreaks&&!t.shiftKey&&n.push(`Enter`),!n.includes(t.key)},handlePaste:(e,t)=>{let n=t.clipboardData||window.clipboardData,r=n.getData(`text/plain`),i=n.getData(`text/html`);return this.processPasteData(e,r,i)},transformPastedHTML(e){return e.replace(/<hr[^>]*\/?>/gi,`<p><br></p>`).replace(/(<\/\w+>)((<br \/>)+)/g,`$2$1`).replace(/(<br[^>]*>\s*)+<\/p>(\s*)$/i,`</p>$2`)}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return this.showLinkBubbleMenu&&e.isActive(`link`)},getSelectedLinkText(e){let{view:t,state:n}=e,{from:r,to:i}=t.state.selection,a=n.doc.textBetween(r,i,``),o=this.editor.state.doc.nodeAt(r);return o&&o.marks?.at(0)?.type?.name===`link`?o.textContent:a},editLink(){let e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes(`link`).href,text:e};this.$emit(`edit-link`,t)},removeLink(){this.editor?.chain()?.focus()?.unsetLink()?.run()},openLink(){this.editor?.chain()?.focus();let e=this.editor.getAttributes(`link`).href;window.open(e,`_blank`)},forceLinkifyPendingText(){!this.editor||!this.link||this.customLink||te.t(this.editor)},setLink(e,t,n,r=g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){if(!e){this.removeLink();return}r.find(t=>t.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange(`link`).run();let a=this.editor?.view?.state?.selection,o=t||e;this.editor.chain().focus().insertContent(o).setTextSelection({from:a.from,to:a.from+o.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){if(!this.editor)return;let n=this.getOutput();if(!(t&&(0,W.default)(e,n))){if(typeof e==`string`&&this.outputFormat===`text`){let t=RegExp(`(${y.emojiPattern})`,`g`);e=e?.replace(t,`<emoji-component code="$1"></emoji-component>`)}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace}}),this._applyPhoneMarks()}},_applyPhoneMarks(){if(!this.editor)return;let e=this.editor.schema.marks.LinkPhoneNumbers;if(!e)return;let{tr:t,doc:n}=this.editor.state;t.removeMark(0,n.content.size,e),this.linkPhoneNumbers?.length&&n.descendants((n,r)=>{if(!(!n.isText||!n.text))for(let i of this.linkPhoneNumbers){let a=0,o;for(;(o=n.text.indexOf(i,a))!==-1;)t.addMark(r+o,r+o+i.length,e.create()),a=o+i.length}}),this.editor.view.dispatch(t)},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){let n=(this.pasteRichText?t:t.replace(/\r\n/g,`
|
|
3
3
|
`).replace(/\n\n/g,`
|
|
4
4
|
`)).replace(/[\r\n]+$/,``).split(/\r?\n/),r=[];for(let e=0;e<n.length;e++)e>0&&r.push({type:`hardBreak`}),n[e]&&r.push({type:`text`,text:n[e]});this.editor.chain().focus().insertContent(r).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,n){if(this.shouldPreserveLineBreaks(t,n))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(n)){let t=this.extractPreformattedText(n);if(t&&t.includes(`
|
|
@@ -8,4 +8,4 @@ const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=
|
|
|
8
8
|
`)||/\n\s*\n/.test(e)},extractPreformattedText(e){let t=document.createElement(`div`);return t.innerHTML=e,this.walkAndExtractText(t)},walkAndExtractText(e){let t=``;if(e.nodeType===Node.TEXT_NODE)t+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if(this.hasPreWhitespace(e))t+=e.textContent;else for(let n of e.childNodes)t+=this.walkAndExtractText(n);return t},triggerInputChangeEvents(){let e=this.getOutput();this.$emit(`update:modelValue`,e);let t=this.editor.getJSON();this.$emit(`json-input`,t);let n=this.editor.getHTML();this.$emit(`html-input`,n);let r=this.editor.getText({blockSeparator:`
|
|
9
9
|
`});this.$emit(`text-input`,r);let i=_.t(t,this.extensions);this.$emit(`markdown-input`,i)},addEditorListeners(){this.editor.on(`create`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`update`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`selectionUpdate`,({editor:e})=>{this.$emit(`selected`,this.getSelectedLinkText(e))}),this.editor.on(`focus`,({event:e})=>{this.$emit(`focus`,e)}),this.editor.on(`blur`,({event:e})=>{this.$emit(`blur`,e)}),this.editor.on(`mention-click`,e=>{this.$emit(`mention-click`,e)}),this.editor.on(`mention-hover`,e=>{this.$emit(`mention-hover`,e)}),this.editor.on(`mention-leave`,e=>{this.$emit(`mention-leave`,e)}),this.editor.on(`channel-click`,e=>{this.$emit(`channel-click`,e)}),this.editor.on(`phone-click`,e=>{this.$emit(`phone-click`,e)}),this.editor.on(`link-click`,e=>{this.$emit(`link-click`,e)})},getOutput(){switch(this.outputFormat){case`json`:return this.editor.getJSON();case`html`:return this.editor.getHTML();case`markdown`:return _.t(this.editor.getJSON(),this.extensions);default:return this.editor.getText({blockSeparator:`
|
|
10
10
|
`})}},getExtension(e,t){return typeof t==`boolean`?e:e.configure?.(t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}},Nt={class:`d-popover__dialog`};function Pt(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-button`),s=(0,v.resolveComponent)(`dt-stack`),c=(0,v.resolveComponent)(`bubble-menu`),l=(0,v.resolveComponent)(`editor-content`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,null,[i.editor&&n.link?((0,v.openBlock)(),(0,v.createBlock)(c,{key:0,editor:i.editor,"should-show":a.bubbleMenuShouldShow,options:i.floatingOptions,"append-to":i.appendTo,style:{visibility:`visible`}},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`div`,Nt,[(0,v.createVNode)(s,{direction:`row`,class:`d-rich-text-editor-bubble-menu__button-stack`,gap:`0`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.editLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,v.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.openLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,v.createVNode)(o,{kind:`critical`,importance:`clear`,onClick:a.removeLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`])]),_:1})])]),_:1},8,[`editor`,`should-show`,`options`,`append-to`])):(0,v.createCommentVNode)(``,!0),(0,v.createVNode)(l,(0,v.mergeProps)({ref:`editor`,editor:i.editor,class:`d-rich-text-editor`,"data-qa":`dt-rich-text-editor`},a.attrs),null,16,[`editor`])])}var Ft=n.t(Mt,[[`render`,Pt]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Ft}});
|
|
11
|
-
//# sourceMappingURL=RichTextEditor-
|
|
11
|
+
//# sourceMappingURL=RichTextEditor-DMUDJKVn.cjs.map
|