@dialpad/dialtone 9.125.0 → 9.126.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.
Files changed (118) hide show
  1. package/dist/css/dialtone-default-theme.css +4 -0
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone.css +4 -0
  4. package/dist/css/dialtone.min.css +1 -1
  5. package/dist/tokens/doc.json +23474 -23474
  6. package/dist/vue2/component-documentation.json +1 -1
  7. package/dist/vue2/dialtone-vue.cjs +1 -1
  8. package/dist/vue2/dialtone-vue.js +227 -225
  9. package/dist/vue2/dialtone-vue.js.map +1 -1
  10. package/dist/vue2/lib/button/button.cjs +1 -1
  11. package/dist/vue2/lib/button/button.cjs.map +1 -1
  12. package/dist/vue2/lib/button/button.js +7 -7
  13. package/dist/vue2/lib/button/button.js.map +1 -1
  14. package/dist/vue2/lib/list-item/list-item.cjs +1 -1
  15. package/dist/vue2/lib/list-item/list-item.cjs.map +1 -1
  16. package/dist/vue2/lib/list-item/list-item.js +21 -11
  17. package/dist/vue2/lib/list-item/list-item.js.map +1 -1
  18. package/dist/vue2/lib/loader/index.cjs +2 -0
  19. package/dist/vue2/lib/loader/index.cjs.map +1 -0
  20. package/dist/vue2/lib/loader/index.js +5 -0
  21. package/dist/vue2/lib/loader/index.js.map +1 -0
  22. package/dist/vue2/lib/loader/loader.cjs +2 -0
  23. package/dist/vue2/lib/loader/loader.cjs.map +1 -0
  24. package/dist/vue2/lib/loader/loader.js +48 -0
  25. package/dist/vue2/lib/loader/loader.js.map +1 -0
  26. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs +8 -4
  27. package/dist/vue2/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  28. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js +414 -356
  29. package/dist/vue2/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  30. package/dist/vue2/localization/de-DE.cjs +169 -0
  31. package/dist/vue2/localization/de-DE.cjs.map +1 -0
  32. package/dist/vue2/localization/de-DE.js +172 -0
  33. package/dist/vue2/localization/de-DE.js.map +1 -0
  34. package/dist/vue2/localization/en-US.cjs +1 -1
  35. package/dist/vue2/localization/en-US.cjs.map +1 -1
  36. package/dist/vue2/localization/en-US.js +1 -1
  37. package/dist/vue2/localization/en-US.js.map +1 -1
  38. package/dist/vue2/localization/es-LA.cjs +2 -2
  39. package/dist/vue2/localization/es-LA.cjs.map +1 -1
  40. package/dist/vue2/localization/es-LA.js +2 -2
  41. package/dist/vue2/localization/es-LA.js.map +1 -1
  42. package/dist/vue2/localization/fr-FR.cjs +169 -0
  43. package/dist/vue2/localization/fr-FR.cjs.map +1 -0
  44. package/dist/vue2/localization/fr-FR.js +172 -0
  45. package/dist/vue2/localization/fr-FR.js.map +1 -0
  46. package/dist/vue2/localization/index.cjs +1 -1175
  47. package/dist/vue2/localization/index.cjs.map +1 -1
  48. package/dist/vue2/localization/index.js +46 -1211
  49. package/dist/vue2/localization/index.js.map +1 -1
  50. package/dist/vue2/localization/it-IT.cjs +169 -0
  51. package/dist/vue2/localization/it-IT.cjs.map +1 -0
  52. package/dist/vue2/localization/it-IT.js +172 -0
  53. package/dist/vue2/localization/it-IT.js.map +1 -0
  54. package/dist/vue2/localization/ja-JP.cjs +148 -0
  55. package/dist/vue2/localization/ja-JP.cjs.map +1 -0
  56. package/dist/vue2/localization/ja-JP.js +151 -0
  57. package/dist/vue2/localization/ja-JP.js.map +1 -0
  58. package/dist/vue2/localization/nl-NL.cjs +169 -0
  59. package/dist/vue2/localization/nl-NL.cjs.map +1 -0
  60. package/dist/vue2/localization/nl-NL.js +172 -0
  61. package/dist/vue2/localization/nl-NL.js.map +1 -0
  62. package/dist/vue2/localization/pt-BR.cjs +169 -0
  63. package/dist/vue2/localization/pt-BR.cjs.map +1 -0
  64. package/dist/vue2/localization/pt-BR.js +172 -0
  65. package/dist/vue2/localization/pt-BR.js.map +1 -0
  66. package/dist/vue2/localization/ru-RU.cjs +179 -0
  67. package/dist/vue2/localization/ru-RU.cjs.map +1 -0
  68. package/dist/vue2/localization/ru-RU.js +182 -0
  69. package/dist/vue2/localization/ru-RU.js.map +1 -0
  70. package/dist/vue2/localization/zh-CN.cjs +164 -0
  71. package/dist/vue2/localization/zh-CN.cjs.map +1 -0
  72. package/dist/vue2/localization/zh-CN.js +167 -0
  73. package/dist/vue2/localization/zh-CN.js.map +1 -0
  74. package/dist/vue2/types/components/list_item/list_item.vue.d.ts +9 -0
  75. package/dist/vue2/types/components/list_item/list_item.vue.d.ts.map +1 -1
  76. package/dist/vue2/types/components/loader/index.d.ts +2 -0
  77. package/dist/vue2/types/components/loader/index.d.ts.map +1 -0
  78. package/dist/vue2/types/components/loader/loader.vue.d.ts +32 -0
  79. package/dist/vue2/types/components/loader/loader.vue.d.ts.map +1 -0
  80. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +10 -0
  81. package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  82. package/dist/vue2/types/index.d.ts +1 -0
  83. package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +1 -1
  84. package/dist/vue3/component-documentation.json +1 -1
  85. package/dist/vue3/dialtone-vue.cjs +1 -1
  86. package/dist/vue3/dialtone-vue.js +208 -206
  87. package/dist/vue3/dialtone-vue.js.map +1 -1
  88. package/dist/vue3/lib/list-item/list-item.cjs +1 -1
  89. package/dist/vue3/lib/list-item/list-item.cjs.map +1 -1
  90. package/dist/vue3/lib/list-item/list-item.js +35 -30
  91. package/dist/vue3/lib/list-item/list-item.js.map +1 -1
  92. package/dist/vue3/lib/loader/index.cjs +2 -0
  93. package/dist/vue3/lib/loader/index.cjs.map +1 -0
  94. package/dist/vue3/lib/loader/index.js +5 -0
  95. package/dist/vue3/lib/loader/index.js.map +1 -0
  96. package/dist/vue3/lib/loader/loader.cjs +2 -0
  97. package/dist/vue3/lib/loader/loader.cjs.map +1 -0
  98. package/dist/vue3/lib/loader/loader.js +48 -0
  99. package/dist/vue3/lib/loader/loader.js.map +1 -0
  100. package/dist/vue3/lib/message-input/message-input.cjs +1 -1
  101. package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
  102. package/dist/vue3/lib/message-input/message-input.js +2 -1
  103. package/dist/vue3/lib/message-input/message-input.js.map +1 -1
  104. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +8 -4
  105. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  106. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +301 -235
  107. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  108. package/dist/vue3/types/components/list_item/list_item.vue.d.ts +10 -2
  109. package/dist/vue3/types/components/loader/index.d.ts +2 -0
  110. package/dist/vue3/types/components/loader/index.d.ts.map +1 -0
  111. package/dist/vue3/types/components/loader/loader.vue.d.ts +26 -0
  112. package/dist/vue3/types/components/loader/loader.vue.d.ts.map +1 -0
  113. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +19 -0
  114. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  115. package/dist/vue3/types/components/toggle/toggle.vue.d.ts +1 -1
  116. package/dist/vue3/types/index.d.ts +1 -0
  117. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  118. package/package.json +3 -3
