reactjs-tiptap-editor 1.0.26 → 1.0.29

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 (159) hide show
  1. package/lib/{ActionMenuButton-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
  2. package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +27 -27
  5. package/lib/Blockquote.cjs +3 -3
  6. package/lib/Blockquote.js +251 -244
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout-B9uXfbP3.js +340 -0
  12. package/lib/Callout-C_TXsss3.cjs +1 -0
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +8 -222
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +2 -2
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +2 -2
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +2 -2
  27. package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
  28. package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +168 -135
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +5 -5
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +5 -5
  43. package/lib/FormatPainter.cjs +1 -1
  44. package/lib/FormatPainter.js +2 -2
  45. package/lib/Heading.cjs +1 -1
  46. package/lib/Heading.js +10 -10
  47. package/lib/Highlight.cjs +1 -1
  48. package/lib/Highlight.js +3 -3
  49. package/lib/History.cjs +2 -2
  50. package/lib/History.js +584 -531
  51. package/lib/HorizontalRule.cjs +1 -1
  52. package/lib/HorizontalRule.js +2 -2
  53. package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
  54. package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +3 -3
  57. package/lib/Image.cjs +1 -1
  58. package/lib/Image.js +9 -6
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +19 -19
  61. package/lib/ImportWord.cjs +1 -1
  62. package/lib/ImportWord.js +15 -15
  63. package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
  64. package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
  65. package/lib/Indent.cjs +1 -1
  66. package/lib/Indent.js +2 -2
  67. package/lib/Italic.cjs +1 -1
  68. package/lib/Italic.js +2 -2
  69. package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
  70. package/lib/Katex-oLGrtLTf.cjs +4 -0
  71. package/lib/Katex.cjs +1 -1
  72. package/lib/Katex.js +3 -3
  73. package/lib/LineHeight.cjs +1 -1
  74. package/lib/LineHeight.js +4 -4
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
  78. package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
  79. package/lib/MarkdownPaste.cjs +1 -1
  80. package/lib/MarkdownPaste.js +1 -1
  81. package/lib/Mention.cjs +1 -1
  82. package/lib/Mention.js +4 -4
  83. package/lib/Mermaid.cjs +2 -2
  84. package/lib/Mermaid.js +62 -61
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +5 -5
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +2 -2
  89. package/lib/SearchAndReplace.cjs +1 -1
  90. package/lib/SearchAndReplace.js +8 -8
  91. package/lib/SlashCommand.cjs +1 -1
  92. package/lib/SlashCommand.js +7 -7
  93. package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
  94. package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
  95. package/lib/Strike.cjs +1 -1
  96. package/lib/Strike.js +2 -2
  97. package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
  98. package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
  99. package/lib/Table.cjs +1 -1
  100. package/lib/Table.js +1 -1
  101. package/lib/TaskList.cjs +1 -1
  102. package/lib/TaskList.js +2 -2
  103. package/lib/TextAlign.cjs +1 -1
  104. package/lib/TextAlign.js +3 -3
  105. package/lib/TextDirection.cjs +1 -1
  106. package/lib/TextDirection.js +3 -3
  107. package/lib/TextUnderline.cjs +1 -1
  108. package/lib/TextUnderline.js +2 -2
  109. package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
  110. package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
  111. package/lib/Twitter.cjs +1 -1
  112. package/lib/Twitter.js +3 -3
  113. package/lib/Video.cjs +1 -1
  114. package/lib/Video.js +5 -5
  115. package/lib/bubble.cjs +6 -6
  116. package/lib/bubble.js +2258 -2552
  117. package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
  118. package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
  119. package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
  120. package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
  121. package/lib/extensions/Image/Image.d.ts +13 -1
  122. package/lib/index-BJQ1G8B1.js +311 -0
  123. package/lib/index-BO82_0q8.cjs +1 -0
  124. package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
  125. package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
  126. package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
  127. package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
  128. package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
  129. package/lib/index-DUeBQoIA.cjs +1 -0
  130. package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
  131. package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
  132. package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
  133. package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
  134. package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
  135. package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
  136. package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
  137. package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
  138. package/lib/index.cjs +1 -1
  139. package/lib/index.js +12 -12
  140. package/lib/locale-bundle.cjs +1 -1
  141. package/lib/locale-bundle.js +1 -1
  142. package/lib/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
  143. package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
  144. package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
  145. package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
  146. package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
  147. package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
  148. package/lib/style.css +1 -1
  149. package/lib/textarea-DV9Fw3y1.cjs +1 -0
  150. package/lib/textarea-GXaWJbm9.js +20 -0
  151. package/lib/theme.cjs +1 -1
  152. package/lib/theme.js +1 -1
  153. package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
  154. package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
  155. package/package.json +59 -59
  156. package/lib/Katex-CUofhjB5.cjs +0 -4
  157. package/lib/index-BG0kQamI.js +0 -285
  158. package/lib/index-NsYff_Ni.cjs +0 -1
  159. package/lib/index-aujjnfSJ.cjs +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";const kt=require("@tiptap/pm/state"),Zt=require("./index-BGfIcDCQ.cjs"),Ot=require("@tiptap/pm/view"),qt=["top","right","bottom","left"],Ct=["start","end"],Et=qt.reduce((t,e)=>t.concat(e,e+"-"+Ct[0],e+"-"+Ct[1]),[]),N=Math.min,_=Math.max,st=Math.round,it=Math.floor,z=t=>({x:t,y:t}),te={left:"right",right:"left",bottom:"top",top:"bottom"};function ht(t,e,o){return _(t,N(e,o))}function X(t,e){return typeof t=="function"?t(e):t}function k(t){return t.split("-")[0]}function W(t){return t.split("-")[1]}function Wt(t){return t==="x"?"y":"x"}function wt(t){return t==="y"?"height":"width"}function I(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function xt(t){return Wt(I(t))}function Nt(t,e,o){o===void 0&&(o=!1);const n=W(t),i=xt(t),r=wt(i);let s=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=ct(s)),[s,ct(s)]}function ee(t){const e=ct(t);return[rt(t),e,rt(e)]}function rt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Pt=["left","right"],Dt=["right","left"],ne=["top","bottom"],oe=["bottom","top"];function ie(t,e,o){switch(t){case"top":case"bottom":return o?e?Dt:Pt:e?Pt:Dt;case"left":case"right":return e?ne:oe;default:return[]}}function se(t,e,o,n){const i=W(t);let r=ie(k(t),o==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(rt)))),r}function ct(t){const e=k(t);return te[e]+t.slice(e.length)}function re(t){return{top:0,right:0,bottom:0,left:0,...t}}function yt(t){return typeof t!="number"?re(t):{top:t,right:t,bottom:t,left:t}}function J(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function Lt(t,e,o){let{reference:n,floating:i}=t;const r=I(e),s=xt(e),c=wt(s),a=k(e),u=r==="y",f=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let d;switch(a){case"top":d={x:f,y:n.y-i.height};break;case"bottom":d={x:f,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:l};break;case"left":d={x:n.x-i.width,y:l};break;default:d={x:n.x,y:n.y}}switch(W(e)){case"start":d[s]-=g*(o&&u?-1:1);break;case"end":d[s]+=g*(o&&u?-1:1);break}return d}async function ce(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:r,rects:s,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:l="floating",altBoundary:g=!1,padding:d=0}=X(e,t),p=yt(d),h=c[g?l==="floating"?"reference":"floating":l],x=J(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(h)))==null||o?h:h.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:a})),v=l==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),m=await(r.isElement==null?void 0:r.isElement(y))?await(r.getScale==null?void 0:r.getScale(y))||{x:1,y:1}:{x:1,y:1},A=J(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:a}):v);return{top:(x.top-A.top+p.top)/m.y,bottom:(A.bottom-x.bottom+p.bottom)/m.y,left:(x.left-A.left+p.left)/m.x,right:(A.right-x.right+p.right)/m.x}}const le=50,ae=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=o,c=s.detectOverflow?s:{...s,detectOverflow:ce},a=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:l}=Lt(u,n,a),g=n,d=0;const p={};for(let w=0;w<r.length;w++){const h=r[w];if(!h)continue;const{name:x,fn:v}=h,{x:y,y:m,data:A,reset:b}=await v({x:f,y:l,initialPlacement:n,placement:g,strategy:i,middlewareData:p,rects:u,platform:c,elements:{reference:t,floating:e}});f=y??f,l=m??l,p[x]={...p[x],...A},b&&d<le&&(d++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:f,y:l}=Lt(u,g,a)),w=-1)}return{x:f,y:l,placement:g,strategy:i,middlewareData:p}},fe=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:i,rects:r,platform:s,elements:c,middlewareData:a}=e,{element:u,padding:f=0}=X(t,e)||{};if(u==null)return{};const l=yt(f),g={x:o,y:n},d=xt(i),p=wt(d),w=await s.getDimensions(u),h=d==="y",x=h?"top":"left",v=h?"bottom":"right",y=h?"clientHeight":"clientWidth",m=r.reference[p]+r.reference[d]-g[d]-r.floating[p],A=g[d]-r.reference[d],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let O=b?b[y]:0;(!O||!await(s.isElement==null?void 0:s.isElement(b)))&&(O=c.floating[y]||r.floating[p]);const D=m/2-A/2,L=O/2-w[p]/2-1,R=N(l[x],L),C=N(l[v],L),S=R,M=O-w[p]-C,P=O/2-w[p]/2+D,$=ht(S,P,M),T=!a.arrow&&W(i)!=null&&P!==$&&r.reference[p]/2-(P<S?R:C)-w[p]/2<0,E=T?P<S?P-S:P-M:0;return{[d]:g[d]+E,data:{[d]:$,centerOffset:P-$-E,...T&&{alignmentOffset:E}},reset:T}}});function ue(t,e,o){return(t?[...o.filter(i=>W(i)===t),...o.filter(i=>W(i)!==t)]:o.filter(i=>k(i)===i)).filter(i=>t?W(i)===t||(e?rt(i)!==i:!1):!0)}const de=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var o,n,i;const{rects:r,middlewareData:s,placement:c,platform:a,elements:u}=e,{crossAxis:f=!1,alignment:l,allowedPlacements:g=Et,autoAlignment:d=!0,...p}=X(t,e),w=l!==void 0||g===Et?ue(l||null,d,g):g,h=await a.detectOverflow(e,p),x=((o=s.autoPlacement)==null?void 0:o.index)||0,v=w[x];if(v==null)return{};const y=Nt(v,r,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(c!==v)return{reset:{placement:w[0]}};const m=[h[k(v)],h[y[0]],h[y[1]]],A=[...((n=s.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:m}],b=w[x+1];if(b)return{data:{index:x+1,overflows:A},reset:{placement:b}};const O=A.map(R=>{const C=W(R.placement);return[R.placement,C&&f?R.overflows.slice(0,2).reduce((S,M)=>S+M,0):R.overflows[0],R.overflows]}).sort((R,C)=>R[1]-C[1]),L=((i=O.filter(R=>R[2].slice(0,W(R[0])?2:3).every(C=>C<=0))[0])==null?void 0:i[0])||O[0][0];return L!==c?{data:{index:x+1,overflows:A},reset:{placement:L}}:{}}}},ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:f=!0,crossAxis:l=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:w=!0,...h}=X(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const x=k(i),v=I(c),y=k(c)===c,m=await(a.isRTL==null?void 0:a.isRTL(u.floating)),A=g||(y||!w?[ct(c)]:ee(c)),b=p!=="none";!g&&b&&A.push(...se(c,w,p,m));const O=[c,...A],D=await a.detectOverflow(e,h),L=[];let R=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&L.push(D[x]),l){const P=Nt(i,s,m);L.push(D[P[0]],D[P[1]])}if(R=[...R,{placement:i,overflows:L}],!L.every(P=>P<=0)){var C,S;const P=(((C=r.flip)==null?void 0:C.index)||0)+1,$=O[P];if($&&(!(l==="alignment"?v!==I($):!1)||R.every(F=>I(F.placement)===v?F.overflows[0]>0:!0)))return{data:{index:P,overflows:R},reset:{placement:$}};let T=(S=R.filter(E=>E.overflows[0]<=0).sort((E,F)=>E.overflows[1]-F.overflows[1])[0])==null?void 0:S.placement;if(!T)switch(d){case"bestFit":{var M;const E=(M=R.filter(F=>{if(b){const q=I(F.placement);return q===v||q==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(q=>q>0).reduce((q,dt)=>q+dt,0)]).sort((F,q)=>F[1]-q[1])[0])==null?void 0:M[0];E&&(T=E);break}case"initialPlacement":T=c;break}if(i!==T)return{reset:{placement:T}}}return{}}}};function Tt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Mt(t){return qt.some(e=>t[e]>=0)}const me=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:o,platform:n}=e,{strategy:i="referenceHidden",...r}=X(t,e);switch(i){case"referenceHidden":{const s=await n.detectOverflow(e,{...r,elementContext:"reference"}),c=Tt(s,o.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Mt(c)}}}case"escaped":{const s=await n.detectOverflow(e,{...r,altBoundary:!0}),c=Tt(s,o.floating);return{data:{escapedOffsets:c,escaped:Mt(c)}}}default:return{}}}}};function Ht(t){const e=N(...t.map(r=>r.left)),o=N(...t.map(r=>r.top)),n=_(...t.map(r=>r.right)),i=_(...t.map(r=>r.bottom));return{x:e,y:o,width:n-e,height:i-o}}function he(t){const e=t.slice().sort((i,r)=>i.y-r.y),o=[];let n=null;for(let i=0;i<e.length;i++){const r=e[i];!n||r.y-n.y>n.height/2?o.push([r]):o[o.length-1].push(r),n=r}return o.map(i=>J(Ht(i)))}const pe=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:o,elements:n,rects:i,platform:r,strategy:s}=e,{padding:c=2,x:a,y:u}=X(t,e),f=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(n.reference))||[]),l=he(f),g=J(Ht(f)),d=yt(c);function p(){if(l.length===2&&l[0].left>l[1].right&&a!=null&&u!=null)return l.find(h=>a>h.left-d.left&&a<h.right+d.right&&u>h.top-d.top&&u<h.bottom+d.bottom)||g;if(l.length>=2){if(I(o)==="y"){const R=l[0],C=l[l.length-1],S=k(o)==="top",M=R.top,P=C.bottom,$=S?R.left:C.left,T=S?R.right:C.right,E=T-$,F=P-M;return{top:M,bottom:P,left:$,right:T,width:E,height:F,x:$,y:M}}const h=k(o)==="left",x=_(...l.map(R=>R.right)),v=N(...l.map(R=>R.left)),y=l.filter(R=>h?R.left===v:R.right===x),m=y[0].top,A=y[y.length-1].bottom,b=v,O=x,D=O-b,L=A-m;return{top:m,bottom:A,left:b,right:O,width:D,height:L,x:b,y:m}}return g}const w=await r.getElementRects({reference:{getBoundingClientRect:p},floating:n.floating,strategy:s});return i.reference.x!==w.reference.x||i.reference.y!==w.reference.y||i.reference.width!==w.reference.width||i.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},we=new Set(["left","top"]);async function xe(t,e){const{placement:o,platform:n,elements:i}=t,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=k(o),c=W(o),a=I(o)==="y",u=we.has(s)?-1:1,f=r&&a?-1:1,l=X(e,t);let{mainAxis:g,crossAxis:d,alignmentAxis:p}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),a?{x:d*f,y:g*u}:{x:g*u,y:d*f}}const ye=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:r,placement:s,middlewareData:c}=e,a=await xe(e,t);return s===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},ve=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i,platform:r}=e,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:v,y}=x;return{x:v,y}}},...u}=X(t,e),f={x:o,y:n},l=await r.detectOverflow(e,u),g=I(k(i)),d=Wt(g);let p=f[d],w=f[g];if(s){const x=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=p+l[x],m=p-l[v];p=ht(y,p,m)}if(c){const x=g==="y"?"top":"left",v=g==="y"?"bottom":"right",y=w+l[x],m=w-l[v];w=ht(y,w,m)}const h=a.fn({...e,[d]:p,[g]:w});return{...h,data:{x:h.x-o,y:h.y-n,enabled:{[d]:s,[g]:c}}}}}},be=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,n;const{placement:i,rects:r,platform:s,elements:c}=e,{apply:a=()=>{},...u}=X(t,e),f=await s.detectOverflow(e,u),l=k(i),g=W(i),d=I(i)==="y",{width:p,height:w}=r.floating;let h,x;l==="top"||l==="bottom"?(h=l,x=g===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(x=l,h=g==="end"?"top":"bottom");const v=w-f.top-f.bottom,y=p-f.left-f.right,m=N(w-f[h],v),A=N(p-f[x],y),b=!e.middlewareData.shift;let O=m,D=A;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(D=y),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(O=v),b&&!g){const R=_(f.left,0),C=_(f.right,0),S=_(f.top,0),M=_(f.bottom,0);d?D=p-2*(R!==0||C!==0?R+C:_(f.left,f.right)):O=w-2*(S!==0||M!==0?S+M:_(f.top,f.bottom))}await a({...e,availableWidth:D,availableHeight:O});const L=await s.getDimensions(c.floating);return p!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window<"u"}function tt(t){return Vt(t)?(t.nodeName||"").toLowerCase():"#document"}function B(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function j(t){var e;return(e=(Vt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Vt(t){return lt()?t instanceof Node||t instanceof B(t).Node:!1}function H(t){return lt()?t instanceof Element||t instanceof B(t).Element:!1}function U(t){return lt()?t instanceof HTMLElement||t instanceof B(t).HTMLElement:!1}function $t(t){return!lt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof B(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=V(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&i!=="inline"&&i!=="contents"}function Re(t){return/^(table|td|th)$/.test(tt(t))}function at(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Se=/transform|translate|scale|rotate|perspective|filter/,Ae=/paint|layout|strict|content/,K=t=>!!t&&t!=="none";let gt;function vt(t){const e=H(t)?V(t):t;return K(e.transform)||K(e.translate)||K(e.scale)||K(e.rotate)||K(e.perspective)||!bt()&&(K(e.backdropFilter)||K(e.filter))||Se.test(e.willChange||"")||Ae.test(e.contain||"")}function Oe(t){let e=Y(t);for(;U(e)&&!Z(e);){if(vt(e))return e;if(at(e))return null;e=Y(e)}return null}function bt(){return gt==null&&(gt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gt}function Z(t){return/^(html|body|#document)$/.test(tt(t))}function V(t){return B(t).getComputedStyle(t)}function ft(t){return H(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Y(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||$t(t)&&t.host||j(t);return $t(e)?e.host:e}function It(t){const e=Y(t);return Z(e)?t.ownerDocument?t.ownerDocument.body:t.body:U(e)&&ot(e)?e:It(e)}function nt(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=It(t),r=i===((n=t.ownerDocument)==null?void 0:n.body),s=B(i);if(r){const c=pt(s);return e.concat(s,s.visualViewport||[],ot(i)?i:[],c&&o?nt(c):[])}else return e.concat(i,nt(i,[],o))}function pt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function zt(t){const e=V(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=U(t),r=i?t.offsetWidth:o,s=i?t.offsetHeight:n,c=st(o)!==r||st(n)!==s;return c&&(o=r,n=s),{width:o,height:n,$:c}}function Rt(t){return H(t)?t:t.contextElement}function G(t){const e=Rt(t);if(!U(e))return z(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:r}=zt(e);let s=(r?st(o.width):o.width)/n,c=(r?st(o.height):o.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Ce=z(0);function jt(t){const e=B(t);return!bt()||!e.visualViewport?Ce:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ee(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==B(t)?!1:e}function Q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),r=Rt(t);let s=z(1);e&&(n?H(n)&&(s=G(n)):s=G(t));const c=Ee(r,o,n)?jt(r):z(0);let a=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,f=i.width/s.x,l=i.height/s.y;if(r){const g=B(r),d=n&&H(n)?B(n):n;let p=g,w=pt(p);for(;w&&n&&d!==p;){const h=G(w),x=w.getBoundingClientRect(),v=V(w),y=x.left+(w.clientLeft+parseFloat(v.paddingLeft))*h.x,m=x.top+(w.clientTop+parseFloat(v.paddingTop))*h.y;a*=h.x,u*=h.y,f*=h.x,l*=h.y,a+=y,u+=m,p=B(w),w=pt(p)}}return J({width:f,height:l,x:a,y:u})}function ut(t,e){const o=ft(t).scrollLeft;return e?e.left+o:Q(j(t)).left+o}function Xt(t,e){const o=t.getBoundingClientRect(),n=o.left+e.scrollLeft-ut(t,o),i=o.top+e.scrollTop;return{x:n,y:i}}function Pe(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const r=i==="fixed",s=j(n),c=e?at(e.floating):!1;if(n===s||c&&r)return o;let a={scrollLeft:0,scrollTop:0},u=z(1);const f=z(0),l=U(n);if((l||!l&&!r)&&((tt(n)!=="body"||ot(s))&&(a=ft(n)),l)){const d=Q(n);u=G(n),f.x=d.x+n.clientLeft,f.y=d.y+n.clientTop}const g=s&&!l&&!r?Xt(s,a):z(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+f.x+g.x,y:o.y*u.y-a.scrollTop*u.y+f.y+g.y}}function De(t){return Array.from(t.getClientRects())}function Le(t){const e=j(t),o=ft(t),n=t.ownerDocument.body,i=_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-o.scrollLeft+ut(t);const c=-o.scrollTop;return V(n).direction==="rtl"&&(s+=_(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:c}}const Ft=25;function Te(t,e){const o=B(t),n=j(t),i=o.visualViewport;let r=n.clientWidth,s=n.clientHeight,c=0,a=0;if(i){r=i.width,s=i.height;const f=bt();(!f||f&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}const u=ut(n);if(u<=0){const f=n.ownerDocument,l=f.body,g=getComputedStyle(l),d=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,p=Math.abs(n.clientWidth-l.clientWidth-d);p<=Ft&&(r-=p)}else u<=Ft&&(r+=u);return{width:r,height:s,x:c,y:a}}function Me(t,e){const o=Q(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,r=U(t)?G(t):z(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,a=i*r.x,u=n*r.y;return{width:s,height:c,x:a,y:u}}function _t(t,e,o){let n;if(e==="viewport")n=Te(t,o);else if(e==="document")n=Le(j(t));else if(H(e))n=Me(e,o);else{const i=jt(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return J(n)}function Ut(t,e){const o=Y(t);return o===e||!H(o)||Z(o)?!1:V(o).position==="fixed"||Ut(o,e)}function $e(t,e){const o=e.get(t);if(o)return o;let n=nt(t,[],!1).filter(c=>H(c)&&tt(c)!=="body"),i=null;const r=V(t).position==="fixed";let s=r?Y(t):t;for(;H(s)&&!Z(s);){const c=V(s),a=vt(s);!a&&c.position==="fixed"&&(i=null),(r?!a&&!i:!a&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ot(s)&&!a&&Ut(t,s))?n=n.filter(f=>f!==s):i=c,s=Y(s)}return e.set(t,n),n}function Fe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const s=[...o==="clippingAncestors"?at(e)?[]:$e(e,this._c):[].concat(o),n],c=_t(e,s[0],i);let a=c.top,u=c.right,f=c.bottom,l=c.left;for(let g=1;g<s.length;g++){const d=_t(e,s[g],i);a=_(d.top,a),u=N(d.right,u),f=N(d.bottom,f),l=_(d.left,l)}return{width:u-l,height:f-a,x:l,y:a}}function _e(t){const{width:e,height:o}=zt(t);return{width:e,height:o}}function Be(t,e,o){const n=U(e),i=j(e),r=o==="fixed",s=Q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=z(0);function u(){a.x=ut(i)}if(n||!n&&!r)if((tt(e)!=="body"||ot(i))&&(c=ft(e)),n){const d=Q(e,!0,r,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&u();r&&!n&&i&&u();const f=i&&!n&&!r?Xt(i,c):z(0),l=s.left+c.scrollLeft-a.x-f.x,g=s.top+c.scrollTop-a.y-f.y;return{x:l,y:g,width:s.width,height:s.height}}function mt(t){return V(t).position==="static"}function Bt(t,e){if(!U(t)||V(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return j(t)===o&&(o=o.ownerDocument.body),o}function Yt(t,e){const o=B(t);if(at(t))return o;if(!U(t)){let i=Y(t);for(;i&&!Z(i);){if(H(i)&&!mt(i))return i;i=Y(i)}return o}let n=Bt(t,e);for(;n&&Re(n)&&mt(n);)n=Bt(n,e);return n&&Z(n)&&mt(n)&&!vt(n)?o:n||Oe(t)||o}const ke=async function(t){const e=this.getOffsetParent||Yt,o=this.getDimensions,n=await o(t.floating);return{reference:Be(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function qe(t){return V(t).direction==="rtl"}const We={convertOffsetParentRelativeRectToViewportRelativeRect:Pe,getDocumentElement:j,getClippingRect:Fe,getOffsetParent:Yt,getElementRects:ke,getClientRects:De,getDimensions:_e,getScale:G,isElement:H,isRTL:qe};function Kt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ne(t,e){let o=null,n;const i=j(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const u=t.getBoundingClientRect(),{left:f,top:l,width:g,height:d}=u;if(c||e(),!g||!d)return;const p=it(l),w=it(i.clientWidth-(f+g)),h=it(i.clientHeight-(l+d)),x=it(f),y={rootMargin:-p+"px "+-w+"px "+-h+"px "+-x+"px",threshold:_(0,N(1,a))||1};let m=!0;function A(b){const O=b[0].intersectionRatio;if(O!==a){if(!m)return s();O?s(!1,O):n=setTimeout(()=>{s(!1,1e-7)},1e3)}O===1&&!Kt(u,t.getBoundingClientRect())&&s(),m=!1}try{o=new IntersectionObserver(A,{...y,root:i.ownerDocument})}catch{o=new IntersectionObserver(A,y)}o.observe(t)}return s(!0),r}function He(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Rt(t),f=i||r?[...u?nt(u):[],...e?nt(e):[]]:[];f.forEach(x=>{i&&x.addEventListener("scroll",o,{passive:!0}),r&&x.addEventListener("resize",o)});const l=u&&c?Ne(u,o):null;let g=-1,d=null;s&&(d=new ResizeObserver(x=>{let[v]=x;v&&v.target===u&&d&&e&&(d.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=d)==null||y.observe(e)})),o()}),u&&!a&&d.observe(u),e&&d.observe(e));let p,w=a?Q(t):null;a&&h();function h(){const x=Q(t);w&&!Kt(w,x)&&o(),w=x,p=requestAnimationFrame(h)}return o(),()=>{var x;f.forEach(v=>{i&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),l==null||l(),(x=d)==null||x.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const Qt=ye,Ve=de,Ie=ve,Gt=ge,ze=be,je=me,Xe=fe,Ue=pe,Jt=(t,e,o)=>{const n=new Map,i={platform:We,...o},r={...i.platform,_c:n};return ae(t,e,{...i,platform:r})};function Ye(t){var e;const{char:o,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:s,$position:c}=t,a=n&&!i,u=Zt.escapeForRegEx(o),f=new RegExp(`\\s${u}$`),l=s?"^":"",g=i?"":u,d=a?new RegExp(`${l}${u}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${l}(?:^)?${u}[^\\s${g}]*`,"gm"),p=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!p)return null;const w=c.pos-p.length,h=Array.from(p.matchAll(d)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const x=h.input.slice(Math.max(0,h.index-1),h.index),v=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(x);if(r!==null&&!v)return null;const y=w+h.index;let m=y+h[0].length;return a&&f.test(p.slice(m-1,m+1))&&(h[0]+=" ",m+=1),y<c.pos&&m>=c.pos?{range:{from:y,to:m},query:h[0].slice(o.length),text:h[0]}:null}function Ke(t){return t.docChanged?t.steps.some(e=>{const o=e.slice;if(!(o!=null&&o.content))return!1;const n=o.content.textBetween(0,o.content.size,`
1
+ "use strict";const kt=require("@tiptap/pm/state"),Zt=require("./index-EoGU7W4e.cjs"),Ot=require("@tiptap/pm/view"),qt=["top","right","bottom","left"],Ct=["start","end"],Et=qt.reduce((t,e)=>t.concat(e,e+"-"+Ct[0],e+"-"+Ct[1]),[]),N=Math.min,_=Math.max,st=Math.round,it=Math.floor,z=t=>({x:t,y:t}),te={left:"right",right:"left",bottom:"top",top:"bottom"};function ht(t,e,o){return _(t,N(e,o))}function X(t,e){return typeof t=="function"?t(e):t}function k(t){return t.split("-")[0]}function W(t){return t.split("-")[1]}function Wt(t){return t==="x"?"y":"x"}function wt(t){return t==="y"?"height":"width"}function I(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function xt(t){return Wt(I(t))}function Nt(t,e,o){o===void 0&&(o=!1);const n=W(t),i=xt(t),r=wt(i);let s=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=ct(s)),[s,ct(s)]}function ee(t){const e=ct(t);return[rt(t),e,rt(e)]}function rt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Pt=["left","right"],Dt=["right","left"],ne=["top","bottom"],oe=["bottom","top"];function ie(t,e,o){switch(t){case"top":case"bottom":return o?e?Dt:Pt:e?Pt:Dt;case"left":case"right":return e?ne:oe;default:return[]}}function se(t,e,o,n){const i=W(t);let r=ie(k(t),o==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(rt)))),r}function ct(t){const e=k(t);return te[e]+t.slice(e.length)}function re(t){return{top:0,right:0,bottom:0,left:0,...t}}function yt(t){return typeof t!="number"?re(t):{top:t,right:t,bottom:t,left:t}}function J(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function Lt(t,e,o){let{reference:n,floating:i}=t;const r=I(e),s=xt(e),c=wt(s),a=k(e),u=r==="y",f=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let d;switch(a){case"top":d={x:f,y:n.y-i.height};break;case"bottom":d={x:f,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:l};break;case"left":d={x:n.x-i.width,y:l};break;default:d={x:n.x,y:n.y}}switch(W(e)){case"start":d[s]-=g*(o&&u?-1:1);break;case"end":d[s]+=g*(o&&u?-1:1);break}return d}async function ce(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:r,rects:s,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:l="floating",altBoundary:g=!1,padding:d=0}=X(e,t),p=yt(d),h=c[g?l==="floating"?"reference":"floating":l],x=J(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(h)))==null||o?h:h.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:a})),v=l==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,y=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),m=await(r.isElement==null?void 0:r.isElement(y))?await(r.getScale==null?void 0:r.getScale(y))||{x:1,y:1}:{x:1,y:1},A=J(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:a}):v);return{top:(x.top-A.top+p.top)/m.y,bottom:(A.bottom-x.bottom+p.bottom)/m.y,left:(x.left-A.left+p.left)/m.x,right:(A.right-x.right+p.right)/m.x}}const le=50,ae=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=o,c=s.detectOverflow?s:{...s,detectOverflow:ce},a=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:l}=Lt(u,n,a),g=n,d=0;const p={};for(let w=0;w<r.length;w++){const h=r[w];if(!h)continue;const{name:x,fn:v}=h,{x:y,y:m,data:A,reset:b}=await v({x:f,y:l,initialPlacement:n,placement:g,strategy:i,middlewareData:p,rects:u,platform:c,elements:{reference:t,floating:e}});f=y??f,l=m??l,p[x]={...p[x],...A},b&&d<le&&(d++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:f,y:l}=Lt(u,g,a)),w=-1)}return{x:f,y:l,placement:g,strategy:i,middlewareData:p}},fe=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:i,rects:r,platform:s,elements:c,middlewareData:a}=e,{element:u,padding:f=0}=X(t,e)||{};if(u==null)return{};const l=yt(f),g={x:o,y:n},d=xt(i),p=wt(d),w=await s.getDimensions(u),h=d==="y",x=h?"top":"left",v=h?"bottom":"right",y=h?"clientHeight":"clientWidth",m=r.reference[p]+r.reference[d]-g[d]-r.floating[p],A=g[d]-r.reference[d],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let O=b?b[y]:0;(!O||!await(s.isElement==null?void 0:s.isElement(b)))&&(O=c.floating[y]||r.floating[p]);const D=m/2-A/2,L=O/2-w[p]/2-1,R=N(l[x],L),C=N(l[v],L),S=R,M=O-w[p]-C,P=O/2-w[p]/2+D,$=ht(S,P,M),T=!a.arrow&&W(i)!=null&&P!==$&&r.reference[p]/2-(P<S?R:C)-w[p]/2<0,E=T?P<S?P-S:P-M:0;return{[d]:g[d]+E,data:{[d]:$,centerOffset:P-$-E,...T&&{alignmentOffset:E}},reset:T}}});function ue(t,e,o){return(t?[...o.filter(i=>W(i)===t),...o.filter(i=>W(i)!==t)]:o.filter(i=>k(i)===i)).filter(i=>t?W(i)===t||(e?rt(i)!==i:!1):!0)}const de=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var o,n,i;const{rects:r,middlewareData:s,placement:c,platform:a,elements:u}=e,{crossAxis:f=!1,alignment:l,allowedPlacements:g=Et,autoAlignment:d=!0,...p}=X(t,e),w=l!==void 0||g===Et?ue(l||null,d,g):g,h=await a.detectOverflow(e,p),x=((o=s.autoPlacement)==null?void 0:o.index)||0,v=w[x];if(v==null)return{};const y=Nt(v,r,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(c!==v)return{reset:{placement:w[0]}};const m=[h[k(v)],h[y[0]],h[y[1]]],A=[...((n=s.autoPlacement)==null?void 0:n.overflows)||[],{placement:v,overflows:m}],b=w[x+1];if(b)return{data:{index:x+1,overflows:A},reset:{placement:b}};const O=A.map(R=>{const C=W(R.placement);return[R.placement,C&&f?R.overflows.slice(0,2).reduce((S,M)=>S+M,0):R.overflows[0],R.overflows]}).sort((R,C)=>R[1]-C[1]),L=((i=O.filter(R=>R[2].slice(0,W(R[0])?2:3).every(C=>C<=0))[0])==null?void 0:i[0])||O[0][0];return L!==c?{data:{index:x+1,overflows:A},reset:{placement:L}}:{}}}},ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:f=!0,crossAxis:l=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:w=!0,...h}=X(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const x=k(i),v=I(c),y=k(c)===c,m=await(a.isRTL==null?void 0:a.isRTL(u.floating)),A=g||(y||!w?[ct(c)]:ee(c)),b=p!=="none";!g&&b&&A.push(...se(c,w,p,m));const O=[c,...A],D=await a.detectOverflow(e,h),L=[];let R=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&L.push(D[x]),l){const P=Nt(i,s,m);L.push(D[P[0]],D[P[1]])}if(R=[...R,{placement:i,overflows:L}],!L.every(P=>P<=0)){var C,S;const P=(((C=r.flip)==null?void 0:C.index)||0)+1,$=O[P];if($&&(!(l==="alignment"?v!==I($):!1)||R.every(F=>I(F.placement)===v?F.overflows[0]>0:!0)))return{data:{index:P,overflows:R},reset:{placement:$}};let T=(S=R.filter(E=>E.overflows[0]<=0).sort((E,F)=>E.overflows[1]-F.overflows[1])[0])==null?void 0:S.placement;if(!T)switch(d){case"bestFit":{var M;const E=(M=R.filter(F=>{if(b){const q=I(F.placement);return q===v||q==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(q=>q>0).reduce((q,dt)=>q+dt,0)]).sort((F,q)=>F[1]-q[1])[0])==null?void 0:M[0];E&&(T=E);break}case"initialPlacement":T=c;break}if(i!==T)return{reset:{placement:T}}}return{}}}};function Tt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Mt(t){return qt.some(e=>t[e]>=0)}const me=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:o,platform:n}=e,{strategy:i="referenceHidden",...r}=X(t,e);switch(i){case"referenceHidden":{const s=await n.detectOverflow(e,{...r,elementContext:"reference"}),c=Tt(s,o.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Mt(c)}}}case"escaped":{const s=await n.detectOverflow(e,{...r,altBoundary:!0}),c=Tt(s,o.floating);return{data:{escapedOffsets:c,escaped:Mt(c)}}}default:return{}}}}};function Ht(t){const e=N(...t.map(r=>r.left)),o=N(...t.map(r=>r.top)),n=_(...t.map(r=>r.right)),i=_(...t.map(r=>r.bottom));return{x:e,y:o,width:n-e,height:i-o}}function he(t){const e=t.slice().sort((i,r)=>i.y-r.y),o=[];let n=null;for(let i=0;i<e.length;i++){const r=e[i];!n||r.y-n.y>n.height/2?o.push([r]):o[o.length-1].push(r),n=r}return o.map(i=>J(Ht(i)))}const pe=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:o,elements:n,rects:i,platform:r,strategy:s}=e,{padding:c=2,x:a,y:u}=X(t,e),f=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(n.reference))||[]),l=he(f),g=J(Ht(f)),d=yt(c);function p(){if(l.length===2&&l[0].left>l[1].right&&a!=null&&u!=null)return l.find(h=>a>h.left-d.left&&a<h.right+d.right&&u>h.top-d.top&&u<h.bottom+d.bottom)||g;if(l.length>=2){if(I(o)==="y"){const R=l[0],C=l[l.length-1],S=k(o)==="top",M=R.top,P=C.bottom,$=S?R.left:C.left,T=S?R.right:C.right,E=T-$,F=P-M;return{top:M,bottom:P,left:$,right:T,width:E,height:F,x:$,y:M}}const h=k(o)==="left",x=_(...l.map(R=>R.right)),v=N(...l.map(R=>R.left)),y=l.filter(R=>h?R.left===v:R.right===x),m=y[0].top,A=y[y.length-1].bottom,b=v,O=x,D=O-b,L=A-m;return{top:m,bottom:A,left:b,right:O,width:D,height:L,x:b,y:m}}return g}const w=await r.getElementRects({reference:{getBoundingClientRect:p},floating:n.floating,strategy:s});return i.reference.x!==w.reference.x||i.reference.y!==w.reference.y||i.reference.width!==w.reference.width||i.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},we=new Set(["left","top"]);async function xe(t,e){const{placement:o,platform:n,elements:i}=t,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=k(o),c=W(o),a=I(o)==="y",u=we.has(s)?-1:1,f=r&&a?-1:1,l=X(e,t);let{mainAxis:g,crossAxis:d,alignmentAxis:p}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),a?{x:d*f,y:g*u}:{x:g*u,y:d*f}}const ye=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:r,placement:s,middlewareData:c}=e,a=await xe(e,t);return s===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},ve=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i,platform:r}=e,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:v,y}=x;return{x:v,y}}},...u}=X(t,e),f={x:o,y:n},l=await r.detectOverflow(e,u),g=I(k(i)),d=Wt(g);let p=f[d],w=f[g];if(s){const x=d==="y"?"top":"left",v=d==="y"?"bottom":"right",y=p+l[x],m=p-l[v];p=ht(y,p,m)}if(c){const x=g==="y"?"top":"left",v=g==="y"?"bottom":"right",y=w+l[x],m=w-l[v];w=ht(y,w,m)}const h=a.fn({...e,[d]:p,[g]:w});return{...h,data:{x:h.x-o,y:h.y-n,enabled:{[d]:s,[g]:c}}}}}},be=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,n;const{placement:i,rects:r,platform:s,elements:c}=e,{apply:a=()=>{},...u}=X(t,e),f=await s.detectOverflow(e,u),l=k(i),g=W(i),d=I(i)==="y",{width:p,height:w}=r.floating;let h,x;l==="top"||l==="bottom"?(h=l,x=g===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(x=l,h=g==="end"?"top":"bottom");const v=w-f.top-f.bottom,y=p-f.left-f.right,m=N(w-f[h],v),A=N(p-f[x],y),b=!e.middlewareData.shift;let O=m,D=A;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(D=y),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(O=v),b&&!g){const R=_(f.left,0),C=_(f.right,0),S=_(f.top,0),M=_(f.bottom,0);d?D=p-2*(R!==0||C!==0?R+C:_(f.left,f.right)):O=w-2*(S!==0||M!==0?S+M:_(f.top,f.bottom))}await a({...e,availableWidth:D,availableHeight:O});const L=await s.getDimensions(c.floating);return p!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window<"u"}function tt(t){return Vt(t)?(t.nodeName||"").toLowerCase():"#document"}function B(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function j(t){var e;return(e=(Vt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Vt(t){return lt()?t instanceof Node||t instanceof B(t).Node:!1}function H(t){return lt()?t instanceof Element||t instanceof B(t).Element:!1}function U(t){return lt()?t instanceof HTMLElement||t instanceof B(t).HTMLElement:!1}function $t(t){return!lt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof B(t).ShadowRoot}function ot(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=V(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&i!=="inline"&&i!=="contents"}function Re(t){return/^(table|td|th)$/.test(tt(t))}function at(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Se=/transform|translate|scale|rotate|perspective|filter/,Ae=/paint|layout|strict|content/,K=t=>!!t&&t!=="none";let gt;function vt(t){const e=H(t)?V(t):t;return K(e.transform)||K(e.translate)||K(e.scale)||K(e.rotate)||K(e.perspective)||!bt()&&(K(e.backdropFilter)||K(e.filter))||Se.test(e.willChange||"")||Ae.test(e.contain||"")}function Oe(t){let e=Y(t);for(;U(e)&&!Z(e);){if(vt(e))return e;if(at(e))return null;e=Y(e)}return null}function bt(){return gt==null&&(gt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gt}function Z(t){return/^(html|body|#document)$/.test(tt(t))}function V(t){return B(t).getComputedStyle(t)}function ft(t){return H(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Y(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||$t(t)&&t.host||j(t);return $t(e)?e.host:e}function It(t){const e=Y(t);return Z(e)?t.ownerDocument?t.ownerDocument.body:t.body:U(e)&&ot(e)?e:It(e)}function nt(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=It(t),r=i===((n=t.ownerDocument)==null?void 0:n.body),s=B(i);if(r){const c=pt(s);return e.concat(s,s.visualViewport||[],ot(i)?i:[],c&&o?nt(c):[])}else return e.concat(i,nt(i,[],o))}function pt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function zt(t){const e=V(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=U(t),r=i?t.offsetWidth:o,s=i?t.offsetHeight:n,c=st(o)!==r||st(n)!==s;return c&&(o=r,n=s),{width:o,height:n,$:c}}function Rt(t){return H(t)?t:t.contextElement}function G(t){const e=Rt(t);if(!U(e))return z(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:r}=zt(e);let s=(r?st(o.width):o.width)/n,c=(r?st(o.height):o.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Ce=z(0);function jt(t){const e=B(t);return!bt()||!e.visualViewport?Ce:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ee(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==B(t)?!1:e}function Q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),r=Rt(t);let s=z(1);e&&(n?H(n)&&(s=G(n)):s=G(t));const c=Ee(r,o,n)?jt(r):z(0);let a=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,f=i.width/s.x,l=i.height/s.y;if(r){const g=B(r),d=n&&H(n)?B(n):n;let p=g,w=pt(p);for(;w&&n&&d!==p;){const h=G(w),x=w.getBoundingClientRect(),v=V(w),y=x.left+(w.clientLeft+parseFloat(v.paddingLeft))*h.x,m=x.top+(w.clientTop+parseFloat(v.paddingTop))*h.y;a*=h.x,u*=h.y,f*=h.x,l*=h.y,a+=y,u+=m,p=B(w),w=pt(p)}}return J({width:f,height:l,x:a,y:u})}function ut(t,e){const o=ft(t).scrollLeft;return e?e.left+o:Q(j(t)).left+o}function Xt(t,e){const o=t.getBoundingClientRect(),n=o.left+e.scrollLeft-ut(t,o),i=o.top+e.scrollTop;return{x:n,y:i}}function Pe(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const r=i==="fixed",s=j(n),c=e?at(e.floating):!1;if(n===s||c&&r)return o;let a={scrollLeft:0,scrollTop:0},u=z(1);const f=z(0),l=U(n);if((l||!l&&!r)&&((tt(n)!=="body"||ot(s))&&(a=ft(n)),l)){const d=Q(n);u=G(n),f.x=d.x+n.clientLeft,f.y=d.y+n.clientTop}const g=s&&!l&&!r?Xt(s,a):z(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+f.x+g.x,y:o.y*u.y-a.scrollTop*u.y+f.y+g.y}}function De(t){return Array.from(t.getClientRects())}function Le(t){const e=j(t),o=ft(t),n=t.ownerDocument.body,i=_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-o.scrollLeft+ut(t);const c=-o.scrollTop;return V(n).direction==="rtl"&&(s+=_(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:c}}const Ft=25;function Te(t,e){const o=B(t),n=j(t),i=o.visualViewport;let r=n.clientWidth,s=n.clientHeight,c=0,a=0;if(i){r=i.width,s=i.height;const f=bt();(!f||f&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}const u=ut(n);if(u<=0){const f=n.ownerDocument,l=f.body,g=getComputedStyle(l),d=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,p=Math.abs(n.clientWidth-l.clientWidth-d);p<=Ft&&(r-=p)}else u<=Ft&&(r+=u);return{width:r,height:s,x:c,y:a}}function Me(t,e){const o=Q(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,r=U(t)?G(t):z(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,a=i*r.x,u=n*r.y;return{width:s,height:c,x:a,y:u}}function _t(t,e,o){let n;if(e==="viewport")n=Te(t,o);else if(e==="document")n=Le(j(t));else if(H(e))n=Me(e,o);else{const i=jt(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return J(n)}function Ut(t,e){const o=Y(t);return o===e||!H(o)||Z(o)?!1:V(o).position==="fixed"||Ut(o,e)}function $e(t,e){const o=e.get(t);if(o)return o;let n=nt(t,[],!1).filter(c=>H(c)&&tt(c)!=="body"),i=null;const r=V(t).position==="fixed";let s=r?Y(t):t;for(;H(s)&&!Z(s);){const c=V(s),a=vt(s);!a&&c.position==="fixed"&&(i=null),(r?!a&&!i:!a&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ot(s)&&!a&&Ut(t,s))?n=n.filter(f=>f!==s):i=c,s=Y(s)}return e.set(t,n),n}function Fe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const s=[...o==="clippingAncestors"?at(e)?[]:$e(e,this._c):[].concat(o),n],c=_t(e,s[0],i);let a=c.top,u=c.right,f=c.bottom,l=c.left;for(let g=1;g<s.length;g++){const d=_t(e,s[g],i);a=_(d.top,a),u=N(d.right,u),f=N(d.bottom,f),l=_(d.left,l)}return{width:u-l,height:f-a,x:l,y:a}}function _e(t){const{width:e,height:o}=zt(t);return{width:e,height:o}}function Be(t,e,o){const n=U(e),i=j(e),r=o==="fixed",s=Q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=z(0);function u(){a.x=ut(i)}if(n||!n&&!r)if((tt(e)!=="body"||ot(i))&&(c=ft(e)),n){const d=Q(e,!0,r,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&u();r&&!n&&i&&u();const f=i&&!n&&!r?Xt(i,c):z(0),l=s.left+c.scrollLeft-a.x-f.x,g=s.top+c.scrollTop-a.y-f.y;return{x:l,y:g,width:s.width,height:s.height}}function mt(t){return V(t).position==="static"}function Bt(t,e){if(!U(t)||V(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return j(t)===o&&(o=o.ownerDocument.body),o}function Yt(t,e){const o=B(t);if(at(t))return o;if(!U(t)){let i=Y(t);for(;i&&!Z(i);){if(H(i)&&!mt(i))return i;i=Y(i)}return o}let n=Bt(t,e);for(;n&&Re(n)&&mt(n);)n=Bt(n,e);return n&&Z(n)&&mt(n)&&!vt(n)?o:n||Oe(t)||o}const ke=async function(t){const e=this.getOffsetParent||Yt,o=this.getDimensions,n=await o(t.floating);return{reference:Be(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function qe(t){return V(t).direction==="rtl"}const We={convertOffsetParentRelativeRectToViewportRelativeRect:Pe,getDocumentElement:j,getClippingRect:Fe,getOffsetParent:Yt,getElementRects:ke,getClientRects:De,getDimensions:_e,getScale:G,isElement:H,isRTL:qe};function Kt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ne(t,e){let o=null,n;const i=j(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const u=t.getBoundingClientRect(),{left:f,top:l,width:g,height:d}=u;if(c||e(),!g||!d)return;const p=it(l),w=it(i.clientWidth-(f+g)),h=it(i.clientHeight-(l+d)),x=it(f),y={rootMargin:-p+"px "+-w+"px "+-h+"px "+-x+"px",threshold:_(0,N(1,a))||1};let m=!0;function A(b){const O=b[0].intersectionRatio;if(O!==a){if(!m)return s();O?s(!1,O):n=setTimeout(()=>{s(!1,1e-7)},1e3)}O===1&&!Kt(u,t.getBoundingClientRect())&&s(),m=!1}try{o=new IntersectionObserver(A,{...y,root:i.ownerDocument})}catch{o=new IntersectionObserver(A,y)}o.observe(t)}return s(!0),r}function He(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Rt(t),f=i||r?[...u?nt(u):[],...e?nt(e):[]]:[];f.forEach(x=>{i&&x.addEventListener("scroll",o,{passive:!0}),r&&x.addEventListener("resize",o)});const l=u&&c?Ne(u,o):null;let g=-1,d=null;s&&(d=new ResizeObserver(x=>{let[v]=x;v&&v.target===u&&d&&e&&(d.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=d)==null||y.observe(e)})),o()}),u&&!a&&d.observe(u),e&&d.observe(e));let p,w=a?Q(t):null;a&&h();function h(){const x=Q(t);w&&!Kt(w,x)&&o(),w=x,p=requestAnimationFrame(h)}return o(),()=>{var x;f.forEach(v=>{i&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),l==null||l(),(x=d)==null||x.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const Qt=ye,Ve=de,Ie=ve,Gt=ge,ze=be,je=me,Xe=fe,Ue=pe,Jt=(t,e,o)=>{const n=new Map,i={platform:We,...o},r={...i.platform,_c:n};return ae(t,e,{...i,platform:r})};function Ye(t){var e;const{char:o,allowSpaces:n,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:s,$position:c}=t,a=n&&!i,u=Zt.escapeForRegEx(o),f=new RegExp(`\\s${u}$`),l=s?"^":"",g=i?"":u,d=a?new RegExp(`${l}${u}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${l}(?:^)?${u}[^\\s${g}]*`,"gm"),p=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!p)return null;const w=c.pos-p.length,h=Array.from(p.matchAll(d)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const x=h.input.slice(Math.max(0,h.index-1),h.index),v=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(x);if(r!==null&&!v)return null;const y=w+h.index;let m=y+h[0].length;return a&&f.test(p.slice(m-1,m+1))&&(h[0]+=" ",m+=1),y<c.pos&&m>=c.pos?{range:{from:y,to:m},query:h[0].slice(o.length),text:h[0]}:null}function Ke(t){return t.docChanged?t.steps.some(e=>{const o=e.slice;if(!(o!=null&&o.content))return!1;const n=o.content.textBetween(0,o.content.size,`
2
2
  `);return/\s/.test(n)}):!1}function Qe(t){return()=>{const e=t.state.selection.$anchor.pos,o=t.view.coordsAtPos(e),{top:n,right:i,bottom:r,left:s}=o;try{return new DOMRect(s,n,i-s,r-n)}catch{return null}}}function Ge(t,e,o,n){return o?()=>{const i=n.getState(t.state),r=i==null?void 0:i.decorationId,s=e.dom.querySelector(`[data-decoration-id="${r}"]`);return(s==null?void 0:s.getBoundingClientRect())||null}:Qe(t)}function Je({match:t,dismissedRange:e,state:o,transaction:n,editor:i,shouldResetDismissed:r,effectiveAllowSpaces:s}){return r!=null&&r({editor:i,state:o,range:e,match:t,transaction:n,allowSpaces:s})?!1:s?t.range.from===e.from:t.range.from===e.from&&!Ke(n)}function Ze({view:t,pluginKeyRef:e}){const o=t.state.tr.setMeta(e,{exit:!0});t.dispatch(o)}function tn({pluginKey:t,decorationTag:e,decorationClass:o,decorationContent:n,decorationEmptyClass:i,renderer:r,dispatchExit:s}){return{handleKeyDown(c,a){var u,f;const l=t.getState(c.state);return l.active?a.key==="Escape"||a.key==="Esc"?((u=r==null?void 0:r.onKeyDown)==null||u.call(r,{view:c,event:a,range:l.range}),s(c),!0):((f=r==null?void 0:r.onKeyDown)==null?void 0:f.call(r,{view:c,event:a,range:l.range}))||!1:!1},decorations(c){const a=t.getState(c),{active:u,range:f,decorationId:l,query:g}=a;if(!u)return null;const d=!(g!=null&&g.length),p=[o];return d&&p.push(i),Ot.DecorationSet.create(c.doc,[Ot.Decoration.inline(f.from,f.to,{nodeName:e,class:p.join(" "),"data-decoration-id":l||void 0,"data-decoration-content":n})])}}}function en({editor:t,char:e,effectiveAllowSpaces:o,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,findSuggestionMatch:s,allow:c,shouldShow:a,shouldKeepDismissed:u,pluginKey:f}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(l,g,d,p){const{isEditable:w}=t,{composing:h}=t.view,{selection:x}=l,{empty:v,from:y}=x,m={...g},A=l.getMeta(f);if(A&&A.exit)return m.active=!1,m.decorationId=null,m.range={from:0,to:0},m.query=null,m.text=null,m.dismissedRange=g.active?{...g.range}:g.dismissedRange,m;if(m.composing=h,l.docChanged&&m.dismissedRange!==null&&(m.dismissedRange={from:l.mapping.map(m.dismissedRange.from),to:l.mapping.map(m.dismissedRange.to)}),w&&(v||t.view.composing)){(y<g.range.from||y>g.range.to)&&!h&&!g.composing&&(m.active=!1);const b=s({char:e,allowSpaces:o,allowToIncludeChar:n,allowedPrefixes:i,startOfLine:r,$position:x.$from}),O=`id_${Math.floor(Math.random()*4294967295)}`;b&&c({editor:t,state:p,range:b.range,isActive:g.active})&&(!a||a({editor:t,range:b.range,query:b.query,text:b.text,transaction:l}))?(m.dismissedRange!==null&&!u({match:b,dismissedRange:m.dismissedRange,state:p,transaction:l})&&(m.dismissedRange=null),m.dismissedRange===null?(m.active=!0,m.decorationId=g.decorationId||O,m.range=b.range,m.query=b.query,m.text=b.text):m.active=!1):(b||(m.dismissedRange=null),m.active=!1)}else m.active=!1;return m.active||(m.decorationId=null,m.range={from:0,to:0},m.query=null,m.text=null),m}}}function nn({editor:t,items:e}){let o=null,n=null,i=null;const r=()=>{n!==null&&(clearTimeout(n),n=null),i==null||i(),i=null},s=u=>new Promise(f=>{i=f,n=setTimeout(()=>{n=null;const l=i;i=null,l==null||l()},u)}),c=()=>{o==null||o.abort(),r(),o=null};return{abort:c,fetch:async(u,f)=>{c(),o=new AbortController;const l=o;if(f>0&&await s(f),o!==l||l.signal.aborted)return{status:"aborted"};try{const g=await e({editor:t,query:u,signal:l.signal});return o!==l||l.signal.aborted?{status:"aborted"}:{status:"resolved",items:g}}catch{return o!==l||l.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function on({placement:t,offset:e,flip:o,floatingUi:n}){var i,r,s,c;const a=[Qt({mainAxis:(i=e.mainAxis)!=null?i:4,crossAxis:(r=e.crossAxis)!=null?r:0})];return o&&a.push(Gt()),(s=n==null?void 0:n.middleware)!=null&&s.length&&a.push(...n.middleware),{placement:t,strategy:(c=n==null?void 0:n.strategy)!=null?c:"absolute",middleware:a}}function sn(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{const e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function rn({getReferenceRect:t,contextElement:e,config:o,container:n,dismissOnOutsideClick:i,dismiss:r}){return(s,c={})=>{const a={getBoundingClientRect:()=>{var p;return(p=t())!=null?p:new DOMRect},contextElement:e};let u=!1;const f=!s.isConnected;f&&sn(n).appendChild(s),c.onPosition||(s.style.visibility="hidden",s.style.width="max-content");const g=He(a,s,()=>{Jt(a,s,{placement:o.placement,strategy:o.strategy,middleware:o.middleware}).then(({x:p,y:w,placement:h,strategy:x})=>{if(c.onPosition){c.onPosition({x:p,y:w,placement:h,strategy:x});return}Object.assign(s.style,{position:x,left:`${p}px`,top:`${w}px`}),u||(u=!0,s.style.visibility="")})},c.autoUpdate);let d;return i&&(d=p=>{const w=p.target;!(w instanceof Node)||s.contains(w)||e.contains(w)||r()},document.addEventListener("pointerdown",d,!0)),()=>{g(),d&&document.removeEventListener("pointerdown",d,!0),f&&s.remove()}}}function cn({editor:t,pluginKey:e,items:o,renderer:n,minQueryLength:i,debounce:r,initialItems:s,placement:c,offset:a,container:u,flip:f,floatingUi:l,dismissOnOutsideClick:g,command:d,clientRectFor:p,dispatchExit:w}){let h;const x=nn({editor:t,items:o}),v=on({placement:c,offset:a,flip:f,floatingUi:l});function y(m,A){var b,O,D;switch(m){case"started":(b=n==null?void 0:n.onStart)==null||b.call(n,A);break;case"updated":(O=n==null?void 0:n.onUpdate)==null||O.call(n,A);break;case"stopped":(D=n==null?void 0:n.onExit)==null||D.call(n,A);break}}return{update:async(m,A)=>{var b,O,D,L;const R=e.getState(A),C=e.getState(m.state);if(!R||!C)return;let S=null;const M=R.query!==C.query,P=R.text!==C.text,$=R.range.from!==C.range.from||R.range.to!==C.range.to,T=M||P||$;if(!R.active&&C.active)S="started";else if(R.active&&!C.active)S="stopped";else if(C.active&&T)S="updated";else return;const E=S==="stopped"?R:C,F=m.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`),q=p(m,F),dt=i===0||(E.query?E.query.length>=i:!1),St=(S==="started"||S==="updated")&&dt;if(h={editor:t,range:E.range,query:E.query||"",text:E.text||"",items:s??[],command:et=>d({editor:t,range:E.range,props:et}),decorationNode:F,clientRect:q,loading:St,placement:c,offset:{mainAxis:(b=a.mainAxis)!=null?b:4,crossAxis:(O=a.crossAxis)!=null?O:0},container:u,flip:f,floatingUi:v,mount:rn({getReferenceRect:q,contextElement:m.dom,config:v,container:u,dismissOnOutsideClick:g,dismiss:()=>w(t.view)})},S==="started"&&((D=n==null?void 0:n.onBeforeStart)==null||D.call(n,h)),S==="updated"&&((L=n==null?void 0:n.onBeforeUpdate)==null||L.call(n,h)),S==="started"&&y(S,h),S==="started"||S==="updated")if(!St)x.abort(),h={...h,items:s??[],loading:!1};else{h={...h,items:s??[],loading:!0},S="updated",y(S,h);const et=await x.fetch(E.query||"",r);if(et.status==="aborted")return;const At=e.getState(m.state);if(!(At!=null&&At.active)){x.abort();return}h=et.status==="resolved"?{...h,items:et.items,loading:!1}:{...h,loading:!1}}if(S==="stopped"){x.abort(),y(S,h),h=void 0;return}S==="updated"&&y(S,h)},destroy:()=>{var m;x.abort(),h&&((m=n==null?void 0:n.onExit)==null||m.call(n,h))}}}var ln=new kt.PluginKey("suggestion");function an({pluginKey:t=ln,editor:e,char:o="@",allowSpaces:n=!1,allowToIncludeChar:i=!1,allowedPrefixes:r=[" "],startOfLine:s=!1,decorationTag:c="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:l=()=>null,items:g=()=>[],minQueryLength:d=0,debounce:p=0,initialItems:w,placement:h="bottom-start",offset:x={},container:v,flip:y=!0,floatingUi:m,dismissOnOutsideClick:A=!0,render:b=()=>({}),allow:O=()=>!0,findSuggestionMatch:D=Ye,shouldShow:L,shouldResetDismissed:R}){const C=b==null?void 0:b(),S=n&&!i,M=(T,E)=>Ge(e,T,E,t);function P(T){return Je({...T,editor:e,shouldResetDismissed:R,effectiveAllowSpaces:S})}const $=T=>Ze({view:T,pluginKeyRef:t});return new kt.Plugin({key:t,view:()=>cn({editor:e,pluginKey:t,items:g,renderer:C,minQueryLength:d,debounce:p,initialItems:w,placement:h,offset:x,container:v,flip:y,floatingUi:m,dismissOnOutsideClick:A,command:l,clientRectFor:M,dispatchExit:$}),state:en({editor:e,char:o,effectiveAllowSpaces:S,allowToIncludeChar:i,allowedPrefixes:r,startOfLine:s,findSuggestionMatch:D,allow:O,shouldShow:L,shouldKeepDismissed:P,pluginKey:t}),props:tn({pluginKey:t,decorationTag:c,decorationClass:a,decorationContent:u,decorationEmptyClass:f,renderer:C,dispatchExit:$})})}exports.Suggestion=an;exports.arrow=Xe;exports.autoPlacement=Ve;exports.computePosition=Jt;exports.flip=Gt;exports.hide=je;exports.inline=Ue;exports.offset=Qt;exports.shift=Ie;exports.size=ze;
package/lib/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("./clsx-DRbkQ4T7.cjs"),l=require("react"),d=require("./index-aujjnfSJ.cjs"),f=require("./theme.cjs"),M=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),C=require("./clsx-DJURdKPs.cjs"),l=require("react"),d=require("./index-BO82_0q8.cjs"),f=require("./theme.cjs"),M=`
2
2
  .reactjs-tiptap-editor {
3
3
  button,
4
4
  input:where([type=button]),
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as s, Fragment as f, jsxs as j } from "react/jsx-runtime";
2
- import { E as N } from "./clsx-_bq4MQQ7.js";
1
+ import { jsx as s, Fragment as f, jsxs as T } from "react/jsx-runtime";
2
+ import { E as j } from "./clsx-b_2OwHLk.js";
3
3
  import { useEffect as l, useId as M } from "react";
4
- import { U as P, V as A, W as $, X as O } from "./index-C52cuQ_Y.js";
4
+ import { N as P, R as A, O, S as $ } from "./index-DRcwHivm.js";
5
5
  import { useTheme as D, THEME as m } from "./theme.js";
6
6
  const H = `
7
7
  .reactjs-tiptap-editor {
@@ -160,8 +160,8 @@ function y(e, n = {}) {
160
160
  const p = x(u).filter((b) => {
161
161
  if (!["prepend", "prependQueue"].includes(b.getAttribute(g)))
162
162
  return !1;
163
- const T = Number(b.getAttribute(E) || 0);
164
- return r >= T;
163
+ const N = Number(b.getAttribute(E) || 0);
164
+ return r >= N;
165
165
  });
166
166
  if (p.length > 0)
167
167
  return u.insertBefore(i, p.at(-1).nextSibling), i;
@@ -196,7 +196,7 @@ function C(e, n, t = {}) {
196
196
  const a = y(e, t);
197
197
  return a.setAttribute(v(t), n), a;
198
198
  }
199
- function V() {
199
+ function Y() {
200
200
  const { theme: e, color: n, borderRadius: t } = D();
201
201
  return l(() => {
202
202
  const o = e || "light", r = n || "default";
@@ -223,19 +223,19 @@ function V() {
223
223
  };
224
224
  }, [e, n, t]), /* @__PURE__ */ s(f, {});
225
225
  }
226
- function W({ editor: e, children: n }) {
226
+ function k({ editor: e, children: n }) {
227
227
  const t = M();
228
228
  return l(() => (C(H, "react-tiptap-reset"), () => {
229
229
  w("react-tiptap-reset");
230
230
  }), []), l(() => {
231
231
  e && (e.id = t);
232
- }, [t, e]), e ? /* @__PURE__ */ s("div", { className: "reactjs-tiptap-editor", children: /* @__PURE__ */ s(A, { children: /* @__PURE__ */ j(N.Provider, { value: { editor: e }, children: [
233
- /* @__PURE__ */ s($, { delayDuration: 0, disableHoverableContent: !0, children: n }),
232
+ }, [t, e]), e ? /* @__PURE__ */ s("div", { className: "reactjs-tiptap-editor", children: /* @__PURE__ */ s(A, { children: /* @__PURE__ */ T(j.Provider, { value: { editor: e }, children: [
233
+ /* @__PURE__ */ s(O, { delayDuration: 0, disableHoverableContent: !0, children: n }),
234
234
  /* @__PURE__ */ s(L, { editor: e }),
235
- /* @__PURE__ */ s(O, {}),
236
- /* @__PURE__ */ s(V, {})
235
+ /* @__PURE__ */ s($, {}),
236
+ /* @__PURE__ */ s(Y, {})
237
237
  ] }) }) }) : /* @__PURE__ */ s(f, {});
238
238
  }
239
239
  export {
240
- W as RichTextProvider
240
+ k as RichTextProvider
241
241
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BpLw6ebr.cjs");exports.en=e.locale;exports.fi=e.locale$1;exports.hu_HU=e.locale$2;exports.ja=e.locale$3;exports.localeActions=e.localeActions;exports.pt_BR=e.locale$4;exports.useLocale=e.useLocale;exports.vi=e.locale$5;exports.zh_CN=e.locale$6;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CwbGrQFa.cjs");exports.en=e.locale;exports.fi=e.locale$1;exports.hu_HU=e.locale$2;exports.ja=e.locale$3;exports.localeActions=e.localeActions;exports.pt_BR=e.locale$4;exports.useLocale=e.useLocale;exports.vi=e.locale$5;exports.zh_CN=e.locale$6;
@@ -1,4 +1,4 @@
1
- import { l as e, a as o, b as c, c as l, d as f, e as i, u as t, f as u, g as _ } from "./index-DtyAGMbq.js";
1
+ import { l as e, a as o, b as c, c as l, d as f, e as i, u as t, f as u, g as _ } from "./index-DKruDABV.js";
2
2
  export {
3
3
  e as en,
4
4
  o as fi,
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-popover";
3
3
  import * as c from "react";
4
- import { c as s } from "./index-C52cuQ_Y.js";
4
+ import { c as s } from "./index-DRcwHivm.js";
5
5
  const x = t.Root, p = t.Trigger, n = c.forwardRef(({ className: o, align: r = "center", sideOffset: i = 4, ...a }, d) => /* @__PURE__ */ e(t.Portal, { children: /* @__PURE__ */ e(
6
6
  t.Content,
7
7
  {
@@ -1 +1 @@
1
- "use strict";const a=require("react/jsx-runtime"),d=require("@radix-ui/react-popover"),p=require("react"),h=require("./index-aujjnfSJ.cjs");function n(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const o=n(d),l=n(p),x=o.Root,m=o.Trigger,c=l.forwardRef(({className:t,align:r="center",sideOffset:e=4,...i},s)=>a.jsx(o.Portal,{children:a.jsx(o.Content,{align:r,"data-richtext-portal":!0,ref:s,sideOffset:e,className:h.cn("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...i})}));c.displayName=o.Content.displayName;exports.Popover=x;exports.PopoverContent=c;exports.PopoverTrigger=m;
1
+ "use strict";const a=require("react/jsx-runtime"),d=require("@radix-ui/react-popover"),p=require("react"),h=require("./index-BO82_0q8.cjs");function n(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const o=n(d),l=n(p),x=o.Root,m=o.Trigger,c=l.forwardRef(({className:t,align:r="center",sideOffset:e=4,...i},s)=>a.jsx(o.Portal,{children:a.jsx(o.Content,{align:r,"data-richtext-portal":!0,ref:s,sideOffset:e,className:h.cn("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...i})}));c.displayName=o.Content.displayName;exports.Popover=x;exports.PopoverContent=c;exports.PopoverTrigger=m;
@@ -1 +1 @@
1
- "use strict";const i=require("./clsx-DRbkQ4T7.cjs"),r=require("./updatePosition-B1oRJE1x.cjs");function d(o){return()=>{let e;return{onStart:t=>{t.clientRect&&(e=new i.ReactRenderer(o,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),r.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&r.updatePosition(t.editor,e.element)},onKeyDown(t){var n;return t.event.key==="Escape"?(e.destroy(),e.element.remove(),!0):(n=e.ref)==null?void 0:n.onKeyDown(t)},onExit(){e.destroy(),e.element.remove()}}}}exports.renderNodeViewClosure=d;
1
+ "use strict";const i=require("./clsx-DJURdKPs.cjs"),r=require("./updatePosition-D_D-TbEu.cjs");function d(o){return()=>{let e;return{onStart:t=>{t.clientRect&&(e=new i.ReactRenderer(o,{props:t,editor:t.editor}),e.element.style.position="absolute",document.body.appendChild(e.element),r.updatePosition(t.editor,e.element))},onUpdate(t){e.updateProps(t),t.clientRect&&r.updatePosition(t.editor,e.element)},onKeyDown(t){var n;return t.event.key==="Escape"?(e.destroy(),e.element.remove(),!0):(n=e.ref)==null?void 0:n.onKeyDown(t)},onExit(){e.destroy(),e.element.remove()}}}}exports.renderNodeViewClosure=d;
@@ -1,5 +1,5 @@
1
- import { R as i } from "./clsx-_bq4MQQ7.js";
2
- import { u as r } from "./updatePosition-CFTYKYNJ.js";
1
+ import { R as i } from "./clsx-b_2OwHLk.js";
2
+ import { u as r } from "./updatePosition-DY1jI7qb.js";
3
3
  function l(o) {
4
4
  return () => {
5
5
  let e;
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),E=require("lucide-react"),n=require("react"),P=require("react-colorful"),j=require("./index-aujjnfSJ.cjs");require("./theme.cjs");const v=require("./popover-CrywEkBR.cjs"),O=require("@radix-ui/react-separator"),C=require("./index-BpLw6ebr.cjs");function N(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const h=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(r,c,h.get?h:{enumerable:!0,get:()=>t[c]})}}return r.default=t,Object.freeze(r)}const y=N(n),z=N(O);function R(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5L5.27 5.27L4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6c1.52 0 2.9-.57 3.96-1.5l2.63 2.63l1.27-1.27z"})})}const w=typeof window>"u";function L(t,r,c=window){const h=n.useRef(void 0);n.useEffect(()=>{h.current=r},[r]),n.useEffect(()=>{if(!(c&&c.addEventListener))return;const f=x=>{h.current&&h.current(x)};return c.addEventListener(t,f),()=>{c.removeEventListener(t,f)}},[t,c])}function _(t,r,c={}){const{initializeWithValue:h=!0}=c,i=n.useCallback(o=>c.serializer?c.serializer(o):JSON.stringify(o),[c]),f=n.useCallback(o=>{if(c.deserializer)return c.deserializer(o);if(o==="undefined")return;const l=r instanceof Function?r():r;let s;try{s=JSON.parse(o)}catch(a){return console.error("Error parsing JSON:",a),l}return s},[c,r]),x=n.useCallback(()=>{const o=r instanceof Function?r():r;if(w)return o;try{const l=window.localStorage.getItem(t);return l?f(l):o}catch(l){return console.warn(`Error reading localStorage key “${t}”:`,l),o}},[r,t,f]),[d,p]=n.useState(()=>h?x():r instanceof Function?r():r),b=n.useCallback(o=>{w&&console.warn(`Tried setting localStorage key “${t}” even though environment is not a client`);try{const l=o instanceof Function?o(x()):o;window.localStorage.setItem(t,i(l)),p(l),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))}catch(l){console.warn(`Error setting localStorage key “${t}”:`,l)}},[t,i,x]),g=n.useCallback(()=>{w&&console.warn(`Tried removing localStorage key “${t}” even though environment is not a client`);const o=r instanceof Function?r():r;window.localStorage.removeItem(t),p(o),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))},[t,r]);n.useEffect(()=>{p(x())},[t]);const m=n.useCallback(o=>{o.key&&o.key!==t||p(x())},[t,x]);return L("storage",m),L("local-storage",m),[d,b,g]}function q(t){const{t:r}=C.useLocale(),{disabled:c=!1,value:h,onChange:i,colors:f=C.COLORS_LIST,highlight:x}=t,[d,p]=n.useState(!1),b=n.useMemo(()=>{const s=f,a=[];for(let u=0;u<s.length;u+=10)a.push(s.slice(u,u+10));return a},[f]),[g,m]=_(x?"richtext-recent-highlight":"richtext-recent-colors",[]),o=s=>{const a=[...g],u=a.indexOf(s);u!==-1&&a.splice(u,1),a.unshift(s),a.length>10&&a.pop(),m(a)};function l(s){if(s===void 0){i==null||i(s),p(!1);return}/^#([\da-f]{3}){1,2}$/i.test(s)&&(i==null||i(s),o(s),p(!1))}return e.jsxs(v.Popover,{modal:!0,onOpenChange:p,open:d,children:[e.jsx(v.PopoverTrigger,{asChild:!0,className:"!richtext-p-0",disabled:c,children:t==null?void 0:t.children}),e.jsx(v.PopoverContent,{align:"start",className:"richtext-size-full !richtext-p-2",hideWhenDetached:!0,side:"bottom",children:e.jsxs("div",{className:"richtext-flex richtext-flex-col",children:[e.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>{l(void 0)},children:[e.jsx(R,{}),e.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:r(x?"editor.nofill":"editor.default")})]}),b.map((s,a)=>e.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:s.map((u,k)=>e.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-solid !richtext-border-transparent richtext-p-0.5 hover:!richtext-border-border",onClick:()=>l(u),children:e.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px]",style:{backgroundColor:u},children:u===h?e.jsx("svg",{className:"richtext-absolute -richtext-top-px richtext-left-px richtext-block richtext-size-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):e.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${k}`))},`color-row-${a}`)),e.jsxs("div",{children:[e.jsx("div",{className:"richtext-my-1 richtext-text-sm",children:r("editor.recent")}),e.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-flex-wrap richtext-p-0 last:richtext-pb-2",children:g==null?void 0:g.map((s,a)=>e.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>l(s),children:e.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:s},children:e.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-recent-${a}`))})]}),e.jsx(M,{setColor:l})]})})]})}function M({setColor:t}){const{t:r}=C.useLocale(),[c,h]=n.useState(!1),[i,f]=n.useState("#000000"),x=n.useCallback(d=>{f(d)},[]);return e.jsxs(v.Popover,{onOpenChange:h,open:c,children:[e.jsx(v.PopoverTrigger,{asChild:!0,children:e.jsxs("div",{className:"richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent",children:[r("editor.color.more"),"..."]})}),e.jsxs(v.PopoverContent,{children:[e.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-justify-center",children:[e.jsx(P.HexColorPicker,{color:i,onChange:d=>{x(d)}}),e.jsx(j.Input,{className:"richtext-mt-[8px] richtext-w-full",type:"text",value:i.replace("#",""),onChange:d=>{d.preventDefault(),d.stopPropagation(),x(`#${d.target.value}`)}})]}),e.jsx(S,{className:"richtext-my-[10px]"}),e.jsx(j.Button,{className:"richtext-w-full",onClick:d=>{d.preventDefault(),d.stopPropagation(),t(i),h(!1)},children:e.jsx(E.Plus,{size:16})})]})]})}const S=y.forwardRef(({className:t,orientation:r="horizontal",decorative:c=!0,...h},i)=>e.jsx(z.Root,{ref:i,decorative:c,orientation:r,className:j.cn("richtext-shrink-0 richtext-bg-border",r==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",t),...h}));S.displayName=z.Root.displayName;exports.ColorPicker=q;exports.Separator=S;
1
+ "use strict";const e=require("react/jsx-runtime"),E=require("lucide-react"),n=require("react"),P=require("react-colorful"),j=require("./index-BO82_0q8.cjs");require("./theme.cjs");const C=require("./index-CwbGrQFa.cjs"),v=require("./popover-Bl1kxRJX.cjs"),O=require("@radix-ui/react-separator");function N(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const h=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(r,c,h.get?h:{enumerable:!0,get:()=>t[c]})}}return r.default=t,Object.freeze(r)}const y=N(n),z=N(O);function R(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5L5.27 5.27L4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6c1.52 0 2.9-.57 3.96-1.5l2.63 2.63l1.27-1.27z"})})}const w=typeof window>"u";function L(t,r,c=window){const h=n.useRef(void 0);n.useEffect(()=>{h.current=r},[r]),n.useEffect(()=>{if(!(c&&c.addEventListener))return;const f=x=>{h.current&&h.current(x)};return c.addEventListener(t,f),()=>{c.removeEventListener(t,f)}},[t,c])}function _(t,r,c={}){const{initializeWithValue:h=!0}=c,i=n.useCallback(o=>c.serializer?c.serializer(o):JSON.stringify(o),[c]),f=n.useCallback(o=>{if(c.deserializer)return c.deserializer(o);if(o==="undefined")return;const l=r instanceof Function?r():r;let s;try{s=JSON.parse(o)}catch(a){return console.error("Error parsing JSON:",a),l}return s},[c,r]),x=n.useCallback(()=>{const o=r instanceof Function?r():r;if(w)return o;try{const l=window.localStorage.getItem(t);return l?f(l):o}catch(l){return console.warn(`Error reading localStorage key “${t}”:`,l),o}},[r,t,f]),[d,p]=n.useState(()=>h?x():r instanceof Function?r():r),b=n.useCallback(o=>{w&&console.warn(`Tried setting localStorage key “${t}” even though environment is not a client`);try{const l=o instanceof Function?o(x()):o;window.localStorage.setItem(t,i(l)),p(l),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))}catch(l){console.warn(`Error setting localStorage key “${t}”:`,l)}},[t,i,x]),g=n.useCallback(()=>{w&&console.warn(`Tried removing localStorage key “${t}” even though environment is not a client`);const o=r instanceof Function?r():r;window.localStorage.removeItem(t),p(o),window.dispatchEvent(new StorageEvent("local-storage",{key:t}))},[t,r]);n.useEffect(()=>{p(x())},[t]);const m=n.useCallback(o=>{o.key&&o.key!==t||p(x())},[t,x]);return L("storage",m),L("local-storage",m),[d,b,g]}function q(t){const{t:r}=C.useLocale(),{disabled:c=!1,value:h,onChange:i,colors:f=C.COLORS_LIST,highlight:x}=t,[d,p]=n.useState(!1),b=n.useMemo(()=>{const s=f,a=[];for(let u=0;u<s.length;u+=10)a.push(s.slice(u,u+10));return a},[f]),[g,m]=_(x?"richtext-recent-highlight":"richtext-recent-colors",[]),o=s=>{const a=[...g],u=a.indexOf(s);u!==-1&&a.splice(u,1),a.unshift(s),a.length>10&&a.pop(),m(a)};function l(s){if(s===void 0){i==null||i(s),p(!1);return}/^#([\da-f]{3}){1,2}$/i.test(s)&&(i==null||i(s),o(s),p(!1))}return e.jsxs(v.Popover,{modal:!0,onOpenChange:p,open:d,children:[e.jsx(v.PopoverTrigger,{asChild:!0,className:"!richtext-p-0",disabled:c,children:t==null?void 0:t.children}),e.jsx(v.PopoverContent,{align:"start",className:"richtext-size-full !richtext-p-2",hideWhenDetached:!0,side:"bottom",children:e.jsxs("div",{className:"richtext-flex richtext-flex-col",children:[e.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>{l(void 0)},children:[e.jsx(R,{}),e.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:r(x?"editor.nofill":"editor.default")})]}),b.map((s,a)=>e.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:s.map((u,k)=>e.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-solid !richtext-border-transparent richtext-p-0.5 hover:!richtext-border-border",onClick:()=>l(u),children:e.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px]",style:{backgroundColor:u},children:u===h?e.jsx("svg",{className:"richtext-absolute -richtext-top-px richtext-left-px richtext-block richtext-size-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):e.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${k}`))},`color-row-${a}`)),e.jsxs("div",{children:[e.jsx("div",{className:"richtext-my-1 richtext-text-sm",children:r("editor.recent")}),e.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-flex-wrap richtext-p-0 last:richtext-pb-2",children:g==null?void 0:g.map((s,a)=>e.jsx("span",{className:"richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",onClick:()=>l(s),children:e.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:s},children:e.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:e.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-recent-${a}`))})]}),e.jsx(M,{setColor:l})]})})]})}function M({setColor:t}){const{t:r}=C.useLocale(),[c,h]=n.useState(!1),[i,f]=n.useState("#000000"),x=n.useCallback(d=>{f(d)},[]);return e.jsxs(v.Popover,{onOpenChange:h,open:c,children:[e.jsx(v.PopoverTrigger,{asChild:!0,children:e.jsxs("div",{className:"richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent",children:[r("editor.color.more"),"..."]})}),e.jsxs(v.PopoverContent,{children:[e.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-justify-center",children:[e.jsx(P.HexColorPicker,{color:i,onChange:d=>{x(d)}}),e.jsx(j.Input,{className:"richtext-mt-[8px] richtext-w-full",type:"text",value:i.replace("#",""),onChange:d=>{d.preventDefault(),d.stopPropagation(),x(`#${d.target.value}`)}})]}),e.jsx(S,{className:"richtext-my-[10px]"}),e.jsx(j.Button,{className:"richtext-w-full",onClick:d=>{d.preventDefault(),d.stopPropagation(),t(i),h(!1)},children:e.jsx(E.Plus,{size:16})})]})]})}const S=y.forwardRef(({className:t,orientation:r="horizontal",decorative:c=!0,...h},i)=>e.jsx(z.Root,{ref:i,decorative:c,orientation:r,className:j.cn("richtext-shrink-0 richtext-bg-border",r==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",t),...h}));S.displayName=z.Root.displayName;exports.ColorPicker=q;exports.Separator=S;
@@ -3,11 +3,11 @@ import { Plus as P } from "lucide-react";
3
3
  import * as $ from "react";
4
4
  import { useCallback as m, useState as w, useEffect as L, useRef as M, useMemo as B } from "react";
5
5
  import { HexColorPicker as F } from "react-colorful";
6
- import { k as I, B as _, c as T } from "./index-C52cuQ_Y.js";
6
+ import { k as I, B as _, c as T } from "./index-DRcwHivm.js";
7
7
  import "./theme.js";
8
- import { P as N, a as z, b as E } from "./popover-BB-ZDnqk.js";
9
- import * as y from "@radix-ui/react-separator";
10
- import { u as R, C as j } from "./index-DtyAGMbq.js";
8
+ import { u as N, C as j } from "./index-DKruDABV.js";
9
+ import { P as z, a as E, b as y } from "./popover-Beieacfy.js";
10
+ import * as R from "@radix-ui/react-separator";
11
11
  function D() {
12
12
  return /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ t(
13
13
  "path",
@@ -102,7 +102,7 @@ function J(e, r, c = {}) {
102
102
  return S("storage", v), S("local-storage", v), [h, b, g];
103
103
  }
104
104
  function X(e) {
105
- const { t: r } = R(), { disabled: c = !1, value: d, onChange: n, colors: u = j, highlight: a } = e, [h, f] = w(!1), b = B(() => {
105
+ const { t: r } = N(), { disabled: c = !1, value: d, onChange: n, colors: u = j, highlight: a } = e, [h, f] = w(!1), b = B(() => {
106
106
  const i = u, l = [];
107
107
  for (let x = 0; x < i.length; x += 10)
108
108
  l.push(i.slice(x, x + 10));
@@ -121,10 +121,10 @@ function X(e) {
121
121
  }
122
122
  /^#([\da-f]{3}){1,2}$/i.test(i) && (n == null || n(i), o(i), f(!1));
123
123
  }
124
- return /* @__PURE__ */ p(N, { modal: !0, onOpenChange: f, open: h, children: [
125
- /* @__PURE__ */ t(z, { asChild: !0, className: "!richtext-p-0", disabled: c, children: e == null ? void 0 : e.children }),
124
+ return /* @__PURE__ */ p(z, { modal: !0, onOpenChange: f, open: h, children: [
125
+ /* @__PURE__ */ t(E, { asChild: !0, className: "!richtext-p-0", disabled: c, children: e == null ? void 0 : e.children }),
126
126
  /* @__PURE__ */ t(
127
- E,
127
+ y,
128
128
  {
129
129
  align: "start",
130
130
  className: "richtext-size-full !richtext-p-2",
@@ -227,15 +227,15 @@ function X(e) {
227
227
  ] });
228
228
  }
229
229
  function Z({ setColor: e }) {
230
- const { t: r } = R(), [c, d] = w(!1), [n, u] = w("#000000"), a = m((h) => {
230
+ const { t: r } = N(), [c, d] = w(!1), [n, u] = w("#000000"), a = m((h) => {
231
231
  u(h);
232
232
  }, []);
233
- return /* @__PURE__ */ p(N, { onOpenChange: d, open: c, children: [
234
- /* @__PURE__ */ t(z, { asChild: !0, children: /* @__PURE__ */ p("div", { className: "richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent", children: [
233
+ return /* @__PURE__ */ p(z, { onOpenChange: d, open: c, children: [
234
+ /* @__PURE__ */ t(E, { asChild: !0, children: /* @__PURE__ */ p("div", { className: "richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent", children: [
235
235
  r("editor.color.more"),
236
236
  "..."
237
237
  ] }) }),
238
- /* @__PURE__ */ p(E, { children: [
238
+ /* @__PURE__ */ p(y, { children: [
239
239
  /* @__PURE__ */ p("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-justify-center", children: [
240
240
  /* @__PURE__ */ t(
241
241
  F,
@@ -273,7 +273,7 @@ function Z({ setColor: e }) {
273
273
  ] });
274
274
  }
275
275
  const k = $.forwardRef(({ className: e, orientation: r = "horizontal", decorative: c = !0, ...d }, n) => /* @__PURE__ */ t(
276
- y.Root,
276
+ R.Root,
277
277
  {
278
278
  ref: n,
279
279
  decorative: c,
@@ -286,7 +286,7 @@ const k = $.forwardRef(({ className: e, orientation: r = "horizontal", decorativ
286
286
  ...d
287
287
  }
288
288
  ));
289
- k.displayName = y.Root.displayName;
289
+ k.displayName = R.Root.displayName;
290
290
  export {
291
291
  X as C,
292
292
  k as S