@globalpayments/vega 2.34.0 → 2.34.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 (122) hide show
  1. package/dist/cjs/{app-globals-4e819773.js → app-globals-48582633.js} +2 -2
  2. package/dist/cjs/{content-state-3a2724f6.js → content-state-6a5b9736.js} +64 -294
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/{text-color-toolbar-button-slimmer-b1c9f40e.js → text-color-toolbar-button-slimmer-21a166e4.js} +1 -1
  6. package/dist/cjs/{text-node-0d12da5a.js → text-node-494856f3.js} +0 -122
  7. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  8. package/dist/cjs/vega-pagination.cjs.entry.js +5 -2
  9. package/dist/cjs/vega-rich-text-content.cjs.entry.js +2 -2
  10. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +629 -416
  11. package/dist/cjs/vega-table_8.cjs.entry.js +1 -1
  12. package/dist/cjs/vega.cjs.js +3 -3
  13. package/dist/collection/components/vega-pagination/vega-pagination.js +5 -2
  14. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +0 -10
  15. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +0 -9
  16. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +0 -44
  17. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +0 -10
  18. package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +0 -42
  19. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +0 -9
  20. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +0 -14
  21. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +0 -11
  22. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +0 -26
  23. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +0 -44
  24. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +0 -11
  25. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +0 -18
  26. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +0 -13
  27. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +0 -19
  28. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +0 -27
  29. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +2 -14
  30. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +0 -10
  31. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +0 -32
  32. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +258 -0
  33. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +71 -0
  34. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +70 -0
  35. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +37 -0
  36. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +55 -0
  37. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +85 -0
  38. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +49 -0
  39. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +50 -0
  40. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +60 -0
  41. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +50 -0
  42. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +56 -0
  43. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +7 -3
  44. package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +3 -0
  45. package/dist/esm/{app-globals-9971ccfd.js → app-globals-48531a04.js} +2 -2
  46. package/dist/esm/{content-state-acf55eb0.js → content-state-4b036bf1.js} +65 -295
  47. package/dist/esm/index.js +2 -2
  48. package/dist/esm/loader.js +3 -3
  49. package/dist/esm/{text-color-toolbar-button-slimmer-d0255b98.js → text-color-toolbar-button-slimmer-b2270b64.js} +1 -1
  50. package/dist/esm/{text-node-6f7d736c.js → text-node-a652ca87.js} +0 -122
  51. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  52. package/dist/esm/vega-pagination.entry.js +5 -2
  53. package/dist/esm/vega-rich-text-content.entry.js +2 -2
  54. package/dist/esm/vega-rich-text-editor_4.entry.js +630 -417
  55. package/dist/esm/vega-table_8.entry.js +1 -1
  56. package/dist/esm/vega.js +3 -3
  57. package/dist/types/components/vega-pagination/vega-pagination.d.ts +1 -0
  58. package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +0 -7
  59. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +0 -7
  60. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +0 -14
  61. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +0 -8
  62. package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +0 -14
  63. package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +0 -7
  64. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +0 -7
  65. package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +0 -7
  66. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +0 -7
  67. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +0 -14
  68. package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +0 -7
  69. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +0 -8
  70. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +0 -1
  71. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -1
  72. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +0 -1
  73. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +0 -1
  74. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +0 -1
  75. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -2
  76. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +111 -0
  77. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +32 -0
  78. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +19 -0
  79. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +32 -0
  80. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +31 -0
  81. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +38 -0
  82. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +35 -0
  83. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +36 -0
  84. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +31 -0
  85. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +36 -0
  86. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +31 -0
  87. package/dist/vega/index.esm.js +1 -1
  88. package/dist/vega/{p-d302f052.entry.js → p-0190095c.entry.js} +1 -1
  89. package/dist/vega/p-10393104.js +1 -0
  90. package/dist/vega/p-584dcd9b.js +1 -0
  91. package/dist/vega/p-5f377954.js +1 -1
  92. package/dist/vega/{p-c1d97d12.entry.js → p-734ea281.entry.js} +1 -1
  93. package/dist/vega/{p-49f4a666.js → p-8836c1b9.js} +1 -1
  94. package/dist/vega/p-8f004647.entry.js +1 -0
  95. package/dist/vega/p-9e732a26.entry.js +1 -0
  96. package/dist/vega/{p-2fc3af2f.js → p-9f39dd10.js} +1 -1
  97. package/dist/vega/vega.esm.js +1 -1
  98. package/package.json +1 -1
  99. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +0 -135
  100. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +0 -74
  101. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +0 -47
  102. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +0 -39
  103. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +0 -50
  104. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +0 -41
  105. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +0 -57
  106. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +0 -56
  107. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +0 -77
  108. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +0 -44
  109. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +0 -67
  110. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +0 -29
  111. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +0 -37
  112. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +0 -35
  113. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +0 -37
  114. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +0 -36
  115. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +0 -39
  116. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +0 -39
  117. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +0 -46
  118. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +0 -37
  119. package/dist/vega/p-315667f1.js +0 -1
  120. package/dist/vega/p-728b029a.entry.js +0 -1
  121. package/dist/vega/p-b6af0fc1.entry.js +0 -1
  122. package/dist/vega/p-e43c2a27.js +0 -1