@@ -1,6 +1,10 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../node_modules/@tiptap/vue-2.cjs"),l=require("@tiptap/core"),D=require("@tiptap/extension-blockquote"),j=require("@tiptap/extension-code-block"),P=require("@tiptap/extension-code"),M=require("@tiptap/extension-document"),$=require("@tiptap/extension-paragraph"),B=require("@tiptap/extension-placeholder"),H=require("@tiptap/extension-hard-break"),N=require("@tiptap/extension-bold"),V=require("@tiptap/extension-bullet-list"),F=require("@tiptap/extension-italic"),K=require("@tiptap/extension-link"),U=require("@tiptap/extension-list-item"),W=require("@tiptap/extension-ordered-list"),z=require("@tiptap/extension-strike"),X=require("@tiptap/extension-underline"),J=require("@tiptap/extension-text"),Y=require("@tiptap/extension-text-align"),G=require("@tiptap/extension-history"),Q=require("@tiptap/extension-text-style"),Z=require("@tiptap/extension-color"),ee=require("@tiptap/extension-font-family"),p=require("@tiptap/pm/state"),te=require("@tiptap/suggestion"),I=require("regex-combined-emojis"),u=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),O=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),ne=require("@dialpad/dialtone-emojis"),re=require("../list-item/list-item.cjs"),y=require("../stack/stack.cjs"),v=require("tippy.js"),E=require("../../common/utils/index.cjs"),ie=require("@tiptap/extension-image"),R=require("@tiptap/extension-mention"),q=require("../link/link.cjs"),w=require("./rich-text-editor-constants.cjs"),se=require("../avatar/avatar.cjs"),oe=require("@dialpad/dialtone-icons/vue2/hash"),ae=require("@dialpad/dialtone-icons/vue2/lock"),ce=require("deep-equal"),le=require("../button/button.cjs"),de=require("../../common/mixins/localization.cjs"),ue={name:"EmojiComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtEmoji:O.default},props:c.nodeViewProps};var me=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block d-va-bottom d-lh0"},[n("dt-emoji",{attrs:{size:"500",code:e.node.attrs.code}})],1)},he=[],fe=u.n(ue,me,he);const pe=fe.exports,ge={name:"SuggestionList",components:{DtListItem:re.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:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"||t.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const t=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");t&&t.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const e=this.items[t];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.id,avatarSrc:e.avatarSrc});break;case"channel":this.command({name:e.name,id:e.id});break;case"slash-command":this.command({command:e.command});break}}}};var _e=function(){var e=this,n=e._self._c;return n("div",{staticClass:"d-popover__dialog d-suggestion-list__container"},[n("ul",{directives:[{name:"show",rawName:"v-show",value:e.items.length,expression:"items.length"}],ref:"suggestionList",staticClass:"d-suggestion-list"},e._l(e.items,function(r,i){return n("dt-list-item",{key:r.id,class:["d-suggestion-list__item",{"d-list-item--highlighted":i===e.selectedIndex}],attrs:{"navigation-type":"arrow-keys"},on:{click:function(o){return e.selectItem(i)},keydown:function(o){return o.preventDefault(),e.onKeyDown.apply(null,arguments)}}},[n(e.itemComponent,{tag:"component",attrs:{item:r}})],1)}),1)])},be=[],we=u.n(ge,_e,be);const x=we.exports,ye={name:"EmojiSuggestion",components:{DtEmoji:O.default,DtStack:y.default},props:{item:{type:Object,required:!0}}};var ve=function(){var e=this,n=e._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[n("dt-emoji",{attrs:{size:"200",code:e.item.code}}),e._v(" "+e._s(e.item.code)+" ")],1)},xe=[],ke=u.n(ye,ve,xe);const Ce=ke.exports,k={name:"hideOnEsc",defaultValue:!0,fn({hide:t}){function e(n){n.keyCode===27&&t()}return{onShow(){document.addEventListener("keydown",e)},onHide(){document.removeEventListener("keydown",e)}}}},Te=20,Ee={items:({query:t})=>{if(t.length<2)return[];const e=Object.values(ne.emojisIndexed);return t=t.toLowerCase(),e.filter(r=>[r.name,r.shortname.replaceAll(":",""),...r.keywords].some(i=>i.startsWith(t))).splice(0,Te).map(r=>({code:r.shortname}))},command:({editor:t,range:e,props:n})=>{var o,s;const r=t.view.state.selection.$to.nodeAfter;((o=r==null?void 0:r.text)==null?void 0:o.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:"emoji",attrs:n}]).run(),(s=window.getSelection())==null||s.collapseToEnd()},render:()=>{let t,e,n=!1;return{onStart:r=>{t=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:Ce,itemType:"emoji",...r},editor:r.editor}),r.clientRect&&(e=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),e==null||e[0].setProps({getReferenceClientRect:r.clientRect})},onKeyDown(r){var i;if(n)return(i=t==null?void 0:t.ref)==null?void 0:i.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},Re=/(:\w+:)$/,Se=new RegExp(I.emojiPattern+"$"),Le=t=>{if(t&&f.codeToEmojiData(t[0]))return{text:t[2]||t[0]}},$e=t=>[...t.matchAll(f.emojiShortCodeRegex)].filter(n=>f.codeToEmojiData(n[0])).map(n=>({index:n.index,text:n[0],match:n})),Ie=l.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return c.VueNodeViewRenderer(pe)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:t}){return f.stringToUnicode(f.codeToEmojiData(t.attrs.code).unicode_output)},renderHTML({HTMLAttributes:t}){return["emoji-component",l.mergeAttributes(this.options.HTMLAttributes,t)]},addInputRules(){return[new l.InputRule({find:t=>{const e=t.match(Re)||t.match(Se);if(e)return Le(e)},handler:({state:t,range:e,match:n,commands:r,chain:i,can:o})=>{const{tr:s}=t,a=e.from,d=e.to;s.replaceWith(a,d,this.type.create({code:n[0]}))}})]},addPasteRules(){return[l.nodePasteRule({find:$e,type:this.type,getAttributes(t){return{code:t[0]}}}),l.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(t){return{code:t[0]}}})]},addProseMirrorPlugins(){return[te({char:":",pluginKey:new p.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Ee})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:i,anchor:o}=r;return i?(e.doc.nodesBetween(o-1,o,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText("",a,a+s.nodeSize),!1}),n):!1})}}});function Oe(t,e,n=()=>!0){const r=[];e.lastIndex=0;let i;for(;i=e.exec(t);)n(t,i)&&r.push(i);return r}function qe(t,e){return!["#","@"].includes(t.charAt(e.index))&&!["#","@"].includes(t.charAt(e.index-1))}function Ae(t){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return t.replace(e,"")}function De(t,e){const n=t.slice(0,e+1).search(/\S+\s*$/),r=t.slice(e).search(/\s/);if(r<0){const i=t.slice(n);return{text:i,from:n,to:n+i.length}}return{text:t.slice(n,r+e),from:n,to:r+e}}function T(t,e,n,r){const i=De(t,e);if(r.lastIndex=0,!r.test(i.text))return i;const o=n==="left"?i.from-1:i.to+1;return o<=0||o>=t.length||o===e?i:T(t,o,n,r)}function je(t,e,n,r){const i=Math.max(t.from-1,0),o=Math.min(t.to+1,e.content.size),s=l.getMarksBetween(i,o,e);for(const a of s)a.mark.type===r&&n.removeMark(a.from,a.to,r)}const S=E.getPhoneNumberRegex(1,15);function L(t,e,n,r,i,o){if(!t)return;let s=n-e-1;s=s<0?0:s;const a=r-e,d=T(t,s,"left",S),m=T(t,a,"right",S),h=t.slice(d.from,m.to);Oe(h,E.linkRegex,qe).forEach(C=>{const g=Ae(C[0]),b=e+d.from+C.index+1,A=b+g.length;i.addMark(b,A,o.create())})}function Pe(t){let e=!1;return new p.Plugin({key:new p.PluginKey("autolink"),appendTransaction:(n,r,i)=>{const o=n.some(h=>h.docChanged)&&!r.doc.eq(i.doc);if(e&&!o)return;const{tr:s}=i,{textContent:a}=i.doc;e||L(a,0,0,a.length,s,t.type),e=!0;const d=l.combineTransactionSteps(r.doc,[...n]);return l.getChangedRanges(d).forEach(({oldRange:h,newRange:_})=>{je(_,i.doc,s,t.type),l.findChildrenInRange(i.doc,_,g=>g.isTextblock).forEach(({node:g,pos:b})=>{L(g.textContent,b,h.from,_.to,s,t.type)})}),s}})}const Me={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Be=l.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:t}){return["a",l.mergeAttributes(this.options.HTMLAttributes,t,Me)]},renderText({node:t}){return t.attrs.text},addProseMirrorPlugins(){return[Pe({type:this.type})]}}),He=ie.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}),Ne=$.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:t}){return["div",l.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Ve={name:"MentionComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:q.default},props:c.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}}};var Fe=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[e._v(" "+e._s(e.text)+" ")])],1)},Ke=[],Ue=u.n(Ve,Fe,Ke);const We=Ue.exports,ze=R.extend({addNodeView(){return c.VueNodeViewRenderer(We)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:t}){return`@${t.attrs.id}`},renderHTML({HTMLAttributes:t}){return["mention-component",l.mergeAttributes(this.options.HTMLAttributes,t)]}}).configure({suggestion:{char:"@",pluginKey:new p.PluginKey("mentionSuggestion")}}),Xe={name:"ChannelComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:q.default},props:c.nodeViewProps,computed:{text(){return"#"+this.$props.node.attrs.name}}};var Je=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[e._v(" "+e._s(e.text)+" ")])],1)},Ye=[],Ge=u.n(Xe,Je,Ye);const Qe=Ge.exports,Ze=R.extend({name:"channel",addNodeView(){return c.VueNodeViewRenderer(Qe)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1}}},renderText({node:t}){return`#${t.attrs.id}`},renderHTML({HTMLAttributes:t}){return["channel-component",l.mergeAttributes(this.options.HTMLAttributes,t)]}}).configure({suggestion:{char:"#",pluginKey:new p.PluginKey("channelSuggestion")}}),et={name:"SlashCommandsComponent",components:{NodeViewWrapper:c.NodeViewWrapper},props:c.nodeViewProps,emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){this.$parent.$emit("selected-command",this.$props.node.attrs.command)}};var tt=function(){var e=this,n=e._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[e._v(" "+e._s(e.text)+" ")])},nt=[],rt=u.n(et,tt,nt);const it=rt.exports,st=(t,e)=>[...t.matchAll(e)].map(r=>{let i=r[2];return i.endsWith(" ")||(i+=" "),{index:r.index,text:i,match:r}}),ot=R.extend({name:"slash-commands",group:"inline",inline:!0,addNodeView(){return c.VueNodeViewRenderer(it)},parseHTML(){return[{tag:"command-component"}]},addAttributes(){return{command:{default:""},parametersExample:{default:""},description:{default:""}}},renderText({node:t}){return`/${t.attrs.command}`},renderHTML({HTMLAttributes:t}){return["command-component",l.mergeAttributes(this.options.HTMLAttributes,t)]},addInputRules(){var n;const t=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),e=new RegExp(`^((?:\\/)(${t.join("|")})) $`);return[l.nodeInputRule({find:e,type:this.type,getAttributes(r){return{command:r[2]}}})]},addPasteRules(){var n;const t=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),e=new RegExp(`^((?:\\/)(${t.join("|")})) ?$`,"g");return[l.nodePasteRule({find:r=>st(r,e),type:this.type,getAttributes(r){return{command:r[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new p.PluginKey("slashCommandSuggestion")}}),at={name:"MentionSuggestion",components:{DtAvatar:se.default,DtStack:y.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}};var ct=function(){var e=this,n=e._self._c;return n("dt-stack",{staticClass:"d-mention-suggestion__container",attrs:{direction:"row",gap:"400"}},[n("dt-avatar",{attrs:{"full-name":e.name,"image-src":e.avatarSrc,"image-alt":e.name,"show-presence":e.showDetails,presence:e.presence,size:"sm"}}),n("dt-stack",{staticClass:"d-mention-suggestion__details-container",attrs:{gap:"100"}},[n("span",{staticClass:"d-mention-suggestion__name"},[e._v(" "+e._s(e.name)+" ")]),e.showDetails?n("dt-stack",{staticClass:"d-label--sm-plain",attrs:{direction:"row",gap:"300"}},[e.presenceText?n("span",{staticClass:"d-mention-suggestion__presence",class:[e.presenceFontColorClass]},[e._v(" "+e._s(e.presenceText)+" ")]):e._e(),e.status&&e.presenceText?n("div",{staticClass:"d-mention-suggestion__divider"},[e._v(" • ")]):e._e(),e.status?n("div",{staticClass:"d-mention-suggestion__status"},[e._v(" "+e._s(e.status)+" ")]):e._e()]):e._e()],1)],1)},lt=[],dt=u.n(at,ct,lt);const ut=dt.exports,mt={allowSpaces:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:ut,itemType:"mention",...r},editor:r.editor}),r.clientRect&&(e=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var i;if(n)return(i=t==null?void 0:t.ref)==null?void 0:i.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},ht={name:"ChannelSuggestion",components:{DtStack:y.default,DtIconHash:oe,DtIconLock:ae},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};var ft=function(){var e=this,n=e._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[e.item.locked?n("dt-icon-lock",{attrs:{size:"300"}}):n("dt-icon-hash",{attrs:{size:"300"}}),n("span",[e._v(e._s(e.name))])],1)},pt=[],gt=u.n(ht,ft,pt);const _t=gt.exports,bt={allowSpaces:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:_t,itemType:"channel",...r},editor:r.editor}),r.clientRect&&(e=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var i;if(n)return(i=t==null?void 0:t.ref)==null?void 0:i.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},wt={name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}};var yt=function(){var e=this,n=e._self._c;return n("div",[n("div",{staticClass:"d-body--md-compact"},[n("span",[e._v("/"+e._s(e.command))]),e.parametersExample?n("span",[e._v(" "+e._s(e.parametersExample))]):e._e()]),n("div",{staticClass:"d-body--sm d-fc-tertiary"},[e._v(" "+e._s(e.description)+" ")])])},vt=[],xt=u.n(wt,yt,vt);const kt=xt.exports,Ct={allowSpaces:!0,startOfLine:!0,render:()=>{let t,e,n=!1;return{onStart:r=>{t=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:kt,itemType:"slash-command",...r},editor:r.editor}),r.clientRect&&(e=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[k]}),r.items.length>0&&(e==null||e[0].show()))},onUpdate(r){t==null||t.updateProps(r),r.items.length>0?e==null||e[0].show():e==null||e[0].hide(),r.clientRect&&(e==null||e[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var i;if(n)return(i=t==null?void 0:t.ref)==null?void 0:i.onKeyDown(r)},onExit(){e==null||e[0].destroy(),e=null,t==null||t.destroy(),t=null}}}},Tt={name:"DtRichTextEditor",components:{EditorContent:c.EditorContent,BubbleMenu:c.BubbleMenu,DtButton:le.default,DtStack:y.default},mixins:[de.default],props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(t){return typeof t=="string"?w.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(t):!0}},outputFormat:{type:String,default:"html",validator(t){return w.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(t)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","update:value","blur","focus","enter","edit-link","selected"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var t;return(t=this.$refs.editor.$el.getRootNode())==null?void 0:t.querySelector("body")},placement:"top-start"}}},computed:{editorListeners(){return{...this.$listeners,input:()=>{},focus:()=>{},blur:()=>{}}},extensions(){const t=[M,J,G,H];t.push(this.useDivTags?Ne:$),this.allowBlockquote&&t.push(D),this.allowBold&&t.push(N),this.allowBulletList&&(t.push(V),t.push(U.extend({renderText({node:r}){return r.textContent}})),t.push(W)),this.allowItalic&&t.push(F),this.allowStrike&&t.push(z),this.allowUnderline&&t.push(X),this.placeholder&&t.push(B.configure({placeholder:this.placeholder}));const e=this,n=l.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:r})=>e.allowLineBreaks?!1:(r.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>e.allowBulletList&&i.splitListItem("listItem"),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),!0),Enter:()=>e.allowLineBreaks?!1:(e.$emit("enter"),!0)}}});if(t.push(n),this.link&&t.push(K.extend({inclusive:!1}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&t.push(this.getExtension(Be,this.customLink)),this.mentionSuggestion){const r={...this.mentionSuggestion,...mt};t.push(ze.configure({suggestion:r}))}if(this.channelSuggestion){const r={...this.channelSuggestion,...bt};t.push(Ze.configure({suggestion:r}))}if(this.slashCommandSuggestion){const r={...this.slashCommandSuggestion,...Ct};t.push(ot.configure({suggestion:r}))}return t.push(Ie),t.push(Y.configure({types:["paragraph"]})),this.allowCode&&t.push(P),this.allowCodeblock&&t.push(j.extend({renderText({node:r}){return`\`\`\`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("../../node_modules/@tiptap/vue-2.cjs"),l=require("@tiptap/core"),q=require("@tiptap/extension-blockquote"),B=require("@tiptap/extension-code-block"),D=require("@tiptap/extension-code"),j=require("@tiptap/extension-document"),$=require("@tiptap/extension-paragraph"),M=require("@tiptap/extension-placeholder"),H=require("@tiptap/extension-hard-break"),N=require("@tiptap/extension-bold"),V=require("@tiptap/extension-bullet-list"),F=require("@tiptap/extension-italic"),K=require("@tiptap/extension-link"),W=require("@tiptap/extension-list-item"),U=require("@tiptap/extension-ordered-list"),z=require("@tiptap/extension-strike"),X=require("@tiptap/extension-underline"),J=require("@tiptap/extension-text"),Y=require("@tiptap/extension-text-align"),G=require("@tiptap/extension-history"),Q=require("@tiptap/extension-text-style"),Z=require("@tiptap/extension-color"),ee=require("@tiptap/extension-font-family"),p=require("@tiptap/pm/state"),te=require("@tiptap/suggestion"),I=require("regex-combined-emojis"),u=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),P=require("../emoji/emoji.cjs"),f=require("../../common/emoji/index.cjs"),ne=require("@dialpad/dialtone-emojis"),re=require("../list-item/list-item.cjs"),b=require("../stack/stack.cjs"),v=require("tippy.js"),E=require("../../common/utils/index.cjs"),se=require("@tiptap/extension-image"),R=require("@tiptap/extension-mention"),A=require("../link/link.cjs"),w=require("./rich-text-editor-constants.cjs"),ie=require("../avatar/avatar.cjs"),oe=require("@dialpad/dialtone-icons/vue2/hash"),ae=require("@dialpad/dialtone-icons/vue2/lock"),ce=require("deep-equal"),le=require("../button/button.cjs"),de=require("../../common/mixins/localization.cjs"),ue={name:"EmojiComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtEmoji:P.default},props:c.nodeViewProps};var me=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block d-va-bottom d-lh0"},[n("dt-emoji",{attrs:{size:"500",code:t.node.attrs.code}})],1)},he=[],fe=u.n(ue,me,he);const pe=fe.exports,ge={name:"SuggestionList",components:{DtListItem:re.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key==="ArrowUp"?(this.upHandler(),!0):e.key==="ArrowDown"?(this.downHandler(),!0):e.key==="Enter"||e.key==="Tab"?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();const e=this.$refs.suggestionList.querySelector(".d-list-item--highlighted");e&&e.scrollIntoView({behaviour:"smooth",block:"center"})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){const t=this.items[e];switch(this.itemType){case"emoji":this.command(t);return;case"mention":this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc});break;case"channel":this.command({name:t.name,id:t.id});break;case"slash-command":this.command({command:t.command});break}}}};var _e=function(){var t=this,n=t._self._c;return n("div",{staticClass:"d-popover__dialog d-suggestion-list__container"},[n("ul",{directives:[{name:"show",rawName:"v-show",value:t.items.length,expression:"items.length"}],ref:"suggestionList",staticClass:"d-suggestion-list"},t._l(t.items,function(r,s){return n("dt-list-item",{key:r.id,class:["d-suggestion-list__item",{"d-list-item--highlighted":s===t.selectedIndex}],attrs:{"navigation-type":"arrow-keys"},on:{click:function(o){return t.selectItem(s)},keydown:function(o){return o.preventDefault(),t.onKeyDown.apply(null,arguments)}}},[n(t.itemComponent,{tag:"component",attrs:{item:r}})],1)}),1)])},ye=[],we=u.n(ge,_e,ye);const x=we.exports,be={name:"EmojiSuggestion",components:{DtEmoji:P.default,DtStack:b.default},props:{item:{type:Object,required:!0}}};var ve=function(){var t=this,n=t._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[n("dt-emoji",{attrs:{size:"200",code:t.item.code}}),t._v(" "+t._s(t.item.code)+" ")],1)},xe=[],Te=u.n(be,ve,xe);const ke=Te.exports,T={name:"hideOnEsc",defaultValue:!0,fn({hide:e}){function t(n){n.keyCode===27&&e()}return{onShow(){document.addEventListener("keydown",t)},onHide(){document.removeEventListener("keydown",t)}}}},Ce=20,Ee={items:({query:e})=>{if(e.length<2)return[];const t=Object.values(ne.emojisIndexed);return e=e.toLowerCase(),t.filter(r=>[r.name,r.shortname.replaceAll(":",""),...r.keywords].some(s=>s.startsWith(e))).splice(0,Ce).map(r=>({code:r.shortname}))},command:({editor:e,range:t,props:n})=>{var o,i;const r=e.view.state.selection.$to.nodeAfter;((o=r==null?void 0:r.text)==null?void 0:o.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:"emoji",attrs:n}]).run(),(i=window.getSelection())==null||i.collapseToEnd()},render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:ke,itemType:"emoji",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[T]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),t==null||t[0].setProps({getReferenceClientRect:r.clientRect})},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Re=/(:\w+:)$/,Se=new RegExp(I.emojiPattern+"$"),Le=e=>{if(e&&f.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},$e=e=>[...e.matchAll(f.emojiShortCodeRegex)].filter(n=>f.codeToEmojiData(n[0])).map(n=>({index:n.index,text:n[0],match:n})),Ie=l.Node.create({name:"emoji",addOptions(){return{HTMLAttributes:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addNodeView(){return c.VueNodeViewRenderer(pe)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:e}){return f.stringToUnicode(f.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return["emoji-component",l.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){return[new l.InputRule({find:e=>{const t=e.match(Re)||e.match(Se);if(t)return Le(t)},handler:({state:e,range:t,match:n,commands:r,chain:s,can:o})=>{const{tr:i}=e,a=t.from,d=t.to;i.replaceWith(a,d,this.type.create({code:n[0]}))}})]},addPasteRules(){return[l.nodePasteRule({find:$e,type:this.type,getAttributes(e){return{code:e[0]}}}),l.nodePasteRule({find:f.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[te({char:":",pluginKey:new p.PluginKey("emoji"),editor:this.editor,...this.options.suggestion,...Ee})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:r}=t,{empty:s,anchor:o}=r;return s?(t.doc.nodesBetween(o-1,o,(i,a)=>{if(i.type.name===this.name)return n=!0,e.insertText("",a,a+i.nodeSize),!1}),n):!1})}}});function Pe(e,t,n=()=>!0){const r=[];t.lastIndex=0;let s;for(;s=t.exec(e);)n(e,s)&&r.push(s);return r}function Ae(e,t){return!["#","@"].includes(e.charAt(t.index))&&!["#","@"].includes(e.charAt(t.index-1))}function Oe(e){const t=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return e.replace(t,"")}function qe(e,t){const n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){const s=e.slice(n);return{text:s,from:n,to:n+s.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function C(e,t,n,r){const s=qe(e,t);if(r.lastIndex=0,!r.test(s.text))return s;const o=n==="left"?s.from-1:s.to+1;return o<=0||o>=e.length||o===t?s:C(e,o,n,r)}function Be(e,t,n,r){const s=Math.max(e.from-1,0),o=Math.min(e.to+1,t.content.size),i=l.getMarksBetween(s,o,t);for(const a of i)a.mark.type===r&&n.removeMark(a.from,a.to,r)}const S=E.getPhoneNumberRegex(1,15);function L(e,t,n,r,s,o){if(!e)return;let i=n-t-1;i=i<0?0:i;const a=r-t,d=C(e,i,"left",S),m=C(e,a,"right",S),h=e.slice(d.from,m.to);Pe(h,E.linkRegex,Ae).forEach(k=>{const g=Oe(k[0]),y=t+d.from+k.index+1,O=y+g.length;s.addMark(y,O,o.create())})}function De(e){let t=!1;return new p.Plugin({key:new p.PluginKey("autolink"),appendTransaction:(n,r,s)=>{const o=n.some(h=>h.docChanged)&&!r.doc.eq(s.doc);if(t&&!o)return;const{tr:i}=s,{textContent:a}=s.doc;t||L(a,0,0,a.length,i,e.type),t=!0;const d=l.combineTransactionSteps(r.doc,[...n]);return l.getChangedRanges(d).forEach(({oldRange:h,newRange:_})=>{Be(_,s.doc,i,e.type),l.findChildrenInRange(s.doc,_,g=>g.isTextblock).forEach(({node:g,pos:y})=>{L(g.textContent,y,h.from,_.to,i,e.type)})}),i}})}const je={class:"d-link d-c-text d-d-inline-block d-wb-break-all",rel:"noopener noreferrer nofollow"},Me=l.Mark.create({name:"CustomLink",renderHTML({HTMLAttributes:e}){return["a",l.mergeAttributes(this.options.HTMLAttributes,e,je)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[De({type:this.type})]}}),He=se.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}),Ne=$.extend({parseHTML(){return[{tag:"div"}]},renderHTML({HTMLAttributes:e}){return["div",l.mergeAttributes(this.options.HTMLAttributes,e),0]}}),Ve={name:"MentionComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:A.default},props:c.nodeViewProps,computed:{text(){return"@"+this.$props.node.attrs.name}}};var Fe=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[t._v(" "+t._s(t.text)+" ")])],1)},Ke=[],We=u.n(Ve,Fe,Ke);const Ue=We.exports,ze=R.extend({addNodeView(){return c.VueNodeViewRenderer(Ue)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["mention-component",l.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"@",pluginKey:new p.PluginKey("mentionSuggestion")}}),Xe={name:"ChannelComponent",components:{NodeViewWrapper:c.NodeViewWrapper,DtLink:A.default},props:c.nodeViewProps,computed:{text(){return"#"+this.$props.node.attrs.name}}};var Je=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[n("dt-link",{attrs:{kind:"mention"}},[t._v(" "+t._s(t.text)+" ")])],1)},Ye=[],Ge=u.n(Xe,Je,Ye);const Qe=Ge.exports,Ze=R.extend({name:"channel",addNodeView(){return c.VueNodeViewRenderer(Qe)},parseHTML(){return[{tag:"channel-component"}]},addAttributes(){return{name:{default:""},id:{default:""},locked:{default:!1}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return["channel-component",l.mergeAttributes(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:"#",pluginKey:new p.PluginKey("channelSuggestion")}}),et={name:"SlashCommandsComponent",components:{NodeViewWrapper:c.NodeViewWrapper},props:c.nodeViewProps,emits:["selected-command"],computed:{text(){return"/"+this.$props.node.attrs.command}},created(){this.$parent.$emit("selected-command",this.$props.node.attrs.command)}};var tt=function(){var t=this,n=t._self._c;return n("node-view-wrapper",{staticClass:"d-d-inline-block"},[t._v(" "+t._s(t.text)+" ")])},nt=[],rt=u.n(et,tt,nt);const st=rt.exports,it=(e,t)=>[...e.matchAll(t)].map(r=>{let s=r[2];return s.endsWith(" ")||(s+=" "),{index:r.index,text:s,match:r}}),ot=R.extend({name:"slash-commands",group:"inline",inline:!0,addNodeView(){return c.VueNodeViewRenderer(st)},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",l.mergeAttributes(this.options.HTMLAttributes,e)]},addInputRules(){var n;const e=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) $`);return[l.nodeInputRule({find:t,type:this.type,getAttributes(r){return{command:r[2]}}})]},addPasteRules(){var n;const e=(n=this.options.suggestion)==null?void 0:n.items({query:""}).map(r=>r.command),t=new RegExp(`^((?:\\/)(${e.join("|")})) ?$`,"g");return[l.nodePasteRule({find:r=>it(r,t),type:this.type,getAttributes(r){return{command:r[0].trim()}}})]}}).configure({suggestion:{char:"/",pluginKey:new p.PluginKey("slashCommandSuggestion")}}),at={name:"MentionSuggestion",components:{DtAvatar:ie.default,DtStack:b.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:"d-recipe-contact-row--active",busy:"d-recipe-contact-row--busy",away:"d-recipe-contact-row--away",offline:"d-recipe-contact-row--busy"}[this.presence]},showDetails(){return this.item.showDetails}}};var ct=function(){var t=this,n=t._self._c;return n("dt-stack",{staticClass:"d-mention-suggestion__container",attrs:{direction:"row",gap:"400"}},[n("dt-avatar",{attrs:{"full-name":t.name,"image-src":t.avatarSrc,"image-alt":t.name,"show-presence":t.showDetails,presence:t.presence,size:"sm"}}),n("dt-stack",{staticClass:"d-mention-suggestion__details-container",attrs:{gap:"100"}},[n("span",{staticClass:"d-mention-suggestion__name"},[t._v(" "+t._s(t.name)+" ")]),t.showDetails?n("dt-stack",{staticClass:"d-label--sm-plain",attrs:{direction:"row",gap:"300"}},[t.presenceText?n("span",{staticClass:"d-mention-suggestion__presence",class:[t.presenceFontColorClass]},[t._v(" "+t._s(t.presenceText)+" ")]):t._e(),t.status&&t.presenceText?n("div",{staticClass:"d-mention-suggestion__divider"},[t._v(" • ")]):t._e(),t.status?n("div",{staticClass:"d-mention-suggestion__status"},[t._v(" "+t._s(t.status)+" ")]):t._e()]):t._e()],1)],1)},lt=[],dt=u.n(at,ct,lt);const ut=dt.exports,mt={allowSpaces:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:ut,itemType:"mention",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[T]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},ht={name:"ChannelSuggestion",components:{DtStack:b.default,DtIconHash:oe,DtIconLock:ae},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};var ft=function(){var t=this,n=t._self._c;return n("dt-stack",{attrs:{direction:"row",gap:"400"}},[t.item.locked?n("dt-icon-lock",{attrs:{size:"300"}}):n("dt-icon-hash",{attrs:{size:"300"}}),n("span",[t._v(t._s(t.name))])],1)},pt=[],gt=u.n(ht,ft,pt);const _t=gt.exports,yt={allowSpaces:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:_t,itemType:"channel",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[T]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},wt={name:"SlashCommandSuggestion",props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}};var bt=function(){var t=this,n=t._self._c;return n("div",[n("div",{staticClass:"d-body--md-compact"},[n("span",[t._v("/"+t._s(t.command))]),t.parametersExample?n("span",[t._v(" "+t._s(t.parametersExample))]):t._e()]),n("div",{staticClass:"d-body--sm d-fc-tertiary"},[t._v(" "+t._s(t.description)+" ")])])},vt=[],xt=u.n(wt,bt,vt);const Tt=xt.exports,kt={allowSpaces:!0,startOfLine:!0,render:()=>{let e,t,n=!1;return{onStart:r=>{e=new c.VueRenderer(x,{parent:void 0,propsData:{itemComponent:Tt,itemType:"slash-command",...r},editor:r.editor}),r.clientRect&&(t=v("body",{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!1,onShow:()=>{n=!0},onHidden:()=>{n=!1},interactive:!0,trigger:"manual",placement:"top-start",zIndex:650,plugins:[T]}),r.items.length>0&&(t==null||t[0].show()))},onUpdate(r){e==null||e.updateProps(r),r.items.length>0?t==null||t[0].show():t==null||t[0].hide(),r.clientRect&&(t==null||t[0].setProps({getReferenceClientRect:r.clientRect}))},onKeyDown(r){var s;if(n)return(s=e==null?void 0:e.ref)==null?void 0:s.onKeyDown(r)},onExit(){t==null||t[0].destroy(),t=null,e==null||e.destroy(),e=null}}}},Ct={name:"DtRichTextEditor",components:{EditorContent:c.EditorContent,BubbleMenu:c.BubbleMenu,DtButton:le.default,DtStack:b.default},mixins:[de.default],props:{value:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},preventTyping:{type:Boolean,default:!1},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e=="string"?w.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:"html",validator(e){return w.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},additionalExtensions:{type:Array,default:()=>[]},hideLinkBubbleMenu:{type:Boolean,default:!1},useDivTags:{type:Boolean,default:!1}},emits:["input","json-input","html-input","text-input","update:value","blur","focus","enter","edit-link","selected"],data(){return{editor:null,tippyOptions:{appendTo:()=>{var e;return(e=this.$refs.editor.$el.getRootNode())==null?void 0:e.querySelector("body")},placement:"top-start"}}},computed:{editorListeners(){return{...this.$listeners,input:()=>{},focus:()=>{},blur:()=>{}}},extensions(){const e=[j,J,G,H];e.push(this.useDivTags?Ne:$),this.allowBlockquote&&e.push(q),this.allowBold&&e.push(N),this.allowBulletList&&(e.push(V),e.push(W.extend({renderText({node:r}){return r.textContent}})),e.push(U)),this.allowItalic&&e.push(F),this.allowStrike&&e.push(z),this.allowUnderline&&e.push(X),this.placeholder&&e.push(M.configure({placeholder:this.placeholder}));const t=this,n=l.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:r})=>t.allowLineBreaks?!1:(r.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>t.allowBulletList&&s.splitListItem("listItem"),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit("enter"),!0)}}});if(e.push(n),this.link&&e.push(K.extend({inclusive:!1}).configure({HTMLAttributes:{class:"d-link d-wb-break-all"},openOnClick:!1,autolink:!0,protocols:w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Me,this.customLink)),this.mentionSuggestion){const r={...this.mentionSuggestion,...mt};e.push(ze.configure({suggestion:r}))}if(this.channelSuggestion){const r={...this.channelSuggestion,...yt};e.push(Ze.configure({suggestion:r}))}if(this.slashCommandSuggestion){const r={...this.slashCommandSuggestion,...kt};e.push(ot.configure({suggestion:r}))}return e.push(Ie),e.push(Y.configure({types:["paragraph"]})),this.allowCode&&e.push(D),this.allowCodeblock&&e.push(B.extend({renderText({node:r}){return`\`\`\`
2
2
  ${r.textContent}
3
- \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&t.push(He),(this.allowFontFamily||this.allowFontColor)&&(t.push(Q),this.allowFontColor&&t.push(Z),this.allowFontFamily&&t.push(ee)),this.additionalExtensions.length&&t.push(...this.additionalExtensions),t},inputAttrs(){const t={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(t["aria-readonly"]=!0),t}},watch:{editable(t){this.editor.setEditable(t),this.updateEditorAttributes({"aria-readonly":!t})},inputClass(t){this.updateEditorAttributes({class:t})},inputAriaLabel(t){this.updateEditorAttributes({"aria-label":t})},extensions(){this.destroyEditor(),this.createEditor()},value(t){this.processValue(t)}},created(){this.createEditor()},beforeDestroy(){this.destroyEditor()},mounted(){E.warnIfUnmounted(this.$el,this.$options.name),this.processValue(this.value,!1)},methods:{createEditor(){this.editor=new c.Editor({autofocus:this.autoFocus,content:this.value,editable:this.editable,extensions:this.extensions,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handlePaste:(t,e,n)=>{if(!this.pasteRichText){const i=(e.clipboardData||window.clipboardData).getData("text/plain");if(i){const{tr:o}=t.state,{from:s,to:a}=t.state.selection;return o.insertText(i,s,a),t.dispatch(o),!0}}return!1},transformPastedHTML(t){return t.replace(/<br\s*\/?>/gi,"<br />").replace(/(<\/(?:p|div)>)\s*\n/gi,"$1<br />").replace(/\n(?=\S)/g,"<br />").replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:t,view:e,state:n,oldState:r,from:i,to:o}){return t.isActive("link")},getSelectedLinkText(t){var a,d,m;const{view:e,state:n}=t,{from:r,to:i}=e.state.selection,o=n.doc.textBetween(r,i,""),s=this.editor.state.doc.nodeAt(r);return s&&((m=(d=(a=s.marks)==null?void 0:a.at(0))==null?void 0:d.type)==null?void 0:m.name)==="link"?s.textContent:o},editLink(){const t=this.getSelectedLinkText(this.editor),e={href:this.editor.getAttributes("link").href,text:t};this.$emit("edit-link",e)},removeLink(){var t,e,n,r;(r=(n=(e=(t=this.editor)==null?void 0:t.chain())==null?void 0:e.focus())==null?void 0:n.unsetLink())==null||r.run()},openLink(){var e,n;(n=(e=this.editor)==null?void 0:e.chain())==null||n.focus();const t=this.editor.getAttributes("link").href;window.open(t,"_blank")},setLink(t,e,n,r=w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){var a,d,m;if(!t){this.removeLink();return}r.find(h=>h.test(t))||(t=`${i}${t}`),this.editor.chain().focus().extendMarkRange("link").run();const s=(m=(d=(a=this.editor)==null?void 0:a.view)==null?void 0:d.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(e).setTextSelection({from:s.from,to:s.from+e.length}).setLink({href:t,class:n.class}).run()},processValue(t,e=!0){const n=this.getOutput();if(!(e&&ce(t,n))){if(typeof t=="string"&&this.outputFormat==="text"){const r=new RegExp(`(${I.emojiPattern})`,"g");t=t==null?void 0:t.replace(r,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(t,!1)}},destroyEditor(){this.editor.destroy()},triggerInputChangeEvents(){const t=this.getOutput();this.$emit("input",t),this.$emit("update:value",t);const e=this.editor.getJSON();this.$emit("json-input",e);const n=this.editor.getHTML();this.$emit("html-input",n);const r=this.editor.getText({blockSeparator:`
4
- `});this.$emit("text-input",r)},addEditorListeners(){this.editor.on("create",()=>{this.triggerInputChangeEvents()}),this.editor.on("update",()=>{var t,e;if(this.preventTyping&&((e=(t=this.editor.view)==null?void 0:t.input)==null?void 0:e.lastKeyCode)!==8){this.editor.commands.setContent(this.value,!1);return}this.triggerInputChangeEvents()}),this.editor.on("selectionUpdate",({editor:t})=>{this.$emit("selected",this.getSelectedLinkText(t))}),this.editor.on("focus",({event:t})=>{this.$emit("focus",t)}),this.editor.on("blur",({event:t})=>{this.$emit("blur",t)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText({blockSeparator:`
5
- `})}},getExtension(t,e){var n;return typeof e=="boolean"?t:(n=t.configure)==null?void 0:n.call(t,e)},updateEditorAttributes(t){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...t}}})},focusEditor(){this.editor.commands.focus()}}};var Et=function(){var e=this,n=e._self._c;return n("div",[e.editor&&e.link&&!e.hideLinkBubbleMenu?n("bubble-menu",{staticStyle:{visibility:"visible"},attrs:{editor:e.editor,"should-show":e.bubbleMenuShouldShow,"tippy-options":e.tippyOptions}},[n("div",{staticClass:"d-popover__dialog"},[n("dt-stack",{staticClass:"d-rich-text-editor-bubble-menu__button-stack",attrs:{direction:"row",gap:"0"}},[n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:e.editLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:e.openLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"danger",importance:"clear"},on:{click:e.removeLink}},[e._v(" "+e._s(e.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL"))+" ")])],1)],1)]):e._e(),n("editor-content",e._g({ref:"editor",staticClass:"d-rich-text-editor",attrs:{editor:e.editor,"data-qa":"dt-rich-text-editor"}},e.editorListeners))],1)},Rt=[],St=u.n(Tt,Et,Rt);const Lt=St.exports;exports.default=Lt;
3
+ \`\`\``}}).configure({HTMLAttributes:{class:"d-rich-text-editor__code-block"}})),this.allowInlineImages&&e.push(He),(this.allowFontFamily||this.allowFontColor)&&(e.push(Q),this.allowFontColor&&e.push(Z),this.allowFontFamily&&e.push(ee)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),e},inputAttrs(){const e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(e["aria-readonly"]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},value(e){this.processValue(e)}},created(){this.createEditor()},beforeDestroy(){this.destroyEditor()},mounted(){E.warnIfUnmounted(this.$el,this.$options.name),this.processValue(this.value,!1)},methods:{createEditor(){this.editor=new c.Editor({autofocus:this.autoFocus,content:this.value,editable:this.editable,extensions:this.extensions,parseOptions:{preserveWhitespace:"full"},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handlePaste:(e,t,n)=>{const r=t.clipboardData||window.clipboardData,s=r.getData("text/plain"),o=r.getData("text/html");return this.processPasteData(e,s,o)},transformPastedHTML(e){return e.replace(/(<\/\w+>)((<br \/>)+)/g,"$2$3$1")}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e,view:t,state:n,oldState:r,from:s,to:o}){return e.isActive("link")},getSelectedLinkText(e){var a,d,m;const{view:t,state:n}=e,{from:r,to:s}=t.state.selection,o=n.doc.textBetween(r,s,""),i=this.editor.state.doc.nodeAt(r);return i&&((m=(d=(a=i.marks)==null?void 0:a.at(0))==null?void 0:d.type)==null?void 0:m.name)==="link"?i.textContent:o},editLink(){const e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes("link").href,text:e};this.$emit("edit-link",t)},removeLink(){var e,t,n,r;(r=(n=(t=(e=this.editor)==null?void 0:e.chain())==null?void 0:t.focus())==null?void 0:n.unsetLink())==null||r.run()},openLink(){var t,n;(n=(t=this.editor)==null?void 0:t.chain())==null||n.focus();const e=this.editor.getAttributes("link").href;window.open(e,"_blank")},setLink(e,t,n,r=w.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,s){var a,d,m;if(!e){this.removeLink();return}r.find(h=>h.test(e))||(e=`${s}${e}`),this.editor.chain().focus().extendMarkRange("link").run();const i=(m=(d=(a=this.editor)==null?void 0:a.view)==null?void 0:d.state)==null?void 0:m.selection;this.editor.chain().focus().insertContent(t).setTextSelection({from:i.from,to:i.from+t.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){const n=this.getOutput();if(!(t&&ce(e,n))){if(typeof e=="string"&&this.outputFormat==="text"){const r=new RegExp(`(${I.emojiPattern})`,"g");e=e==null?void 0:e.replace(r,'<emoji-component code="$1"></emoji-component>')}this.editor.commands.setContent(e,!1,{preserveWhitespace:"full"})}},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){const{tr:n}=e.state,{from:r,to:s}=e.state.selection;n.deleteRange(r,s);const o=t.split(/\r?\n/);let i=r;for(let a=0;a<o.length;a++)a>0&&(n.insert(i,e.state.schema.nodes.hardBreak.create()),i++),n.insertText(o[a],i),i+=o[a].length;e.dispatch(n)},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)){const r=this.extractPreformattedText(n);if(r&&r.includes(`
4
+ `))return this.insertPlainTextWithHardBreaks(e,r),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){const t=document.createElement("div");t.innerHTML=e;const n=t.querySelectorAll("*");for(const r of n)if(this.hasPreWhitespace(r)&&this.hasLineBreaks(r))return!0;return!1},hasPreWhitespace(e){const t=e.getAttribute("style")||"",n=e.style.whiteSpace||"",r=n==="pre"||n==="pre-wrap",s=t.includes("white-space: pre");return r||s},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
5
+ `)},hasBlankLines(e){return e.includes(`
6
+
7
+ `)||/\n\s*\n/.test(e)},extractPreformattedText(e){const 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(const n of e.childNodes)t+=this.walkAndExtractText(n);return t},triggerInputChangeEvents(){const e=this.getOutput();this.$emit("input",e),this.$emit("update:value",e);const t=this.editor.getJSON();this.$emit("json-input",t);const n=this.editor.getHTML();this.$emit("html-input",n);const r=this.editor.getText({blockSeparator:`
8
+ `});this.$emit("text-input",r)},addEditorListeners(){this.editor.on("create",()=>{this.triggerInputChangeEvents()}),this.editor.on("update",()=>{var e,t;if(this.preventTyping&&((t=(e=this.editor.view)==null?void 0:e.input)==null?void 0:t.lastKeyCode)!==8){this.editor.commands.setContent(this.value,!1);return}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)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText({blockSeparator:`
9
+ `})}},getExtension(e,t){var n;return typeof t=="boolean"?e:(n=e.configure)==null?void 0:n.call(e,t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}};var Et=function(){var t=this,n=t._self._c;return n("div",[t.editor&&t.link&&!t.hideLinkBubbleMenu?n("bubble-menu",{staticStyle:{visibility:"visible"},attrs:{editor:t.editor,"should-show":t.bubbleMenuShouldShow,"tippy-options":t.tippyOptions}},[n("div",{staticClass:"d-popover__dialog"},[n("dt-stack",{staticClass:"d-rich-text-editor-bubble-menu__button-stack",attrs:{direction:"row",gap:"0"}},[n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:t.editLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"muted",importance:"clear"},on:{click:t.openLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL"))+" ")]),n("dt-button",{attrs:{kind:"danger",importance:"clear"},on:{click:t.removeLink}},[t._v(" "+t._s(t.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL"))+" ")])],1)],1)]):t._e(),n("editor-content",t._g({ref:"editor",staticClass:"d-rich-text-editor",attrs:{editor:t.editor,"data-qa":"dt-rich-text-editor"}},t.editorListeners))],1)},Rt=[],St=u.n(Ct,Et,Rt);const Lt=St.exports;exports.default=Lt;
6
10
  //# sourceMappingURL=rich-text-editor.cjs.map