@@ -0,0 +1 @@
1
+ import{h as t}from"./p-9c1eeff2.js";import{B as s,e}from"./p-452e284a.js";import{C as i}from"./p-443ad3b3.js";import{d as n,D as r,V as h}from"./p-a5ffe912.js";import{M as a,b as o,s as c,N as l,a as u,R as d,c as p,I as w}from"./p-8c26227e.js";import{V as f}from"./p-f357cf46.js";import{i as b}from"./p-b1f65b13.js";import{Z as g,A as m,T as k,B as y,R as x,L as N,D as A,a as v,U as O,S as j}from"./p-584dcd9b.js";import{g as S}from"./p-3ce31dc3.js";class B extends s{constructor(t){super(),this.type=e.ALIGNMENT,this.textAlign=t}static from(t){return[e.ALIGNMENT,new B(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}render(){return null}}class I extends s{constructor(t){super(),this.type=e.INDENT,this.indent=Math.max(0,t)}static from(t){return[e.INDENT,new I(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class C{replaceBlockWithBlocks(t,s){this.blocks&&(s.forEach((t=>{t.parent=this})),this.blocks=this.blocks.flatMap((e=>e===t?s:e)))}appendChildBlocks(t){this.blocks&&(t.forEach((t=>{t.parent=this})),this.blocks=this.blocks.concat(t))}removeChildBlock(t){this.blocks&&(this.blocks=this.blocks.filter((s=>s!==t)))}}class L extends a{constructor(t){super(),this.type=o.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class T extends a{constructor(t){super(),this.type=o.DELETE_CHILD,this.entityToBeRemoved=t}}class M extends C{constructor(t){super(),this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,s){switch(t){case"textAlign":return B.from(s);case"indent":return I.from(s)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof s)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=c.getDOMByEntity(this);if(t){const s=n.getSubjectFromParentNodeByEventId(t,f);s&&i.notify(s,{})}}}doApply(t){t instanceof a?this.doModifyActionApply(t):this.applyAnnotationAction(t)}applyAnnotationAction(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}getStyles(){return Array.from(this.annotationMap.values()).filter((t=>t instanceof s)).map((t=>t.render())).filter(b).reduce(((t,s)=>Object.assign(Object.assign({},t),s)),{})}getClasses(){return Array.from(this.annotationMap.values()).map((t=>{var s;return null===(s=t.renderClass)||void 0===s?void 0:s.call(t)})).filter(b).reduce(((t,s)=>[t,s].join(" ")),"")}appendChildNodes(t){t.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.concat(t)}mergeTwoBlocksNodes(t){if(this.type===t.type||"image"!==this.type&&"image"!==t.type){let s=t.nodes;"image"!==this.type&&(s=t.nodes.filter((t=>t.text&&t.text!==g))),this.apply(new L(s)),t.parent.apply(new T(t))}}concatBlocksNodes(t){const s=[];return t.map((t=>{"image"!==t.type&&(s.push(...t.nodes),t.parent.apply(new T(t)))})),s}getPreviousNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(e>0)return s.nodes[e-1];if(s.parent){const t=this.getPreviousBlock(s);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(s.nodes[e+1])return s.nodes[e+1];if(s.parent){const t=this.getNextBlock(s);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t),i=s.parent;if("list-item"===s.type){const t=i.parent;return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===i}return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockLastNode(t.blocks[t.blocks.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(s>0)return t.parent.blocks[s-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===s)return this.getPreviousBlock(t.parent)}}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(t.parent.blocks[s+1])return t.parent.blocks[s+1];if("list-item"===t.type&&t.parent.blocks.length===s+1)return this.getNextBlock(t.parent)}}replaceNodeWithNodes(t,s){this.nodes&&(s.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.flatMap((e=>e===t?s:e)))}}class E extends l{constructor(t="md",s){super(),this.type=u.IMAGE,this.size=t,this.alt=s}static from(t,s){return[u.IMAGE,new E(t,s)]}toJSON(){return b(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class J extends m{constructor(t,s){super(),this.isFlushable=!0,this.size=t,this.alt=s}toAnnotation(){return new E(this.size,this.alt)}}class z extends d{constructor(t,s,e,i){super(t,i),this.type=p.IMAGE,this.url=s,this.parentBlock=e}static from(t,s){const e=new z(t.id,t.url,s);let i;return i=t.annotations&&0!==Object.keys(t.annotations).length?t.annotations:{size:"md"},e.annotationMap=new Map(Object.keys(i).map((()=>E.from(i.size,i.alt))).filter(b)),e}toJSON(){const t=this.annotationMap.get(u.IMAGE),s={};return(null==t?void 0:t.size)&&(s.size=t.size),(null==t?void 0:t.alt)&&(s.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{}),{type:"image",url:this.url})}render({editable:s}={}){const e=this.annotationMap.get(u.IMAGE),i=null==e?void 0:e.size,n=null==e?void 0:e.alt,a=({detail:t})=>{switch(t.action){case"edit":this.apply(new J(t.payload.size,t.payload.alt));break;case"delete":{const t=new InputEvent("beforeinput",{inputType:"deleteContentBackward",bubbles:!0});setTimeout((()=>{c.getDOMByEntity(this).dispatchEvent(t)}),50);break}}};return s?t("vega-rich-text-image-editor",{style:this.getStyles(),size:i,alt:n,ref:t=>{r.addUniqueObserverToNode(t,h,a)}},this.renderImage(s,n)):this.renderImage(s,n)}doAnnotationActionApply(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s)}doModifyActionApply(t){}registerRef(t){t&&c.register(t,this)}renderImage(s,e){return t("img",{style:s?{width:"100%"}:this.getStyles(),alt:e,src:this.url,ref:this.registerRef.bind(this)})}}class W extends a{constructor(t){super(),this.type=o.REPLACE_CHILD_NODES,this.newChildNodes=t}}class P extends a{constructor(t,...s){super(),this.type=o.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=s}}class F extends a{constructor(t,s){super(),this.type=o.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=s}}class H extends s{constructor(t){super(),this.type=e.TEXT_STYLE,this.textStyle=t}static from(t){return[e.TEXT_STYLE,new H(t)]}toJSON(){return{textStyle:this.textStyle}}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"}}}}class R extends m{constructor(t,s){super(),this.isFlushable=!0,this.textStyle=t,this.bold=s}toAnnotation(){return new H(this.textStyle)}}class V extends k{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new y(this.bold)}}class D extends a{constructor(t){super(),this.type=o.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class U extends a{constructor(t,...s){super(),this.type=o.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=s}}class $ extends M{constructor(t,s){super(t),this.nodes=[],this.type=s,this.annotationMap=$.isAcceptableTextStyle(s)?new Map([H.from(s)]):new Map([H.from("paragraph")])}static from(t){const s=new $(t.id,t.type),{annotations:e}=t;return s.nodes=t.nodes.map((t=>x.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static createAnnotationEntity(t,s){return"textStyle"===t?H.from(s):super.createAnnotationEntity(t,s)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((s,e)=>{const i=s.at(-1);if(t instanceof N&&t.needMergeNode){const t=null==i?void 0:i.getAnnotationByType(u.LINK),n=e.getAnnotationByType(u.LINK);if(t&&n&&t.toEqual(n))return s}return[...s,e]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new $(S(),this.type);return s.nodes=[],s.apply(new L(t)),s}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}render(s,e){const i=this.getBlockTagByType(this.type);return t(i,{ref:this.registerRef.bind(this),style:this.getStyles(),class:super.getClasses()},this.renderNodes(s),e)}registerRef(t){t&&c.register(t,this)}renderNodes(t={}){const s=this.getAnnotationByType(w.LINK_GROUP);return s?s.renderNodes(this.nodes,t):this.nodes.map((t=>t.render()))}doAnnotationActionApply(t){if(t instanceof R)return"list-item"!==this.type&&(this.type=t.textStyle),void this.nodes.forEach(t.bold?t=>{const s=new V(!0);s.doSplit=!1,t.apply(s)}:t=>{t.apply(new A(u.BOLD))});if(t instanceof v){const s=this.getAnnotationByType(w.LINK_GROUP);if(s){const e=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...e,...t.nodes]),this.annotationMap.set(w.LINK_GROUP,s)}}}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildNode(t);break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.TRANSFORM_LIST_BLOCK:this.convertParagraphToList(t);break;case o.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}splitTextNodeBlock(t,s){if(t){const e=t.text.slice(0,s),i=t.text.slice(s),n=this.nodes.indexOf(t);if(n>-1){const s=this.nodes.slice(0,n),r=this.nodes.slice(n+1);e&&s.push(t.cloneWithText(e)),i&&r.unshift(t.cloneWithText(i)),this.apply(new W(s));const h=this.cloneWithNodes(r);return this.parent.apply(new P(this,h)),h}}}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){const e=this.nodes[this.nodes.length-1];return t===e&&(t.isEmpty()||s===e.text.length)}lineBreakSingleBlock(t,s){if(t){const e=new x(S(),"\n",this),i=t.text.slice(0,s),n=t.text.slice(s),r=this.nodes.indexOf(t);if(r>-1){const s=this.nodes.slice(0,r),h=this.nodes.slice(r+1);i&&s.push(t.cloneWithText(i)),n&&h.unshift(t.cloneWithText(n)),this.mergeLineBreakNodes(s,e,h)}return e}}lineBreakMultipleBlocks(t){const s=this.nodes,e=new x(S(),"\n",this),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,e,i),e}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;if(0!==e&&!s.isEmpty()){const i=s.text.slice(0,e-1)+s.text.slice(e);if(s.apply(new O(i)),i)return void(t.previousNode=s);{const e=this.getPreviousNode(s);return e&&e.parentBlock===this&&"\n"===e.text||1===this.nodes.length?void(t.previousNode=s):(this.apply(new T(s)),void(t.previousNode=e))}}{let e=this.getPreviousNode(s),i=null;if(this.nodes.length&&e&&e.parentBlock!==this)s.isEmpty()&&this.apply(new T(s)),e.parentBlock.apply(new D(this));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&this.apply(new T(s)),e instanceof x&&e.isEmpty()){const t=e;e=this.getPreviousNode(e),t.parentBlock.apply(new T(t)),e||(i=s)}0===this.nodes.length&&this.parent.apply(new T(this)),e?t.previousNode=e:i&&(t.nextNode=i)}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new T(this))}mergeLineBreakNodes(t,s,e){(0===e.length||e[0]&&""===e[0].text)&&e.push(new x(S(),"\n",this,t[t.length-1]&&t[t.length-1].annotationMap)),this.apply(new W([...t,s,...e]))}getBlockTagByType(t){switch(t){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"paragraph":return"p";case"list-item":return"li"}}breakSingleTextBlock(t,s){const e=this.copyInlineStyleToNewParagraph(t);if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new P(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}this.parent.apply(new U(this,e))}return e}convertParagraphToList(t){const s=this.parent.createList(t.listType),e=t.selectedBlocks.map((t=>this.parent.toListItem(t)));s.apply(new L(e)),this.parent.apply(new P(t.selectedBlocks[0],s)),t.selectedBlocks.forEach((t=>{t.parent.apply(new T(t))}))}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtEnd(s,e))this.parent.apply(new P(this,i));else if(this.isCaretPositionAtStart(s,e))this.parent.apply(new U(this,i));else{const t=new F(s,e);this.apply(t),this.parent.apply(new P(this,i))}}copyInlineStyleToNewParagraph(t){const s=t.cloneWithText("");s.annotationMap.delete(u.LINK);const e=new $(S(),"paragraph");return e.apply(new L([s])),e}}class Z extends M{constructor(t){super(t),this.type="image",this.nodes=[]}static from(t){const s=new Z(t.id),{annotations:e}=t;return s.nodes=t.nodes.map((t=>z.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.nodes.map((t=>t.toJSON()))})}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>t.url.length>0))}getLastNode(){return this.nodes[this.nodes.length-1]}render(s){return t("div",{style:Object.assign({},this.getStyles()),ref:this.registerRef.bind(this),class:super.getClasses()},this.nodes.map((t=>t.render(s))))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildNode(t);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case o.INSERT_NODES_AFTER:this.replaceNodeWithNodes(t.referNode,[t.referNode,...t.nodesToBeInserted]);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}registerRef(t){t&&c.register(t,this)}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new T(this))}splitImageNodes(t,s){const e=this.nodes.indexOf(t);if(e>-1){const t=this.nodes.slice(0,e+s),i=this.nodes.slice(e+s);this.apply(new W(t));const n=this.cloneWithNodes(i);return this.parent.apply(new P(this,n)),n}}cloneWithNodes(t){const s=new Z(S());return s.nodes=[],s.apply(new L(t)),s}breakSingleBlock(t,s){const e=$.from({id:S(),type:"paragraph",nodes:[{id:S(),type:"text",text:""}]});if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new P(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}this.parent.apply(new U(this,e))}return e}lineBreakSingleBlock(t,s){const e=this.breakSingleBlock(t,s);if(e)return e.nodes[0]}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){return t===this.nodes[this.nodes.length-1]&&1===s}lineBreakMultipleBlocks(t){const s=$.from({id:S(),type:"paragraph",nodes:[{id:S(),type:"text",text:"\n"}]});this.parent.apply(new P(this,s));const e=this.concatBlocksNodes(t.slice(1));return(0===e.length||e[0]&&""===e[0].text)&&e.push(new x(S(),"\n",s)),s.apply(new L(e)),s.nodes[0]}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;let i=this.getPreviousNode(s),n=null;if(1===e){const t=s.parentBlock;this.isContentFirstNode(s)&&(n=this.getNextNode(s)),1===t.nodes.length?t.parent.apply(new T(t)):s.parentBlock.apply(new T(s))}else{const e=i;e&&e instanceof z&&(i=this.getPreviousNode(e),e.parentBlock.apply(new T(e)),i||(t.nextNode=s))}i?t.previousNode=i:n&&(t.nextNode=n)}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;this.nodes.length<1?this.apply(new L(t.imageBlockToBeInserted.nodes)):this.isCaretPositionAtEnd(s,e)?this.parent.apply(new P(this,i)):this.isCaretPositionAtStart(s,e)?this.parent.apply(new U(this,i)):(this.apply(new F(s,e)),this.parent.apply(new P(this,i)))}}class q extends ${constructor(t,s){super(t,"list-item"),this.children=[],this.children=s}static from(t){const s=new q(t.id);s.nodes=t.nodes.map((t=>x.from(t,s))),t.children&&(s.children=t.children.map((t=>{const e=K.from(t);return e.parent=s,e})));const{annotations:e}=t;return e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.children)||void 0===t?void 0:t.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new q(S());return s.nodes=[],s.apply(new L(t)),s}isNotEmpty(){return this.children?super.isNotEmpty()||this.children.some((t=>t.isNotEmpty())):super.isNotEmpty()}getLastNode(){return this.children&&this.children.length>0?this.children[this.children.length-1].getLastNode():super.getLastNode()}render(t){return super.render(t,this.renderChildren(t))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeListChildNode(t);break;case o.DELETE_NEST_LIST:this.removeNestList(t);break;case o.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case o.CLEAR_CHILD_NODES:this.nodes=[];break;case o.SPLIT_BLOCK_WITH_NODE:this.splitListItemBlock(t);break;case o.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case o.REPLACE_NEST_LIST:this.replaceNestList(t.newList);break;case o.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case o.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case o.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case o.DELETE_BLOCK_CONTENT:this.deleteListNodeContent(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.parent.apply(t);break;case o.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}renderChildren(t){var s;return null===(s=this.children)||void 0===s?void 0:s.map((s=>s.render(t)))}removeListChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0!==this.nodes.length||this.children&&this.children.length||this.parent.apply(new T(this))}removeNestList(t){this.children&&(this.children=this.children.length>1?this.children.filter((s=>s!==t.nestListBlockToBeRemoved)):void 0)}replaceNestList(t){t.forEach((t=>{t.parent=this})),this.children=t}splitListItemBlock(t){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode)}breakSingleListItemBlock(t,s){const e=new q(S()),i=this.copyInlineStyleToNewNode(t);if(e.apply(new L([i])),this.isCaretPositionAtEnd(t,s))return this.breakListItemAtEnd(e);if(!this.isCaretPositionAtStart(t,s)){const e=new F(t,s);return this.apply(e),e.newBlock}return this.parent.apply(new U(this,e)),e}breakListItemAtEnd(t){const s=this.parent.blocks[this.parent.blocks.length-1],e=1===this.nodes.length&&this.nodes[0].isEmpty();if(this===s&&e){const s=this.parent.parent;if("list-item"!==s.type){const e=$.from({id:S(),type:"paragraph",nodes:[]});return e.apply(new L(t.nodes)),s.apply(new P(this.parent,e)),this.parent.apply(new T(this)),e}s.parent.apply(new P(s,t)),this.parent.apply(new T(this))}else this.parent.apply(new P(this,t));return t}deleteListNodeContent(t){const s=t.startContainerNode.parentBlock.parent;this.deleteNodeContent(t),0===s.blocks.length&&s.parent.apply(new T(s))}copyInlineStyleToNewNode(t){const s=t.cloneWithText("");return s.annotationMap.delete(u.LINK),s}}class G extends a{constructor(t){super(),this.type=o.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class K extends M{constructor(t,s){super(t),this.type="bullet-list",this.blocks=[],this.type=s}static from(t){const s=new K(t.id,t.type);return s.blocks=t.blocks.map((t=>{const e=q.from(t);return e.parent=s,e})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.blocks.map((t=>t.toJSON()))})}isNotEmpty(){return this.blocks.length>0&&this.blocks.some((t=>t.isNotEmpty()))}getLastNode(){return this.blocks[this.blocks.length-1].getLastNode()}render(s){return t("number-list"===this.type?"ol":"ul",{ref:this.registerRef.bind(this)},this.blocks.map((t=>t.render(s))))}doModifyActionApply(t){switch(t.type){case o.DELETE_CHILD:this.removeListItemBlock(t.entityToBeRemoved);break;case o.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case o.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock]);break;case o.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case o.TRANSFORM_LIST_BLOCK:this.convertToList(t);break;case o.TRANSFORM_PARAGRAPH_BLOCK:this.convertToParagraph(t);break;case o.INSERT_IMAGE_TO_BLOCK:this.insertImage(t)}}toParagraph(t){const s=new $(S(),"paragraph");return s.apply(new L(t.nodes)),s.annotationMap=t.annotationMap,s}registerRef(t){t&&c.register(t,this)}convertToList(t){const s=t.selectedBlocks,e=this.parent.createList(t.listType);if(s.every((t=>t.parent===this)))e.apply(new L(this.blocks)),this.parent.apply(new P(this,e)),this.parent.apply(new T(this)),s.forEach((t=>t.nodes.map((t=>t.apply(new j)))));else{const s=t.selectedBlocks.map((t=>this.parent.toListItem(t)));e.apply(new L(s)),this.parent.apply(new P(this,e)),t.selectedBlocks.forEach((t=>{t.parent.apply(new T(t))})),0===this.blocks.length&&this.parent.apply(new T(this))}}convertToParagraph(t){let s=!1,e=!1;const i=t.selectedBlocks,n=i.map((t=>(t.nodes.map((t=>t.apply(new j))),t===this.blocks[0]&&(s=!0),t===this.blocks[this.blocks.length-1]&&(e=!0),this.toParagraph(t))));if(s)this.parent.apply(new U(this,...n));else if(e)this.parent.apply(new P(this,...n));else{const t=this.blocks.indexOf(i[0]),s=this.blocks.indexOf(i[i.length-1]),e=this.parent.createList(this.type);e.apply(new L(this.blocks.slice(0,t)));const r=this.parent.createList(this.type);r.apply(new L(this.blocks.slice(s+1))),this.parent.apply(new U(this,e,...n,r)),this.parent.apply(new T(this))}i.map((t=>{this.apply(new T(t))})),0===this.blocks.length&&this.parent.apply(new T(this))}insertImage(t){this.parent.apply("list-item"!==this.parent.type?new P(this,t.imageBlockToBeInserted):t)}removeListItemBlock(t){super.removeChildBlock(t),0===this.blocks.length&&this.parent&&this.parent.apply(this.parent instanceof q?new G(this):new T(this))}}class Q extends C{constructor(t){super(),t.forEach((t=>{t.parent=this})),this.blocks=t}static fromJSON(t){const s=t.map((t=>{switch(t.type){case"paragraph":case"title":case"subtitle":case"heading-1":case"heading-2":case"heading-3":return $.from(t);case"image":return Z.from(t);case"bullet-list":case"number-list":return K.from(t);default:throw new Error(`[Vega] Unknown block type: ${t.type}`)}}));return new Q(s)}static createEmptyContent(){return Q.fromJSON([{id:S(),type:"paragraph",nodes:[{id:S(),type:"text",text:""}]}])}clone(){return new Q([...this.blocks])}toJSON(){return this.blocks.map((t=>t.toJSON()))}apply(t){switch(t.type){case o.DELETE_CHILD:this.removeChildBlock(t.entityToBeRemoved);break;case o.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case o.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case o.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock])}}toListItem(t){t.nodes.map((t=>t.apply(new j)));const s=new q(S());return s.apply(new L(t.nodes)),s.annotationMap=t.annotationMap,s}createList(t){return new K(S(),t)}}export{L as A,V as B,B as H,I,D as M,$ as R,F as S,R as T,Q as V,H as a,z as b,q as c,T as d,U as e,W as f,K as g,Z as h,P as i,J as j}
@@ -0,0 +1 @@
1
+ import{W as t,A as s,I as e,N as r,a as n,V as i,M as o,b as a,R as h,c,s as u}from"./p-8c26227e.js";import{O as l,d,D as f,V as p}from"./p-a5ffe912.js";import{C as w}from"./p-443ad3b3.js";import{a as x,b as k}from"./p-f357cf46.js";import{h as m}from"./p-9c1eeff2.js";import{g as y}from"./p-3ce31dc3.js";import{i as g}from"./p-b1f65b13.js";import{c as O}from"./p-86194314.js";const N=async()=>t.handle(),C=async t=>new Promise((s=>{const e=new l(b.bind(null),(()=>{w.unregister(d.getSubject(t,x),e),s(null)}));w.register(d.getSubject(t,x),e)})),b=()=>!0,A=[{key:"black",light:"#111128",dark:"#E3E3E8"},{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],S="​";class j{}class E extends j{constructor(){super(...arguments),this.doSplit=!0}}class T extends s{constructor(t){super(),this.type=e.SELECTION_RANGE,this.range=t}}const v=new class{constructor(){this.textNodeElements=new Map}register(t,s){this.textNodeElements.set(t,s)}getTextNodeElements(){return this.textNodeElements}};class B extends r{constructor(t){super(),this.type=n.STRIKETHROUGH,this.strikethrough=t}static from(t){return[n.STRIKETHROUGH,new B(t)]}toJSON(){return{strikethrough:this.strikethrough}}renderClass(){return this.strikethrough?"v-rte--strikethrough":null}render(){return null}}class M extends r{constructor(t){super(),this.type=n.UNDERLINE,this.underline=t}static from(t){return[n.UNDERLINE,new M(t)]}toJSON(){return{underline:this.underline}}renderClass(){return this.underline?"v-rte--underline":null}render(){return null}}class D extends r{constructor(t){super(),this.type=n.ITALIC,this.italic=t}static from(t){return[n.ITALIC,new D(t)]}toJSON(){return{italic:this.italic}}render(){return this.italic?{"font-style":"italic"}:null}}class F extends r{constructor(t){super(),this.type=n.BOLD,this.bold=t}static from(t){return[n.BOLD,new F(t)]}toJSON(){return{bold:this.bold}}render(){return this.bold?{"font-weight":"700"}:null}}class J extends s{constructor(){super(...arguments),this.type=e.CLEAR_FORMATTING,this.items=[n.BOLD,n.ITALIC,n.UNDERLINE,n.STRIKETHROUGH,n.TEXT_COLOR,n.CODE]}}class L extends r{constructor(t){super(),this.type=n.CODE,this.code=t}static from(t){return[n.CODE,new L(t)]}toJSON(){return{code:this.code}}renderClass(){return this.code?"v-rte--code":null}render(){return null}}class K extends r{constructor(t){super(),this.type=n.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[n.TEXT_COLOR,new K(t)]}toJSON(){return{textColor:this.textColor.key}}renderClass(){return null}render(){return{color:i.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return A.find((s=>s.key===t))||A[0]}}class I extends r{constructor(t){super(),this.type=n.LINK,this.link=t}static from(t){return[n.LINK,new I({href:t.href,groupKey:t.groupKey})]}toJSON(){return{link:{href:this.link.href,groupKey:this.link.groupKey}}}toEqual(t){return this.link.groupKey===t.link.groupKey}render(){return null}}class R extends E{constructor({link:t,newText:s,needMergeNode:e,doSplit:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=e,this.newText=s,g(r)&&(this.doSplit=r)}toAnnotation(){return new I(this.link)}}class W extends E{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new L(this.code)}}class U extends E{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new J}}class V extends o{constructor(t){super(),this.type=a.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class _ extends s{constructor(t){super(),this.type=e.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}renderNodes(t,{editable:s}){return this.groupNodesByLink(t).flatMap((t=>{if(this.isLinkGroup(t)){const e=t[0].getAnnotationByType(n.LINK);return s?this.renderLinkEditorWrapper(t,e):this.renderLink(t,e)}return t.render()}))}renderLinkEditorWrapper(t,s){const{href:e}=s.link,r=t.map((t=>t.text)).join(""),i=({detail:s})=>{switch(s.action){case"link":{const{url:e,text:n}=s.payload,i=n!==r,o=y();return void t.forEach((s=>{const r=new R({link:{href:e,groupKey:o},newText:i?n:void 0,needMergeNode:i&&t.length>1,doSplit:!1});s.apply(r)}))}case"unlink":return void t.forEach((t=>t.deleteAnnotationByType(n.LINK)))}};let o;return m("span",{class:"link-editor-wrapper",role:"link",tabIndex:0,onKeyDown:O(),ref:t=>{t&&(o=t)}},this.renderLink(t,s),m("vega-rich-text-link-editor",{record:{text:r,url:e},ref:t=>{t&&(t.target=o,f.addUniqueObserverToNode(t,p,i))}}))}renderLink(t,s){const{href:e}=s.link;return m("a",{class:"v-rte--link",href:e,target:"_blank"},t.map((t=>t.render())))}isLinkGroup(t){return Array.isArray(t)}groupNodesByLink(t){return t.reduce(((t,s)=>{const e=s.getAnnotationByType(n.LINK),r=t[t.length-1];return g(e)?r&&this.isLinkGroup(r)&&r[0].getAnnotationByType(n.LINK).toEqual(e)?r.push(s):t.push([s]):t.push(s),t}),[])}}class q extends j{constructor(t,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=s}toAnnotation(){return new _(this.groupKey)}}class G extends j{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class P extends j{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class X extends h{constructor(t,s,e,r){super(t,r),this.type=c.TEXT,this.parentBlock=e,this.text=s}static from(t,s){const e=new X(t.id,t.text,s),{annotations:r}=t;return r&&(e.annotationMap=new Map(Object.keys(r).map((t=>(r.link&&s.apply(new q(r.link.groupKey,[e])),this.createAnnotationEntity(t,r[t])))).filter(g))),e}static createAnnotationEntity(t,s){switch(t){case"bold":return F.from(s);case"italic":return D.from(s);case"underline":return M.from(s);case"strikethrough":return B.from(s);case"code":return L.from(s);case"textColor":return K.from(s);case"link":return I.from(s)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof r)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}cloneWithText(t){return new X(y(),t,this.parentBlock,new Map(this.annotationMap))}isEmpty(){return!this.text||"​"===this.text||"\n"===this.text}render(){const t=this.annotationMap.get(n.CODE);return m((null==t?void 0:t.code)?"code":"span",{style:this.getStyles(),class:this.getClasses(),ref:this.registerRef.bind(this)},this.text||"​")}doAnnotationActionApply(t){const s=this.getAnnotationByType(e.SELECTION_RANGE);if(t instanceof E&&t.doSplit&&s){const{startContainer:e,endContainer:r,startOffset:n,endOffset:i}=s.range,o=e===r&&n===i;this.parentBlock.nodes=this.parentBlock.nodes.flatMap((e=>e.id===this.id?o?this.insertNewNode(n,t):this.shouldSplitSelection(s.range)?this.splitTextNode(t,s.range):(this.applyActionToNode(this,t),this):e))}else this.applyActionToNode(this,t);this.parentBlock.mergeNodes(t)}doModifyActionApply(t){switch(t.type){case a.UPDATE_TEXT:this.updateText(t.newTextContent);break;case a.REPLACE_SELECTED_TEXT:this.replaceSelectedText(t.textToBeInsert,t.currentRange)}}registerRef(t){if(t){u.register(t,this);const s=this.getAnnotationByType("TEXT_COLOR");s&&v.register(t,s)}}splitTextNode(t,s){const{startContainer:e,endContainer:r,startOffset:n}=s,i=e.parentElement,o=r.parentElement,a=(t,s,e)=>{const r=t.substring(0,s),n=t.substring(s,e),i=t.substring(e);return[this.cloneWithText(r),this.cloneWithText(n),this.cloneWithText(i)]},h=i&&u.getEntityByDOM(i),c=o&&u.getEntityByDOM(o);if(h&&h.id===this.id){const i=e===r?s.endOffset:this.text.length,[o,h,c]=a(this.text,n,i);return this.applyActionToNode(h,t),[o,h,c].filter((t=>!!t.text))}if(c&&c.id===this.id){const[e,r,n]=a(this.text,0,s.endOffset);return this.applyActionToNode(r,t),[e,r,n].filter((t=>!!t.text))}return this.applyActionToNode(this,t),this}applyActionToNode(t,s){const e=s.toAnnotation();if(s instanceof G)this.syncUpSelectedNodes(t);else if(e instanceof T||this.syncUpSelectedNodes(t),s instanceof P)this.annotationMap.delete(s.annotationType);else{if(!(e instanceof J))return e instanceof r||e instanceof T?(s instanceof R&&(g(s.newText)&&(t.text=s.newText),this.parentBlock.apply(new q(s.link.groupKey,[t]))),s instanceof W&&this.applyActionToNode(t,new U),void t.annotationMap.set(e.type,e)):void 0;e.items.forEach((s=>{t.deleteAnnotationByType(s)}))}}replaceSelectedText(t,s){if(s&&s.startContainer&&s.endContainer){const{startContainer:e,endContainer:r,startOffset:n,endOffset:i}=s,o=e.parentElement,a=r.parentElement,h=o&&u.getEntityByDOM(o),c=a&&u.getEntityByDOM(a);let l=0,d=this.text.length;h&&h===this?(l=n,d=e===r?i:d):c&&c===this&&(d=i),this.apply(new V(this.text.slice(0,l)+t+this.text.slice(d)))}}updateText(t){this.text=t,!this.text&&this.isLinkNode()&&this.annotationMap.delete(n.LINK)}isLinkNode(){return this.annotationMap.has("LINK")}shouldSplitSelection(t){const{startContainer:s,endContainer:e,startOffset:r,endOffset:n}=t;return s!==e||r>0||n<(e.textContent?e.textContent.length:0)}syncUpSelectedNodes(t){const s=u.getDOMByEntity(this);if(s){const e=d.getSubjectFromParentNodeByEventId(s,k);e&&w.notify(e,{node:t})}}insertNewNode(t,s){if(0===t){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[t,this]}if(t===this.text.length){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[this,t]}const e=this.cloneWithText(this.text.substring(0,t)),r=this.cloneWithText(""),n=this.cloneWithText(this.text.substring(t));return this.applyActionToNode(r,s),[e,r,n]}}export{j as A,F as B,U as C,P as D,D as I,R as L,X as R,G as S,E as T,V as U,S as Z,q as a,C as b,K as c,A as d,M as e,W as f,B as g,T as h,v as i,N as w}
@@ -1 +1 @@
1
- var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.34.0",this.framework=t.VanillaJs}getVegaEnv(){return{version:this.vegaVersion,framework:this.framework}}setVegaFramework(t){this.framework=t}};export{t as F,s as v}
1
+ var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.34.1",this.framework=t.VanillaJs}getVegaEnv(){return{version:this.vegaVersion,framework:this.framework}}setVegaFramework(t){this.framework=t}};export{t as F,s as v}
@@ -1 +1 @@
1
- import{d as t,V as e,h as o,H as r,r as i,g as n,I as s}from"./p-9c1eeff2.js";import{V as a,I as c}from"./p-8f93242a.js";import{s as l}from"./p-296cc56b.js";import{d as h}from"./p-8c26227e.js";import{T as p}from"./p-49f4a666.js";import{S as f}from"./p-e0b25eaf.js";import{f as d}from"./p-1995e98e.js";import{b as x}from"./p-315667f1.js";import"./p-112455b1.js";import"./p-d057999f.js";import"./p-443ad3b3.js";import"./p-a5ffe912.js";import"./p-3ce31dc3.js";import"./p-59bdf9b8.js";import"./p-f357cf46.js";import"./p-a6a7d0c9.js";import"./p-65b79fd7.js";import"./p-b1f65b13.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-86194314.js";var v=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};class m extends e{constructor(){super(),h.registerCustomDarkModeColor(p.formatDarkModeColor())}getRichTextContentRef(){return this.richTextContentRef}render(){return o(r,null,this.renderRichTextContent())}renderRichTextContent(){const t=this.shouldShowPlaceholder();return o("div",{ref:t=>this.richTextContentRef=t,class:{showPlaceholder:t,"rich-text-content":!0},"data-placeholder":this.placeholder,contenteditable:this.contentEditable},this.renderContent())}renderContent(){var t;return null===(t=this.content)||void 0===t?void 0:t.blocks.map((t=>t.render({editable:this.contentEditable})))}shouldShowPlaceholder(){var t;const e=null===(t=this.content)||void 0===t?void 0:t.blocks;if(e){if(e.length>1)return!1;for(const t of e)if(t.isNotEmpty())return!1}return!0}}v([t()],m.prototype,"placeholder",void 0),v([t()],m.prototype,"contentEditable",void 0),v([t({writable:!0})],m.prototype,"content",void 0);var u=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};class b extends f{constructor(){super({parent:"vega-rich-text-editor",subStates:[{subStateName:"placeholder",parentStateName:"placeholder"},{subStateName:"contentEditable",parentStateName:"richTextContentEditable"}]})}}u([t()],b.prototype,"host",void 0),u([t({writable:!0})],b.prototype,"placeholder",void 0),u([t({writable:!0})],b.prototype,"contentEditable",void 0);var g=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};const j=class{constructor(t){i(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new a,this.vegaRichTextContentRenderer=new m,this.vegaRichTextContentStateController=new b,this.contentEditable=!1}async vegaFocus(){this.vegaRichTextContentRenderer.getRichTextContentRef().focus();const t=d(this.host,"vega-rich-text-editor");t&&await x(t)}render(){return l(this.vegaRichTextContentRenderer.render(),this.host)}get host(){return n(this)}};g([c()],j.prototype,"globalSlimmers",void 0),g([s()],j.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),g([s()],j.prototype,"vegaRichTextContentRenderer",void 0),g([s()],j.prototype,"vegaRichTextContentStateController",void 0),j.style=':host{display:flex;flex-direction:column;width:100%}:host .rich-text-content{position:relative;height:100%;outline:2px solid transparent;outline-offset:2px;font-family:"Inter", sans-serif;font-weight:500;color:var(--v-rich-text-editor-black, #111128);overflow-wrap:break-word;white-space:pre-wrap}:host .rich-text-content.showPlaceholder::before{position:absolute;content:attr(data-placeholder);font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .rich-text-content h1,:host .rich-text-content h2,:host .rich-text-content h3,:host .rich-text-content p{margin:0}:host .rich-text-content a.v-rte--link{color:rgba(var(--v-text-link, 19, 98, 226, 1));outline:none}:host .rich-text-content a.v-rte--link:visited{color:rgba(var(--v-text-link-visited, 95, 56, 206, 1))}:host .rich-text-content a.v-rte--link:hover{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host .rich-text-content a.v-rte--link:active{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host .rich-text-content a.v-rte--link:focus-visible{color:rgba(var(--v-text-link-focus, 4, 112, 236, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;border-radius:8px}:host .rich-text-content .v-rte--underline{text-decoration:underline}:host .rich-text-content .v-rte--strikethrough{text-decoration:line-through}:host .rich-text-content .v-rte--underline.v-rte--strikethrough{text-decoration:underline line-through}:host .rich-text-content .v-rte--horizontal-alignment-right{text-align:right}:host .rich-text-content .v-rte--horizontal-alignment-left{text-align:left}:host .rich-text-content .v-rte--horizontal-alignment-center{text-align:center}:host .rich-text-content .v-rte--horizontal-alignment-justify{text-align:justify}:host .rich-text-content .v-rte--code{font-family:"Roboto Mono";white-space:pre-wrap}:host .rich-text-content img{vertical-align:bottom;cursor:pointer}:host .rich-text-content ul{padding-left:8px;margin-left:16px}:host .rich-text-content ol{padding-left:8px;list-style-position:inside}:host .rich-text-content .link-editor-wrapper{position:relative;outline:2px solid transparent;outline-offset:2px}:host .rich-text-content .link-editor-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}';export{j as vega_rich_text_content}
1
+ import{d as t,V as e,h as o,H as r,r as i,g as n,I as s}from"./p-9c1eeff2.js";import{V as a,I as c}from"./p-8f93242a.js";import{s as l}from"./p-296cc56b.js";import{d as h}from"./p-8c26227e.js";import{T as p}from"./p-8836c1b9.js";import{S as f}from"./p-e0b25eaf.js";import{f as d}from"./p-1995e98e.js";import{b as x}from"./p-584dcd9b.js";import"./p-112455b1.js";import"./p-d057999f.js";import"./p-443ad3b3.js";import"./p-a5ffe912.js";import"./p-3ce31dc3.js";import"./p-59bdf9b8.js";import"./p-f357cf46.js";import"./p-a6a7d0c9.js";import"./p-65b79fd7.js";import"./p-b1f65b13.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-86194314.js";var v=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};class m extends e{constructor(){super(),h.registerCustomDarkModeColor(p.formatDarkModeColor())}getRichTextContentRef(){return this.richTextContentRef}render(){return o(r,null,this.renderRichTextContent())}renderRichTextContent(){const t=this.shouldShowPlaceholder();return o("div",{ref:t=>this.richTextContentRef=t,class:{showPlaceholder:t,"rich-text-content":!0},"data-placeholder":this.placeholder,contenteditable:this.contentEditable},this.renderContent())}renderContent(){var t;return null===(t=this.content)||void 0===t?void 0:t.blocks.map((t=>t.render({editable:this.contentEditable})))}shouldShowPlaceholder(){var t;const e=null===(t=this.content)||void 0===t?void 0:t.blocks;if(e){if(e.length>1)return!1;for(const t of e)if(t.isNotEmpty())return!1}return!0}}v([t()],m.prototype,"placeholder",void 0),v([t()],m.prototype,"contentEditable",void 0),v([t({writable:!0})],m.prototype,"content",void 0);var u=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};class b extends f{constructor(){super({parent:"vega-rich-text-editor",subStates:[{subStateName:"placeholder",parentStateName:"placeholder"},{subStateName:"contentEditable",parentStateName:"richTextContentEditable"}]})}}u([t()],b.prototype,"host",void 0),u([t({writable:!0})],b.prototype,"placeholder",void 0),u([t({writable:!0})],b.prototype,"contentEditable",void 0);var g=function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s};const j=class{constructor(t){i(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new a,this.vegaRichTextContentRenderer=new m,this.vegaRichTextContentStateController=new b,this.contentEditable=!1}async vegaFocus(){this.vegaRichTextContentRenderer.getRichTextContentRef().focus();const t=d(this.host,"vega-rich-text-editor");t&&await x(t)}render(){return l(this.vegaRichTextContentRenderer.render(),this.host)}get host(){return n(this)}};g([c()],j.prototype,"globalSlimmers",void 0),g([s()],j.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),g([s()],j.prototype,"vegaRichTextContentRenderer",void 0),g([s()],j.prototype,"vegaRichTextContentStateController",void 0),j.style=':host{display:flex;flex-direction:column;width:100%}:host .rich-text-content{position:relative;height:100%;outline:2px solid transparent;outline-offset:2px;font-family:"Inter", sans-serif;font-weight:500;color:var(--v-rich-text-editor-black, #111128);overflow-wrap:break-word;white-space:pre-wrap}:host .rich-text-content.showPlaceholder::before{position:absolute;content:attr(data-placeholder);font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-content.showPlaceholder::before{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .rich-text-content h1,:host .rich-text-content h2,:host .rich-text-content h3,:host .rich-text-content p{margin:0}:host .rich-text-content a.v-rte--link{color:rgba(var(--v-text-link, 19, 98, 226, 1));outline:none}:host .rich-text-content a.v-rte--link:visited{color:rgba(var(--v-text-link-visited, 95, 56, 206, 1))}:host .rich-text-content a.v-rte--link:hover{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host .rich-text-content a.v-rte--link:active{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host .rich-text-content a.v-rte--link:focus-visible{color:rgba(var(--v-text-link-focus, 4, 112, 236, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;border-radius:8px}:host .rich-text-content .v-rte--underline{text-decoration:underline}:host .rich-text-content .v-rte--strikethrough{text-decoration:line-through}:host .rich-text-content .v-rte--underline.v-rte--strikethrough{text-decoration:underline line-through}:host .rich-text-content .v-rte--horizontal-alignment-right{text-align:right}:host .rich-text-content .v-rte--horizontal-alignment-left{text-align:left}:host .rich-text-content .v-rte--horizontal-alignment-center{text-align:center}:host .rich-text-content .v-rte--horizontal-alignment-justify{text-align:justify}:host .rich-text-content .v-rte--code{font-family:"Roboto Mono";white-space:pre-wrap}:host .rich-text-content img{vertical-align:bottom;cursor:pointer}:host .rich-text-content ul{padding-left:8px;margin-left:16px}:host .rich-text-content ol{padding-left:8px;list-style-position:inside}:host .rich-text-content .link-editor-wrapper{position:relative;outline:2px solid transparent;outline-offset:2px}:host .rich-text-content .link-editor-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}';export{j as vega_rich_text_content}
@@ -1 +1 @@
1
- import{d as t,V as e,h as o}from"./p-9c1eeff2.js";import{D as s,b as r,M as i,N as n,V as c}from"./p-a5ffe912.js";import{V as l}from"./p-a6a7d0c9.js";import{T as h,c as a,d as u,R as p}from"./p-315667f1.js";import{d as v,a as d}from"./p-8c26227e.js";var f=function(t,e,o,s){var r,i=arguments.length,n=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};class m extends e{constructor({icon:t,tooltip:e}){super(),this.renderBtn=({showArrowIcon:t,iconColor:e}={})=>{var i,n;return o("vega-tooltip",{text:this.tooltip.text,placement:["bottom","top"]},o("vega-rich-text-editor-toolbar-button",Object.assign({showArrowIcon:t,icon:this.icon,iconColor:e,ref:t=>{s.addUniqueObserverToNode(t,r,(()=>{this.handleClick()}))},selected:this.isSelected(),disabled:null===(i=this.isDisabled)||void 0===i?void 0:i.call(this)},this.preventLostFocus()),null===(n=this.renderSlotContent)||void 0===n?void 0:n.call(this)))},this.handleClick=()=>{"function"==typeof this.onClick&&(this.selectionController.getSelectedNodes().length?this.onClick():this.focusController.focusOnLastTextNode().then((()=>{this.onClick()})))},this.icon=t,this.tooltip=e}setIcon(t){this.icon=t}render(){return"function"==typeof this.renderBtnWrapper?this.renderBtnWrapper(this.renderBtn):this.renderBtn()}preventLostFocus(){return{onMouseDown:t=>t.preventDefault()}}}f([t()],m.prototype,"selectionController",void 0),f([t()],m.prototype,"focusController",void 0);class C extends h{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new a(this.textColor)}}var w=function(t,e,o,s){var r,i=arguments.length,n=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};class b extends m{constructor(){super({icon:"text",tooltip:{text:"Text Color"}}),this.popoverShow=!1,v.registerCustomDarkModeColor(b.formatDarkModeColor())}static formatDarkModeColor(){return u.reduce(((t,e)=>(e.dark&&(t[`rich-text-editor-${e.key}`]=e.dark),t)),{})}renderSlotContent(){return o("div",{class:"toolbar-btn-color-preview-box",style:{backgroundColor:this.getCurrentColor()}})}handlePopoverShowChange(){this.popoverShow=!0}handlePopoverHideChange(){this.popoverShow=!1}renderBtnWrapper(t){return o("vega-popover",{placement:"bottom",alignment:"center",ref:t=>{this.popoverRef=t,s.addUniqueObserverToNode(t,i,this.handlePopoverShowChange.bind(this)),s.addUniqueObserverToNode(t,n,this.handlePopoverHideChange.bind(this))}},o("div",{slot:"popover-content"},t({showArrowIcon:!1})),o("div",Object.assign({slot:"popover",style:{userSelect:"none"}},super.preventLostFocus()),this.renderPopoverContent()))}renderPopoverContent(){return o("vega-color-picker",{isInline:!0,colors:u.map((t=>t[this.isInDarkMode?"dark":"light"])),ref:t=>{s.addUniqueObserverToNode(t,c,this.handleChange.bind(this))},value:this.getCurrentColor()})}async handleChange(t){this.popoverShow&&(this.selectionController.getSelectedNodes().length||await this.focusController.focusOnLastTextNode(),this.selectionController.getSelectedNodes().filter((t=>t instanceof p)).forEach((e=>e.apply(new C(this.matchColor(t.detail).key))))),this.popoverRef.hide()}matchColor(t){return u.find((e=>e[this.isInDarkMode?"dark":"light"]===t))}getCurrentColor(){let t=u[0];const e=this.selectionController.getSelectedNodes();return e.length>1&&(t=this.isSelectedSameColor(e)?this.getTextColor(e[0]):null),1===e.length&&(t=this.getTextColor(e[0])),t?t[this.isInDarkMode?"dark":"light"]:null}isSelected(){return!1}isSelectedSameColor(t){return t.every((e=>this.getTextColor(e).key===this.getTextColor(t[0]).key))}getTextColor(t){var e;return(null===(e=t.getAnnotationByType("TEXT_COLOR"))||void 0===e?void 0:e.textColor)||u[0]}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(d.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(d.LINK)||t.getAnnotationByType(d.IMAGE)}))}}l.register({text:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 96v32c0 17.7-14.3 32-32 32s-32-14.3-32-32V80C0 53.5 21.5 32 48 32H224 400c26.5 0 48 21.5 48 48v48c0 17.7-14.3 32-32 32s-32-14.3-32-32V96H256l0 320h48c17.7 0 32 14.3 32 32s-14.3 32-32 32H144c-17.7 0-32-14.3-32-32s14.3-32 32-32h48l0-320H64z"/></svg>'}}),w([t()],b.prototype,"host",void 0),w([t()],b.prototype,"isInDarkMode",void 0),w([t()],b.prototype,"selectionController",void 0),w([t()],b.prototype,"focusController",void 0);export{b as T,m as a}
1
+ import{d as t,V as e,h as o}from"./p-9c1eeff2.js";import{D as s,b as r,M as i,N as n,V as c}from"./p-a5ffe912.js";import{V as l}from"./p-a6a7d0c9.js";import{T as h,c as a,d as u,R as d}from"./p-584dcd9b.js";import{d as p,a as v}from"./p-8c26227e.js";var f=function(t,e,o,s){var r,i=arguments.length,n=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};class m extends e{constructor({icon:t,tooltip:e}){super(),this.renderBtn=({showArrowIcon:t,iconColor:e}={})=>{var i,n;return o("vega-tooltip",{text:this.tooltip.text,placement:["bottom","top"]},o("vega-rich-text-editor-toolbar-button",Object.assign({showArrowIcon:t,icon:this.icon,iconColor:e,ref:t=>{s.addUniqueObserverToNode(t,r,(()=>{this.handleClick()}))},selected:this.isSelected(),disabled:null===(i=this.isDisabled)||void 0===i?void 0:i.call(this)},this.preventLostFocus()),null===(n=this.renderSlotContent)||void 0===n?void 0:n.call(this)))},this.handleClick=()=>{"function"==typeof this.onClick&&(this.selectionController.getSelectedNodes().length?this.onClick():this.focusController.focusOnLastTextNode().then((()=>{this.onClick()})))},this.icon=t,this.tooltip=e}setIcon(t){this.icon=t}render(){return"function"==typeof this.renderBtnWrapper?this.renderBtnWrapper(this.renderBtn):this.renderBtn()}preventLostFocus(){return{onMouseDown:t=>t.preventDefault()}}}f([t()],m.prototype,"selectionController",void 0),f([t()],m.prototype,"focusController",void 0);class C extends h{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new a(this.textColor)}}var b=function(t,e,o,s){var r,i=arguments.length,n=i<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,s);else for(var c=t.length-1;c>=0;c--)(r=t[c])&&(n=(i<3?r(n):i>3?r(e,o,n):r(e,o))||n);return i>3&&n&&Object.defineProperty(e,o,n),n};class w extends m{constructor(){super({icon:"text",tooltip:{text:"Text Color"}}),this.popoverShow=!1,p.registerCustomDarkModeColor(w.formatDarkModeColor())}static formatDarkModeColor(){return u.reduce(((t,e)=>(e.dark&&(t[`rich-text-editor-${e.key}`]=e.dark),t)),{})}renderSlotContent(){return o("div",{class:"toolbar-btn-color-preview-box",style:{backgroundColor:this.getCurrentColor()}})}handlePopoverShowChange(){this.popoverShow=!0}handlePopoverHideChange(){this.popoverShow=!1}renderBtnWrapper(t){return o("vega-popover",{placement:"bottom",alignment:"center",ref:t=>{this.popoverRef=t,s.addUniqueObserverToNode(t,i,this.handlePopoverShowChange.bind(this)),s.addUniqueObserverToNode(t,n,this.handlePopoverHideChange.bind(this))}},o("div",{slot:"popover-content"},t({showArrowIcon:!1})),o("div",Object.assign({slot:"popover",style:{userSelect:"none"}},super.preventLostFocus()),this.renderPopoverContent()))}renderPopoverContent(){return o("vega-color-picker",{isInline:!0,colors:u.map((t=>t[this.isInDarkMode?"dark":"light"])),ref:t=>{s.addUniqueObserverToNode(t,c,this.handleChange.bind(this))},value:this.getCurrentColor()})}async handleChange(t){this.popoverShow&&(this.selectionController.getSelectedNodes().length||await this.focusController.focusOnLastTextNode(),this.selectionController.getSelectedNodes().filter((t=>t instanceof d)).forEach((e=>e.apply(new C(this.matchColor(t.detail).key))))),this.popoverRef.hide()}matchColor(t){return u.find((e=>e[this.isInDarkMode?"dark":"light"]===t))}getCurrentColor(){let t=u[0];const e=this.selectionController.getSelectedNodes();return e.length>1&&(t=this.isSelectedSameColor(e)?this.getTextColor(e[0]):null),1===e.length&&(t=this.getTextColor(e[0])),t?t[this.isInDarkMode?"dark":"light"]:null}isSelected(){return!1}isSelectedSameColor(t){return t.every((e=>this.getTextColor(e).key===this.getTextColor(t[0]).key))}getTextColor(t){var e;return(null===(e=t.getAnnotationByType("TEXT_COLOR"))||void 0===e?void 0:e.textColor)||u[0]}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(v.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(v.LINK)||t.getAnnotationByType(v.IMAGE)}))}}l.register({text:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 96v32c0 17.7-14.3 32-32 32s-32-14.3-32-32V80C0 53.5 21.5 32 48 32H224 400c26.5 0 48 21.5 48 48v48c0 17.7-14.3 32-32 32s-32-14.3-32-32V96H256l0 320h48c17.7 0 32 14.3 32 32s-14.3 32-32 32H144c-17.7 0-32-14.3-32-32s14.3-32 32-32h48l0-320H64z"/></svg>'}}),b([t()],w.prototype,"host",void 0),b([t()],w.prototype,"isInDarkMode",void 0),b([t()],w.prototype,"selectionController",void 0),b([t()],w.prototype,"focusController",void 0);export{w as T,m as a}
@@ -0,0 +1 @@
1
+ import{d as t,M as e,V as i,h as s,H as n,F as o,I as r,L as c,r as l,e as a,g as h}from"./p-9c1eeff2.js";import{V as d,I as u}from"./p-8f93242a.js";import{g as f,s as p}from"./p-296cc56b.js";import{c as v}from"./p-86194314.js";import{C as m}from"./p-443ad3b3.js";import{d as g,D as b,c as x,V as w,O as y,Q as C,b as R,M as j,N as k}from"./p-a5ffe912.js";import{a as O,b as S,V as T,o as H,p as z,k as E}from"./p-f357cf46.js";import{a as I,T as L}from"./p-8836c1b9.js";import{V as B}from"./p-a6a7d0c9.js";import{B as A,R as M,T as N,a as D,I as P,b as F,c as V,H as U,V as W,d as G,A as _,e as K,M as q,S as X,f as J,g as $,h as Y,i as Q,j as Z}from"./p-10393104.js";import{a as tt,M as et,b as it,R as st,s as nt,I as ot,V as rt}from"./p-8c26227e.js";import{R as ct,T as lt,I as at,e as ht,B as dt,C as ut,f as ft,g as pt,A as vt,h as mt,L as gt,b as bt,Z as xt,U as wt,d as yt,i as Ct}from"./p-584dcd9b.js";import{e as Rt}from"./p-452e284a.js";import{g as jt}from"./p-3ce31dc3.js";import{F as kt}from"./p-4c41dd64.js";import{c as Ot}from"./p-11cb477b.js";import{c as St}from"./p-a6104aa7.js";import{d as Tt}from"./p-1bc5b3bc.js";import{S as Ht}from"./p-1fb56e14.js";import{f as zt,r as Et}from"./p-1995e98e.js";import{b as It,D as Lt}from"./p-d057999f.js";import"./p-5f377954.js";import"./p-acf7f903.js";import"./p-11a19ca0.js";import"./p-65b79fd7.js";import"./p-e1e1fcf0.js";import{C as Bt}from"./p-39836361.js";import{c as At}from"./p-613ddaab.js";import{t as Mt}from"./p-aacf6920.js";import{r as Nt}from"./p-3b4bde3e.js";import"./p-b1f65b13.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-112455b1.js";import"./p-eac38d87.js";import"./p-262ec334.js";import"./p-59bdf9b8.js";import"./p-70151c27.js";import"./p-4bcd6612.js";import"./p-f763e2eb.js";import"./p-0bb29d98.js";import"./p-843a0c1c.js";import"./p-a9354a5c.js";import"./p-b0502d01.js";import"./p-7a40e033.js";var Dt=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Pt extends i{constructor(){super(...arguments),this.renderHintMessage=()=>s("vega-text",null,this.hint),this.renderTextContent=()=>s("div",{class:{"rich-text-editor-container":!0,disabled:this.disabled},style:{minHeight:24*this.rows+"px"},onClick:this.richTextContentFocus,role:"textbox",tabIndex:this.disabled?0:-1,onKeyDown:v(),ref:t=>this.richTextContainerRef=t},s("vega-rich-text-content",{ref:t=>this.richTextContentRef=t,content:this.value}),this.renderCharacterCounter()),this.renderCharacterCounter=()=>s("div",{class:{"text-editor-counter":!0,"counter-exceed-max-length":!1},style:{display:"none"}},s("span",null,"0"),s("span",null,"/100")),this.renderErrorMessage=()=>s("div",{class:"vega-error vega-hidden"}),this.richTextContentFocus=()=>{this.richTextContentRef.vegaFocus()}}componentDidRender(){m.notify(g.getSubject(this.host,O),{})}getRichTextContainerRef(){return this.richTextContainerRef}getRichTextContentRef(){return this.richTextContentRef}getRichTextWrapperRef(){return this.richTextWrapperRef}getRTEEditableElementRef(){if(this.richTextContentRef&&this.richTextContentRef.shadowRoot)return this.richTextContentRef.shadowRoot.querySelector(".rich-text-content")}render(){return s(n,null,this.renderRichTextEditor())}renderRichTextEditor(){return s("vega-flex",{direction:"col",gap:"0",ref:t=>this.richTextWrapperRef=t},this.renderLabel(),this.hint&&this.renderHintMessage(),this.toolbarRenderer.render(),this.renderTextContent(),this.renderErrorMessage())}renderLabel(){return this.label&&s("vega-field-label",{onClick:this.richTextContentFocus,isFieldRequired:this.required,disabled:this.disabled,label:this.label})}}Dt([t()],Pt.prototype,"host",void 0),Dt([t()],Pt.prototype,"toolbarRenderer",void 0),Dt([t()],Pt.prototype,"label",void 0),Dt([t()],Pt.prototype,"required",void 0),Dt([t()],Pt.prototype,"hint",void 0),Dt([t()],Pt.prototype,"disabled",void 0),Dt([t()],Pt.prototype,"rows",void 0),Dt([t()],Pt.prototype,"placeholder",void 0),Dt([t()],Pt.prototype,"value",void 0),Dt([e("componentDidRender")],Pt.prototype,"componentDidRender",null);var Ft=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Vt extends i{constructor(){super(...arguments),this.getToolbarBtnRenderer=t=>{switch(t){case"clearStyle":return this.clearStyleToolbarButtonSlimmer;case"bold":return this.boldToolbarButtonSlimmer;case"textStyles":return this.textStylesToolbarButtonSlimmer;case"italic":return this.italicToolbarButtonSlimmer;case"underline":return this.underlineToolbarButtonSlimmer;case"textColor":return this.textColorToolbarButtonSlimmer;case"moreIndent":return this.moreIndentToolbarButtonSlimmer;case"lessIndent":return this.lessIndentToolbarButtonSlimmer;case"code":return this.codeToolbarButtonSlimmer;case"strikethrough":return this.strikethroughToolbarButtonSlimmer;case"link":return this.linkToolbarButtonSlimmer;case"image":return this.imageToolbarButtonSlimmer;case"bulletsNumbers":return this.bulletsNumbersToolbarButtonSlimmer;case"horizontalAlignment":return this.horizontalAlignmentToolbarButtonSlimmer}}}render(){return s("vega-flex",{gap:"size-8",alignItems:"center",flexWrap:"wrap"},this.toolbarItems.map((t=>s("div",{class:"toolbar-btn-group"},t.map((t=>this.getToolbarBtnRenderer(t).render()))))))}}Ft([t()],Vt.prototype,"toolbarItems",void 0),Ft([t()],Vt.prototype,"clearStyleToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"boldToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"textStylesToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"italicToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"underlineToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"textColorToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"strikethroughToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"imageToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"moreIndentToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"lessIndentToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"codeToolbarButtonSlimmer",void 0),Ft([t()],Vt.prototype,"linkToolbarButtonSlimmer",void 0);class Ut extends I{constructor(){super({icon:"bold",tooltip:{text:"Bold"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new A(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.BOLD))||void 0===e?void 0:e.bold}))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}B.register({bold:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H80 96 224c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128H96 80 32c-17.7 0-32-14.3-32-32s14.3-32 32-32H48V256 96H32C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64H112V224H224zM112 288V416H256c35.3 0 64-28.7 64-64s-28.7-64-64-64H224 112z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],Ut.prototype,"selectionController",void 0);class Wt extends lt{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new at(this.italic)}}class Gt extends I{constructor(){super({icon:"italic",tooltip:{text:"Italic"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.ITALIC))||void 0===e?void 0:e.italic}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new Wt(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}B.register({italic:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M128 64c0-17.7 14.3-32 32-32H352c17.7 0 32 14.3 32 32s-14.3 32-32 32H293.3L160 416h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H90.7L224 96H160c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],Gt.prototype,"selectionController",void 0);class _t extends lt{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new ht(this.underline)}}class Kt extends I{constructor(){super({icon:"underline",tooltip:{text:"Underline"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.UNDERLINE))||void 0===e?void 0:e.underline}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new _t(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}B.register({underline:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M16 64c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H128V224c0 53 43 96 96 96s96-43 96-96V96H304c-17.7 0-32-14.3-32-32s14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H384V224c0 88.4-71.6 160-160 160s-160-71.6-160-160V96H48C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],Kt.prototype,"selectionController",void 0);var qt=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Xt extends I{constructor(){super({icon:"text-size",tooltip:{text:"Text Styles"}}),this.handleDropdownItemClick=t=>{const e=t.detail,i=Xt.items.find((t=>t.key===e)).bold,s=this.selectionController.getSelectedBlocks().filter((t=>t instanceof M));s.length>0?s.forEach((t=>{t.apply(new N(e,i))})):this.focusController.focusOnLastTextNode({newLine:!0}).then((()=>{this.selectionController.getSelectedBlocks().filter((t=>t instanceof M)).forEach((t=>{t.apply(new N(e,i))}))}))}}renderBtnWrapper(t){return s("vega-dropdown",{selectType:"single",trigger:"click",alignment:"center",selectedSourceKey:this.getSelectedSourceKey(),ref:t=>{this.addDropdownObserver(t)}},t({showArrowIcon:!0}),s("div",Object.assign({slot:"items"},super.preventLostFocus()),this.renderDropdownContent()))}renderDropdownContent(){return s(o,null,Xt.items.map((t=>{const e=new D(t.key),i=new dt(t.bold);return s("vega-dropdown-item",{key:t.key,itemKey:t.key},s("vega-box",{padding:{right:"size-20"}},s("div",{style:Object.assign(Object.assign({},e.render()),i.render())},t.label)))})))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.IMAGE)))}addDropdownObserver(t){b.addUniqueObserverToNode(t,x,this.handleDropdownItemClick)}getSelectedSourceKey(){const t=this.selectionController.getSelectedBlocks().filter((t=>t instanceof M));return t.length>0&&t.every((e=>e.type===t[0].type))?t[0].getAnnotationByType(Rt.TEXT_STYLE).textStyle:""}}B.register({"text-size":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 128V96h96l0 320H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H256c17.7 0 32-14.3 32-32s-14.3-32-32-32H224l0-320h96v32c0 17.7 14.3 32 32 32s32-14.3 32-32V80c0-26.5-21.5-48-48-48H192 48C21.5 32 0 53.5 0 80v48c0 17.7 14.3 32 32 32s32-14.3 32-32zM384 304V288h64l0 128H432c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H512l0-128h64v16c0 17.7 14.3 32 32 32s32-14.3 32-32V272c0-26.5-21.5-48-48-48H368c-26.5 0-48 21.5-48 48v32c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>'}}),Xt.items=[{key:"title",label:"Title",bold:!0},{key:"subtitle",label:"Subtitle"},{key:"heading-1",label:"Heading 1",bold:!0},{key:"heading-2",label:"Heading 2",bold:!0},{key:"heading-3",label:"Heading 3",bold:!0},{key:"paragraph",label:"Paragraph"}],qt([t()],Xt.prototype,"selectionController",void 0),qt([t()],Xt.prototype,"focusController",void 0);class Jt extends I{constructor(){super({icon:"text-slash",tooltip:{text:"Clear Style"}})}isSelected(){return!1}onClick(){this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((t=>{t.apply(new ut)}))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.IMAGE)))}}B.register({"text-slash":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96H503L497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32H376.1h-.3H204.5c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96H333.7L301.3 210.8l-94.5-74.1zM243.3 416H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H309.8l17.6-62.1L272.9 311 243.3 416z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],Jt.prototype,"selectionController",void 0);class $t extends I{constructor(){super({icon:"code-simple",tooltip:{text:"Code"}})}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new ft(!t))))}isSelected(){const t=this.selectionController.getSelectedNodes();return t.length>0&&t.filter((t=>t instanceof ct)).map((t=>t.getAnnotationByType(tt.CODE))).every((t=>t&&t.code))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.LINK)||t.getAnnotationByType(tt.IMAGE)))}}B.register({"code-simple":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6zm146.7 0L498.7 256 361.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],$t.prototype,"selectionController",void 0);class Yt extends lt{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new pt(this.strikethrough)}}class Qt extends I{constructor(){super({icon:"strikethrough",tooltip:{text:"Strikethrough"}})}isSelected(){const t=this.selectionController.getSelectedNodes().filter((t=>t instanceof ct));return t.length>0&&t.every((t=>{var e;return null===(e=t.getAnnotationByType(tt.STRIKETHROUGH))||void 0===e?void 0:e.strikethrough}))}onClick(){const t=this.isSelected();this.selectionController.getSelectedNodes().filter((t=>t instanceof ct)).forEach((e=>e.apply(new Yt(!t))))}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>{var e;return(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)||t.getAnnotationByType(tt.IMAGE)}))}}B.register({strikethrough:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --\x3e<path fill="currentColor" d="M332.2 319.9c17.22 12.17 22.33 26.51 18.61 48.21c-3.031 17.59-10.88 29.34-24.72 36.99c-35.44 19.75-108.5 11.96-186-19.68c-16.34-6.686-35.03 1.156-41.72 17.53s1.188 35.05 17.53 41.71c31.75 12.93 95.69 35.37 157.6 35.37c29.62 0 58.81-5.156 83.72-18.96c30.81-17.09 50.44-45.46 56.72-82.11c3.998-23.27 2.168-42.58-3.488-59.05H332.2zM488 239.9l-176.5-.0309c-15.85-5.613-31.83-10.34-46.7-14.62c-85.47-24.62-110.9-39.05-103.7-81.33c2.5-14.53 10.16-25.96 22.72-34.03c20.47-13.15 64.06-23.84 155.4 .3438c17.09 4.531 34.59-5.654 39.13-22.74c4.531-17.09-5.656-34.59-22.75-39.12c-91.31-24.18-160.7-21.62-206.3 7.654C121.8 73.72 103.6 101.1 98.09 133.1C89.26 184.5 107.9 217.3 137.2 239.9L24 239.9c-13.25 0-24 10.75-24 23.1c0 13.25 10.75 23.1 24 23.1h464c13.25 0 24-10.75 24-23.1C512 250.7 501.3 239.9 488 239.9z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],Qt.prototype,"selectionController",void 0);class Zt extends vt{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new mt(this.range)}}class te extends I{constructor(){super({icon:"link",tooltip:{text:"Link"}}),this.handleLinkEditorChange=({detail:t})=>{switch(t.action){case"link":{const{url:e,text:i}=t.payload,s=i!==this.currentSelectedText,n=jt();return void this.currentSelectedNodes.forEach((t=>{t.apply(new Zt(this.currentRange)).apply(new gt({link:{href:e,groupKey:n},newText:s?i:void 0,needMergeNode:s&&this.currentSelectedNodes.length>1}))}))}}}}renderBtnWrapper(t){return s("div",{class:"toolbar-btn-link-wrapper",ref:t=>this.linkBtnWrapperRef=t},t(),s("vega-rich-text-link-editor",{resetStatusAfterHide:!1,status:"linkEdit",ref:t=>{t&&(this.linkEditorRef=t),b.addUniqueObserverToNode(t,w,this.handleLinkEditorChange)}}))}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedNodes();return this.selectionController.getSelectedBlocks().length>1||t.some((t=>{var e;return!(t instanceof ct)||t.getAnnotationByType(tt.LINK)||(null===(e=t.getAnnotationByType(tt.CODE))||void 0===e?void 0:e.code)}))}onClick(){this.currentRange=this.selectionController.getCurrentRange().toNativeRange(),this.currentSelectedNodes=this.selectionController.getSelectedNodes(),this.currentRange&&(this.currentSelectedText=this.currentRange.toString(),this.currentSelectedNodes.length>0&&(this.linkEditorRef.record={text:this.currentSelectedText,url:""})),this.linkEditorRef.target||(this.linkEditorRef.target=this.linkBtnWrapperRef,bt(this.linkEditorRef).then((()=>{this.linkEditorRef.show()})))}}B.register({link:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M562.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L405.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C189.5 251.2 196 330 246 380c56.5 56.5 148 56.5 204.5 0L562.8 267.7zM43.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C57 372 57 321 88.5 289.5L200.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C416.5 260.8 410 182 360 132c-56.5-56.5-148-56.5-204.5 0L43.2 244.3z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],te.prototype,"selectionController",void 0);class ee extends vt{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new P(this.indent)}}class ie extends I{constructor(){super({icon:"indent",tooltip:{text:"More Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return t.some((t=>"list-item"===t.type))||e.some((t=>t instanceof F))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const s=null!==(i=null===(e=t.getAnnotationByType(Rt.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new ee(s+1))}))}}B.register({indent:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32zm32 96H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3V176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],ie.prototype,"selectionController",void 0);class se extends I{constructor(){super({icon:"outdent",tooltip:{text:"Less Indent"}})}isSelected(){return!1}isDisabled(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getSelectedNodes();return t.some((t=>"list-item"===t.type))||e.some((t=>t instanceof F))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>{var e,i;const s=null!==(i=null===(e=t.getAnnotationByType(Rt.INDENT))||void 0===e?void 0:e.indent)&&void 0!==i?i:0;t.apply(new ee(s>1?s-1:0))}))}}B.register({outdent:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M6 64C6 46.3 20.3 32 38 32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38C20.3 96 6 81.7 6 64zM198 192c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32zm32 96H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32s14.3-32 32-32zM6 448c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38c-17.7 0-32-14.3-32-32zm.2-179.4c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6V335.3c0 13.3-15.3 20.8-25.8 12.6L6.2 268.6z"/></svg>'}}),function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([t()],se.prototype,"selectionController",void 0);var ne=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class oe extends I{constructor(){super({icon:"image",tooltip:{text:"Image"}}),this.onClick=()=>{this.inputElementRef.click()},this.fileInputChange=t=>{t.stopPropagation();const e=t.target;if(!e.files.length)return;const i=this.insertImageController.insertImageToCaretPosition(URL.createObjectURL(e.files[0]));this.updateNodeURLMap||(this.updateNodeURLMap=new Map),this.updateNodeURLMap.set(i,(t=>{i.url=t}));const s={file:e.files[0],sendBackUploadedURLCallback:this.updateNodeURLMap.get(i)};this.imageInsertedEventEmitter.emit(s),e.value=""}}renderBtnWrapper(t){return s("vega-box",null,t({showArrowIcon:!1}),s("input",{type:"file",style:{display:"none"},ref:t=>this.inputElementRef=t,accept:"image/*",onChange:this.fileInputChange}))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t.getAnnotationByType(tt.LINK)))}}B.register({image:{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>'}}),ne([t()],oe.prototype,"insertImageController",void 0),ne([t()],oe.prototype,"imageInsertedEventEmitter",void 0),ne([t()],oe.prototype,"selectionController",void 0);class re extends et{constructor(t,e){super(),this.type=it.TRANSFORM_LIST_BLOCK,this.isFlushable=!0,this.listType=t,this.selectedBlocks=e}}class ce extends et{constructor(t){super(),this.type=it.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}var le=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class ae extends I{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectBulletList():this.selectBulletList(),this.popoverRef.hide()}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof F))}isListType(t,e="bullet-list"){return t.length>0&&t.every((t=>t instanceof V&&t.parent.type===e))}deselectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new ce(t))}selectBulletList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new re("bullet-list",t))}}le([t()],ae.prototype,"selectionController",void 0),le([t()],ae.prototype,"popoverRef",void 0);var he=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class de extends I{constructor(){super({icon:"list-ol",tooltip:{text:"Numbers"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return this.isListType(t)}onClick(){this.isSelected()?this.deselectNumberList():this.selectNumberList(),this.popoverRef.hide()}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof F))}isListType(t,e="number-list"){return t.length>0&&t.every((t=>t instanceof V&&t.parent.type===e))}deselectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&t[0].parent.apply(new ce(t))}selectNumberList(){const t=this.selectionController.getSelectedBlocks();t[0]&&("list-item"===t[0].type?t[0].parent:t[0]).apply(new re("number-list",t))}}he([t()],de.prototype,"selectionController",void 0),he([t()],de.prototype,"popoverRef",void 0);var ue=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class fe extends I{constructor(){super({icon:"list-ul",tooltip:{text:"Bullets"}}),this.bulletsToolbarButtonSlimmer=new ae,this.numbersToolbarButtonSlimmer=new de}componentWillRender(){this.numbersToolbarButtonSlimmer.isSelected()?super.setIcon("list-ol"):super.setIcon("list-ul")}renderBtnWrapper(t){return s("vega-popover",{showArrow:!1,trigger:"click",placement:"bottom",alignment:"center",ref:t=>this.popoverRef=t},s("div",{slot:"popover-content"},t({showArrowIcon:!0})),s("div",{slot:"popover"},this.renderContent()))}renderContent(){return s("vega-flex",{gap:"size-8","justify-content":"center"},s("div",null,this.bulletsToolbarButtonSlimmer.render()),s("div",null,this.numbersToolbarButtonSlimmer.render()))}isSelected(){return!1}isDisabled(){return this.selectionController.getSelectedNodes().some((t=>t instanceof F))}}B.register({"list-ul":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"/></svg>'},"list-ol":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M24 56c0-13.3 10.7-24 24-24H80c13.3 0 24 10.7 24 24V176h16c13.3 0 24 10.7 24 24s-10.7 24-24 24H40c-13.3 0-24-10.7-24-24s10.7-24 24-24H56V80H48C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432H120c13.3 0 24 10.7 24 24s-10.7 24-24 24H32c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>'}}),ue([t()],fe.prototype,"selectionController",void 0),ue([r()],fe.prototype,"bulletsToolbarButtonSlimmer",void 0),ue([r()],fe.prototype,"numbersToolbarButtonSlimmer",void 0),ue([e("componentWillRender")],fe.prototype,"componentWillRender",null);class pe extends vt{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new U(this.textAlign)}}var ve=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class me extends I{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"left"===(null===(e=t.getAnnotationByType(Rt.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new pe("left")))),this.popoverRef.hide()}}B.register({"align-left":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M288 64c0 17.7-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32H256c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H256c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),ve([t()],me.prototype,"selectionController",void 0),ve([t()],me.prototype,"popoverRef",void 0);var ge=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class be extends I{constructor(){super({icon:"align-center",tooltip:{text:"Center Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"center"===(null===(e=t.getAnnotationByType(Rt.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new pe("center")))),this.popoverRef.hide()}}B.register({"align-center":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M352 64c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32z"/></svg>'}}),ge([t()],be.prototype,"selectionController",void 0),ge([t()],be.prototype,"popoverRef",void 0);var xe=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class we extends I{constructor(){super({icon:"align-right",tooltip:{text:"Right Align"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"right"===(null===(e=t.getAnnotationByType(Rt.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new pe("right")))),this.popoverRef.hide()}}B.register({"align-right":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M448 64c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>'}}),xe([t()],we.prototype,"selectionController",void 0),xe([t()],we.prototype,"popoverRef",void 0);var ye=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Ce extends I{constructor(){super({icon:"align-justify",tooltip:{text:"Justified"}})}isSelected(){const t=this.selectionController.getSelectedBlocks();return t.length>0&&t.every((t=>{var e;return"justify"===(null===(e=t.getAnnotationByType(Rt.ALIGNMENT))||void 0===e?void 0:e.textAlign)}))}onClick(){this.selectionController.getSelectedBlocks().forEach((t=>t.apply(new pe("justify")))),this.popoverRef.hide()}}B.register({"align-justify":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M448 64c0-17.7-14.3-32-32-32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 192c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32zM448 448c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32z"/></svg>'}}),ye([t()],Ce.prototype,"selectionController",void 0),ye([t()],Ce.prototype,"popoverRef",void 0);var Re=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class je extends I{constructor(){super({icon:"align-left",tooltip:{text:"Left Align"}}),this.leftAlignToolbarButtonSlimmer=new me,this.centerAlignToolbarButtonSlimmer=new be,this.rightAlignToolbarButtonSlimmer=new we,this.justifiedToolbarButtonSlimmer=new Ce}componentWillRender(){this.leftAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-left"):this.centerAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-center"):this.rightAlignToolbarButtonSlimmer.isSelected()?super.setIcon("align-right"):this.justifiedToolbarButtonSlimmer.isSelected()?super.setIcon("align-justify"):super.setIcon("align-left")}renderBtnWrapper(t){return s("vega-popover",{trigger:"click",showArrow:!1,alignment:"center",placement:"bottom",ref:t=>this.popoverRef=t},s("div",{slot:"popover-content"},t({showArrowIcon:!0})),s("div",{slot:"popover"},this.renderContent()))}renderContent(){return s("vega-flex",{gap:"size-8","justify-content":"center"},s("div",null,this.leftAlignToolbarButtonSlimmer.render()),s("div",null,this.centerAlignToolbarButtonSlimmer.render()),s("div",null,this.rightAlignToolbarButtonSlimmer.render()),s("div",null,this.justifiedToolbarButtonSlimmer.render()))}isSelected(){return!1}}Re([t()],je.prototype,"selectionController",void 0),Re([r()],je.prototype,"leftAlignToolbarButtonSlimmer",void 0),Re([r()],je.prototype,"centerAlignToolbarButtonSlimmer",void 0),Re([r()],je.prototype,"rightAlignToolbarButtonSlimmer",void 0),Re([r()],je.prototype,"justifiedToolbarButtonSlimmer",void 0),Re([e("componentWillRender")],je.prototype,"componentWillRender",null);let ke=!1;class Oe{constructor(){this.rangeCount=0,this.ranges=[]}getRangeAt(t){return this.ranges[t]}addRange(t){if(this.ranges.push(t),this.rangeCount=this.ranges.length,!ke){const e=window.getSelection();e.removeAllRanges(),e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}}removeAllRanges(){this.ranges=[],this.rangeCount=0}}const Se=new class{constructor(){this.supportShadowSelection="function"==typeof window.ShadowRoot.prototype.getSelection,this.supportBeforeInput="function"==typeof window.InputEvent.prototype.getTargetRanges,this.isFirefox=window.navigator.userAgent.toLowerCase().indexOf("firefox")>0,this.listen()}getSelection(t){return this.supportShadowSelection?t.getSelection():this.isFirefox?this.getFirefoxSelection():this.polyfilledShadowSelection}getFirefoxSelection(){const t=document.getSelection(),e=t.getRangeAt(0),i=e.startContainer,s=e.endContainer;if(i!==s&&i.textContent.length===e.startOffset){const t=i.nodeType===Node.TEXT_NODE?i.parentNode.nextSibling:i.nextSibling;e.setStart(t.firstChild,0)}if(s!==i&&0===e.endOffset){const t=s.nodeType===Node.TEXT_NODE?s.parentNode.previousSibling:s.previousSibling;e.setEnd(t.lastChild,t.lastChild.textContent.length)}return t}listen(){this.isFirefox||this.supportShadowSelection||!this.supportBeforeInput||(this.polyfilledShadowSelection=new Oe,window.addEventListener("selectionchange",(()=>{if(!ke){ke=!0;const t=f();t&&t.hasAttribute("contenteditable")?document.execCommand("indent"):this.polyfilledShadowSelection.removeAllRanges(),ke=!1}}),!0),window.addEventListener("beforeinput",(t=>{if(ke){const e=t.getTargetRanges()[0],i=new Range;i.setStart(e.startContainer,e.startOffset),i.setEnd(e.endContainer,e.endOffset),this.polyfilledShadowSelection.removeAllRanges(),this.polyfilledShadowSelection.addRange(i),t.preventDefault(),t.stopImmediatePropagation()}}),!0))}};class Te{constructor(t,e,i=0,s=0,n,o,r){this._startOffset=0,this._endOffset=0,this._startContainer=t,this._endContainer=e,this._startOffset=i,this._endOffset=s,this._startNode=n,this._endNode=o,r&&(this._oldNativeRange=r)}get startContainer(){return this._startContainer}get endContainer(){return this._endContainer}get startNode(){return this._startNode}get endNode(){return this._endNode}get startOffset(){return this._startOffset}get endOffset(){return this._endOffset}updateRTERange(t,e){const{startOffset:i,endOffset:s}=t;this._startOffset=i,this._endOffset=s;const n=t.startNode,o=t.endNode;if(n instanceof st){this._startNode=n,this._endNode=o;const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode);t&&(this._startContainer=t,this._endContainer=e)}else this._startContainer=n,this._endContainer=o,this._startNode=this.getRTENodeByElement(this._startContainer),this._endNode=this._startContainer===this._endContainer?this._startNode:this.getRTENodeByElement(this._endContainer),e&&(this._oldNativeRange=e);return new Te(this._startContainer,this._endContainer,this._startOffset,this._endOffset,this._startNode,this._endNode,this._oldNativeRange)}toNativeRange(){const t=this.getElementByRTENode(this._startNode),e=this._startNode===this._endNode?t:this.getElementByRTENode(this._endNode),i=new Range;return t&&e?(i.setStart(t,this._startOffset),i.setEnd(e,this._endOffset),this._startContainer=t,this._endContainer=e,this._oldNativeRange=i,i):this._oldNativeRange?this._oldNativeRange:void 0}getElementByRTENode(t){if(t){const e=nt.getDOMByEntity(t);if(e)return t instanceof F?zt(e,"vega-rich-text-image-editor"):e.firstChild}}getRTENodeByElement(t){if(t){const e=t.nodeType===Node.TEXT_NODE?t.parentElement:"VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t;return nt.getEntityByDOM(e)}}}var He=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class ze extends i{constructor(){super(...arguments),this.currentRange=new Te,this.updateCaretPositionTaskQueue=new Ht(1),this.handleSelectionWithDebounce=Tt(this.handleSelectionChange,ze.SELECTION_CHANGE_DEBOUNCE_TIME,this),this.selectedNodes=[],this.createUpdateSelectionRangeTask=async()=>{await Promise.resolve();const t=this.currentRange.toNativeRange();t&&this.setSelectionRange(t)}}connectedCallback(){this.registerSelectionRangeChangeObserver()}disconnectedCallback(){m.unregister(g.getSubject(this.host,S),this.selectionRangeChangeObserver)}componentDidLoad(){document.addEventListener("selectionchange",this.handleSelectionWithDebounce)}watchValueUpdate(){this.restoreSelection()}async updateCaretPosition(){this.updateCaretPositionTaskQueue.queue.length&&await this.updateCaretPositionTaskQueue.runTask()}getCurrentRange(){return this.currentRange}getSelectedNodes(){return Array.from(this.selectionMap.values()).flat()}getSelectedBlocks(){return Array.from(this.selectionMap.keys())}enqueueSelectionRangeFutureState(t,e,i,s,n=!1){this.currentRange=this.currentRange.updateRTERange({startNode:t,endNode:i=i||t,startOffset:e,endOffset:s=s||0===s?s:e}),this.updateCaretPositionTaskQueue.enqueue({run:async()=>{try{await this.createUpdateSelectionRangeTask()}catch(t){c.error("Set range error.",t)}}},n)}setSelectionRange(t){const e=this.getSelection();e.removeAllRanges(),e.addRange(t),this.saveSelection()}saveSelection(){const t=this.getSelection();if(t&&t.rangeCount>0&&0===this.updateCaretPositionTaskQueue.queue.length){const e=t.getRangeAt(0),{startContainer:i,endContainer:s,startOffset:n,endOffset:o}=e;this.currentRange=this.currentRange.updateRTERange({startNode:i,endNode:s,startOffset:n,endOffset:o},e)}}restoreSelection(){if(this.selectedNodes.length>0){const t=this.selectedNodes[0],e=this.selectedNodes.length>1?this.selectedNodes[this.selectedNodes.length-1]:t;if(t===e&&0===t.text.length)this.enqueueSelectionRangeFutureState(t,xt.length);else{const{startContainer:i,endContainer:s,startOffset:n,endOffset:o}=this.currentRange;nt.getDOMByEntity(t)===i.parentElement&&nt.getDOMByEntity(e)===s.parentElement?this.enqueueSelectionRangeFutureState(t,n,e,o):this.enqueueSelectionRangeFutureState(t,0,e,e.text.length)}this.selectedNodes=[]}}getSelection(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();return Se.getSelection(t.shadowRoot)}handleSelectionChange(){const t=this.getSelection();if(!t||0===t.rangeCount)return;this.clearSelectionMap(),this.saveSelection();const e=t.getRangeAt(0),i=[],s=t=>{if(e.intersectsNode(t)){if(t.nodeType===Node.TEXT_NODE){const e=nt.getEntityByDOM(t.parentElement);if(e instanceof st)return void i.push(e)}if(t.nodeType===Node.ELEMENT_NODE){const e="VEGA-RICH-TEXT-IMAGE-EDITOR"===t.nodeName?t.querySelector("img"):t,s=nt.getEntityByDOM(e);if(s instanceof st)return void i.push(s)}t.childNodes.forEach(s)}};s(e.commonAncestorContainer),i.forEach((t=>{this.selectionMap.has(t.parentBlock)?this.selectionMap.get(t.parentBlock).push(t):this.selectionMap.set(t.parentBlock,[t])})),this.getSelectedNodes().forEach((t=>t.apply(new Zt(e))))}clearSelectionMap(){this.getSelectedNodes().forEach((t=>{t.annotationMap.delete(ot.SELECTION_RANGE)})),this.selectionMap=new Map}isAcceptableSelectionRangeChange(){return!0}registerSelectionRangeChangeObserver(){this.selectionRangeChangeObserver=new y(this.isAcceptableSelectionRangeChange.bind(this),(t=>{this.selectedNodes.push(t.node)})),m.register(g.getSubject(this.host,S),this.selectionRangeChangeObserver)}}ze.SELECTION_CHANGE_DEBOUNCE_TIME=50,He([t()],ze.prototype,"vegaRichTextEditorRenderer",void 0),He([t({writable:!0})],ze.prototype,"selectionMap",void 0),He([t()],ze.prototype,"host",void 0),He([t()],ze.prototype,"value",void 0),He([t()],ze.prototype,"valueController",void 0),He([e("connectedCallback")],ze.prototype,"connectedCallback",null),He([e("disconnectedCallback")],ze.prototype,"disconnectedCallback",null),He([e("componentDidLoad")],ze.prototype,"componentDidLoad",null),He([e("watchValueUpdate")],ze.prototype,"watchValueUpdate",null),He([e("componentDidUpdate")],ze.prototype,"updateCaretPosition",null);var Ee=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Ie extends i{connectedCallback(){const t=Tt((()=>{this.valueController.flushChanges(this.value)}),Ie.VALUE_CHANGE_DEBOUNCE_TIME,this);this.flushChangeObserver=new y(this.isAcceptableFlushChange.bind(this),t),m.register(g.getSubject(this.host,T),this.flushChangeObserver)}disconnectedCallback(){m.unregister(g.getSubject(this.host,T),this.flushChangeObserver)}watchValueUpdate(){this.value&&0!==this.value.blocks.length?(this.changeEventEmitter.emit(this.value),m.notify(It,{host:this.host,detail:this.value})):this.value=W.createEmptyContent()}async flushChanges(t){this.value=t.clone(),await bt(this.host)}isAcceptableFlushChange(){return!0}}Ie.VALUE_CHANGE_DEBOUNCE_TIME=50,Ee([t()],Ie.prototype,"host",void 0),Ee([t({writable:!0})],Ie.prototype,"value",void 0),Ee([t()],Ie.prototype,"changeEventEmitter",void 0),Ee([t()],Ie.prototype,"valueController",void 0),Ee([e("connectedCallback")],Ie.prototype,"connectedCallback",null),Ee([e("disconnectedCallback")],Ie.prototype,"disconnectedCallback",null),Ee([e("watchValueUpdate")],Ie.prototype,"watchValueUpdate",null);var Le=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Be extends i{connectedCallback(){this.observer=new y(this.isAcceptObserver.bind(this),(t=>{this.isInDarkMode=t})),m.register(Lt,this.observer)}disconnectResizeObserver(){m.unregister(Lt,this.observer)}isAcceptObserver(){return!0}}Le([t({writable:!0})],Be.prototype,"isInDarkMode",void 0),Le([e("connectedCallback")],Be.prototype,"connectedCallback",null),Le([e("disconnectedCallback")],Be.prototype,"disconnectResizeObserver",null);class Ae{constructor(t){this.editor=t}syncRichTextContentEditable(){this.editor.richTextContentEditable=!this.editor.disabled}}class Me extends et{constructor(t,e){super(),this.type=it.REPLACE_SELECTED_TEXT,this.textToBeInsert="",this.textToBeInsert=t,this.currentRange=e}}class Ne{execute(t,e,i){this.initCurrentStateAndSelection(t,e),this.handleEvent(i)}replaceSelectedNodesWithText(t){const e=this.selectionController.getSelectedNodes(),i=this.selectionController.getCurrentRange(),{startContainer:s,endContainer:n}=i,o=this.removeSelectionRange(),r=e[0];return r instanceof ct&&t&&r.apply(new wt(r.text+t)),this.mergeRangeStartAndEnd(s,n),o}isRootContainer(t){return t&&t.nodeType===Node.ELEMENT_NODE&&t.classList.contains("rich-text-content")}isEmptyParagraph(t){return t&&t.childNodes&&0===t.childNodes.length}removeRangeStartAndEndSelectedText(){const t=this.selectionController.getSelectedNodes(),e=this.selectionController.getCurrentRange();t[0]instanceof ct&&t[0].apply(new Me("",e)),t.length>1&&t[t.length-1]instanceof ct&&t[t.length-1].apply(new Me("",e))}mergeRangeStartAndEnd(t,e){if(t!==e&&t.nodeType===Node.TEXT_NODE&&e.nodeType===Node.TEXT_NODE){const t=this.selectionController.getSelectedNodes(),e=t[0],i=t[t.length-1];if(e&&e.parentBlock&&i&&i.parentBlock){const t=i.parentBlock;this.shouldMergeTextNode(e,i)&&(e.apply(new wt(e.text+i.text)),e.parentBlock===i.parentBlock?e.parentBlock.apply(new G(i)):i.parentBlock.apply(new G(i.parentBlock.nodes[0]))),e.parentBlock!==i.parentBlock&&(e.parentBlock.apply(new _(t.nodes)),t.nodes=[]),t.nodes.length<1&&t.parent.apply(new G(t))}}}removeSelectionRange(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),{endOffset:i,startOffset:s}=t,n=e[0],o=e[e.length-1];if(e.length>1&&e.filter((t=>"IMAGE"!==t.type?t!==n&&t!==o:t!==n&&(t!==o||t===o&&0!==i))).forEach((t=>{t.parentBlock.apply(new G(t))})),this.removeRangeStartAndEndSelectedText(),n instanceof F&&1!==s&&(o!==n||0!==i)){if(1===n.parentBlock.nodes.length){const t=this.createEmptyParagraph();return n.parentBlock.parent.apply(new K(n.parentBlock,t)),n.parentBlock.apply(new G(n)),t.nodes[0]}if(n===n.parentBlock.nodes[0])return n.parentBlock.apply(new G(n)),n.parentBlock.nodes[0]}return n}createEmptyParagraph(){const t=new M(jt(),"paragraph"),e=new ct(`${t.id}1`,"",t);return t.apply(new _([e])),t}shouldMergeTextNode(t,e){const{annotations:i}=t.toJSON(),{annotations:s}=e.toJSON();return JSON.stringify(i)===JSON.stringify(s)}initCurrentStateAndSelection(t,e){this.currentState=t,this.selectionController=e}}class De extends et{constructor(t,...e){super(),this.type=it.INSERT_NODES_BEFORE,this.referNode=t,this.nodesToBeInserted=e}}class Pe extends Ne{handleEvent(t){const e=t.data,i=this.selectionController.getCurrentRange(),{startContainer:s,startOffset:n}=i,o=this.selectionController.getSelectedNodes();if(o.length<2){if(!o.length&&this.isRootContainer(s)){const t=this.insertTextToRoot(e);this.selectionController.enqueueSelectionRangeFutureState(t,e.length)}else if(o[0]instanceof ct){let t=n+e.length,r=!1,c=o[0];"\n"===c.text?(c=this.insertTextToLineBreakNode(c,e),r=!0):(s.nodeValue===xt&&n===xt.length&&c.isEmpty()&&(s.nodeValue="",t-=xt.length),c instanceof ct&&(r=!0,c.apply(new Me(e,i)))),r&&this.selectionController.enqueueSelectionRangeFutureState(c,Math.min(t,c.text.length))}}else{const t=this.replaceSelectedNodesWithText(e);this.selectionController.enqueueSelectionRangeFutureState(t,t instanceof ct?Math.min(n+e.length,t.text.length):n)}}insertTextToRoot(t){if(this.currentState&&this.currentState.blocks[0]&&this.currentState.blocks[0]instanceof M){const e=this.currentState.blocks[0].nodes[0];return e.apply(new wt(t)),e}}insertTextToLineBreakNode(t,e){const{startOffset:i,endOffset:s}=this.selectionController.getCurrentRange(),n=t.parentBlock,o=n.nodes.indexOf(t);if(0===i&&i===s&&n.nodes[o+1]){const i=t.cloneWithText(e);return n.apply(new De(t,i)),i}return t.apply(new wt(e)),t}}class Fe extends et{constructor(t,e){super(),this.type=it.BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class Ve extends Ne{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.breakSingleBlock():this.breakMultipleBlocks()}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.selectionController.getCurrentRange(),i=this.removeSelectionRange();if(t.length&&"list-item"===t[0].type||"list-item"===t[t.length-1].type){const s=i.parentBlock,n=t[t.length-1];if(s.type!==n.type&&e.startContainer.nodeType===e.endContainer.nodeType){s.apply(new q(n));const t=new X(i,i.text.length);return s.apply(t),void this.switchCaretPositionToNextElement(t.newBlock)}}this.selectionController.enqueueSelectionRangeFutureState(i,e.startOffset)}breakSingleBlock(){const t=this.removeSelectionRange(),e=t.parentBlock,{startOffset:i}=this.selectionController.getCurrentRange();if(e){const s=new Fe(t,i);e.apply(s),this.switchCaretPositionToNextElement(s.newBlock)}}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}}class Ue extends et{constructor(t,e){super(),this.type=it.LINE_BREAK_SINGLE_BLOCK,this.startContainerNode=t,this.startOffset=e}}class We extends et{constructor(t){super(),this.type=it.LINE_BREAK_MULTIPLE_BLOCKS,this.selectedBlocks=t}}class Ge extends Ne{handleEvent(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedBlocks();this.isRootContainer(t.startContainer)&&this.breakNewBlock(),e.length<2?this.breakSingleBlock():this.breakMultipleBlocks()}breakNewBlock(){const t=new M(jt(),"paragraph"),e=this.createLineBreakNode(t);t.apply(new _([this.createLineBreakNode(t),e])),this.currentState.apply(new _([t])),this.switchCaretPositionToSpecifiedNode(e)}breakSingleBlock(){const t=this.selectionController.getCurrentRange(),e=this.removeSelectionRange(),i=e.parentBlock;if(i){const s=new Ue(e,t.startOffset);i.apply(s),this.switchCaretPositionToSpecifiedNode(s.lineBreakNode)}}breakMultipleBlocks(){const t=this.selectionController.getSelectedBlocks(),e=this.removeSelectionRange(),i=new We(t);e.parentBlock.apply(i),this.switchCaretPositionToSpecifiedNode(i.lineBreakNode)}switchCaretPositionToSpecifiedNode(t){this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(t),0)}getNextRTENode(t){const e=t.parentBlock.nodes.indexOf(t);return t.parentBlock.nodes[e+1]||t}createLineBreakNode(t){return new ct(jt(),"\n",t)}}class _e extends et{constructor(t,e){super(),this.type=it.DELETE_BLOCK_CONTENT,this.startContainerNode=t,this.startOffset=e}}class Ke extends Ne{handleEvent(){this.selectionController.getSelectedBlocks().length<2?this.deleteContentWithSingleBlock():this.deleteContentWithMultipleNodes()}deleteContentWithSingleBlock(){const t=this.selectionController.getCurrentRange(),{startOffset:e,endOffset:i,startContainer:s,endContainer:n}=t,o=this.selectionController.getSelectedBlocks(),r=this.selectionController.getSelectedNodes();if(e!==i||s!==n)this.deleteContentWithMultipleNodes();else if(o[0]){const t=new _e(r[0],e);if(o[0].apply(t),t.previousNode){const i=t.previousNode===r[0]?Math.max(0,e-1):this.getNodeEndOffset(t.previousNode);this.selectionController.enqueueSelectionRangeFutureState(t.previousNode,i)}else t.nextNode?this.selectionController.enqueueSelectionRangeFutureState(t.nextNode,0):0===this.currentState.blocks.length&&this.insertDefaultParagraph()}}insertDefaultParagraph(){const t=this.createEmptyParagraph();this.currentState.apply(new _([t])),this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],1)}deleteContentWithMultipleNodes(){const t=this.selectionController.getCurrentRange(),e=this.selectionController.getSelectedNodes(),i=this.replaceSelectedNodesWithText(""),s=e[e.length-1];e.length>1&&s instanceof ct&&s.isEmpty()&&s.parentBlock.apply(new G(s)),this.convertFirstBlockToParagraph(i.parentBlock),this.selectionController.enqueueSelectionRangeFutureState(i,t.startOffset)}convertFirstBlockToParagraph(t){if(this.currentState.blocks[0]===t&&t instanceof M&&1===t.nodes.length&&t.nodes[0].isEmpty()&&"paragraph"!==t.type){const e=this.createEmptyParagraph();e.apply(new J(t.nodes)),t.parent.apply(new K(t,e)),t.parent.apply(new G(t))}}getNodeEndOffset(t){return"IMAGE"===t.type?1:"TEXT"===t.type?"\n"===t.text?0:t.text.length:void 0}}class qe{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(){const t=this.currentStrategy.handle(this.currentElements);return this.childrenOutput.length>0&&t&&this.currentStrategy.appendChildBlocks(t,this.childrenOutput.map((t=>t.toDto())).filter(Boolean)),t}}class Xe extends class{}{generateChildNodes(t,e={}){const i=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){if(this.isInvalidTextNode(t))return;i.push({id:jt(),type:"text",text:t.textContent,annotations:e})}else i.push(...this.generateChildNodes(Array.from(t.childNodes),Object.assign({},e,this.generateTextNodeAnnotations(t))))})),i}generateBlockAnnotations(t){const e={},i=this.getTextAlign(t),s=this.getIndent(t);return i&&(e.textAlign=i),s&&(e.indent=s),e}isInvalidTextNode(t){return!(!t.nodeValue.includes("\t")||0!==t.nodeValue.replace(/\n|\t/gm,"").length)}generateTextNodeAnnotations(t){if(this.isCode(t))return{code:!0};const e={bold:this.isBold(t),italic:this.isItalic(t),underline:this.isUnderline(t),strikethrough:this.isStrikethrough(t)},i=this.getColor(t),s=this.getLink(t);return i&&(e.textColor=i),s&&(e.link=s),e}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName}isBold(t){return"STRONG"===t.nodeName||"bold"===t.style.fontWeight||"700"===t.style.fontWeight}isItalic(t){return"I"===t.nodeName||"italic"===t.style.fontStyle||"EM"===t.nodeName}isUnderline(t){return t.style.textDecoration.includes("underline")||"U"===t.nodeName||t.classList.contains("v-rte--underline")}isStrikethrough(t){return t.style.textDecoration.includes("line-through")||"S"===t.nodeName||t.classList.contains("v-rte--strikethrough")}getColor(t){var e;const i=null===(e=Et(t.style.color))||void 0===e?void 0:e.toUpperCase();if(i){const t=yt.find((t=>t.light===i||t.dark===i));return t?t.key:null}for(const e of yt)if(t.style.color.includes(e.key))return e.key;return null}getLink(t){return"A"===t.nodeName?{href:t.href,groupKey:jt()}:null}getTextAlign(t){const e=t.classList;if(e.contains("v-rte--horizontal-alignment-left"))return"left";if(e.contains("v-rte--horizontal-alignment-center"))return"center";if(e.contains("v-rte--horizontal-alignment-right"))return"right";if(e.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}getIndent(t){const e=t.style;let i;if(e.marginLeft)i=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:i=t[3];break;case 2:case 3:i=t[1];break;default:i=t[0]}}}const s=Number(i.replace("px",""));return s&&s>=0?Math.floor(s/16):null}}class Je extends Xe{canHandle(t,e){let i=0;for(let s=e;s<t.length;s++){const e=t[s];if(e.nodeType!==Node.TEXT_NODE&&(!Je.canHandleTags.includes(e.nodeName)||""===e.textContent&&e.querySelector("IMG")))break;i++}return i}handle(t){const e=t[0].parentElement,i=this.generateChildNodes(t);return 0===i.length?null:M.from({id:jt(),type:"paragraph",nodes:i,annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}Je.canHandleTags=["SPAN","STRONG","CODE","I","EM","S","U","A","VEGA-RICH-TEXT-LINK-EDITOR"];class $e extends Xe{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:$.from({id:jt(),type:"bullet-list",blocks:[],annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.blocks=e,e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}class Ye extends Xe{canHandle(t,e){return"LI"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:V.from({id:jt(),type:"list-item",nodes:this.generateChildNodes(Array.from(t[0].childNodes).filter((t=>!["UL","OL"].includes(t.nodeName)))),annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.children=e.filter((t=>["bullet-list","number-list"].includes(t.type)))}shouldProceedToElementChildren(){return!0}}class Qe extends Xe{canHandle(t,e){return["heading-1","heading-2","heading-3","title","subtitle"].includes(this.getElementType(t[e]))?1:0}handle(t){const e=this.generateChildNodes(t);return 0===e.length?null:M.from({id:jt(),type:this.getElementType(t[0]),nodes:e,annotations:Object.assign(Object.assign({},this.generateBlockAnnotations(t[0])),{textStyle:this.getElementType(t[0])})})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}getElementType(t){var e;if(t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type"))return t.getAttribute("data-type");switch(null===(e=t.style)||void 0===e?void 0:e.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3"}switch(t.nodeName){case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";default:return""}}}class Ze extends Xe{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t){const e=t[0];return Y.from({id:jt(),type:"image",nodes:[{id:jt(),type:"image",url:e.src,annotations:{size:"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class ti extends Xe{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t){const e=t[0],i=e.querySelector("img");return Y.from({id:jt(),type:"image",nodes:[{id:jt(),type:"image",url:i.src,annotations:{size:e.size||"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class ei extends Xe{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t){return 0===t[0].childNodes.length?null:$.from({id:jt(),type:"number-list",blocks:[],annotations:this.generateBlockAnnotations(t[0])})}appendChildBlocks(t,e){t.blocks=e,e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}class ii extends Xe{canHandle(t,e){const i=t[e];return i.nodeType===Node.ELEMENT_NODE&&""===i.textContent&&i.querySelector("img")?1:0}handle(t){const e=t[0].querySelector("img");return Y.from({id:jt(),type:"image",nodes:[{id:jt(),type:"image",url:e.src,annotations:{size:"md",alt:e.alt}}],annotations:this.generateBlockAnnotations(e)})}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class si{constructor(){this.elementStrategies=[new $e,new ei,new Ye,new Qe,new Ze,new ti,new ii,new Je]}process(t){const e=[];for(let i=0;i<t.length;i++){if(this.isInvalidElement(t[i]))continue;let s=0;for(const n of this.elementStrategies)if(s=n.canHandle(t,i),s>0){const o=t.slice(i,i+s),r=new qe(n,o);1===s&&n.shouldProceedToElementChildren()&&r.setChildrenOutput(this.process(Array.from(o[0].childNodes))),e.push(r),i+=s-1;break}if(0===s&&i<t.length){const s=Array.from(t[i].childNodes),n=this.process(Array.from(s));n.length>0&&e.push(...n)}}return e}isInvalidElement(t){return t.nodeType===Node.COMMENT_NODE||["META","BUTTON","STYLE"].includes(t.nodeName)}}class ni extends Ne{constructor(){super(...arguments),this.elementToDTOProcessor=new si}handleEvent(t){const e=this.parsePastedElements(t),{startContainer:i}=this.selectionController.getCurrentRange();this.isRootContainer(i)?this.insertBlocksToRoot(e):this.isEmptyParagraph(i)?this.insertBlocksBeforeEmptyBlock(e):this.insertBlocksToContent(e)}insertBlocksToRoot(t){this.currentState.apply(new _(t))}insertBlocksToContent(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parentBlock;if(i){const{startOffset:s}=this.selectionController.getCurrentRange(),n=new X(e,s);i.apply(n),i.parent.apply(new Q(i,...t)),this.switchCaretPositionToNextElement(n.newBlock)}}insertBlocksBeforeEmptyBlock(t){const e=this.removeSelectionRange(),i=null==e?void 0:e.parentBlock;i.parent.apply(new K(i,...t)),this.switchCaretPositionToNextElement(i)}parsePastedElements(t){const e=t.dataTransfer.getData("text/html"),i=document.createElement("div");return i.innerHTML=e,this.elementToDTOProcessor.process(Array.from(i.childNodes)).filter(Boolean).map((t=>t.toDto())).filter(Boolean)}switchCaretPositionToNextElement(t){t&&t.nodes&&this.selectionController.enqueueSelectionRangeFutureState(t.nodes[0],0)}}var oi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class ri extends i{constructor(){super(...arguments),this.insertTextHandler=new Pe,this.insertParagraphHandler=new Ve,this.insertLineBreakHandler=new Ge,this.deleteContentHandler=new Ke,this.insertPasteHandler=new ni,this.observerOptions={characterData:!0,characterDataOldValue:!0,subtree:!0,childList:!0},this.handleUserInputAction=t=>{this.removeObserver(),t.preventDefault(),this.initValueIfEmpty();let e=!1;switch(t.inputType){case"insertParagraph":e=!0,this.insertParagraphHandler.execute(this.value,this.selectionController,t);break;case"insertText":e=!0,this.insertTextHandler.execute(this.value,this.selectionController,t);break;case"insertLineBreak":e=!0,this.insertLineBreakHandler.execute(this.value,this.selectionController,t);break;case"deleteContentBackward":e=!0,this.deleteContentHandler.execute(this.value,this.selectionController,t);break;case"insertFromPaste":e=!0,this.insertPasteHandler.execute(this.value,this.selectionController,t)}e&&this.notifyComponentFlushValue()},this.handleObserver=t=>{let e=!1;t.every((t=>"characterData"===t.type))&&(t.forEach((t=>{const{target:i}=t;if(i.nodeType===Node.TEXT_NODE&&i.parentElement){const t=nt.getEntityByDOM(i.parentElement);t&&t.text!==i.textContent&&(e=!0,t.text=i.textContent)}})),e&&this.notifyComponentFlushValue())}}initMutationObserver(){if(this.mutationObserver){const t=this.getEditableElementRef();t&&(this.mutationObserver.disconnect(),this.mutationObserver.observe(t,this.observerOptions))}}removeObserver(){this.mutationObserver&&this.mutationObserver.disconnect()}addActionListener(){const t=this.getEditableElementRef();t&&(t.addEventListener("beforeinput",this.handleUserInputAction),t.addEventListener("drop",this.preventDropEvent)),this.mutationObserver=new MutationObserver(this.handleObserver),this.initMutationObserver()}removeActionListener(){const t=this.getEditableElementRef();t&&(t.removeEventListener("beforeinput",this.handleUserInputAction),t.removeEventListener("drop",this.preventDropEvent)),this.removeObserver()}reConnectObserver(){this.initMutationObserver()}getEditableElementRef(){return this.editableElementRef||(this.editableElementRef=this.vegaRichTextEditorRenderer.getRTEEditableElementRef()),this.editableElementRef}notifyComponentFlushValue(){this.valueController.flushChanges(this.value)}preventDropEvent(t){t.preventDefault()}initValueIfEmpty(){if(!this.value){const t=jt();this.valueController.flushChanges(W.fromJSON([{id:t,type:"paragraph",nodes:[{id:`${t}1`,type:"text",text:""}]}]))}}}oi([t()],ri.prototype,"host",void 0),oi([t()],ri.prototype,"value",void 0),oi([t()],ri.prototype,"valueController",void 0),oi([t()],ri.prototype,"vegaRichTextEditorRenderer",void 0),oi([t()],ri.prototype,"selectionController",void 0),oi([e("componentDidLoad")],ri.prototype,"addActionListener",null),oi([e("disconnectedCallback")],ri.prototype,"removeActionListener",null),oi([e("componentDidRender")],ri.prototype,"reConnectObserver",null);class ci{evaluate(t){var e;if(!this.isAcceptedInputType(t))throw new Error(`Invalid value ${t} for rich text editor`);const i=(null===(e=null==t?void 0:t.blocks)||void 0===e?void 0:e.length)>0&&t.blocks.some((t=>t.isNotEmpty()));return{isValid:i,message:i?"":"This field is required"}}canEvaluate(t,e){return e?this.isAcceptedInputType(t)&&!e.disabled&&e.visible:this.isAcceptedInputType(t)}shouldShowError(t){return!t.disabled&&t.visible&&(t.touched||t.modified)}isAcceptedInputType(t){return null==t||t instanceof W}}class li extends et{constructor(t,e,i){super(),this.isFlushable=!0,this.type=it.INSERT_IMAGE_TO_BLOCK,this.splitPointNode=t,this.startOffsetOfNode=e,this.imageBlockToBeInserted=i}}var ai=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class hi extends i{insertImageToCaretPosition(t){const e=this.selectionController.getSelectedBlocks(),i=new Y(jt()),s=new F(jt(),t,i);if(s.apply(new Z("md","")),i.apply(new _([s])),e.length<1||this.value.blocks.length<1)this.value.apply(new _([i])),this.valueController.flushChanges(this.value);else{const{startOffset:t}=this.selectionController.getCurrentRange(),s=this.selectionController.getSelectedNodes();e[0].apply(new li(s[0],t,i))}return this.updateCaretPosition(s),s}registerObserver(){this.registerImageSelectedObserver()}unRegisterObserver(){this.removeImageSelectedObserver()}updateCaretPosition(t){this.selectionController.enqueueSelectionRangeFutureState(t,1)}registerImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(b.addUniqueObserverToNode(t,H,(t=>{const e=this.selectionController.getCurrentRange();if(!e||e.startContainer!==t.host||0!==e.startOffset){const e=nt.getEntityByDOM(t.host.querySelector("img"));this.selectionController.enqueueSelectionRangeFutureState(e,0,e,0,!0)}})),b.addUniqueObserverToNode(t,z,(t=>{const e=this.selectionController.getCurrentRange();e&&e.startContainer===t.host&&1===e.startOffset||this.selectionController.enqueueSelectionRangeFutureState(t.host,1,t.host,1,!0)})))}removeImageSelectedObserver(){const t=this.vegaRichTextEditorRenderer.getRichTextContentRef();t&&(b.removeUniqueObserverFromNode(t,H),b.removeUniqueObserverFromNode(t,z))}}ai([t()],hi.prototype,"selectionController",void 0),ai([t()],hi.prototype,"value",void 0),ai([t()],hi.prototype,"valueController",void 0),ai([t()],hi.prototype,"vegaRichTextEditorRenderer",void 0),ai([e("componentDidLoad")],hi.prototype,"registerObserver",null),ai([e("disconnectedCallback")],hi.prototype,"unRegisterObserver",null);var di=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class ui extends i{constructor(){super(...arguments),this.doFocusOnLastTextNode=async t=>{this.setCaretRangeToNodeEnd(nt.getDOMByEntity(t.getLastNode()).firstChild),await this.vegaRichTextEditorRenderer.getRichTextContentRef().vegaFocus()}}async focusOnLastTextNode(t){const e=this.value.blocks[this.value.blocks.length-1];if(e instanceof M&&!(null==t?void 0:t.newLine))await this.doFocusOnLastTextNode(e);else{const t=M.from({id:jt(),type:"paragraph",nodes:[{id:jt(),type:"text",text:""}]});e.parent.apply(new Q(e,t)),await this.valueController.flushChanges(this.value),await this.doFocusOnLastTextNode(t)}}setCaretRangeToNodeEnd(t){const e=new Range;e.setStart(t,t.nodeValue.length),this.selectionController.setSelectionRange(e)}}di([t()],ui.prototype,"vegaRichTextEditorRenderer",void 0),di([t()],ui.prototype,"selectionController",void 0),di([t()],ui.prototype,"valueController",void 0),di([t()],ui.prototype,"value",void 0);var fi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class pi extends i{connectedCallback(){this.observer=new y(this.isAcceptObserver.bind(this),(t=>{Ct.getTextNodeElements().forEach(((e,i)=>{i.style.color=t?e.textColor.dark:e.textColor.light}))})),m.register(Lt,this.observer)}disconnectResizeObserver(){m.unregister(Lt,this.observer)}isAcceptObserver(){return!0}}fi([e("connectedCallback")],pi.prototype,"connectedCallback",null),fi([e("disconnectedCallback")],pi.prototype,"disconnectResizeObserver",null);var vi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};const mi=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.vegaImageInserted=a(this,"vegaImageInserted",7),this.imageInserted=a(this,"imageInserted",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.formFieldController=new kt({propertyRules:[{propertyName:"required",ruleFactory:t=>t?new ci:null}],validationRulesName:"validationRules",defaultValue:null,attributeGetter:t=>this[t],inputContainerGetter:()=>this.vegaRichTextEditorRenderer.getRichTextContainerRef(),touchableAreaGetter:()=>[this.vegaRichTextEditorRenderer.getRichTextContentRef()]}),this.changeEventEmitter=Ot(mi,w),this.vegaRichTextEditorRenderer=new Pt,this.valueController=new Ie,this.selectionController=new ze,this.focusController=new ui,this.darkModeStateControllerSlimmer=new Be,this.toolbarRenderer=new Vt,this.clearStyleToolbarButtonSlimmer=new Jt,this.boldToolbarButtonSlimmer=new Ut,this.italicToolbarButtonSlimmer=new Gt,this.underlineToolbarButtonSlimmer=new Kt,this.textColorToolbarButtonSlimmer=new L,this.textStylesToolbarButtonSlimmer=new Xt,this.codeToolbarButtonSlimmer=new $t,this.strikethroughToolbarButtonSlimmer=new Qt,this.imageToolbarButtonSlimmer=new oe,this.linkToolbarButtonSlimmer=new te,this.moreIndentToolbarButtonSlimmer=new ie,this.lessIndentToolbarButtonSlimmer=new se,this.bulletsNumbersToolbarButtonSlimmer=new fe,this.horizontalAlignmentToolbarButtonSlimmer=new je,this.placeholderNotifySlimmer=St(mi,"placeholder","watchPlaceholder"),this.disabledNotifySlimmer=St(mi,"richTextContentEditable","watchRichTextContentEditable"),this.richTextContentController=new Ae(this),this.userInputController=new ri,this.insertImageController=new hi,this.imageInsertedEventEmitter=Ot(mi,C),this.changeEventPreventSlimmer=new Bt([w],(()=>this.vegaRichTextEditorRenderer.getRichTextWrapperRef())),this.textNodeColorController=new pi,this.richTextContentEditable=!0,this.selectionMap=new Map,this.isInDarkMode=rt.isDarkMode(),this.label="",this.required=!1,this.placeholder="",this.disabled=!1,this.hint="",this.rows=4,this.value=W.createEmptyContent(),this.toolbarItems=[["clearStyle"],["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"]],this.isValid=null,this.autoValidation=!0,this.validationRules=[]}watchRichTextContentEditable(){}watchPlaceholder(){}watchDisabled(){this.richTextContentController.syncRichTextContentEditable()}watchValueUpdate(){}watchValidationRules(){}componentWillLoad(){this.richTextContentController.syncRichTextContentEditable()}render(){return p(this.vegaRichTextEditorRenderer.render(),this.host)}get host(){return h(this)}static get watchers(){return{richTextContentEditable:["watchRichTextContentEditable"],placeholder:["watchPlaceholder"],disabled:["watchDisabled"],value:["watchValueUpdate"],validationRules:["watchValidationRules"]}}};vi([u()],mi.prototype,"globalSlimmers",void 0),vi([r()],mi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),vi([r()],mi.prototype,"formFieldController",void 0),vi([r()],mi.prototype,"changeEventEmitter",void 0),vi([r()],mi.prototype,"vegaRichTextEditorRenderer",void 0),vi([r()],mi.prototype,"valueController",void 0),vi([r()],mi.prototype,"selectionController",void 0),vi([r()],mi.prototype,"focusController",void 0),vi([r()],mi.prototype,"darkModeStateControllerSlimmer",void 0),vi([r()],mi.prototype,"toolbarRenderer",void 0),vi([r()],mi.prototype,"clearStyleToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"boldToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"italicToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"underlineToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"textColorToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"textStylesToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"codeToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"strikethroughToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"imageToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"linkToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"moreIndentToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"lessIndentToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"bulletsNumbersToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"horizontalAlignmentToolbarButtonSlimmer",void 0),vi([r()],mi.prototype,"placeholderNotifySlimmer",void 0),vi([r()],mi.prototype,"disabledNotifySlimmer",void 0),vi([r()],mi.prototype,"richTextContentController",void 0),vi([r()],mi.prototype,"userInputController",void 0),vi([r()],mi.prototype,"insertImageController",void 0),vi([r()],mi.prototype,"imageInsertedEventEmitter",void 0),vi([r()],mi.prototype,"changeEventPreventSlimmer",void 0),vi([r()],mi.prototype,"textNodeColorController",void 0),mi.style=':host{display:block}:host vega-field-label{margin-bottom:8px}:host vega-text{margin-bottom:16px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host vega-text{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container{display:flex;box-sizing:content-box;position:relative;box-sizing:content-box;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));margin-top:12px;overflow:auto;resize:vertical;padding-top:12px;padding-right:16px;padding-bottom:32px;padding-left:16px}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host .rich-text-editor-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host .rich-text-editor-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1))}:host .rich-text-editor-container.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:hover,:host .rich-text-editor-container.disabled:focus-within{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:focus-within{outline:none}:host .rich-text-editor-container.error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host .rich-text-editor-container.error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host .rich-text-editor-container.error:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host .rich-text-editor-container .text-editor-counter{position:absolute;bottom:8px;right:8px;display:flex;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;border-radius:4px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1));background-color:rgba(var(--v-bg-textarea-count, 4, 4, 28, 0.6))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container .text-editor-counter{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container .text-editor-counter.counter-exceed-max-length{background-color:rgba(var(--v-bg-textarea-counter-exceed-max-length, 214, 46, 81))}.toolbar-btn-group{display:flex;justify-content:center;align-items:center}.toolbar-btn-group>*:not(:first-child):not(:last-child) ::part(rich-text-editor-toolbar-button){border-radius:0px}.toolbar-btn-group>*:first-child:not(:last-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0px;border-bottom-right-radius:0px}.toolbar-btn-group>*:last-child:not(:first-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:0px;border-bottom-left-radius:0px;border-top-right-radius:4px;border-bottom-right-radius:4px}.toolbar-btn-group>*:not(:first-child) ::part(rich-text-editor-toolbar-button){margin-left:-1px}.toolbar-btn-group .toolbar-btn-color-preview-box{display:flex;border:1px solid rgba(var(--v-border-chip, 205, 209, 211, 1));box-sizing:border-box;border-radius:4px;width:16px;height:16px;cursor:pointer;justify-content:center;align-items:center;margin-left:6px}.toolbar-btn-group .toolbar-btn-link-wrapper{position:relative}.toolbar-btn-group .toolbar-btn-link-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;margin-top:12px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}';var gi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class bi extends i{constructor(){super(...arguments),this.handleClick=t=>{this.disabled?t.preventDefault():this.clickEventEmitter.emit(void 0,t)}}render(){return s("button",{part:"rich-text-editor-toolbar-button",class:{"rich-text-editor-toolbar-btn":!0,"rich-text-editor-toolbar-button-disabled":this.disabled,"rich-text-editor-toolbar-button-selected":this.selected},onClick:this.handleClick,disabled:this.disabled},s("vega-flex",{gap:"size-8",justifyContent:"center",alignItems:"center"},s("vega-icon",{size:"size-16",color:this.iconColor,icon:B.getIconKey(this.icon)}),this.showArrowIcon&&s("vega-icon",{size:"size-8",color:"text-secondary",icon:B.getIconKey("chevron-down")})),s("slot",null))}}B.register({"chevron-down":At}),gi([t()],bi.prototype,"disabled",void 0),gi([t()],bi.prototype,"selected",void 0),gi([t()],bi.prototype,"showArrowIcon",void 0),gi([t()],bi.prototype,"icon",void 0),gi([t()],bi.prototype,"iconColor",void 0),gi([t()],bi.prototype,"clickEventEmitter",void 0);var xi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};const wi=class{constructor(t){l(this,t),this.vegaClick=a(this,"vegaClick",7),this.click=a(this,"click",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.clickEventEmitter=Ot(wi,R),this.eventPrevent=new Bt([R],(()=>this.host),{useCapture:!0,customPreventHandle:t=>{this.disabled&&t.stopImmediatePropagation()}}),this.renderer=new bi,this.disabled=!1,this.selected=!1,this.showArrowIcon=!1,this.icon="",this.iconColor="text-primary"}render(){return p(s(n,null,this.renderer.render()),this.host)}get host(){return h(this)}};xi([u()],wi.prototype,"globalSlimmers",void 0),xi([r()],wi.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),xi([r()],wi.prototype,"clickEventEmitter",void 0),xi([r()],wi.prototype,"eventPrevent",void 0),xi([r()],wi.prototype,"renderer",void 0),wi.style=":host{display:inline-block}.rich-text-editor-toolbar-btn{display:flex;justify-content:center;align-items:center;border-radius:4px;border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));padding-top:8px;padding-bottom:8px;padding-left:12px;padding-right:12px;cursor:pointer;position:relative;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1))}.rich-text-editor-toolbar-btn:hover{background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1));z-index:1}.rich-text-editor-toolbar-btn:active{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:-1px;z-index:2}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-selected{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));background-color:rgba(var(--v-bg-quaternary, 241, 248, 251, 1));z-index:1}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}.rich-text-editor-toolbar-btn.rich-text-editor-toolbar-button-disabled vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}";var yi=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Ci extends i{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&(this.formRef.getValue().then((({alt:t})=>{this.changeEventEmitter.emit({action:"edit",payload:{size:this.size,alt:t}})})),this.popoverRef.hide())}}render(){return s("vega-popover",{style:{width:"100%"},trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,b.addUniqueObserverToNode(t,j,(()=>{this.selected=!0,this.notifyImageSelected(),this.formRef.setValue({alt:this.alt})})),b.addUniqueObserverToNode(t,k,(()=>{this.currentPage=1,this.selected=!1,this.formRef.reset()}))}},s("div",{slot:"popover-content"},s("slot",null)),s("div",{slot:"popover"},this.renderImageEditor(),this.renderAltTextEditor()))}findParentContainerRef(){this.parentContainerRef=zt(this.host,"vega-rich-text-content")}renderImageEditor(){return s("vega-box",{display:1===this.currentPage?"block":"none"},s("vega-flex",{gap:"size-12",alignItems:"center"},s("vega-font",{variant:"font-field-label-sm",color:"text-primary"},"Size:"),s("vega-segment-control",{size:"small",segments:[{key:"sm",text:"Sm"},{key:"md",text:"Md"},{key:"lg",text:"Lg"}],selected:this.size,ref:t=>{b.addUniqueObserverToNode(t,w,(t=>{const e=t.detail;this.size=e,this.changeEventEmitter.emit({action:"edit",payload:{size:e,alt:this.alt}})}))}}),s("vega-button-group",{variant:"tertiary",size:"small",ref:t=>{b.addUniqueObserverToNode(t,R,(t=>{"Alt Text"===t.detail?this.currentPage=2:(this.notifyImageDeleteButtonClicked(),this.changeEventEmitter.emit({action:"delete"}),this.popoverRef.hide())}))}},s("vega-button-group-item",{label:"Alt Text",itemKey:"Alt Text"}),s("vega-button-group-item",{label:"Delete Image",icon:B.getIconKey("trash-can"),iconOnly:!0,itemKey:"trash-can"}))))}renderAltTextEditor(){return s("vega-box",{display:2===this.currentPage?"block":"none"},s("vega-form",{ref:t=>this.formRef=t},s("vega-input",{"data-vega-form":"alt",style:{width:"315px"},label:"Alt Text",ref:t=>{t.doFocus()},onKeyDown:this.handleKeyDown})))}notifyImageSelected(){this.parentContainerRef&&m.notify(g.getSubject(this.parentContainerRef,H),{host:this.host})}notifyImageDeleteButtonClicked(){this.parentContainerRef&&m.notify(g.getSubject(this.parentContainerRef,z),{host:this.host})}}B.register({"trash-can":Mt}),yi([t({writable:!0})],Ci.prototype,"currentPage",void 0),yi([t({writable:!0})],Ci.prototype,"selected",void 0),yi([t()],Ci.prototype,"host",void 0),yi([t()],Ci.prototype,"alt",void 0),yi([t({writable:!0})],Ci.prototype,"size",void 0),yi([t()],Ci.prototype,"changeEventEmitter",void 0),yi([e("componentDidLoad")],Ci.prototype,"findParentContainerRef",null);var Ri=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};const ji=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.renderer=new Ci,this.changeEventEmitter=Ot(ji,w),this.currentPage=1,this.selected=!1,this.alt="",this.size="md"}render(){return p(s(n,{class:{"rte-image-selected":this.selected}},this.renderer.render()),this.host)}get host(){return h(this)}};Ri([u()],ji.prototype,"globalSlimmers",void 0),Ri([r()],ji.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Ri([r()],ji.prototype,"renderer",void 0),Ri([r()],ji.prototype,"changeEventEmitter",void 0),ji.style=":host{display:inline-block}:host(.rte-image-selected){outline:2px solid rgba(var(--v-border-color-tile-selected, 19, 98, 226, 1));outline-offset:-2px}";var ki=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};class Oi extends i{constructor(){super(...arguments),this.handleKeyDown=t=>{"Enter"===t.key&&this.formRef.getValue().then((({text:t,url:e})=>{e.length>0&&(this.changeEventEmitter.emit({action:"link",payload:{text:t||e,url:e}}),this.popoverRef.hide())}))}}componentDidLoad(){this.updatePopoverTarget()}componentDidRender(){m.notify(g.getSubject(this.host,O),{})}watchStatusChange(){"linkEdit"===this.status&&setTimeout((()=>{this.urlInputRef.doFocus()}))}watchTargetChange(){this.updatePopoverTarget()}getPopoverRef(){return this.popoverRef}render(){return s("vega-popover",{trigger:"click",alignment:"start",placement:"bottom",showArrow:!1,ref:t=>{this.popoverRef=t,b.addUniqueObserverToNode(t,j,(()=>{var t,e;"linkEdit"===this.status&&this.urlInputRef.doFocus(),this.formRef.setValue({text:null===(t=this.record)||void 0===t?void 0:t.text,url:null===(e=this.record)||void 0===e?void 0:e.url})})),b.addUniqueObserverToNode(t,k,(()=>{this.formRef.reset(),this.resetStatusAfterHide&&(this.status="editOrUnlinkSelection")}))}},s("span",{slot:"popover-content"},s("slot",null)),s("div",{slot:"popover"},this.renderLinkUnlinkContent(),this.renderLinkEditContent()))}renderLinkUnlinkContent(){return s("vega-box",{display:"editOrUnlinkSelection"===this.status?"block":"none"},s("vega-button-group",{size:"small",variant:"tertiary",ref:t=>{b.addUniqueObserverToNode(t,R,(({detail:t})=>{switch(t){case"edit":return void(this.status="linkEdit");case"unlink":this.changeEventEmitter.emit({action:"unlink"}),this.popoverRef.hide()}}))}},s("vega-button-group-item",{label:"Edit",itemKey:"edit"}),s("vega-button-group-item",{label:"Unlink",itemKey:"unlink"})))}renderLinkEditContent(){return s("vega-box",{display:"linkEdit"===this.status?"block":"none"},s("vega-form",{ref:t=>this.formRef=t},s("vega-flex",{style:{width:"419px"},direction:"col",gap:"size-16"},s("vega-input",{"data-vega-form":"url",ref:t=>{this.urlInputRef=t},size:"small",label:"URL",onKeyDown:this.handleKeyDown}),s("vega-input",{size:"small",label:"Text","data-vega-form":"text",onKeyDown:this.handleKeyDown}))))}updatePopoverTarget(){Nt.call(g.getSubject(this.popoverRef,E),this.target)}}ki([t()],Oi.prototype,"host",void 0),ki([t({writable:!0})],Oi.prototype,"status",void 0),ki([t({writable:!0})],Oi.prototype,"record",void 0),ki([t()],Oi.prototype,"changeEventEmitter",void 0),ki([t()],Oi.prototype,"resetStatusAfterHide",void 0),ki([t()],Oi.prototype,"target",void 0),ki([e("componentDidLoad")],Oi.prototype,"componentDidLoad",null),ki([e("componentDidRender")],Oi.prototype,"componentDidRender",null),ki([e("watchStatusChange")],Oi.prototype,"watchStatusChange",null),ki([e("watchTargetChange")],Oi.prototype,"watchTargetChange",null);var Si=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};const Ti=class{constructor(t){l(this,t),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new d,this.renderer=new Oi,this.changeEventEmitter=Ot(Ti,w),this.status="editOrUnlinkSelection",this.resetStatusAfterHide=!0}watchStatusChange(){}watchTargetChange(){}async show(){await this.renderer.getPopoverRef().show()}render(){return p(s(n,null,this.renderer.render()),this.host)}get host(){return h(this)}static get watchers(){return{status:["watchStatusChange"],target:["watchTargetChange"]}}};Si([u()],Ti.prototype,"globalSlimmers",void 0),Si([r()],Ti.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),Si([r()],Ti.prototype,"renderer",void 0),Si([r()],Ti.prototype,"changeEventEmitter",void 0),Ti.style=":host{display:contents}:host vega-popover{display:inline}";export{mi as vega_rich_text_editor,wi as vega_rich_text_editor_toolbar_button,ji as vega_rich_text_image_editor,Ti as vega_rich_text_link_editor}
@@ -0,0 +1 @@
1
+ import{h as t,r as e,e as i,H as n,g as a,I as s}from"./p-9c1eeff2.js";import{s as o}from"./p-296cc56b.js";import{n as r,c as g}from"./p-262ec334.js";import{D as h,v as p,A as l,V as c,b as m,L as f}from"./p-a5ffe912.js";import{a as v}from"./p-1995e98e.js";import{C as d}from"./p-39836361.js";import{c as u}from"./p-11cb477b.js";import{V as x,I as w}from"./p-8f93242a.js";import{T as b}from"./p-7209d03b.js";import"./p-443ad3b3.js";import"./p-f763e2eb.js";import"./p-5f377954.js";import"./p-acf7f903.js";import"./p-7a40e033.js";import"./p-112455b1.js";import"./p-59bdf9b8.js";import"./p-e1e1fcf0.js";import"./p-d057999f.js";import"./p-3ce31dc3.js";const y=({pageSize:e,current:i,total:n,translationSlimmer:a})=>{const s=n>0?e*(i-1)+1:0,o=Math.min(i*e,n);return t("vega-field-label",{label:a.t("Viewing {0}-{1} of {2}",s,o,n)})},z=({onChange:e,pageCount:i,translationSlimmer:n})=>{let a;const s=()=>{if(a.value){const t=r(g(a.value,1),1,i);e(t),a.value=""}},o=t=>{t.stopPropagation()};return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},t("vega-field-label",{label:n.t("Go To")}),t("vega-form",{ref:t=>{h.addUniqueObserverToNode(t,p,s)}},t("vega-input",{"data-vega-form":"paginationGoTo",type:"number",size:"small",showClearIcon:!1,style:{width:"60px"},maskConfig:{type:"number",options:{allowNegative:!1,precision:0}},onVegaChange:o,onChange:o,ref:t=>{a=t,h.addUniqueObserverToNode(t,l,s)}})))},S=({pageSize:e,pageSizeSelectorOptions:i,onChange:n,translationSlimmer:a})=>{const s=i.sort(((t,e)=>t-e)),o=t=>{const e=Number(t.detail);n(e)};return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},t("vega-field-label",{label:a.t("Show")}),t("div",null,t("vega-input-select",{size:"small",source:s.map((t=>({id:t.toString(),displayName:t.toString()}))),value:e.toString(),placeholder:"Page Size",vegaDropdownProps:{matchTargetWidth:!1,searchable:!1},ref:t=>{h.addUniqueObserverToNode(t,c,o)}})))},C=({total:e,current:i,onChange:n,pageCount:a})=>{const s=e=>{const a=i!==e;return t("li",{key:e,class:v(["vega-pagination-item",i===e?"active":""])},t("button",{onClick:()=>a&&n(e)},e))},o=(e,i,n)=>t("li",{class:v(["vega-pagination-button",i&&"disabled"])},t("vega-button-circle",{variant:"icon-only",icon:e,iconColor:"text-link",size:"small",disabled:i,ref:t=>{h.addUniqueObserverToNode(t,m,n)}}));return t("ul",{class:"vega-pagination"},o("chevron-left",0===e||1===i,(()=>{n(i-1)})),0===e?[s(1)]:((t,e,i=7)=>{if(i<7)throw new Error("Must allow at least 7 pager items");if(i%2==0)throw new Error("Must allow odd number of pager items");if(e<i)return Array(e).fill(0).map(((t,e)=>e+1));const n=Math.max(1,Math.min(e-i+1,t-Math.floor(i/2))),a=new Array(i);for(let t=0;t<i;t+=1)a[t]=t+n;return Number(a[0])>1&&(a[0]=1,a[1]="..."),Number(a[a.length-1])<=e-1&&(a[a.length-1]=e,a[a.length-2]="..."),a})(i,a).map((e=>"string"==typeof e?t("li",{class:"vega-pagination-item pager-ellipsis"},"..."):s(e))),o("chevron-right",0===e||i===a,(()=>{n(i+1)})))};var j=function(t,e,i,n){var a,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(o=(s<3?a(o):s>3?a(e,i,o):a(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o};const I=class{constructor(n){e(this,n),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.vegaPageSizeChange=i(this,"vegaPageSizeChange",7),this.pageSizeChange=i(this,"pageSizeChange",7),this.globalSlimmers={},this.translationSlimmer=new b,this.childEventPrevent=new d([p],(()=>this.host)),this.childValueChangePrevent=new d([c],(()=>this.host),!0),this.vegaChangeEventEmitter=u(I,c),this.vegaPageSizeChangeEventEmitter=u(I,f),this.vegaComponentUsageRuntimeMetricsSlimmer=new x,this.vegaPaginationItemTypes=["currentPageLabel","pageSizeSelector","pageSelector","goTo"],this.pageCount=0,this.current=1,this.total=0,this.pageSize=10,this.extensions=[["pageSelector"]],this.pageSizeSelectorOptions=[10,20,50,100],this.renderPaginationItemsWrapper=e=>t("vega-flex",{gap:"size-24",alignItems:"center",key:this.generateWrapperKey(e)},e.map((e=>t("div",{key:e},this.renderPaginationItem(e))))),this.renderPaginationItem=e=>{switch(e){case"currentPageLabel":return t(y,{total:this.total,current:this.current,pageSize:this.pageSize,translationSlimmer:this.translationSlimmer});case"pageSizeSelector":{const e=this.pageSizeSelectorOptions.includes(this.pageSize)?this.pageSizeSelectorOptions:[...this.pageSizeSelectorOptions,this.pageSize];return t(S,{pageSize:this.pageSize,pageSizeSelectorOptions:e,onChange:this.onPageSizeSelectorChange,translationSlimmer:this.translationSlimmer})}case"pageSelector":return t(C,{current:this.current,total:this.total,onChange:this.onPageSelectorChange,pageCount:this.pageCount});case"goTo":return t(z,{onChange:this.handlePaginationGoToChange,pageCount:this.pageCount,translationSlimmer:this.translationSlimmer})}},this.handlePaginationGoToChange=t=>{this.current=t},this.onPageSizeSelectorChange=t=>{this.pageSize=t},this.calculatePages=()=>this.total?Math.floor((this.total-1)/this.pageSize)+1:0,this.onPageSelectorChange=t=>{this.current=t},this.removeDuplicateItems=t=>{const e=[...this.vegaPaginationItemTypes];return[...t].map((t=>t.filter(((i,n)=>{const a=e.indexOf(i);return a>=0?(e.splice(a,1),!0):(t.splice(n,1),!1)})))).filter((t=>t.length>0))},this.generateWrapperKey=t=>t.map(String).reduce(((t,e)=>`${t}-${e}`)),this.currentValueGuard=()=>{0===this.pageCount?this.current=1:this.current>this.pageCount&&(this.current=this.pageCount)}}watchPageCount(){this.currentValueGuard()}watchCurrent(){this.currentValueGuard(),this.vegaChangeEventEmitter.emit(this.current)}watchTotal(){this.pageCount=this.calculatePages()}watchPageSize(){this.vegaPageSizeChangeEventEmitter.emit(this.pageSize),this.pageCount=this.calculatePages()}componentWillLoad(){this.pageCount=this.calculatePages(),this.currentValueGuard(),this.pageSizeSelectorOptions.includes(this.pageSize)||(this.pageSizeSelectorOptions=[...this.pageSizeSelectorOptions,this.pageSize])}render(){return o(t(n,null,this.removeDuplicateItems(this.extensions).map(this.renderPaginationItemsWrapper)),this.host)}get host(){return a(this)}static get watchers(){return{pageCount:["watchPageCount"],current:["watchCurrent"],total:["watchTotal"],pageSize:["watchPageSize"]}}};j([w()],I.prototype,"globalSlimmers",void 0),j([s()],I.prototype,"translationSlimmer",void 0),j([s()],I.prototype,"childEventPrevent",void 0),j([s()],I.prototype,"childValueChangePrevent",void 0),j([s()],I.prototype,"vegaChangeEventEmitter",void 0),j([s()],I.prototype,"vegaPageSizeChangeEventEmitter",void 0),j([s()],I.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),I.style=':host{display:flex;align-items:center;justify-content:space-between;gap:20px;line-height:normal}.vega-pagination{display:flex;padding:0px;margin:0px}.vega-pagination .vega-pagination-item{list-style-type:none;display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-link, 19, 98, 226, 1));cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.vega-pagination .vega-pagination-item button{background-color:rgba(var(--v-bg-transparent, 0, 0, 0, 0));border-width:0px;outline:2px solid transparent;outline-offset:2px;width:100%;height:100%;cursor:pointer;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;color:rgba(var(--v-text-link, 19, 98, 226, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item button{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}.vega-pagination .vega-pagination-item.pager-ellipsis{cursor:default}.vega-pagination .vega-pagination-item:not(.pager-ellipsis):not(:active):hover{text-decoration:underline;text-underline-offset:2px}.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-pagination .vega-pagination-item button:active,.vega-pagination .vega-pagination-item.active button{font-family:"Inter", sans-serif;font-size:14px;font-weight:700;line-height:18px}}.vega-pagination .vega-pagination-item button:focus-visible{box-shadow:0 0 0 4px rgba(var(--v-ring-action-focus, 19, 98, 226, 0.25));border-radius:9999px}.vega-pagination .vega-pagination-button{list-style-type:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}';export{I as vega_pagination}
@@ -1 +1 @@
1
- import{F as s}from"./p-acf7f903.js";import{V as o,a as t,b as a,c as l,d as e}from"./p-452e284a.js";import{V as i}from"./p-8c26227e.js";import{M as c,V as n,f as r,s as f,G as p}from"./p-9c1eeff2.js";import{V as h}from"./p-11a19ca0.js";import{v as b}from"./p-5f377954.js";import{V as m}from"./p-65b79fd7.js";import"./p-1995e98e.js";import{V as d,a as T,s as u}from"./p-e1e1fcf0.js";import{T as j}from"./p-d884c644.js";import{V as g}from"./p-74958b1a.js";import{w as C}from"./p-315667f1.js";import{V as O}from"./p-e43c2a27.js";import{U as E}from"./p-d057999f.js";import{C as _}from"./p-443ad3b3.js";import{O as R}from"./p-a5ffe912.js";var V=function(s,o,t,a){var l,e=arguments.length,i=e<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(s,o,t,a);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(i=(e<3?l(i):e>3?l(o,t,i):l(o,t))||i);return e>3&&i&&Object.defineProperty(o,t,i),i};class A extends n{constructor(o){super(),this.originalWatchers=new Map,this.hasDisconnected=!1,this.isEnabled=s.isEnabled("VEGA_REACT.PREVENT_CALL_WATCH_METHOD_BEFORE_COMPONENT_LOAD")&&s.isEnabled("VEGA_FRAMEWORK.PREVENT_CALL_WATCH_METHOD_BEFORE_COMPONENT_LOAD"),this.component=o.component}connectedCallback(){if(!this.isEnabled)return;if(this.hasDisconnected)return;const s=this.component.constructor.watchers;for(const o in s)s[o].forEach((s=>{this.originalWatchers.has(s)||(this.originalWatchers.set(s,this.component[s]),this.component[s]=function(){})}))}disconnectedCallback(){this.isEnabled&&(this.hasDisconnected=!0)}componentDidLoad(){this.isEnabled&&this.originalWatchers.forEach(((s,o)=>{const t=s;this.component[o]=function(...s){return t.apply(this,s)}}))}}V([c("connectedCallback")],A.prototype,"connectedCallback",null),V([c("disconnectedCallback")],A.prototype,"disconnectedCallback",null),V([c("componentDidLoad")],A.prototype,"componentDidLoad",null);class k extends n{constructor(s){super(),this.component=s.component}connectedCallback(){const s=new R(this.isAcceptable.bind(this),(()=>{r(this.component)}));_.register(E,s)}isAcceptable(){var s;const o=this.component.host;return null===(s=d.getConnectedComponents().get(o.tagName))||void 0===s?void 0:s.has(o)}}!function(s,o,t,a){var l,e=arguments.length,i=e<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(s,o,t,a);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(i=(e<3?l(i):e>3?l(o,t,i):l(o,t))||i);e>3&&i&&Object.defineProperty(o,t,i)}([c("connectedCallback")],k.prototype,"connectedCallback",null);const v=function(){globalThis.VegaDisabledFeatureKeys&&s.disable(...globalThis.VegaDisabledFeatureKeys),globalThis.VegaEnabledFeatureKeys&&s.enable(...globalThis.VegaEnabledFeatureKeys),globalThis.VegaLoader=o,globalThis.VegaNotify=t,globalThis.VegaThemeManager=i,globalThis.setVegaLogLevel=f,globalThis.VegaDialog=h,p.register([A,k]),globalThis.VegaEventManager=a,Object.keys(j).forEach((s=>{const{url:o}=j[s],t="vega-typography-"+s;if(!document.querySelector("#"+t)){const s=document.createElement("link");s.id=t,s.href=o,s.rel="stylesheet",document.head.append(s)}})),globalThis.VegaIconManager=m,globalThis.VegaZIndexManager=l,globalThis.ValidCreditCardNumberRule=g,globalThis.VegaEnvInfo=b.getVegaEnv(),import("./p-7a40e033.js").then((o=>{o.default.init(s)})),globalThis.waitForVega=C,globalThis.VegaSkeletonLoader=e,globalThis.VegaTranslation=T,globalThis.VegaTranslationResourceEN=u,globalThis.VegaRTEContent=O};export{v as g}
1
+ import{F as s}from"./p-acf7f903.js";import{V as o,a as t,b as a,c as l,d as e}from"./p-452e284a.js";import{V as i}from"./p-8c26227e.js";import{M as c,V as n,f as r,s as f,G as p}from"./p-9c1eeff2.js";import{V as h}from"./p-11a19ca0.js";import{v as b}from"./p-5f377954.js";import{V as m}from"./p-65b79fd7.js";import"./p-1995e98e.js";import{V as d,a as T,s as u}from"./p-e1e1fcf0.js";import{T as j}from"./p-d884c644.js";import{V as g}from"./p-74958b1a.js";import{w as C}from"./p-584dcd9b.js";import{V as O}from"./p-10393104.js";import{U as E}from"./p-d057999f.js";import{C as _}from"./p-443ad3b3.js";import{O as R}from"./p-a5ffe912.js";var V=function(s,o,t,a){var l,e=arguments.length,i=e<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(s,o,t,a);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(i=(e<3?l(i):e>3?l(o,t,i):l(o,t))||i);return e>3&&i&&Object.defineProperty(o,t,i),i};class A extends n{constructor(o){super(),this.originalWatchers=new Map,this.hasDisconnected=!1,this.isEnabled=s.isEnabled("VEGA_REACT.PREVENT_CALL_WATCH_METHOD_BEFORE_COMPONENT_LOAD")&&s.isEnabled("VEGA_FRAMEWORK.PREVENT_CALL_WATCH_METHOD_BEFORE_COMPONENT_LOAD"),this.component=o.component}connectedCallback(){if(!this.isEnabled)return;if(this.hasDisconnected)return;const s=this.component.constructor.watchers;for(const o in s)s[o].forEach((s=>{this.originalWatchers.has(s)||(this.originalWatchers.set(s,this.component[s]),this.component[s]=function(){})}))}disconnectedCallback(){this.isEnabled&&(this.hasDisconnected=!0)}componentDidLoad(){this.isEnabled&&this.originalWatchers.forEach(((s,o)=>{const t=s;this.component[o]=function(...s){return t.apply(this,s)}}))}}V([c("connectedCallback")],A.prototype,"connectedCallback",null),V([c("disconnectedCallback")],A.prototype,"disconnectedCallback",null),V([c("componentDidLoad")],A.prototype,"componentDidLoad",null);class k extends n{constructor(s){super(),this.component=s.component}connectedCallback(){const s=new R(this.isAcceptable.bind(this),(()=>{r(this.component)}));_.register(E,s)}isAcceptable(){var s;const o=this.component.host;return null===(s=d.getConnectedComponents().get(o.tagName))||void 0===s?void 0:s.has(o)}}!function(s,o,t,a){var l,e=arguments.length,i=e<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(s,o,t,a);else for(var c=s.length-1;c>=0;c--)(l=s[c])&&(i=(e<3?l(i):e>3?l(o,t,i):l(o,t))||i);e>3&&i&&Object.defineProperty(o,t,i)}([c("connectedCallback")],k.prototype,"connectedCallback",null);const v=function(){globalThis.VegaDisabledFeatureKeys&&s.disable(...globalThis.VegaDisabledFeatureKeys),globalThis.VegaEnabledFeatureKeys&&s.enable(...globalThis.VegaEnabledFeatureKeys),globalThis.VegaLoader=o,globalThis.VegaNotify=t,globalThis.VegaThemeManager=i,globalThis.setVegaLogLevel=f,globalThis.VegaDialog=h,p.register([A,k]),globalThis.VegaEventManager=a,Object.keys(j).forEach((s=>{const{url:o}=j[s],t="vega-typography-"+s;if(!document.querySelector("#"+t)){const s=document.createElement("link");s.id=t,s.href=o,s.rel="stylesheet",document.head.append(s)}})),globalThis.VegaIconManager=m,globalThis.VegaZIndexManager=l,globalThis.ValidCreditCardNumberRule=g,globalThis.VegaEnvInfo=b.getVegaEnv(),import("./p-7a40e033.js").then((o=>{o.default.init(s)})),globalThis.waitForVega=C,globalThis.VegaSkeletonLoader=e,globalThis.VegaTranslation=T,globalThis.VegaTranslationResourceEN=u,globalThis.VegaRTEContent=O};export{v as g}