reactjs-tiptap-editor 0.3.29 → 0.3.30

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 (222) hide show
  1. package/lib/{ActionMenuButton-Cs9DM_16.js → ActionMenuButton-B6fitGKu.js} +1 -1
  2. package/lib/{ActionMenuButton-5Y8QcYxD.cjs → ActionMenuButton-wiDnIxE2.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +19 -19
  5. package/lib/Attachment.d.ts +19 -19
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +19 -19
  9. package/lib/Blockquote.d.ts +19 -19
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +19 -19
  13. package/lib/Bold.d.ts +19 -19
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +19 -19
  17. package/lib/BulletList.d.ts +19 -19
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +19 -19
  21. package/lib/Clear.d.ts +19 -19
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +19 -19
  25. package/lib/Code.d.ts +19 -19
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +19 -19
  29. package/lib/CodeBlock.d.ts +19 -19
  30. package/lib/CodeBlock.js +1 -1
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +19 -19
  33. package/lib/CodeView.d.ts +19 -19
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +19 -19
  37. package/lib/Color.d.ts +19 -19
  38. package/lib/Color.js +1 -1
  39. package/lib/Document.d.cts +19 -19
  40. package/lib/Document.d.ts +19 -19
  41. package/lib/{Drawer-BCmNLh31.js → Drawer-BKTU9CpU.js} +1 -1
  42. package/lib/{Drawer-DCAp7eZF.cjs → Drawer-CmoEF-Zg.cjs} +1 -1
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +19 -19
  45. package/lib/Drawer.d.ts +19 -19
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +19 -19
  49. package/lib/Emoji.d.ts +19 -19
  50. package/lib/Emoji.js +1 -1
  51. package/lib/{Excalidraw-CYPcjYZB.js → Excalidraw-CM74U5tG.js} +1 -1
  52. package/lib/{Excalidraw-BI50RQL-.cjs → Excalidraw-DAPP9qgY.cjs} +1 -1
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +19 -19
  55. package/lib/Excalidraw.d.ts +19 -19
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +19 -19
  59. package/lib/ExportPdf.d.ts +19 -19
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +19 -19
  63. package/lib/ExportWord.d.ts +19 -19
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +19 -19
  67. package/lib/FontFamily.d.ts +19 -19
  68. package/lib/FontFamily.js +2 -2
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +19 -19
  71. package/lib/FontSize.d.ts +19 -19
  72. package/lib/FontSize.js +2 -2
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +19 -19
  75. package/lib/FormatPainter.d.ts +19 -19
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +19 -19
  79. package/lib/Heading.d.ts +19 -19
  80. package/lib/Heading.js +2 -2
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +19 -19
  83. package/lib/Highlight.d.ts +19 -19
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +19 -19
  87. package/lib/History.d.ts +19 -19
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +19 -19
  91. package/lib/HorizontalRule.d.ts +19 -19
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +19 -19
  95. package/lib/Iframe.d.ts +19 -19
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +19 -19
  99. package/lib/Image.d.ts +19 -19
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +19 -19
  103. package/lib/ImageGif.d.ts +19 -19
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +1 -1
  106. package/lib/ImportWord.d.cts +19 -19
  107. package/lib/ImportWord.d.ts +19 -19
  108. package/lib/ImportWord.js +1 -1
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +19 -19
  111. package/lib/Indent.d.ts +19 -19
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +19 -19
  115. package/lib/Italic.d.ts +19 -19
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +19 -19
  119. package/lib/Katex.d.ts +19 -19
  120. package/lib/Katex.js +2 -2
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +19 -19
  123. package/lib/LineHeight.d.ts +19 -19
  124. package/lib/LineHeight.js +1 -1
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +19 -19
  127. package/lib/Link.d.ts +19 -19
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +19 -19
  130. package/lib/ListItem.d.ts +19 -19
  131. package/lib/Mention.d.cts +19 -19
  132. package/lib/Mention.d.ts +19 -19
  133. package/lib/Mermaid.cjs +1 -1
  134. package/lib/Mermaid.d.cts +19 -19
  135. package/lib/Mermaid.d.ts +19 -19
  136. package/lib/Mermaid.js +2 -2
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +19 -19
  139. package/lib/MoreMark.d.ts +19 -19
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +19 -19
  143. package/lib/MultiColumn.d.ts +19 -19
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +19 -19
  147. package/lib/OrderedList.d.ts +19 -19
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-e6q30rbV.js → RichTextEditor-BQN2eLD_.js} +3 -5
  150. package/lib/{RichTextEditor-DsUcQSbm.cjs → RichTextEditor-C8Sm1E6J.cjs} +1 -1
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +19 -19
  153. package/lib/SearchAndReplace.d.ts +19 -19
  154. package/lib/SearchAndReplace.js +1 -1
  155. package/lib/Selection.d.cts +19 -19
  156. package/lib/Selection.d.ts +19 -19
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +19 -19
  159. package/lib/SlashCommand.d.ts +19 -19
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +19 -19
  163. package/lib/Strike.d.ts +19 -19
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +19 -19
  167. package/lib/SubAndSuperScript.d.ts +19 -19
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +19 -19
  171. package/lib/Table.d.ts +19 -19
  172. package/lib/Table.js +1 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +19 -19
  175. package/lib/TableOfContent.d.ts +19 -19
  176. package/lib/TableOfContent.js +1 -1
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +19 -19
  179. package/lib/TaskList.d.ts +19 -19
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +19 -19
  183. package/lib/TextAlign.d.ts +19 -19
  184. package/lib/TextAlign.js +1 -1
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +19 -19
  187. package/lib/TextBubble.d.ts +19 -19
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +19 -19
  191. package/lib/TextDirection.d.ts +19 -19
  192. package/lib/TextDirection.js +1 -1
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +19 -19
  195. package/lib/TextUnderline.d.ts +19 -19
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +19 -19
  198. package/lib/TrailingNode.d.ts +19 -19
  199. package/lib/{Twitter-D2Osj8qP.cjs → Twitter-CL2pu4QM.cjs} +1 -1
  200. package/lib/{Twitter-Wb7cD3M-.js → Twitter-Dg6WWauX.js} +1 -1
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +19 -19
  203. package/lib/Twitter.d.ts +19 -19
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +19 -19
  207. package/lib/Video.d.ts +19 -19
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +19 -19
  211. package/lib/bubble-extra.d.ts +19 -19
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +19 -19
  215. package/lib/index.d.ts +19 -19
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +19 -19
  218. package/lib/locale-bundle.d.ts +19 -19
  219. package/lib/style.css +1 -1
  220. package/lib/{textarea-Csmx5x-_.js → textarea-BglwYF6b.js} +1 -1
  221. package/lib/{textarea-BVbzd9-k.cjs → textarea-D5WVZMgt.cjs} +1 -1
  222. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  `,H0="️",q0="‍",ii="";let Lr=null,$r=null;function F0(e=[]){const t={};Ee.groups=t;const r=new Ee;Lr==null&&(Lr=ec(L0)),$r==null&&($r=ec($0)),R(r,"'",Pa),R(r,"{",or),R(r,"}",ar),R(r,"[",Yr),R(r,"]",Jr),R(r,"(",Zr),R(r,")",Qr),R(r,"<",en),R(r,">",tn),R(r,"(",rn),R(r,")",nn),R(r,"「",on),R(r,"」",an),R(r,"『",sn),R(r,"』",cn),R(r,"<",ln),R(r,">",un),R(r,"&",dn),R(r,"*",fn),R(r,"@",mt),R(r,"`",pn),R(r,"^",mn),R(r,":",gt),R(r,",",ka),R(r,"$",gn),R(r,".",He),R(r,"=",xn),R(r,"!",Na),R(r,"-",ke),R(r,"%",sr),R(r,"|",vn),R(r,"+",yn),R(r,"#",bn),R(r,"?",cr),R(r,'"',Ma),R(r,"/",qe),R(r,";",La),R(r,"~",lr),R(r,"_",wn),R(r,"\\",hn),R(r,"・",td);const n=pe(r,et,Ra,{[aa]:!0});pe(n,et,n);const i=pe(n,Qe,Qu,{[ir]:!0}),o=pe(n,er,ed,{[rr]:!0}),a=pe(r,Qe,tt,{[sa]:!0});pe(a,et,i),pe(a,Qe,a),pe(i,et,i),pe(i,Qe,i);const s=pe(r,er,ua,{[ca]:!0});pe(s,Qe),pe(s,et,o),pe(s,er,s),pe(o,et,o),pe(o,Qe),pe(o,er,o);const l=R(r,ni,Oa,{[ei]:!0}),u=R(r,Qs,ha,{[ei]:!0}),f=pe(r,ri,ha,{[ei]:!0});R(r,ii,f),R(u,ni,l),R(u,ii,f),pe(u,ri,f),R(f,Qs),R(f,ni),pe(f,ri,f),R(f,ii,f);const d=pe(r,ti,rd,{[Zu]:!0});R(d,"#"),pe(d,ti,d),R(d,H0,d);const h=R(d,q0);R(h,"#"),pe(h,ti,d);const p=[[Qe,a],[et,i]],m=[[Qe,null],[er,s],[et,o]];for(let x=0;x<Lr.length;x++)ht(r,Lr[x],da,tt,p);for(let x=0;x<$r.length;x++)ht(r,$r[x],fa,ua,m);At(da,{tld:!0,ascii:!0},t),At(fa,{utld:!0,alpha:!0},t),ht(r,"file",Fr,tt,p),ht(r,"mailto",Fr,tt,p),ht(r,"http",Lt,tt,p),ht(r,"https",Lt,tt,p),ht(r,"ftp",Lt,tt,p),ht(r,"ftps",Lt,tt,p),At(Fr,{scheme:!0,ascii:!0},t),At(Lt,{slashscheme:!0,ascii:!0},t),e=e.sort((x,g)=>x[0]>g[0]?1:-1);for(let x=0;x<e.length;x++){const g=e[x][0],S=e[x][1]?{[_0]:!0}:{[D0]:!0};g.indexOf("-")>=0?S[la]=!0:Qe.test(g)?et.test(g)?S[ir]=!0:S[sa]=!0:S[aa]=!0,Zs(r,g,g,S)}return Zs(r,"localhost",mr,{ascii:!0}),r.jd=new Ee(Sn),{start:r,tokens:zt({groups:t},nd)}}function id(e,t){const r=U0(t.replace(/[A-Z]/g,s=>s.toLowerCase())),n=r.length,i=[];let o=0,a=0;for(;a<n;){let s=e,l=null,u=0,f=null,d=-1,h=-1;for(;a<n&&(l=s.go(r[a]));)s=l,s.accepts()?(d=0,h=0,f=s):d>=0&&(d+=r[a].length,h++),u+=r[a].length,o+=r[a].length,a++;o-=d,a-=h,u-=d,i.push({t:f.t,v:t.slice(o-u,o),s:o-u,e:o})}return i}function U0(e){const t=[],r=e.length;let n=0;for(;n<r;){let i=e.charCodeAt(n),o,a=i<55296||i>56319||n+1===r||(o=e.charCodeAt(n+1))<56320||o>57343?e[n]:e.slice(n,n+2);t.push(a),n+=a.length}return t}function ht(e,t,r,n,i){let o;const a=t.length;for(let s=0;s<a-1;s++){const l=t[s];e.j[l]?o=e.j[l]:(o=new Ee(n),o.jr=i.slice(),e.j[l]=o),e=o}return o=new Ee(r),o.jr=i.slice(),e.j[t[a-1]]=o,o}function ec(e){const t=[],r=[];let n=0,i="0123456789";for(;n<e.length;){let o=0;for(;i.indexOf(e[n+o])>=0;)o++;if(o>0){t.push(r.join(""));for(let a=parseInt(e.substring(n,n+o),10);a>0;a--)r.pop();n+=o}else r.push(e[n]),n++}return t}const gr={defaultProtocol:"http",events:null,format:tc,formatHref:tc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function $a(e,t=null){let r=zt({},gr);e&&(r=zt(r,e instanceof $a?e.o:e));const n=r.ignoreTags,i=[];for(let o=0;o<n.length;o++)i.push(n[o].toUpperCase());this.o=r,t&&(this.defaultRender=t),this.ignoreTags=i}$a.prototype={o:gr,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,r){const n=t!=null;let i=this.o[e];return i&&(typeof i=="object"?(i=r.t in i?i[r.t]:gr[e],typeof i=="function"&&n&&(i=i(t,r))):typeof i=="function"&&n&&(i=i(t,r.t,r)),i)},getObj(e,t,r){let n=this.o[e];return typeof n=="function"&&t!=null&&(n=n(t,r.t,r)),n},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function tc(e){return e}function od(e,t){this.t="token",this.v=e,this.tk=t}od.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),r=e.get("truncate",t,this),n=e.get("format",t,this);return r&&n.length>r?n.substring(0,r)+"…":n},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=gr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,r=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",r,this),i=e.get("tagName",r,t),o=this.toFormattedString(e),a={},s=e.get("className",r,t),l=e.get("target",r,t),u=e.get("rel",r,t),f=e.getObj("attributes",r,t),d=e.getObj("events",r,t);return a.href=n,s&&(a.class=s),l&&(a.target=l),u&&(a.rel=u),f&&zt(a,f),{tagName:i,attributes:a,content:o,eventListeners:d}}};function En(e,t){class r extends od{constructor(i,o){super(i,o),this.t=e}}for(const n in t)r.prototype[n]=t[n];return r.t=e,r}const rc=En("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),nc=En("text"),W0=En("nl"),_r=En("url",{isLink:!0,toHref(e=gr.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==mr&&e[1].t===gt}}),Pe=e=>new Ee(e);function G0({groups:e}){const t=e.domain.concat([dn,fn,mt,hn,pn,mn,gn,xn,ke,Ra,sr,vn,yn,bn,qe,Sn,lr,wn]),r=[gt,ka,He,Na,sr,cr,Ma,La,en,tn,or,ar,Jr,Yr,Zr,Qr,rn,nn,on,an,sn,cn,ln,un],n=[dn,Pa,fn,hn,pn,mn,gn,xn,ke,or,ar,sr,vn,yn,bn,cr,qe,Sn,lr,wn],i=Pe(),o=R(i,lr);Z(o,n,o),Z(o,e.domain,o);const a=Pe(),s=Pe(),l=Pe();Z(i,e.domain,a),Z(i,e.scheme,s),Z(i,e.slashscheme,l),Z(a,n,o),Z(a,e.domain,a);const u=R(a,mt);R(o,mt,u),R(s,mt,u),R(l,mt,u);const f=R(o,He);Z(f,n,o),Z(f,e.domain,o);const d=Pe();Z(u,e.domain,d),Z(d,e.domain,d);const h=R(d,He);Z(h,e.domain,d);const p=Pe(rc);Z(h,e.tld,p),Z(h,e.utld,p),R(u,mr,p);const m=R(d,ke);R(m,ke,m),Z(m,e.domain,d),Z(p,e.domain,d),R(p,He,h),R(p,ke,m);const x=R(p,gt);Z(x,e.numeric,rc);const g=R(a,ke),v=R(a,He);R(g,ke,g),Z(g,e.domain,a),Z(v,n,o),Z(v,e.domain,a);const S=Pe(_r);Z(v,e.tld,S),Z(v,e.utld,S),Z(S,e.domain,a),Z(S,n,o),R(S,He,v),R(S,ke,g),R(S,mt,u);const j=R(S,gt),E=Pe(_r);Z(j,e.numeric,E);const C=Pe(_r),k=Pe();Z(C,t,C),Z(C,r,k),Z(k,t,C),Z(k,r,k),R(S,qe,C),R(E,qe,C);const L=R(s,gt),N=R(l,gt),P=R(N,qe),_=R(P,qe);Z(s,e.domain,a),R(s,He,v),R(s,ke,g),Z(l,e.domain,a),R(l,He,v),R(l,ke,g),Z(L,e.domain,C),R(L,qe,C),R(L,cr,C),Z(_,e.domain,C),Z(_,t,C),R(_,qe,C);const T=[[or,ar],[Yr,Jr],[Zr,Qr],[en,tn],[rn,nn],[on,an],[sn,cn],[ln,un]];for(let A=0;A<T.length;A++){const[O,D]=T[A],U=R(C,O);R(k,O,U),R(U,D,C);const H=Pe(_r);Z(U,t,H);const K=Pe();Z(U,r),Z(H,t,H),Z(H,r,K),Z(K,t,H),Z(K,r,K),R(H,D,C),R(K,D,C)}return R(i,mr,S),R(i,Oa,W0),{start:i,tokens:nd}}function V0(e,t,r){let n=r.length,i=0,o=[],a=[];for(;i<n;){let s=e,l=null,u=null,f=0,d=null,h=-1;for(;i<n&&!(l=s.go(r[i].t));)a.push(r[i++]);for(;i<n&&(u=l||s.go(r[i].t));)l=null,s=u,s.accepts()?(h=0,d=s):h>=0&&h++,i++,f++;if(h<0)i-=f,i<n&&(a.push(r[i]),i++);else{a.length>0&&(o.push(oi(nc,t,a)),a=[]),i-=h,f-=h;const p=d.t,m=r.slice(i-f,i);o.push(oi(p,t,m))}}return a.length>0&&o.push(oi(nc,t,a)),o}function oi(e,t,r){const n=r[0].s,i=r[r.length-1].e,o=t.slice(n,i);return new e(o,r)}const K0=typeof console<"u"&&console&&console.warn||(()=>{}),X0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",de={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Y0(){return Ee.groups={},de.scanner=null,de.parser=null,de.tokenQueue=[],de.pluginQueue=[],de.customSchemes=[],de.initialized=!1,de}function ic(e,t=!1){if(de.initialized&&K0(`linkifyjs: already initialized - will not register custom scheme "${e}" ${X0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
3
3
  1. Must only contain digits, lowercase ASCII letters or "-"
4
4
  2. Cannot start or end with "-"
5
- 3. "-" cannot repeat`);de.customSchemes.push([e,t])}function J0(){de.scanner=F0(de.customSchemes);for(let e=0;e<de.tokenQueue.length;e++)de.tokenQueue[e][1]({scanner:de.scanner});de.parser=G0(de.scanner.tokens);for(let e=0;e<de.pluginQueue.length;e++)de.pluginQueue[e][1]({scanner:de.scanner,parser:de.parser});return de.initialized=!0,de}function _a(e){return de.initialized||J0(),V0(de.parser.start,e,id(de.scanner.start,e))}_a.scan=id;function ad(e,t=null,r=null){if(t&&typeof t=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);r=t,t=null}const n=new $a(r),i=_a(e),o=[];for(let a=0;a<i.length;a++){const s=i[a];s.isLink&&(!t||s.t===t)&&n.check(s)&&o.push(s.toFormattedObject(n))}return o}const Da="[\0-   ᠎ -\u2029  ]",Z0=new RegExp(Da),Q0=new RegExp(`${Da}$`),e1=new RegExp(Da,"g");function t1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function r1(e){return new B.Plugin({key:new B.PluginKey("autolink"),appendTransaction:(t,r,n)=>{const i=t.some(u=>u.docChanged)&&!r.doc.eq(n.doc),o=t.some(u=>u.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=n,s=B.combineTransactionSteps(r.doc,[...t]);if(B.getChangedRanges(s).forEach(({newRange:u})=>{const f=B.findChildrenInRange(n.doc,u,p=>p.isTextblock);let d,h;if(f.length>1)d=f[0],h=n.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(f.length){const p=n.doc.textBetween(u.from,u.to," "," ");if(!Q0.test(p))return;d=f[0],h=n.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&h){const p=h.split(Z0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],x=d.pos+h.lastIndexOf(m);if(!m)return!1;const g=_a(m).map(v=>v.toObject(e.defaultProtocol));if(!t1(g))return!1;g.filter(v=>v.isLink).map(v=>({...v,from:x+v.start+1,to:x+v.end+1})).filter(v=>n.schema.marks.code?!n.doc.rangeHasMark(v.from,v.to,n.schema.marks.code):!0).filter(v=>e.validate(v.value)).filter(v=>e.shouldAutoLink(v.value)).forEach(v=>{B.getMarksBetween(v.from,v.to,n.doc).some(S=>S.mark.type===e.type)||a.addMark(v.from,v.to,e.type.create({href:v.href}))})}}),!!a.steps.length)return a}})}function n1(e){return new B.Plugin({key:new B.PluginKey("handleClickLink"),props:{handleClick:(t,r,n)=>{var i,o;if(n.button!==0||!t.editable)return!1;let a=n.target;const s=[];for(;a.nodeName!=="DIV";)s.push(a),a=a.parentNode;if(!s.find(h=>h.nodeName==="A"))return!1;const l=B.getAttributes(t.state,e.type.name),u=n.target,f=(i=u==null?void 0:u.href)!==null&&i!==void 0?i:l.href,d=(o=u==null?void 0:u.target)!==null&&o!==void 0?o:l.target;return u&&f?(window.open(f,d),!0):!1}}})}function i1(e){return new B.Plugin({key:new B.PluginKey("handlePasteLink"),props:{handlePaste:(t,r,n)=>{const{state:i}=t,{selection:o}=i,{empty:a}=o;if(a)return!1;let s="";n.content.forEach(u=>{s+=u.textContent});const l=ad(s,{defaultProtocol:e.defaultProtocol}).find(u=>u.isLink&&u.value===s);return!s||!l?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function wt(e,t){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(n=>{const i=typeof n=="string"?n:n.scheme;i&&r.push(i)}),!e||e.replace(e1,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const o1=B.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){ic(e);return}ic(e.scheme,e.optionalSlashes)})},onDestroy(){Y0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!wt(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:r=>!!wt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!wt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",B.mergeAttributes(this.options.HTMLAttributes,e),0]:["a",B.mergeAttributes(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:r}=e;return this.options.isAllowedUri(r,{defaultValidate:n=>!!wt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:r}=e;return this.options.isAllowedUri(r,{defaultValidate:n=>!!wt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[B.markPasteRule({find:e=>{const t=[];if(e){const{protocols:r,defaultProtocol:n}=this.options,i=ad(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!wt(a,r),protocols:r,defaultProtocol:n}));i.length&&i.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:r}=this.options;return this.options.autolink&&e.push(r1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:i=>!!wt(i,t),protocols:t,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(n1({type:this.type})),this.options.linkOnPaste&&e.push(i1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}});function a1(e){const[t,r]=w.useState(!1);function n(i,o,a){e.action&&(e.action({link:i,text:o,openInNewTab:a}),r(!1))}return c.jsxs(Wt,{modal:!0,open:t,onOpenChange:r,children:[c.jsx(Gt,{disabled:e==null?void 0:e.disabled,asChild:!0,children:c.jsx(W,{tooltip:e==null?void 0:e.tooltip,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:c.jsx(xe,{name:e==null?void 0:e.icon})})}),c.jsx(It,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:c.jsx(cd,{editor:e.editor,onSetLink:n,open:t,target:e.target})})]})}const sd=o1.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",B.mergeAttributes(this.options.HTMLAttributes,e,{class:"link"}),0]},addOptions(){var r,n;const e=((r=this.parent)==null?void 0:r.call(this))||{},t=(n=e.HTMLAttributes)==null?void 0:n.target;return{...e,openOnClick:!0,button:({editor:i,t:o})=>({component:a1,componentProps:{editor:i,action:a=>{const{link:s,text:l,openInNewTab:u}=a;if(!s){i.chain().extendMarkRange("link").unsetLink().run();return}i.isActive("link")&&i.chain().extendMarkRange("link").run();const{from:f}=i.state.selection,d=l.length;i.chain().insertContent({type:"text",text:l,marks:[{type:"link",attrs:{href:s.match(/^https?:\/\//i)?s:`http://${s}`,target:t??(u?"_blank":"")}}]}).setLink({href:s}).setTextSelection({from:f,to:f+d}).focus().run()},id:"linkk",isActive:()=>i.isActive("link")||!1,disabled:!i.can().setLink({href:""}),icon:"Link",tooltip:o("editor.link.tooltip"),target:t}})}},addProseMirrorPlugins(){return[new B.Plugin({props:{handleClick:(e,t)=>{const{schema:r,doc:n,tr:i}=e.state,o=B.getMarkRange(n.resolve(t),r.marks.link);if(!o)return!1;let a=null;if(n.nodesBetween(o.from,o.to,f=>(a=f.marks.find(d=>d.type===r.marks.link),!a)),this.options.openOnClick&&(a!=null&&a.attrs.href)&&t!==o.to)return window.open(a.attrs.href,a.attrs.target||"_self"),!0;const s=n.resolve(o.from),l=n.resolve(o.to),u=i.setSelection(new B.TextSelection(s,l));e.dispatch(u)}}})]}});function cd(e){const{t}=q.useLocale(),[r,n]=w.useState({text:"",link:""}),[i,o]=w.useState(!1),a=w.useRef(null),s=w.useRef(null);w.useEffect(()=>{const u=()=>{var S,j,E,C;const{from:f,to:d,empty:h}=e.editor.state.selection,p=(S=e.editor.extensionManager.extensions.find(k=>k.name===sd.name))==null?void 0:S.options;let m="",x="",g=(j=p==null?void 0:p.HTMLAttributes)==null?void 0:j.target;const v=e.editor.state.doc.nodeAt(f);if(v){const k=v.marks.find(L=>L.type.name==="link");k?(x=k.attrs.href||"",g=k.attrs.target,h?m=v.text||"":m=e.editor.state.doc.textBetween(f,d," ")):m=e.editor.state.doc.textBetween(f,d," ")}v||(m=e.editor.state.doc.textBetween(f,d," ")),n({link:x,text:m}),o(e.target?e.target==="_blank":g==="_blank"),e.open&&(m===""?(E=a.current)==null||E.focus():(C=s.current)==null||C.focus())};return u(),e.editor.on("selectionUpdate",u),()=>{e.editor.off("selectionUpdate",u)}},[e.editor,e.open]);function l(u){u.preventDefault(),u.stopPropagation(),e==null||e.onSetLink(r.link,r.text,i),n({text:"",link:""})}return c.jsx("div",{className:"border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:c.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-2",children:[c.jsx(Ue,{className:"mb-[6px]",children:t("editor.link.dialog.text")}),c.jsx("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:c.jsx(Ie,{ref:a,className:"richtext-w-80",onChange:u=>n({...r,text:u.target.value}),placeholder:"Text",required:!0,type:"text",value:r.text})})}),c.jsx(Ue,{className:"mb-[6px]",children:t("editor.link.dialog.link")}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsxs("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:[c.jsx(Ie,{ref:s,className:"richtext-pl-10",onChange:u=>n({...r,link:u.target.value}),required:!0,type:"url",value:r.link}),c.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2",children:c.jsx(xe,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),!e.target&&c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-space-x-2",children:[c.jsx(Ue,{children:t("editor.link.dialog.openInNewTab")}),c.jsx(Ka,{checked:i,onCheckedChange:u=>{o(u)}})]}),c.jsx(we,{className:"richtext-mt-2 richtext-self-end",onClick:l,type:"button",children:t("editor.link.dialog.button.apply")})]})})}function s1(e){const{t}=q.useLocale();return c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:[c.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"richtext-text-sm richtext-underline richtext-break-all",children:lx(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&c.jsx(Be,{orientation:"vertical",className:"!richtext-h-4"}),c.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[c.jsx(W,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),c.jsx(W,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function c1({editor:e,disabled:t}){const[r,n]=w.useState(!1),i=w.useMemo(()=>{const{href:l}=e.getAttributes("link");return l},[e]),o=w.useCallback(({editor:l})=>l.isActive("link"),[]),a=(l,u,f)=>{const d=e.state.selection,{from:h}=d,p=(u==null?void 0:u.length)??0,m=h+p;e.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:f?"_blank":""}}]}).setLink({href:l}).setTextSelection({from:h,to:m}).focus().run(),n(!1)},s=w.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),n(!1)},[e]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e,shouldShow:o,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n(!1)}},children:t?c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{children:r?c.jsx(cd,{onSetLink:a,editor:e}):c.jsx(s1,{editor:e,onClear:s,onEdit:()=>{n(!0)},link:i})})})})}const l1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ba=B.Node.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",B.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[B.nodeInputRule({find:l1,type:this.type,getAttributes:e=>{const[,,t,r,n]=e;return{src:r,alt:t,title:n}}})]}}),Cr=Ne.Root,jr=Ne.Trigger,u1=Ne.Portal,ld=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Overlay,{ref:r,className:te("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 richtext- 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",e),...t}));ld.displayName=Ne.Overlay.displayName;const Ft=oe.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(u1,{children:[c.jsx(ld,{}),c.jsxs(Ne.Content,{ref:n,className:te("richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 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-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",e),...r,children:[t,c.jsxs(Ne.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[c.jsx(M.X,{className:"richtext-h-4 richtext-w-4"}),c.jsx("span",{className:"richtext-sr-only",children:"Close"})]})]})]}));Ft.displayName=Ne.Content.displayName;function ud({className:e,...t}){return c.jsx("div",{className:te("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",e),...t})}ud.displayName="DialogHeader";function In({className:e,...t}){return c.jsx("div",{className:te("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",e),...t})}In.displayName="DialogFooter";const Ut=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Title,{ref:r,className:te("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight",e),...t}));Ut.displayName=Ne.Title.displayName;const d1=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Description,{ref:r,className:te("richtext-text-sm richtext-text-muted-foreground",e),...t}));d1.displayName=Ne.Description.displayName;const oc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=me.clsx,Rn=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ac(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(u=>{const f=r==null?void 0:r[u],d=o==null?void 0:o[u];if(f===null)return null;const h=oc(f)||oc(d);return i[u][h]}),s=r&&Object.entries(r).reduce((u,f)=>{let[d,h]=f;return h===void 0||(u[d]=h),u},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:d,className:h,...p}=f;return Object.entries(p).every(m=>{let[x,g]=m;return Array.isArray(g)?g.includes({...o,...s}[x]):{...o,...s}[x]===g})?[...u,d,h]:u},[]);return ac(e,a,l,r==null?void 0:r.class,r==null?void 0:r.className)},f1=Rn("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-h-10 richtext-w-10"}},defaultVariants:{variant:"default",size:"default"}}),we=oe.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...i},o)=>{const a=n?tu.Slot:"button";return c.jsx(a,{className:te(f1({variant:t,size:r,className:e})),ref:o,...i})});we.displayName="Button";function h1(e){return e.replace(/^.*\/|\..+$/g,"")}function p1(e){return e.split(".").pop()}function m1(e){return e<1024?`${e} Byte`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function g1(e){return e?e==="application/pdf"?"pdf":e.startsWith("application/")&&[".document","word"].some(t=>e.includes(t))?"word":e.startsWith("application/")&&["presentation"].some(t=>e.includes(t))?"excel":e.startsWith("application/")&&["sheet"].some(t=>e.includes(t))?"ppt":e.startsWith("image")?"image":e.startsWith("audio")?"audio":e.startsWith("video")?"video":"file":"file"}function x1(e){return new Promise(t=>{const r=new FileReader;r.addEventListener("load",()=>{t({alt:e.name,src:r.result})},!1),r.readAsDataURL(e)})}function dd(e,t){const r=e.split(","),n=r[0].match(/:(.*?);/)[1],i=atob(r[r.length-1]);let o=i.length;const a=new Uint8Array(o);for(;o--;)a[o]=i.charCodeAt(o);return new File([a],t,{type:n})}function v1(e,t){const r=e.type,n=e.name.toLowerCase(),i=n.split(".").pop();if(!i)return!1;const a=r||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[i];return t.some(s=>{if(s.startsWith("."))return n.endsWith(s);if(s.endsWith("/*")){const l=s.split("/")[0];return a==null?void 0:a.startsWith(l+"/")}return a===s})}function fd(e,t){const{acceptMimes:r,maxSize:n,t:i,toast:o}=t,a=[];return(Array.isArray(e)?e:Object.values(e)).forEach(l=>{if(!v1(l,r)){t.onError?t.onError({type:"type",message:i("editor.upload.fileTypeNotSupported",{fileName:l.name}),file:l}):o({variant:"default",title:i("editor.upload.fileTypeNotSupported",{fileName:l.name})});return}if(l.size>n){const u=(n/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:u}),file:l}):o({variant:"default",title:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:u})});return}a.push(l)}),a}function y1({editor:e,imageInline:t,onClose:r,disabled:n,alt:i}){var _,T;const{t:o}=q.useLocale(),{toast:a}=Nn(),[s,l]=w.useState(!1),[u,f]=w.useState(!1),d=w.useRef(null),[h,p]=w.useState(),[m,x]=w.useState(""),g=w.useRef(null),[v,S]=w.useState({src:"",file:null}),j=w.useMemo(()=>{var A;return(A=e.extensionManager.extensions.find(O=>O.name===Ht.name))==null?void 0:A.options},[e]);function E(A){if(d.current&&A.width&&A.height){const O=C(d.current,A);x(O)}}function C(A,O){const D=document.createElement("canvas"),U=A.naturalWidth/A.width,H=A.naturalHeight/A.height;D.width=O.width*U,D.height=O.height*H;const K=D.getContext("2d");return K&&(K.imageSmoothingEnabled=!1,K.drawImage(A,O.x*U,O.y*H,O.width*U,O.height*H,0,0,O.width*U,O.height*H)),D.toDataURL("image/png",1)}const k=w.useCallback(async()=>{var A;if(!u){f(!0);try{const O=dd(m,((A=v==null?void 0:v.file)==null?void 0:A.name)||"image.png");let D="";j.upload?D=await j.upload(O):D=URL.createObjectURL(O),e.chain().focus().setImageInline({src:D,inline:t,alt:i}).run(),l(!1),S({src:"",file:null}),P(),r()}catch(O){console.log("Error cropping image",O)}finally{f(!1)}}},[m,e,t,u,r,(_=v==null?void 0:v.file)==null?void 0:_.name,j]);function L(A){var O;A.preventDefault(),(O=g.current)==null||O.click()}const N=async A=>{var K;const O=(K=A==null?void 0:A.target)==null?void 0:K.files;if(!e||e.isDestroyed||O.length===0){A.target.value="";return}const D=fd(O,{acceptMimes:j==null?void 0:j.acceptMimes,maxSize:j==null?void 0:j.maxSize,t:o,toast:a,onError:j.onError});if(D.length<=0){A.target.value="";return}const U=D[0],H=await x1(U);l(!0),S({src:H.src,file:U})},P=()=>{g.current&&(g.current.value="")};return c.jsxs(c.Fragment,{children:[c.jsx(we,{className:"richtext-mt-1 richtext-w-full",disabled:n,onClick:L,size:"sm",children:o("editor.image.dialog.tab.uploadCrop")}),c.jsxs(Cr,{open:s,onOpenChange:A=>{l(A),A||(S({src:"",file:null}),P())},children:[c.jsx(jr,{}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:o("editor.image.dialog.tab.uploadCrop")}),c.jsx("div",{children:v.src&&c.jsx(Cf,{className:"richtext-w-full",crop:h,onChange:A=>p(A),onComplete:A=>E(A),children:c.jsx("img",{alt:"Crop me",ref:d,src:v.src})})}),c.jsxs(In,{children:[c.jsxs(we,{disabled:u,onClick:()=>{l(!1),S({src:"",file:null}),P()},children:[o("editor.imageUpload.cancel"),c.jsx(xe,{className:"richtext-ml-1",name:"Trash2"})]}),c.jsx(we,{className:"richtext-w-fit",disabled:u||!h,onClick:k,children:u?c.jsxs(c.Fragment,{children:[o("editor.imageUpload.uploading"),c.jsx(xe,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):c.jsxs(c.Fragment,{children:[o("editor.imageUpload.crop"),c.jsx(xe,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),c.jsx("input",{accept:((T=j==null?void 0:j.acceptMimes)==null?void 0:T.join(","))||"image/*",multiple:!1,onChange:N,ref:g,style:{display:"none"},type:"file"})]})}function On(e){function t(){const o=w.useRef(e),a=w.useCallback(()=>o.current,[]),s=w.useRef(new Set),l=w.useCallback(f=>{o.current={...o.current,...f},s.current.forEach(d=>d())},[]),u=w.useCallback(f=>(s.current.add(f),()=>s.current.delete(f)),[]);return{get:a,set:l,subscribe:u}}const r=w.createContext(null);function n({children:o}){return c.jsx(r.Provider,{value:t(),children:o})}function i(o){const a=w.useContext(r);if(!a)throw new Error("Store not found");return[w.useSyncExternalStore(a.subscribe,()=>o(a.get()),()=>o(e)),a.set]}return{Provider:n,useStore:i}}On({value:!1});On({value:!1});const{Provider:b1,useStore:hd}=On({value:!1}),{Provider:w1,useStore:pd}=On({value:"light"});q.d("0");function xr(e,t){return window.addEventListener(e,t),()=>{window.removeEventListener(e,t)}}function Pn(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}const vt={UPLOAD_IMAGE:e=>`UPLOAD_IMAGE-${e}`,UPLOAD_VIDEO:e=>`UPLOAD_VIDEO-${e}`,EDIT:e=>`EDIT-${e}`,UPDATE_THEME:e=>`UPDATE_THEME-${e}`,SEARCH_REPLCE:"SEARCH_REPLACE"},md={setOpen:(e,t)=>{Pn(vt.UPLOAD_IMAGE(e),t)}};function S1(e){var E;const{t}=q.useLocale(),{toast:r}=Nn(),[n,i]=w.useState(!1),[o,a]=w.useState(!1),s=C=>{i(C.detail)},[l,u]=w.useState(""),[f,d]=w.useState(""),h=w.useRef(null),p=((E=e.editor.extensionManager.extensions.find(C=>C.name===Ht.name))==null?void 0:E.options.defaultInline)||!1,[m,x]=w.useState(p),g=w.useMemo(()=>{var k;return(k=e.editor.extensionManager.extensions.find(L=>L.name===Ht.name))==null?void 0:k.options},[e.editor]);w.useEffect(()=>{const C=xr(vt.UPLOAD_IMAGE(e.editor.id),s);return()=>{C()}},[]);async function v(C){var N;const k=(N=C==null?void 0:C.target)==null?void 0:N.files;if(!e.editor||e.editor.isDestroyed||k.length===0||o){C.target.value="";return}const L=fd(k,{acceptMimes:g==null?void 0:g.acceptMimes,maxSize:g==null?void 0:g.maxSize,t,toast:r,onError:g.onError});if(L.length<=0){C.target.value="";return}a(!0);try{if(g!=null&&g.multiple){const P=L.map(async T=>{let A="";return g.upload?A=await g.upload(T):A=URL.createObjectURL(T),A});(await Promise.all(P)).forEach(T=>{e.editor.chain().focus().setImageInline({src:T,inline:m,alt:f}).run()})}else{const P=L[0];let _="";g.upload?_=await g.upload(P):_=URL.createObjectURL(P),e.editor.chain().focus().setImageInline({src:_,inline:m,alt:f}).run()}i(!1),d(""),x(p)}catch(P){console.error("Error uploading image",P),g.onError?g.onError({type:"upload",message:t("editor.upload.error")}):r({variant:"destructive",title:t("editor.upload.error")})}finally{a(!1),C.target.value=""}}function S(C){C.preventDefault(),C.stopPropagation(),e.editor.chain().focus().setImageInline({src:l,inline:m,alt:f}).run(),i(!1),x(p),u(""),d("")}function j(C){var k;C.preventDefault(),(k=h.current)==null||k.click()}return c.jsxs(Cr,{onOpenChange:i,open:n,children:[c.jsx(jr,{asChild:!0,children:c.jsx(W,{action:()=>i(!0),icon:e.icon,tooltip:e.tooltip})}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:t("editor.image.dialog.title")}),c.jsxs(Sd,{activationMode:"manual",defaultValue:g.resourceImage==="both"||g.resourceImage==="upload"?"upload":"link",children:[g.resourceImage==="both"&&c.jsxs(Xa,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[c.jsx(yr,{value:"upload",children:t("editor.image.dialog.tab.upload")}),c.jsx(yr,{value:"link",children:t("editor.image.dialog.tab.url")})]}),c.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[c.jsx(Id,{checked:m,onCheckedChange:C=>{x(C)}}),c.jsx(Ue,{children:t("editor.link.dialog.inline")})]}),g.enableAlt&&c.jsxs("div",{className:"richtext-my-[10px] ",children:[c.jsx(Ue,{className:"mb-[6px]",children:t("editor.imageUpload.alt")}),c.jsx(Ie,{onChange:C=>d(C.target.value),required:!0,type:"text",value:f})]}),c.jsxs(br,{value:"upload",children:[c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[c.jsx(we,{className:"richtext-mt-1 richtext-w-full",disabled:o,onClick:j,size:"sm",children:o?c.jsxs(c.Fragment,{children:[t("editor.imageUpload.uploading"),c.jsx(xe,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):t("editor.image.dialog.tab.upload")}),c.jsx(y1,{alt:f,disabled:o,editor:e.editor,imageInline:m,onClose:()=>{md.setOpen(e.editor.id,!1),d("")}})]}),c.jsx("input",{accept:g.acceptMimes.join(",")||"image/*",multiple:g.multiple,onChange:v,ref:h,style:{display:"none"},type:"file"})]}),c.jsx(br,{value:"link",children:c.jsx("form",{onSubmit:S,children:c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[c.jsx(Ie,{autoFocus:!0,onChange:C=>u(C.target.value),placeholder:t("editor.image.dialog.placeholder"),required:!0,type:"url",value:l}),c.jsx(we,{type:"submit",children:t("editor.image.dialog.button.apply")})]})})})]})]})]})}const Dr={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function A1(e){var N,P,_;const[t,r]=w.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[n,i]=w.useState({width:0,height:0}),[o]=w.useState([Dr.TOP_LEFT,Dr.TOP_RIGHT,Dr.BOTTOM_LEFT,Dr.BOTTOM_RIGHT]),[a,s]=w.useState(!1),[l,u]=w.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f,inline:d}=(N=e==null?void 0:e.node)==null?void 0:N.attrs,h=d&&(f==="left"||f==="right"),p=w.useMemo(()=>{var Se;const{src:T,alt:A,width:O,height:D,flipX:U,flipY:H}=(Se=e==null?void 0:e.node)==null?void 0:Se.attrs,K=Kr(O)?`${O}px`:O,re=Kr(D)?`${D}px`:D,ie=[];U&&ie.push("rotateX(180deg)"),H&&ie.push("rotateY(180deg)");const he=ie.join(" ");return{src:T||void 0,alt:A||void 0,style:{width:K||void 0,height:re||void 0,transform:he||"none",...h?{float:f}:{}}}},[(P=e==null?void 0:e.node)==null?void 0:P.attrs]),m=w.useMemo(()=>{const{style:{width:T}}=p;return{width:T==="100%"?T:void 0}},[p]);function x(T){i({width:T.target.width,height:T.target.height})}function g(){const{editor:T,getPos:A}=e;T.commands.setNodeSelection(A())}const v=w.useCallback(Bt(()=>{const{editor:T}=e,{width:A}=getComputedStyle(T.view.dom);r(O=>({...O,width:Number.parseInt(A,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function S(T,A){T.preventDefault(),T.stopPropagation();const O=n.width,D=n.height,U=O/D;let H=Number(e.node.attrs.width),K=Number(e.node.attrs.height);const re=t.width;H&&!K?(H=H>re?re:H,K=Math.round(H/U)):K&&!H?(H=Math.round(K*U),H=H>re?re:H):!H&&!K?(H=O>re?re:O,K=Math.round(H/U)):H=H>re?re:H,s(!0),u({x:T.clientX,y:T.clientY,w:H,h:K,dir:A})}const j=w.useCallback(Bt(T=>{if(T.preventDefault(),T.stopPropagation(),!a)return;const{x:A,w:O,dir:D}=l,U=(T.clientX-A)*(/l/.test(D)?-1:1),H=Eu(O+U,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:H,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[a,l,t,e.updateAttributes]),E=w.useCallback(T=>{T.preventDefault(),T.stopPropagation(),a&&(u({x:0,y:0,w:0,h:0,dir:""}),s(!1),g())},[a,g]),C=w.useCallback(()=>{document==null||document.addEventListener("mousemove",j,!0),document==null||document.addEventListener("mouseup",E,!0)},[j,E]),k=w.useCallback(()=>{document==null||document.removeEventListener("mousemove",j,!0),document==null||document.removeEventListener("mouseup",E,!0)},[j,E]);w.useEffect(()=>(a?C():k(),()=>{k()}),[a,C,k]);const L=w.useMemo(()=>new ResizeObserver(()=>v()),[v]);return w.useEffect(()=>(L.observe(e.editor.view.dom),()=>{L.disconnect()}),[e.editor.view.dom,L]),c.jsx(me.NodeViewWrapper,{as:d?"span":"div",className:"image-view",style:{float:h?f:void 0,margin:h?f==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:d?"inline":"block",textAlign:h?void 0:f,width:((_=p.style)==null?void 0:_.width)??"auto",...h?{}:m},children:c.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:m,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${a?"image-view__body--resizing":""}`,children:[c.jsx("img",{alt:p.alt,className:"image-view__body__image block",height:"auto",onClick:g,onLoad:x,src:p.src,style:p.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||a)&&c.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(T=>c.jsx("span",{className:`image-resizer__handler image-resizer__handler--${T}`,onMouseDown:A=>S(A,T)},`image-dir-${T}`))})]})})}const Dt=new B.PluginKey("upload-image");function C1(){return new B.Plugin({key:Dt,state:{init(){return B.DecorationSet.empty},apply(e,t){t=t.map(e.mapping,e.doc);const r=e.getMeta(Dt);if(r!=null&&r.add)for(const{id:n,pos:i,src:o}of r.add){const a=j1(o),s=B.Decoration.widget(i,a,{id:n});t=t.add(e.doc,[s])}else if(r!=null&&r.remove)for(const n of r.remove)t=t.remove(t.find(void 0,void 0,i=>i.id===n));return t}},props:{decorations(e){return this.getState(e)}}})}function j1(e){const t=document.createElement("div"),r=document.createElement("img");return r.setAttribute("class","opacity-50"),r.src=e,r.addEventListener("load",()=>{t.setAttribute("class","img-placeholder")}),t.append(r),t}function T1(e,t){var i;const n=Dt.getState(e).find(void 0,void 0,o=>o.id===t);return n.length>0?(i=n[0])==null?void 0:i.from:null}function E1({validateFn:e,onUpload:t,postUpload:r,defaultInline:n=!1}){return(i,o,a)=>{for(const s of i){if(e&&!e(s))continue;const l=Date.now().toString(),u=o.state.tr;u.selection.empty||u.deleteSelection();const f=URL.createObjectURL(s);u.setMeta(Dt,{add:[{id:l,pos:a,src:f}]}),o.dispatch(u),t(s).then(async d=>{var S;r&&typeof d=="string"&&(d=await r(d));const{schema:h}=o.state;let p=T1(o.state,l);if(p===null)return;const m=typeof d=="object"?f:d,x=(S=h.nodes.image)==null?void 0:S.create({src:m,inline:n});if(!x)return;const{doc:g}=o.state;p>g.content.size&&(p=g.content.size-1);const v=o.state.tr.replaceWith(p,p,x).setMeta(Dt,{remove:[l]});o.dispatch(v)},()=>{const d=o.state.tr.delete(a,a).setMeta(Dt,{remove:[l]});o.dispatch(d)})}}}function I1(e,t,r){var i;const n=[...((i=t.clipboardData)==null?void 0:i.files)||[]];if(n.length>0){t.preventDefault();const o=e.state.selection.from;return r(n,e,o+1),!0}return!1}function R1(e,t,r,n){var o;const i=[...((o=t.dataTransfer)==null?void 0:o.files)||[]];if(!r&&i.length>0){t.preventDefault();const a=e.posAtCoords({left:t.clientX,top:t.clientY});if(a)return n(i,e,a.pos+1),!0}return!1}const O1={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},Ht=Ba.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...O1,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:r,t:n})=>{var i,o;return{component:S1,componentProps:{action:()=>!0,upload:r.options.upload,disabled:!((o=(i=t.can()).setImage)!=null&&o.call(i,{})),icon:"ImageUp",tooltip:n("editor.image.tooltip"),editor:t}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||null;return r?Number.parseInt(r,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return me.ReactNodeViewRenderer(A1)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:r})=>r.insertContent({type:this.name,attrs:{...t,inline:t.inline??this.options.defaultInline}}),updateImage:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImage:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:r,align:n,inline:i}=e,o=i&&(n==="left"||n==="right"),a=t||r?`transform: rotateX(${t?"180":"0"}deg) rotateY(${r?"180":"0"}deg);`:"",s=o?"":`text-align: ${n};`,f=`${o?`float: ${n};`:""}${o?n==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${a}`;return[i?"span":"div",{style:s,class:"image"},["img",B.mergeAttributes({height:"auto",style:f},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var o;const t=e==null?void 0:e.parentElement,r=e==null?void 0:e.getAttribute("width"),n=(e==null?void 0:e.getAttribute("flipx"))||!1,i=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(e==null?void 0:e.getAttribute("align"))||((o=t==null?void 0:t.style)==null?void 0:o.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:n==="true",flipY:i==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width"),n=(t==null?void 0:t.getAttribute("flipx"))||!1,i=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:n==="true",flipY:i==="true"}}},{tag:'img[src]:not([src^="data:"])'}]},addProseMirrorPlugins(){const t=E1({validateFn:r=>!(!this.options.acceptMimes.includes(r.type)||r.size>this.options.maxSize),onUpload:this.options.upload,defaultInline:this.options.defaultInline});return[C1(),new B.Plugin({key:new B.PluginKey("image"),props:{handlePaste:(r,n)=>{var a;if(!(n.clipboardData&&n.clipboardData.files&&((a=n.clipboardData.files)==null?void 0:a.length)))return;if([...n.clipboardData.files||[]].some(s=>s.type==="text/html"))return!1;if(n.clipboardData.items.length==2){n.clipboardData.items[0].getAsString(s=>{let l="";if(s.replace(/src\s*=\s*"(.*)"/,(u,f)=>l=f),l&&typeof l=="string"){const u=r.state.schema.nodes.image.create({src:l}),f=r.state.tr.replaceSelectionWith(u);r.dispatch(f)}});return}return I1(r,n,t)},handleDrop:(r,n,i,o)=>{if(!(n instanceof DragEvent)||!n.dataTransfer)return!1;if(n.dataTransfer.items.length==2){n.dataTransfer.items[0].getAsString(a=>{let s="";if(a.replace(/src\s*=\s*"(.*)"/,(l,u)=>s=u),s&&typeof s=="string"){const l=r.state.schema.nodes.image.create({src:s}),u=r.state.tr.replaceSelectionWith(l);r.dispatch(u)}});return}return R1(r,n,o,t),!1}}})]}});async function P1(e){var n;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(n=r==null?void 0:r.data)==null?void 0:n.map(i=>{var o,a,s;return{id:i==null?void 0:i.id,src:(o=i==null?void 0:i.images.original)==null?void 0:o.url,width:+((a=i==null?void 0:i.images.original)==null?void 0:a.width),height:+((s=i==null?void 0:i.images.original)==null?void 0:s.width)}})}async function k1(e,t){var i;const n=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=n==null?void 0:n.data)==null?void 0:i.map(o=>{var a,s,l;return{id:o==null?void 0:o.id,src:(a=o==null?void 0:o.images.original)==null?void 0:a.url,width:+((s=o==null?void 0:o.images.original)==null?void 0:s.width),height:+((l=o==null?void 0:o.images.original)==null?void 0:l.width)}})}async function N1(e){var o,a;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(o=r==null?void 0:r.results)==null?void 0:o[0]}&limit=15`)).json();return(a=i==null?void 0:i.results)==null?void 0:a.map(s=>{var l,u,f,d,h,p,m,x;return{id:s==null?void 0:s.id,src:(u=(l=s==null?void 0:s.media_formats)==null?void 0:l.gif)==null?void 0:u.url,width:(h=(d=(f=s==null?void 0:s.media_formats)==null?void 0:f.gif)==null?void 0:d.dims)==null?void 0:h[0],height:(x=(m=(p=s==null?void 0:s.media_formats)==null?void 0:p.gif)==null?void 0:m.dims)==null?void 0:x[1]}})}async function M1(e,t){var i;const n=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=n==null?void 0:n.results)==null?void 0:i.map(o=>{var a,s,l,u,f,d,h,p;return{id:o==null?void 0:o.id,src:(s=(a=o==null?void 0:o.media_formats)==null?void 0:a.gif)==null?void 0:s.url,width:(f=(u=(l=o==null?void 0:o.media_formats)==null?void 0:l.gif)==null?void 0:u.dims)==null?void 0:f[0],height:(p=(h=(d=o==null?void 0:o.media_formats)==null?void 0:d.gif)==null?void 0:h.dims)==null?void 0:p[1]}})}function L1(e,t){return{searchTrending:async()=>t?e==="giphy"?P1(t):e==="tenor"?N1(t):[]:[],searchWord:async i=>t?e==="giphy"?k1(i,t):e==="tenor"?M1(i,t):[]:[]}}function $1({selectImage:e,apiKey:t,provider:r,children:n}){const[i,o]=w.useState([]),a=w.useRef(null),{searchTrending:s,searchWord:l}=L1(r,t);w.useEffect(()=>{(async()=>{const f=await s();o(f)})()},[]);const u=w.useCallback(Ar(async f=>{if(!f.target.value){const h=await s();o(h);return}const d=await l(f.target.value);o(d)},350),[]);return c.jsxs(Wt,{modal:!0,children:[c.jsx(Gt,{asChild:!0,children:n}),c.jsx(It,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:c.jsx(Ie,{onChange:u,placeholder:"Search GIF",ref:a,type:"text"})}),c.jsx("div",{className:"richtext-max-h-[280px] richtext-overflow-y-auto",children:c.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:i!=null&&i.length?i==null?void 0:i.map(f=>c.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-text-center",height:f.height,onClick:()=>e(f.src),src:f.src,width:f.width},f.id)):c.jsx("p",{children:"No GIFs found"})})})]}):c.jsx("div",{children:c.jsx("p",{children:"Missing Giphy API Key"})})})]})}function _1({editor:e,icon:t,provider:r,apiKey:n,...i}){const o=a=>{e.chain().focus().setImageGif({src:a}).run()};return c.jsx($1,{apiKey:n,provider:r,selectImage:o,children:c.jsx(W,{icon:t,tooltip:i==null?void 0:i.tooltip})})}const Br={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function D1(e){var k,L;const[t,r]=w.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[n,i]=w.useState({width:0,height:0}),[o]=w.useState([Br.TOP_LEFT,Br.TOP_RIGHT,Br.BOTTOM_LEFT,Br.BOTTOM_RIGHT]),[a,s]=w.useState(!1),[l,u]=w.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f}=(k=e==null?void 0:e.node)==null?void 0:k.attrs,d=w.useMemo(()=>{var D;const{src:N,alt:P,width:_,height:T}=(D=e==null?void 0:e.node)==null?void 0:D.attrs,A=Kr(_)?`${_}px`:_,O=Kr(T)?`${T}px`:T;return{src:N||void 0,alt:P||void 0,style:{width:A||void 0,height:O||void 0}}},[(L=e==null?void 0:e.node)==null?void 0:L.attrs]),h=w.useMemo(()=>{const{style:{width:N}}=d;return{width:N==="100%"?N:void 0}},[d]);function p(N){i({width:N.target.width,height:N.target.height})}function m(){const{editor:N,getPos:P}=e;N.commands.setNodeSelection(P())}const x=w.useCallback(Bt(()=>{const{editor:N}=e,{width:P}=getComputedStyle(N.view.dom);r(_=>({..._,width:Number.parseInt(P,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function g(N,P){N.preventDefault(),N.stopPropagation();const _=n.width,T=n.height,A=_/T;let O=Number(e.node.attrs.width),D=Number(e.node.attrs.height);const U=t.width;O&&!D?(O=O>U?U:O,D=Math.round(O/A)):D&&!O?(O=Math.round(D*A),O=O>U?U:O):!O&&!D?(O=_>U?U:_,D=Math.round(O/A)):O=O>U?U:O,s(!0),u({x:N.clientX,y:N.clientY,w:O,h:D,dir:P})}const v=w.useCallback(Bt(N=>{if(N.preventDefault(),N.stopPropagation(),!a)return;const{x:P,w:_,dir:T}=l,A=(N.clientX-P)*(/l/.test(T)?-1:1),O=Eu(_+A,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:O,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[a,l,t,e.updateAttributes]),S=w.useCallback(N=>{N.preventDefault(),N.stopPropagation(),a&&(u({x:0,y:0,w:0,h:0,dir:""}),s(!1),m())},[a,m]),j=w.useCallback(()=>{document==null||document.addEventListener("mousemove",v,!0),document==null||document.addEventListener("mouseup",S,!0)},[v,S]),E=w.useCallback(()=>{document==null||document.removeEventListener("mousemove",v,!0),document==null||document.removeEventListener("mouseup",S,!0)},[v,S]);w.useEffect(()=>(a?j():E(),()=>{E()}),[a,j,E]);const C=w.useMemo(()=>new ResizeObserver(()=>x()),[x]);return w.useEffect(()=>(C.observe(e.editor.view.dom),()=>{C.disconnect()}),[e.editor.view.dom,C]),c.jsx(me.NodeViewWrapper,{className:"image-view",style:{...h,width:"100%",textAlign:f},children:c.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:h,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${a?"image-view__body--resizing":""}`,children:[c.jsx("img",{alt:d.alt,className:"image-view__body__image block",height:"auto",onClick:m,onLoad:p,src:d.src,style:d.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||a)&&c.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(N=>c.jsx("span",{className:`image-resizer__handler image-resizer__handler--${N}`,onMouseDown:P=>g(P,N)},`image-dir-${N}`))})]})})}const za=Ba.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:n})=>{var a,s;const i=((a=r==null?void 0:r.options)==null?void 0:a.provider)||"",o=((s=r==null?void 0:r.options)==null?void 0:s.API_KEY)||"";return{component:_1,componentProps:{editor:t,action:()=>{},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:n("editor.imageGif.tooltip"),apiKey:o,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return me.ReactNodeViewRenderer(D1)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",B.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});function B1(e,t){let r;try{r=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const i=n.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(r.hostname)}return r.hostname.includes(n)})}function z1(e){const{t}=q.useLocale(),[r,n]=w.useState(""),i=w.useRef(null),[o,a]=w.useState(""),[s,l]=w.useState(!1),u=m=>{l(m.detail)};w.useEffect(()=>{const m=xr(vt.UPLOAD_VIDEO(e.editor.id),u);return()=>{m()}},[]);const f=w.useMemo(()=>{var x;return(x=e.editor.extensionManager.extensions.find(g=>g.name===Ha.name))==null?void 0:x.options},[e.editor]);async function d(m){var S;const x=(S=m==null?void 0:m.target)==null?void 0:S.files;if(!e.editor||e.editor.isDestroyed||x.length===0)return;const g=x[0];let v="";f.upload?v=await f.upload(g):v=URL.createObjectURL(g),e.editor.chain().focus().setVideo({src:v,width:"100%"}).run(),l(!1)}function h(m){m.preventDefault(),m.stopPropagation(),r&&(e.editor.chain().focus().setVideo({src:r,width:"100%"}).run(),l(!1),n(""))}function p(m){var x;m.preventDefault(),(x=i.current)==null||x.click()}return c.jsxs(Cr,{onOpenChange:l,open:s,children:[c.jsx(jr,{asChild:!0,children:c.jsx(W,{action:()=>l(!0),icon:e.icon,tooltip:e.tooltip})}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:t("editor.video.dialog.title")}),c.jsxs(Sd,{activationMode:"manual",defaultValue:(f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="upload"?"upload":"link",children:[c.jsxs(Xa,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="upload")&&c.jsx(yr,{value:"upload",children:t("editor.video.dialog.tab.upload")}),((f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="link")&&c.jsx(yr,{value:"link",children:t("editor.video.dialog.link")})]}),c.jsxs(br,{value:"upload",children:[c.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:c.jsx(we,{className:"richtext-mt-1 richtext-w-full",onClick:p,size:"sm",children:t("editor.video.dialog.tab.upload")})}),c.jsx("input",{accept:"video/*",multiple:!0,onChange:d,ref:i,type:"file",style:{display:"none"}})]}),c.jsxs(br,{value:"link",children:[c.jsx("div",{children:c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[c.jsx(Ie,{autoFocus:!0,placeholder:t("editor.video.dialog.placeholder"),required:!0,type:"url",value:r,onChange:m=>{n(m.target.value)},onBlur:m=>{const x=m.target.value,g=f.videoProviders||["."];x&&!B1(x,g)?a("Invalid video URL"):a("")}}),c.jsx(we,{type:"button",onClick:h,children:t("editor.video.dialog.button.apply")})]})}),o&&c.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:o})]})]})]})]})}function H1(e,t,r){return e<t?t:e>r?r:e}const q1=e=>typeof e=="number",F1=e=>typeof e=="string",U1=e=>typeof e=="function";function W1(e,t="px"){if(!e)return e;const r=q1(e)?String(e):e,n=Number.parseFloat(r),i=r.match(/[%a-z]+$/i),o=i?i[0]:t;return Number.isNaN(n)?e:n+o}function gd(e,t){if(!e)return!1;const{extensions:r=[]}=(e==null?void 0:e.extensionManager)??{};return!!r.find(i=>i.name===t)}function G1(e){return e.map(t=>F1(t)?{value:t,name:t}:t)}function V1(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const r=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(r){const i=r[1],o=r[2];o?e=`https://player.vimeo.com/video/${i}?h=${o}`:e=`https://player.vimeo.com/video/${i}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const Ha=B.Node.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:q.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var r,n;return{component:z1,componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(r=e.can()).setVideo)!=null&&n.call(r,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?V1(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:W1(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:r="center"}=e??{},n={...e,width:"100%",height:"100%"},i=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,o=`flex: 1;padding-bottom: ${9/16*100}%;`,f=["div",{style:`display: flex; justify-content: ${r};`},["div",{style:i},["div",{style:o}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},f]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}}),qa={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Fa({item:e,disabled:t,editor:r}){var i;const n=e.component;return n?c.jsx(w.Fragment,{children:e.type==="divider"?c.jsx(Be,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):c.jsx(n,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:r})}):c.jsx(c.Fragment,{})}function K1(e){return e.type.name===Ht.name}function X1(e){return e.type.name===za.name}function Y1(e){return e.type.name===Ha.name}function J1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(K1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:Yx(e.editor),[e.disabled,e.editor,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${o}`))})}):c.jsx(c.Fragment,{})})})}function Z1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(X1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:Jx(e.editor),[e.disabled,e.editor,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${o}`))})}):c.jsx(c.Fragment,{})})})}function Q1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(Y1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:e0(e.editor),[e.editor,e.disabled,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${o}`))})}):c.jsx(c.Fragment,{})})})}function ev(e,t,r=null){return r?e.createChecked({index:t},r):e.createAndFill({index:t})}function tv(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function rv(e,t,r=null){const n=tv(e),i=[];for(let o=0;o<t;o+=1){const a=ev(n.column,o,r);a&&i.push(a)}return n.columns.createChecked({cols:t},i)}function ai({state:e,dispatch:t,type:r}){const n=B.findParentNode(o=>o.type.name===vr.name)(e.selection),i=B.findParentNode(o=>o.type.name===Ua.name)(e.selection);if(t&&n&&i){const o=n.node,a=i.node.attrs.index,s=o.toJSON();let l=a;r==="delete"?(l=a-1,s.content.splice(a,1)):(l=r==="addBefore"?a:a+1,s.content.splice(l,0,{type:"column",attrs:{index:a},content:[{type:"paragraph"}]})),s.attrs.cols=s.content.length,s.content.forEach((h,p)=>{h.attrs.index=p});const u=B.Node$1.fromJSON(e.schema,s);let f=n.pos;u.content.forEach((h,p,m)=>{m<l&&(f+=h.nodeSize)});const d=e.tr.setTime(Date.now());d.replaceWith(n.pos,n.pos+n.node.nodeSize,u).setSelection(B.TextSelection.near(d.doc.resolve(f))),t(d)}return!0}function sc({state:e,dispatch:t,type:r}){const n=B.findParentNode(o=>o.type.name===vr.name)(e.selection),i=B.findParentNode(o=>o.type.name===Ua.name)(e.selection);if(t&&n&&i){const o=n.node,a=i.node.attrs.index;let s=0;r==="before"?s=(a-1+o.attrs.cols)%o.attrs.cols:s=(a+1)%o.attrs.cols;let l=n.pos;o.content.forEach((f,d,h)=>{h<s&&(l+=f.nodeSize)});const u=e.tr.setTime(Date.now());return u.setSelection(B.TextSelection.near(u.doc.resolve(l))),t(u),!0}return!1}const Ua=B.Node.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",B.mergeAttributes(this.options.HTMLAttributes,e),0]}}),nv=B.Extension.create({name:"columnActionButton",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r})=>({component:W,componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:r("editor.columns.tooltip")}})}}}),xd=200,vr=B.Node.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:xd,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",B.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:r,editor:n})=>{const i=rv(n.schema,e&&e.cols||3);if(r){const o=t.selection.anchor+1;t.replaceSelectionWith(i).scrollIntoView().setSelection(B.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>sc({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>sc({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}});function Wa(e,t){const{state:r}=t,n=r.selection.$anchor;let i=!1;if(n.depth)for(let o=n.depth;o>0;o--)n.node(o).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(r.tr.delete(n.before(o),n.after(o)).scrollIntoView()),i=!0);else{const o=r.selection.node;o&&o.type.name===e&&(t.chain().deleteSelection().run(),i=!0)}if(!i){const o=n.pos;if(o){const a=r.tr.doc.nodeAt(o);a&&a.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(r.tr.delete(o,o+a.nodeSize)),i=!0)}}return i}function iv({editor:e}){const{t}=q.useLocale(),r=w.useCallback(()=>e.isActive(vr.name),[e]),n=w.useCallback(()=>Wa(vr.name,e),[e]),i=w.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),o=w.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),a=w.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return c.jsx(me.BubbleMenu,{editor:e,pluginKey:"columns-bubble-menu",shouldShow:r,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:c.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[c.jsx(W,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),c.jsx(W,{action:o,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),c.jsx(W,{action:a,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),c.jsx(W,{action:n,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}const vd=fe.Root,yd=fe.Trigger,cc=fe.Portal,lc=fe.Sub,pa=oe.forwardRef(({className:e,inset:t,children:r,...n},i)=>c.jsxs(fe.SubTrigger,{ref:i,className:te("richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",t&&"richtext-pl-8",e),...n,children:[r,c.jsx(M.ChevronRight,{className:"richtext-ml-auto richtext-h-4 richtext-w-4"})]}));pa.displayName=fe.SubTrigger.displayName;const ma=oe.forwardRef(({className:e,...t},r)=>c.jsx(fe.SubContent,{ref:r,className:te("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg 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",e),...t}));ma.displayName=fe.SubContent.displayName;const Ga=oe.forwardRef(({className:e,sideOffset:t=4,...r},n)=>c.jsx(fe.Portal,{children:c.jsx(fe.Content,{ref:n,sideOffset:t,className:te("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md 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",e),...r})}));Ga.displayName=fe.Content.displayName;const ze=oe.forwardRef(({className:e,inset:t,...r},n)=>c.jsx(fe.Item,{ref:n,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t&&"richtext-pl-8",e),...r}));ze.displayName=fe.Item.displayName;const bd=oe.forwardRef(({className:e,children:t,checked:r,...n},i)=>c.jsxs(fe.CheckboxItem,{ref:i,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),checked:r,...n,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:c.jsx(fe.ItemIndicator,{children:c.jsx(M.Check,{className:"richtext-h-4 richtext-w-4"})})}),t]}));bd.displayName=fe.CheckboxItem.displayName;const ov=oe.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(fe.RadioItem,{ref:n,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...r,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:c.jsx(fe.ItemIndicator,{children:c.jsx(M.Circle,{className:"richtext-h-2 richtext-w-2 richtext-fill-current"})})}),t]}));ov.displayName=fe.RadioItem.displayName;const av=oe.forwardRef(({className:e,inset:t,...r},n)=>c.jsx(fe.Label,{ref:n,className:te("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",t&&"richtext-pl-8",e),...r}));av.displayName=fe.Label.displayName;const Va=oe.forwardRef(({className:e,...t},r)=>c.jsx(fe.Separator,{ref:r,className:te("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));Va.displayName=fe.Separator.displayName;function wd({className:e,...t}){return c.jsx("span",{className:te("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",e),...t})}wd.displayName="DropdownMenuShortcut";const Ie=oe.forwardRef(({className:e,type:t,...r},n)=>c.jsx("input",{type:t,className:te("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:n,...r}));Ie.displayName="Input";const sv=Rn("richtext-text-sm richtext-font-medium richtext-leading-none peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"),Ue=oe.forwardRef(({className:e,...t},r)=>c.jsx(ou.Root,{ref:r,className:te(sv(),e),...t}));Ue.displayName=ou.Root.displayName;const Wt=dr.Root,Gt=dr.Trigger,It=oe.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},i)=>c.jsx(dr.Portal,{children:c.jsx(dr.Content,{ref:i,align:t,sideOffset:r,className:te("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-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",e),...n})}));It.displayName=dr.Content.displayName;const Be=oe.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},i)=>c.jsx(nu.Root,{ref:i,decorative:r,orientation:t,className:te("richtext-shrink-0 richtext-bg-border",t==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",e),...n}));Be.displayName=nu.Root.displayName;const Ka=oe.forwardRef(({className:e,...t},r)=>c.jsx(Vo.Root,{className:te("richtext-peer richtext-inline-flex richtext-h-6 richtext-w-11 richtext-shrink-0 richtext-cursor-pointer richtext-items-center richtext-rounded-full richtext-border-2 richtext-border-transparent richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 focus-visible:richtext-ring-offset-background disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=unchecked]:richtext-bg-input",e),...t,ref:r,children:c.jsx(Vo.Thumb,{className:te("richtext-pointer-events-none richtext-block richtext-h-5 richtext-w-5 richtext-rounded-full richtext-bg-background richtext-shadow-lg richtext-ring-0 richtext-transition-transform data-[state=checked]:richtext-translate-x-5 data-[state=unchecked]:richtext-translate-x-0")})}));Ka.displayName=Vo.Root.displayName;const Sd=jt.Root,Xa=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.List,{ref:r,className:te("richtext-inline-flex richtext-h-10 richtext-items-center richtext-justify-center richtext-rounded-md richtext-bg-muted richtext-p-1 richtext-text-muted-foreground",e),...t}));Xa.displayName=jt.List.displayName;const yr=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.Trigger,{ref:r,className:te("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-sm richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-all focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=active]:richtext-bg-background data-[state=active]:richtext-text-foreground data-[state=active]:richtext-shadow-sm",e),...t}));yr.displayName=jt.Trigger.displayName;const br=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.Content,{ref:r,className:te("richtext-mt-2 richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2",e),...t}));br.displayName=jt.Content.displayName;const cv=Oe.Provider,Ad=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Viewport,{ref:r,className:te("richtext-fixed richtext-top-0 richtext-z-[100] richtext-flex richtext-max-h-screen richtext-w-full richtext-flex-col-reverse richtext-p-4 sm:richtext-bottom-0 sm:richtext-right-0 sm:richtext-top-auto sm:richtext-flex-col md:richtext-max-w-[420px]",e),...t}));Ad.displayName=Oe.Viewport.displayName;const lv=Rn("richtext-group richtext-pointer-events-auto richtext-relative richtext-flex richtext-w-full richtext-items-center richtext-justify-between richtext-space-x-4 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-p-6 richtext-pr-8 richtext-shadow-lg richtext-transition-all data-[swipe=cancel]:richtext-translate-x-0 data-[swipe=end]:richtext-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:richtext-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:richtext-transition-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[swipe=end]:richtext-animate-out data-[state=closed]:richtext-fade-out-80 data-[state=closed]:richtext-slide-out-to-right-full data-[state=open]:richtext-slide-in-from-top-full data-[state=open]:sm:richtext-slide-in-from-bottom-full",{variants:{variant:{default:"richtext-border richtext-bg-background richtext-text-foreground",destructive:"richtext-destructive richtext-group richtext-border-destructive richtext-bg-destructive richtext-text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Cd=oe.forwardRef(({className:e,variant:t,...r},n)=>c.jsx(Oe.Root,{ref:n,className:te(lv({variant:t}),e),...r}));Cd.displayName=Oe.Root.displayName;const uv=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Action,{ref:r,className:te("richtext-inline-flex richtext-h-8 richtext-shrink-0 richtext-items-center richtext-justify-center richtext-rounded-md !richtext-border richtext-bg-transparent richtext-px-3 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-secondary focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 group-[.destructive]:richtext-border-muted/40 group-[.destructive]:hover:richtext-border-destructive/30 group-[.destructive]:hover:richtext-bg-destructive group-[.destructive]:hover:richtext-text-destructive-foreground group-[.destructive]:focus:richtext-ring-destructive",e),...t}));uv.displayName=Oe.Action.displayName;const jd=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Close,{ref:r,className:te("richtext-absolute richtext-right-2 richtext-top-2 richtext-rounded-md richtext-p-1 richtext-text-foreground/50 richtext-opacity-0 richtext-transition-opacity hover:richtext-text-foreground focus:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 group-hover:richtext-opacity-100 group-[.destructive]:richtext-text-red-300 group-[.destructive]:hover:richtext-text-red-50 group-[.destructive]:focus:richtext-ring-red-400 group-[.destructive]:focus:richtext-ring-offset-red-600",e),"toast-close":"",...t,children:c.jsx(M.X,{className:"richtext-h-4 richtext-w-4"})}));jd.displayName=Oe.Close.displayName;const Td=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Title,{ref:r,className:te("richtext-text-sm richtext-font-semibold",e),...t}));Td.displayName=Oe.Title.displayName;const Ed=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Description,{ref:r,className:te("richtext-text-sm richtext-opacity-90",e),...t}));Ed.displayName=Oe.Description.displayName;const dv=Rn("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ya=oe.forwardRef(({className:e,variant:t,size:r,...n},i)=>c.jsx(iu.Root,{ref:i,className:te(dv({variant:t,size:r,className:e})),...n}));Ya.displayName=iu.Root.displayName;const fv=Sr.Provider,Ja=Sr.Root,Za=Sr.Trigger,kn=oe.forwardRef(({className:e,sideOffset:t=4,...r},n)=>c.jsx(Sr.Content,{ref:n,sideOffset:t,className:te("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 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",e),...r}));kn.displayName=Sr.Content.displayName;const hv=1,pv=1e6;let si=0;function mv(){return si=(si+1)%Number.MAX_SAFE_INTEGER,si.toString()}const ci=new Map;function uc(e){if(ci.has(e))return;const t=setTimeout(()=>{ci.delete(e),ur({type:"REMOVE_TOAST",toastId:e})},pv);ci.set(e,t)}function gv(e,t){switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,hv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?uc(r):e.toasts.forEach(n=>{uc(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}}const Ur=[];let Wr={toasts:[]};function ur(e){Wr=gv(Wr,e),Ur.forEach(t=>{t(Wr)})}function xv({...e}){const t=mv(),r=i=>ur({type:"UPDATE_TOAST",toast:{...i,id:t}}),n=()=>ur({type:"DISMISS_TOAST",toastId:t});return ur({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||n()}}}),{id:t,dismiss:n,update:r}}function Nn(){const[e,t]=oe.useState(Wr);return oe.useEffect(()=>(Ur.push(t),()=>{const r=Ur.indexOf(t);r>-1&&Ur.splice(r,1)}),[e]),{...e,toast:xv,dismiss:r=>ur({type:"DISMISS_TOAST",toastId:r})}}const Id=oe.forwardRef(({className:e,...t},r)=>c.jsx(Go.Root,{ref:r,className:te("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-p-0 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-2 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...t,children:c.jsx(Go.Indicator,{className:te("!richtext-flex !richtext-p-0 !richtext-items-center !richtext-justify-center !richtext-text-current"),children:c.jsx(M.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));Id.displayName=Go.Root.displayName;const vv={padding:"0 12px 12px"},Rd=({width:e,maxWidth:t,height:r,onOk:n,children:i})=>{const{t:o}=q.useLocale(),[a,s]=w.useState({width:"",height:"",maxWidth:""});w.useEffect(()=>{s({width:e,height:r,maxWidth:t})},[r,t,e]);function l(u){u.preventDefault(),u.stopPropagation(),n(a)}return c.jsxs(Wt,{modal:!0,children:[c.jsx(Gt,{asChild:!0,children:i}),c.jsx(It,{children:c.jsx("div",{style:vv,children:c.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:l,children:[c.jsx(Ue,{className:"mb-[6px]",children:"Width"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.width,required:!0,onChange:u=>s({...a,width:u.target.value})})})}),c.jsx(Ue,{className:"mb-[6px]",children:"Max Width"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.maxWidth,required:!0,onChange:u=>s({...a,maxWidth:u.target.value})})})}),c.jsx(Ue,{className:"mb-[6px]",children:"Height"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.height,required:!0,onChange:u=>s({...a,height:u.target.value})})})}),c.jsx(we,{type:"submit",className:"richtext-self-end richtext-mt-2",children:o("editor.link.dialog.button.apply")})]})})})]})},Vt={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function yv(e){const t=Vt.youtube,r=e.matchedUrl;e.validLink=!0;const n=r.split("="),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}/${o}`,e.validId=!0}return e}function bv(e){const t=Vt.youku,r=e.matchedUrl,n=t.idRule,i=new RegExp(n),o=r.match(i);if(o&&o.length>0){const a=o[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${a}`}else e.validId=!1;return e}function wv(e){const t=Vt.bilibili,n=e.matchedUrl.split("/"),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function Sv(e){const t=Vt.qqvideo,n=e.matchedUrl.split("/"),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function Av(e,t){return t.src=e,t.validId=!0,t}function Cv(e,t){return t.src=e,t.validId=!0,t}function jv(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function Tv(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function Ev(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function Iv(e){const t=Vt.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function Rv(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function Ov(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Pv(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function kv(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function Nv(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Mv(e,t,r){if(e==="googlemaps")return r.validLink=!0,r.matchedUrl=t,r;const i=Vt[e].linkRule;for(const o of i){const a=new RegExp(o),s=t.match(a);if(s&&s.length>0)return r.validLink=!0,r.matchedUrl=e==="youtube"?s[1]:s[0],r}return r}function Lv(e){var r,n;let t="iframe";return((r=e.includes)!=null&&r.call(e,"youtube")||(n=e.includes)!=null&&n.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function Od(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const r=Lv(e);if(t=Mv(r,e,t),!t.validLink)return t;switch(r){case"youtube":return yv(t);case"youku":return bv(t);case"bilibili":return wv(t);case"qqvideo":return Sv(t);case"amap":return Av(e,t);case"baidu_map":return Cv(e,t);case"googlemaps":return jv(e,t);case"modao":return Tv(t);case"lanhu":return Ev(t);case"figma":return Iv(t);case"canva":return Rv(e,t);case"processon":return Ov(e,t);case"codepen":return Pv(t);case"jinshuju":return kv(e,t);case"iframe":return Nv(e,t);default:return e}}function Pd(){const[e]=hd(t=>t.value);return e}const $v={setDisable:(e,t)=>{Pn(vt.EDIT(e),t)}},_v="_wrap_5y04w_1",Dv="_innerWrap_5y04w_15",dc={wrap:_v,innerWrap:Dv};function Bv({editor:e,node:t,updateAttributes:r}){const n=Pd(),{src:i,width:o,height:a}=t.attrs,[s,l]=w.useState("");function u(){if(!s)return;const d=Od(s);e.chain().updateAttributes(St.name,{src:(d==null?void 0:d.src)||s}).setNodeSelection(e.state.selection.from).focus().run()}const f=w.useCallback(d=>{r({width:d.width,height:d.height})},[r]);return c.jsxs(me.NodeViewWrapper,{children:[!i&&c.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-[#ccc] richtext-p-[10px]",children:[c.jsx(Ie,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>l(d.target.value),placeholder:"Enter link",type:"url",value:s}),c.jsx(we,{className:"richtext-w-[60px]",onClick:u,children:"OK"})]}),i&&c.jsx(Af.Resizable,{size:{width:Number.parseInt(o),height:Number.parseInt(a)},onResizeStop:(d,h,p,m)=>{f({width:Number.parseInt(o)+m.width,height:Number.parseInt(a)+m.height})},children:c.jsx("div",{className:me.clsx(dc.wrap,"render-wrapper"),children:c.jsx("div",{className:dc.innerWrap,style:{pointerEvents:n?"none":"auto"},children:c.jsx("iframe",{className:"richtext-my-[12px] ",src:i})})})})]})}const St=B.Node.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:r,t:n})=>({component:W,componentProps:{action:i=>t.commands.setIframe(i),upload:r.options.upload,disabled:!t.can().setIframe({}),icon:"Iframe",tooltip:n("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:me.getDatasetAttribute("width")},height:{default:300,parseHTML:me.getDatasetAttribute("height")},src:{default:null,parseHTML:me.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",B.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:r,chain:n})=>{var o,a,s;if(((s=(a=(o=t.selection)==null?void 0:o.node)==null?void 0:a.type)==null?void 0:s.name)==this.name)return r.updateAttributes(this.name,e);const i=e||{url:""};return n().insertContent({type:this.name,attrs:i}).run()}}},addInputRules(){return[B.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return me.ReactNodeViewRenderer(Bv)}});var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nd(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var li,fc;function Md(){if(fc)return li;fc=1;var e=Object.prototype.toString;return li=function(r){var n=e.call(r),i=n==="[object Arguments]";return i||(i=n!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&e.call(r.callee)==="[object Function]"),i},li}var ui,hc;function zv(){if(hc)return ui;hc=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Md(),i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(h){var p=h.constructor;return p&&p.prototype===h},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var h in window)try{if(!u["$"+h]&&t.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{l(window[h])}catch{return!0}}catch{return!0}return!1}(),d=function(h){if(typeof window>"u"||!f)return l(h);try{return l(h)}catch{return!1}};e=function(p){var m=p!==null&&typeof p=="object",x=r.call(p)==="[object Function]",g=n(p),v=m&&r.call(p)==="[object String]",S=[];if(!m&&!x&&!g)throw new TypeError("Object.keys called on a non-object");var j=a&&x;if(v&&p.length>0&&!t.call(p,0))for(var E=0;E<p.length;++E)S.push(String(E));if(g&&p.length>0)for(var C=0;C<p.length;++C)S.push(String(C));else for(var k in p)!(j&&k==="prototype")&&t.call(p,k)&&S.push(String(k));if(o)for(var L=d(p),N=0;N<s.length;++N)!(L&&s[N]==="constructor")&&t.call(p,s[N])&&S.push(s[N]);return S}}return ui=e,ui}var di,pc;function Qa(){if(pc)return di;pc=1;var e=Array.prototype.slice,t=Md(),r=Object.keys,n=r?function(a){return r(a)}:zv(),i=Object.keys;return n.shim=function(){if(Object.keys){var a=function(){var s=Object.keys(arguments);return s&&s.length===arguments.length}(1,2);a||(Object.keys=function(l){return t(l)?i(e.call(l)):i(l)})}else Object.keys=n;return Object.keys||n},di=n,di}var fi,mc;function Mn(){if(mc)return fi;mc=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return fi=e,fi}var hi,gc;function es(){return gc||(gc=1,hi=SyntaxError),hi}var pi,xc;function Le(){return xc||(xc=1,pi=TypeError),pi}var mi,vc;function Hv(){return vc||(vc=1,mi=Object.getOwnPropertyDescriptor),mi}var gi,yc;function Rt(){if(yc)return gi;yc=1;var e=Hv();if(e)try{e([],"length")}catch{e=null}return gi=e,gi}var xi,bc;function ts(){if(bc)return xi;bc=1;var e=Mn(),t=es(),r=Le(),n=Rt();return xi=function(o,a,s){if(!o||typeof o!="object"&&typeof o!="function")throw new r("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,h=!!n&&n(o,a);if(e)e(o,a,{configurable:f===null&&h?h.configurable:!f,enumerable:l===null&&h?h.enumerable:!l,value:s,writable:u===null&&h?h.writable:!u});else if(d||!l&&!u&&!f)o[a]=s;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},xi}var vi,wc;function rs(){if(wc)return vi;wc=1;var e=Mn(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},vi=t,vi}var yi,Sc;function Ot(){if(Sc)return yi;Sc=1;var e=Qa(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",r=Object.prototype.toString,n=Array.prototype.concat,i=ts(),o=function(u){return typeof u=="function"&&r.call(u)==="[object Function]"},a=rs()(),s=function(u,f,d,h){if(f in u){if(h===!0){if(u[f]===d)return}else if(!o(h)||!h())return}a?i(u,f,d,!0):i(u,f,d)},l=function(u,f){var d=arguments.length>2?arguments[2]:{},h=e(f);t&&(h=n.call(h,Object.getOwnPropertySymbols(f)));for(var p=0;p<h.length;p+=1)s(u,h[p],f[h[p]],d[h[p]])};return l.supportsDescriptors=!!a,yi=l,yi}var bi={exports:{}},wi,Ac;function ns(){return Ac||(Ac=1,wi=Object),wi}var Si,Cc;function Ld(){return Cc||(Cc=1,Si=Error),Si}var Ai,jc;function qv(){return jc||(jc=1,Ai=EvalError),Ai}var Ci,Tc;function Fv(){return Tc||(Tc=1,Ci=RangeError),Ci}var ji,Ec;function Uv(){return Ec||(Ec=1,ji=ReferenceError),ji}var Ti,Ic;function Wv(){return Ic||(Ic=1,Ti=URIError),Ti}var Ei,Rc;function Gv(){return Rc||(Rc=1,Ei=Math.abs),Ei}var Ii,Oc;function Vv(){return Oc||(Oc=1,Ii=Math.floor),Ii}var Ri,Pc;function Kv(){return Pc||(Pc=1,Ri=Math.max),Ri}var Oi,kc;function Xv(){return kc||(kc=1,Oi=Math.min),Oi}var Pi,Nc;function Yv(){return Nc||(Nc=1,Pi=Math.pow),Pi}var ki,Mc;function Jv(){return Mc||(Mc=1,ki=Math.round),ki}var Ni,Lc;function Zv(){return Lc||(Lc=1,Ni=Number.isNaN||function(t){return t!==t}),Ni}var Mi,$c;function Qv(){if($c)return Mi;$c=1;var e=Zv();return Mi=function(r){return e(r)||r===0?r:r<0?-1:1},Mi}var Li,_c;function Ln(){return _c||(_c=1,Li=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),Li}var $i,Dc;function is(){if(Dc)return $i;Dc=1;var e=typeof Symbol<"u"&&Symbol,t=Ln();return $i=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},$i}var _i,Bc;function $d(){return Bc||(Bc=1,_i=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),_i}var Di,zc;function _d(){if(zc)return Di;zc=1;var e=ns();return Di=e.getPrototypeOf||null,Di}var Bi,Hc;function ey(){if(Hc)return Bi;Hc=1;var e="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(l,u){for(var f=[],d=0;d<l.length;d+=1)f[d]=l[d];for(var h=0;h<u.length;h+=1)f[h+l.length]=u[h];return f},o=function(l,u){for(var f=[],d=u,h=0;d<l.length;d+=1,h+=1)f[h]=l[d];return f},a=function(s,l){for(var u="",f=0;f<s.length;f+=1)u+=s[f],f+1<s.length&&(u+=l);return u};return Bi=function(l){var u=this;if(typeof u!="function"||t.apply(u)!==n)throw new TypeError(e+u);for(var f=o(arguments,1),d,h=function(){if(this instanceof d){var v=u.apply(this,i(f,arguments));return Object(v)===v?v:this}return u.apply(l,i(f,arguments))},p=r(0,u.length-f.length),m=[],x=0;x<p;x++)m[x]="$"+x;if(d=Function("binder","return function ("+a(m,",")+"){ return binder.apply(this,arguments); }")(h),u.prototype){var g=function(){};g.prototype=u.prototype,d.prototype=new g,g.prototype=null}return d},Bi}var zi,qc;function Tr(){if(qc)return zi;qc=1;var e=ey();return zi=Function.prototype.bind||e,zi}var Hi,Fc;function os(){return Fc||(Fc=1,Hi=Function.prototype.call),Hi}var qi,Uc;function as(){return Uc||(Uc=1,qi=Function.prototype.apply),qi}var Fi,Wc;function ty(){return Wc||(Wc=1,Fi=typeof Reflect<"u"&&Reflect&&Reflect.apply),Fi}var Ui,Gc;function Dd(){if(Gc)return Ui;Gc=1;var e=Tr(),t=as(),r=os(),n=ty();return Ui=n||e.call(r,t),Ui}var Wi,Vc;function ss(){if(Vc)return Wi;Vc=1;var e=Tr(),t=Le(),r=os(),n=Dd();return Wi=function(o){if(o.length<1||typeof o[0]!="function")throw new t("a function is required");return n(e,r,o)},Wi}var Gi,Kc;function ry(){if(Kc)return Gi;Kc=1;var e=ss(),t=Rt(),r;try{r=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var n=!!r&&t&&t(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return Gi=n&&typeof n.get=="function"?e([n.get]):typeof o=="function"?function(s){return o(s==null?s:i(s))}:!1,Gi}var Vi,Xc;function Bd(){if(Xc)return Vi;Xc=1;var e=$d(),t=_d(),r=ry();return Vi=e?function(i){return e(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:r?function(i){return r(i)}:null,Vi}var Ki,Yc;function cs(){if(Yc)return Ki;Yc=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=Tr();return Ki=r.call(e,t),Ki}var Xi,Jc;function at(){if(Jc)return Xi;Jc=1;var e,t=ns(),r=Ld(),n=qv(),i=Fv(),o=Uv(),a=es(),s=Le(),l=Wv(),u=Gv(),f=Vv(),d=Kv(),h=Xv(),p=Yv(),m=Jv(),x=Qv(),g=Function,v=function(ne){try{return g('"use strict"; return ('+ne+").constructor;")()}catch{}},S=Rt(),j=Mn(),E=function(){throw new s},C=S?function(){try{return arguments.callee,E}catch{try{return S(arguments,"callee").get}catch{return E}}}():E,k=is()(),L=Bd(),N=_d(),P=$d(),_=as(),T=os(),A={},O=typeof Uint8Array>"u"||!L?e:L(Uint8Array),D={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":k&&L?L([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k&&L?L(L([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!k||!L?e:L(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":i,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!k||!L?e:L(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k&&L?L(""[Symbol.iterator]()):e,"%Symbol%":k?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":C,"%TypedArray%":O,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":_,"%Object.defineProperty%":j,"%Object.getPrototypeOf%":N,"%Math.abs%":u,"%Math.floor%":f,"%Math.max%":d,"%Math.min%":h,"%Math.pow%":p,"%Math.round%":m,"%Math.sign%":x,"%Reflect.getPrototypeOf%":P};if(L)try{null.error}catch(ne){var U=L(L(ne));D["%Error.prototype%"]=U}var H=function ne(F){var G;if(F==="%AsyncFunction%")G=v("async function () {}");else if(F==="%GeneratorFunction%")G=v("function* () {}");else if(F==="%AsyncGeneratorFunction%")G=v("async function* () {}");else if(F==="%AsyncGenerator%"){var z=ne("%AsyncGeneratorFunction%");z&&(G=z.prototype)}else if(F==="%AsyncIteratorPrototype%"){var J=ne("%AsyncGenerator%");J&&L&&(G=L(J.prototype))}return D[F]=G,G},K={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Tr(),ie=cs(),he=re.call(T,Array.prototype.concat),ge=re.call(_,Array.prototype.splice),Se=re.call(T,String.prototype.replace),$e=re.call(T,String.prototype.slice),I=re.call(T,RegExp.prototype.exec),$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,V=function(F){var G=$e(F,0,1),z=$e(F,-1);if(G==="%"&&z!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(z==="%"&&G!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var J=[];return Se(F,$,function(ve,ye,be,Ae){J[J.length]=be?Se(Ae,X,"$1"):ye||ve}),J},ee=function(F,G){var z=F,J;if(ie(K,z)&&(J=K[z],z="%"+J[0]+"%"),ie(D,z)){var ve=D[z];if(ve===A&&(ve=H(z)),typeof ve>"u"&&!G)throw new s("intrinsic "+F+" exists, but is not available. Please file an issue!");return{alias:J,name:z,value:ve}}throw new a("intrinsic "+F+" does not exist!")};return Xi=function(F,G){if(typeof F!="string"||F.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof G!="boolean")throw new s('"allowMissing" argument must be a boolean');if(I(/^%?[^%]*%?$/,F)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var z=V(F),J=z.length>0?z[0]:"",ve=ee("%"+J+"%",G),ye=ve.name,be=ve.value,Ae=!1,je=ve.alias;je&&(J=je[0],ge(z,he([0,1],je)));for(var Ke=1,_e=!0;Ke<z.length;Ke+=1){var Te=z[Ke],Xe=$e(Te,0,1),Ye=$e(Te,-1);if((Xe==='"'||Xe==="'"||Xe==="`"||Ye==='"'||Ye==="'"||Ye==="`")&&Xe!==Ye)throw new a("property names with quotes must have matching quotes");if((Te==="constructor"||!_e)&&(Ae=!0),J+="."+Te,ye="%"+J+"%",ie(D,ye))be=D[ye];else if(be!=null){if(!(Te in be)){if(!G)throw new s("base intrinsic for "+F+" exists, but the property is not available.");return}if(S&&Ke+1>=z.length){var Je=S(be,Te);_e=!!Je,_e&&"get"in Je&&!("originalValue"in Je.get)?be=Je.get:be=be[Te]}else _e=ie(be,Te),be=be[Te];_e&&!Ae&&(D[ye]=be)}}return be},Xi}var Yi,Zc;function ny(){if(Zc)return Yi;Zc=1;var e=at(),t=ts(),r=rs()(),n=Rt(),i=Le(),o=e("%Math.floor%");return Yi=function(s,l){if(typeof s!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],f=!0,d=!0;if("length"in s&&n){var h=n(s,"length");h&&!h.configurable&&(f=!1),h&&!h.writable&&(d=!1)}return(f||d||!u)&&(r?t(s,"length",l,!0,!0):t(s,"length",l)),s},Yi}var Ji,Qc;function iy(){if(Qc)return Ji;Qc=1;var e=Tr(),t=as(),r=Dd();return Ji=function(){return r(e,t,arguments)},Ji}var el;function Kt(){return el||(el=1,function(e){var t=ny(),r=Mn(),n=ss(),i=iy();e.exports=function(a){var s=n(arguments),l=a.length-(arguments.length-1);return t(s,1+(l>0?l:0),!0)},r?r(e.exports,"apply",{value:i}):e.exports.apply=i}(bi)),bi.exports}var Zi,tl;function Ce(){if(tl)return Zi;tl=1;var e=at(),t=ss(),r=t([e("%String.prototype.indexOf%")]);return Zi=function(i,o){var a=e(i,!!o);return typeof a=="function"&&r(i,".prototype.")>-1?t([a]):a},Zi}var Qi,rl;function zd(){if(rl)return Qi;rl=1;var e=Qa(),t=Ln()(),r=Ce(),n=ns(),i=r("Array.prototype.push"),o=r("Object.prototype.propertyIsEnumerable"),a=t?n.getOwnPropertySymbols:null;return Qi=function(l,u){if(l==null)throw new TypeError("target must be an object");var f=n(l);if(arguments.length===1)return f;for(var d=1;d<arguments.length;++d){var h=n(arguments[d]),p=e(h),m=t&&(n.getOwnPropertySymbols||a);if(m)for(var x=m(h),g=0;g<x.length;++g){var v=x[g];o(h,v)&&i(p,v)}for(var S=0;S<p.length;++S){var j=p[S];if(o(h,j)){var E=h[j];f[j]=E}}}return f},Qi}var eo,nl;function Hd(){if(nl)return eo;nl=1;var e=zd(),t=function(){if(!Object.assign)return!1;for(var n="abcdefghijklmnopqrst",i=n.split(""),o={},a=0;a<i.length;++a)o[i[a]]=i[a];var s=Object.assign({},o),l="";for(var u in s)l+=u;return n!==l},r=function(){if(!Object.assign||!Object.preventExtensions)return!1;var n=Object.preventExtensions({1:2});try{Object.assign(n,"xy")}catch{return n[1]==="y"}return!1};return eo=function(){return!Object.assign||t()||r()?e:Object.assign},eo}var to,il;function oy(){if(il)return to;il=1;var e=Ot(),t=Hd();return to=function(){var n=t();return e(Object,{assign:n},{assign:function(){return Object.assign!==n}}),n},to}var ro,ol;function ay(){if(ol)return ro;ol=1;var e=Ot(),t=Kt(),r=zd(),n=Hd(),i=oy(),o=t.apply(n()),a=function(l,u){return o(Object,arguments)};return e(a,{getPolyfill:n,implementation:r,shim:i}),ro=a,ro}var no,al;function qd(){if(al)return no;al=1;var e=at(),t=Kt(),r=t(e("String.prototype.indexOf"));return no=function(i,o){var a=e(i,!!o);return typeof a=="function"&&r(i,".prototype.")>-1?t(a):a},no}var io,sl;function sy(){if(sl)return io;sl=1;var e=function(){return typeof(function(){}).name=="string"},t=Object.getOwnPropertyDescriptor;if(t)try{t([],"length")}catch{t=null}e.functionsHaveConfigurableNames=function(){if(!e()||!t)return!1;var i=t(function(){},"name");return!!i&&!!i.configurable};var r=Function.prototype.bind;return e.boundFunctionsHaveNames=function(){return e()&&typeof r=="function"&&(function(){}).bind().name!==""},io=e,io}var oo,cl;function cy(){if(cl)return oo;cl=1;var e=ts(),t=rs()(),r=sy().functionsHaveConfigurableNames(),n=Le();return oo=function(o,a){if(typeof o!="function")throw new n("`fn` is not a function");var s=arguments.length>2&&!!arguments[2];return(!s||r)&&(t?e(o,"name",a,!0,!0):e(o,"name",a)),o},oo}var ao,ll;function Fd(){if(ll)return ao;ll=1;var e=cy(),t=Le(),r=Object;return ao=e(function(){if(this==null||this!==r(this))throw new t("RegExp.prototype.flags getter called on non-object");var i="";return this.hasIndices&&(i+="d"),this.global&&(i+="g"),this.ignoreCase&&(i+="i"),this.multiline&&(i+="m"),this.dotAll&&(i+="s"),this.unicode&&(i+="u"),this.unicodeSets&&(i+="v"),this.sticky&&(i+="y"),i},"get flags",!0),ao}var so,ul;function Ud(){if(ul)return so;ul=1;var e=Fd(),t=Ot().supportsDescriptors,r=Object.getOwnPropertyDescriptor;return so=function(){if(t&&/a/mig.flags==="gim"){var i=r(RegExp.prototype,"flags");if(i&&typeof i.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var o="",a={};if(Object.defineProperty(a,"hasIndices",{get:function(){o+="d"}}),Object.defineProperty(a,"sticky",{get:function(){o+="y"}}),i.get.call(a),o==="dy")return i.get}}return e},so}var co,dl;function ly(){if(dl)return co;dl=1;var e=Ot().supportsDescriptors,t=Ud(),r=Rt(),n=Object.defineProperty,i=Ld(),o=Bd(),a=/a/;return co=function(){if(!e||!o)throw new i("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var l=t(),u=o(a),f=r(u,"flags");return(!f||f.get!==l)&&n(u,"flags",{configurable:!0,enumerable:!1,get:l}),l},co}var lo,fl;function uy(){if(fl)return lo;fl=1;var e=Ot(),t=Kt(),r=Fd(),n=Ud(),i=ly(),o=t(n());return e(o,{getPolyfill:n,implementation:r,shim:i}),lo=o,lo}var tr={exports:{}},uo,hl;function Pt(){if(hl)return uo;hl=1;var e=Ln();return uo=function(){return e()&&!!Symbol.toStringTag},uo}var fo,pl;function Wd(){if(pl)return fo;pl=1;var e=Pt()(),t=Ce(),r=t("Object.prototype.toString"),n=function(s){return e&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:r(s)==="[object Arguments]"},i=function(s){return n(s)?!0:s!==null&&typeof s=="object"&&"length"in s&&typeof s.length=="number"&&s.length>=0&&r(s)!=="[object Array]"&&"callee"in s&&r(s.callee)==="[object Function]"},o=function(){return n(arguments)}();return n.isLegacyArguments=i,fo=o?n:i,fo}const dy={},fy=Object.freeze(Object.defineProperty({__proto__:null,default:dy},Symbol.toStringTag,{value:"Module"})),hy=Nd(fy);var ho,ml;function $n(){if(ml)return ho;ml=1;var e=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=e&&t&&typeof t.get=="function"?t.get:null,n=e&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&o&&typeof o.get=="function"?o.get:null,s=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,f=typeof WeakSet=="function"&&WeakSet.prototype,d=f?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,p=h?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,x=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,S=String.prototype.slice,j=String.prototype.replace,E=String.prototype.toUpperCase,C=String.prototype.toLowerCase,k=RegExp.prototype.test,L=Array.prototype.concat,N=Array.prototype.join,P=Array.prototype.slice,_=Math.floor,T=typeof BigInt=="function"?BigInt.prototype.valueOf:null,A=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,D=typeof Symbol=="function"&&typeof Symbol.iterator=="object",U=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===D||!0)?Symbol.toStringTag:null,H=Object.prototype.propertyIsEnumerable,K=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(y){return y.__proto__}:null);function re(y,b){if(y===1/0||y===-1/0||y!==y||y&&y>-1e3&&y<1e3||k.call(/e/,b))return b;var ae=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof y=="number"){var se=y<0?-_(-y):_(y);if(se!==y){var ce=String(se),Q=S.call(b,ce.length+1);return j.call(ce,ae,"$&_")+"."+j.call(j.call(Q,/([0-9]{3})/g,"$&_"),/_$/,"")}}return j.call(b,ae,"$&_")}var ie=hy,he=ie.custom,ge=ve(he)?he:null,Se={__proto__:null,double:'"',single:"'"},$e={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};ho=function y(b,ae,se,ce){var Q=ae||{};if(Ae(Q,"quoteStyle")&&!Ae(Se,Q.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ae(Q,"maxStringLength")&&(typeof Q.maxStringLength=="number"?Q.maxStringLength<0&&Q.maxStringLength!==1/0:Q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var lt=Ae(Q,"customInspect")?Q.customInspect:!0;if(typeof lt!="boolean"&&lt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ae(Q,"indent")&&Q.indent!==null&&Q.indent!==" "&&!(parseInt(Q.indent,10)===Q.indent&&Q.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ae(Q,"numericSeparator")&&typeof Q.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var bt=Q.numericSeparator;if(typeof b>"u")return"undefined";if(b===null)return"null";if(typeof b=="boolean")return b?"true":"false";if(typeof b=="string")return kt(b,Q);if(typeof b=="number"){if(b===0)return 1/0/b>0?"0":"-0";var Re=String(b);return bt?re(b,Re):Re}if(typeof b=="bigint"){var ut=String(b)+"n";return bt?re(b,ut):ut}var Bn=typeof Q.depth>"u"?5:Q.depth;if(typeof se>"u"&&(se=0),se>=Bn&&Bn>0&&typeof b=="object")return V(b)?"[Array]":"[Object]";var Nt=df(Q,se);if(typeof ce>"u")ce=[];else if(_e(ce,b)>=0)return"[Circular]";function De(Mt,Or,hf){if(Or&&(ce=P.call(ce),ce.push(Or)),hf){var vs={depth:Q.depth};return Ae(Q,"quoteStyle")&&(vs.quoteStyle=Q.quoteStyle),y(Mt,vs,se+1,ce)}return y(Mt,Q,se+1,ce)}if(typeof b=="function"&&!ne(b)){var ds=Ke(b),fs=Ir(b,De);return"[Function"+(ds?": "+ds:" (anonymous)")+"]"+(fs.length>0?" { "+N.call(fs,", ")+" }":"")}if(ve(b)){var hs=D?j.call(String(b),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(b);return typeof b=="object"&&!D?ct(hs):hs}if(st(b)){for(var Yt="<"+C.call(String(b.nodeName)),zn=b.attributes||[],Rr=0;Rr<zn.length;Rr++)Yt+=" "+zn[Rr].name+"="+I($(zn[Rr].value),"double",Q);return Yt+=">",b.childNodes&&b.childNodes.length&&(Yt+="..."),Yt+="</"+C.call(String(b.nodeName))+">",Yt}if(V(b)){if(b.length===0)return"[]";var Hn=Ir(b,De);return Nt&&!uf(Hn)?"["+Dn(Hn,Nt)+"]":"[ "+N.call(Hn,", ")+" ]"}if(F(b)){var qn=Ir(b,De);return!("cause"in Error.prototype)&&"cause"in b&&!H.call(b,"cause")?"{ ["+String(b)+"] "+N.call(L.call("[cause]: "+De(b.cause),qn),", ")+" }":qn.length===0?"["+String(b)+"]":"{ ["+String(b)+"] "+N.call(qn,", ")+" }"}if(typeof b=="object"&&lt){if(ge&&typeof b[ge]=="function"&&ie)return ie(b,{depth:Bn-se});if(lt!=="symbol"&&typeof b.inspect=="function")return b.inspect()}if(Te(b)){var ps=[];return n&&n.call(b,function(Mt,Or){ps.push(De(Or,b,!0)+" => "+De(Mt,b))}),us("Map",r.call(b),ps,Nt)}if(Je(b)){var ms=[];return s&&s.call(b,function(Mt){ms.push(De(Mt,b))}),us("Set",a.call(b),ms,Nt)}if(Xe(b))return _n("WeakMap");if(Er(b))return _n("WeakSet");if(Ye(b))return _n("WeakRef");if(z(b))return ct(De(Number(b)));if(ye(b))return ct(De(T.call(b)));if(J(b))return ct(m.call(b));if(G(b))return ct(De(String(b)));if(typeof window<"u"&&b===window)return"{ [object Window] }";if(typeof globalThis<"u"&&b===globalThis||typeof wr<"u"&&b===wr)return"{ [object globalThis] }";if(!ee(b)&&!ne(b)){var Fn=Ir(b,De),gs=K?K(b)===Object.prototype:b instanceof Object||b.constructor===Object,Un=b instanceof Object?"":"null prototype",xs=!gs&&U&&Object(b)===b&&U in b?S.call(je(b),8,-1):Un?"Object":"",ff=gs||typeof b.constructor!="function"?"":b.constructor.name?b.constructor.name+" ":"",Wn=ff+(xs||Un?"["+N.call(L.call([],xs||[],Un||[]),": ")+"] ":"");return Fn.length===0?Wn+"{}":Nt?Wn+"{"+Dn(Fn,Nt)+"}":Wn+"{ "+N.call(Fn,", ")+" }"}return String(b)};function I(y,b,ae){var se=ae.quoteStyle||b,ce=Se[se];return ce+y+ce}function $(y){return j.call(String(y),/"/g,"&quot;")}function X(y){return!U||!(typeof y=="object"&&(U in y||typeof y[U]<"u"))}function V(y){return je(y)==="[object Array]"&&X(y)}function ee(y){return je(y)==="[object Date]"&&X(y)}function ne(y){return je(y)==="[object RegExp]"&&X(y)}function F(y){return je(y)==="[object Error]"&&X(y)}function G(y){return je(y)==="[object String]"&&X(y)}function z(y){return je(y)==="[object Number]"&&X(y)}function J(y){return je(y)==="[object Boolean]"&&X(y)}function ve(y){if(D)return y&&typeof y=="object"&&y instanceof Symbol;if(typeof y=="symbol")return!0;if(!y||typeof y!="object"||!O)return!1;try{return O.call(y),!0}catch{}return!1}function ye(y){if(!y||typeof y!="object"||!T)return!1;try{return T.call(y),!0}catch{}return!1}var be=Object.prototype.hasOwnProperty||function(y){return y in this};function Ae(y,b){return be.call(y,b)}function je(y){return x.call(y)}function Ke(y){if(y.name)return y.name;var b=v.call(g.call(y),/^function\s*([\w$]+)/);return b?b[1]:null}function _e(y,b){if(y.indexOf)return y.indexOf(b);for(var ae=0,se=y.length;ae<se;ae++)if(y[ae]===b)return ae;return-1}function Te(y){if(!r||!y||typeof y!="object")return!1;try{r.call(y);try{a.call(y)}catch{return!0}return y instanceof Map}catch{}return!1}function Xe(y){if(!u||!y||typeof y!="object")return!1;try{u.call(y,u);try{d.call(y,d)}catch{return!0}return y instanceof WeakMap}catch{}return!1}function Ye(y){if(!p||!y||typeof y!="object")return!1;try{return p.call(y),!0}catch{}return!1}function Je(y){if(!a||!y||typeof y!="object")return!1;try{a.call(y);try{r.call(y)}catch{return!0}return y instanceof Set}catch{}return!1}function Er(y){if(!d||!y||typeof y!="object")return!1;try{d.call(y,d);try{u.call(y,u)}catch{return!0}return y instanceof WeakSet}catch{}return!1}function st(y){return!y||typeof y!="object"?!1:typeof HTMLElement<"u"&&y instanceof HTMLElement?!0:typeof y.nodeName=="string"&&typeof y.getAttribute=="function"}function kt(y,b){if(y.length>b.maxStringLength){var ae=y.length-b.maxStringLength,se="... "+ae+" more character"+(ae>1?"s":"");return kt(S.call(y,0,b.maxStringLength),b)+se}var ce=$e[b.quoteStyle||"single"];ce.lastIndex=0;var Q=j.call(j.call(y,ce,"\\$1"),/[\x00-\x1f]/g,Xt);return I(Q,"single",b)}function Xt(y){var b=y.charCodeAt(0),ae={8:"b",9:"t",10:"n",12:"f",13:"r"}[b];return ae?"\\"+ae:"\\x"+(b<16?"0":"")+E.call(b.toString(16))}function ct(y){return"Object("+y+")"}function _n(y){return y+" { ? }"}function us(y,b,ae,se){var ce=se?Dn(ae,se):N.call(ae,", ");return y+" ("+b+") {"+ce+"}"}function uf(y){for(var b=0;b<y.length;b++)if(_e(y[b],`
5
+ 3. "-" cannot repeat`);de.customSchemes.push([e,t])}function J0(){de.scanner=F0(de.customSchemes);for(let e=0;e<de.tokenQueue.length;e++)de.tokenQueue[e][1]({scanner:de.scanner});de.parser=G0(de.scanner.tokens);for(let e=0;e<de.pluginQueue.length;e++)de.pluginQueue[e][1]({scanner:de.scanner,parser:de.parser});return de.initialized=!0,de}function _a(e){return de.initialized||J0(),V0(de.parser.start,e,id(de.scanner.start,e))}_a.scan=id;function ad(e,t=null,r=null){if(t&&typeof t=="object"){if(r)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);r=t,t=null}const n=new $a(r),i=_a(e),o=[];for(let a=0;a<i.length;a++){const s=i[a];s.isLink&&(!t||s.t===t)&&n.check(s)&&o.push(s.toFormattedObject(n))}return o}const Da="[\0-   ᠎ -\u2029  ]",Z0=new RegExp(Da),Q0=new RegExp(`${Da}$`),e1=new RegExp(Da,"g");function t1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function r1(e){return new B.Plugin({key:new B.PluginKey("autolink"),appendTransaction:(t,r,n)=>{const i=t.some(u=>u.docChanged)&&!r.doc.eq(n.doc),o=t.some(u=>u.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=n,s=B.combineTransactionSteps(r.doc,[...t]);if(B.getChangedRanges(s).forEach(({newRange:u})=>{const f=B.findChildrenInRange(n.doc,u,p=>p.isTextblock);let d,h;if(f.length>1)d=f[0],h=n.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(f.length){const p=n.doc.textBetween(u.from,u.to," "," ");if(!Q0.test(p))return;d=f[0],h=n.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&h){const p=h.split(Z0).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],x=d.pos+h.lastIndexOf(m);if(!m)return!1;const g=_a(m).map(v=>v.toObject(e.defaultProtocol));if(!t1(g))return!1;g.filter(v=>v.isLink).map(v=>({...v,from:x+v.start+1,to:x+v.end+1})).filter(v=>n.schema.marks.code?!n.doc.rangeHasMark(v.from,v.to,n.schema.marks.code):!0).filter(v=>e.validate(v.value)).filter(v=>e.shouldAutoLink(v.value)).forEach(v=>{B.getMarksBetween(v.from,v.to,n.doc).some(S=>S.mark.type===e.type)||a.addMark(v.from,v.to,e.type.create({href:v.href}))})}}),!!a.steps.length)return a}})}function n1(e){return new B.Plugin({key:new B.PluginKey("handleClickLink"),props:{handleClick:(t,r,n)=>{var i,o;if(n.button!==0||!t.editable)return!1;let a=n.target;const s=[];for(;a.nodeName!=="DIV";)s.push(a),a=a.parentNode;if(!s.find(h=>h.nodeName==="A"))return!1;const l=B.getAttributes(t.state,e.type.name),u=n.target,f=(i=u==null?void 0:u.href)!==null&&i!==void 0?i:l.href,d=(o=u==null?void 0:u.target)!==null&&o!==void 0?o:l.target;return u&&f?(window.open(f,d),!0):!1}}})}function i1(e){return new B.Plugin({key:new B.PluginKey("handlePasteLink"),props:{handlePaste:(t,r,n)=>{const{state:i}=t,{selection:o}=i,{empty:a}=o;if(a)return!1;let s="";n.content.forEach(u=>{s+=u.textContent});const l=ad(s,{defaultProtocol:e.defaultProtocol}).find(u=>u.isLink&&u.value===s);return!s||!l?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function wt(e,t){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(n=>{const i=typeof n=="string"?n:n.scheme;i&&r.push(i)}),!e||e.replace(e1,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const o1=B.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){ic(e);return}ic(e.scheme,e.optionalSlashes)})},onDestroy(){Y0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!wt(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:r=>!!wt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!wt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",B.mergeAttributes(this.options.HTMLAttributes,e),0]:["a",B.mergeAttributes(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:r}=e;return this.options.isAllowedUri(r,{defaultValidate:n=>!!wt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:r}=e;return this.options.isAllowedUri(r,{defaultValidate:n=>!!wt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[B.markPasteRule({find:e=>{const t=[];if(e){const{protocols:r,defaultProtocol:n}=this.options,i=ad(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:a=>!!wt(a,r),protocols:r,defaultProtocol:n}));i.length&&i.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:r}=this.options;return this.options.autolink&&e.push(r1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:i=>!!wt(i,t),protocols:t,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(n1({type:this.type})),this.options.linkOnPaste&&e.push(i1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}});function a1(e){const[t,r]=w.useState(!1);function n(i,o,a){e.action&&(e.action({link:i,text:o,openInNewTab:a}),r(!1))}return c.jsxs(Wt,{modal:!0,open:t,onOpenChange:r,children:[c.jsx(Gt,{disabled:e==null?void 0:e.disabled,asChild:!0,children:c.jsx(W,{tooltip:e==null?void 0:e.tooltip,isActive:e==null?void 0:e.isActive,disabled:e==null?void 0:e.disabled,children:c.jsx(xe,{name:e==null?void 0:e.icon})})}),c.jsx(It,{hideWhenDetached:!0,className:"richtext-w-full",align:"start",side:"bottom",children:c.jsx(cd,{editor:e.editor,onSetLink:n,open:t,target:e.target})})]})}const sd=o1.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:e}){return["a",B.mergeAttributes(this.options.HTMLAttributes,e,{class:"link"}),0]},addOptions(){var r,n;const e=((r=this.parent)==null?void 0:r.call(this))||{},t=(n=e.HTMLAttributes)==null?void 0:n.target;return{...e,openOnClick:!0,button:({editor:i,t:o})=>({component:a1,componentProps:{editor:i,action:a=>{const{link:s,text:l,openInNewTab:u}=a;if(!s){i.chain().extendMarkRange("link").unsetLink().run();return}i.isActive("link")&&i.chain().extendMarkRange("link").run();const{from:f}=i.state.selection,d=l.length;i.chain().insertContent({type:"text",text:l,marks:[{type:"link",attrs:{href:s.match(/^https?:\/\//i)?s:`http://${s}`,target:t??(u?"_blank":"")}}]}).setLink({href:s}).setTextSelection({from:f,to:f+d}).focus().run()},id:"linkk",isActive:()=>i.isActive("link")||!1,disabled:!i.can().setLink({href:""}),icon:"Link",tooltip:o("editor.link.tooltip"),target:t}})}},addProseMirrorPlugins(){return[new B.Plugin({props:{handleClick:(e,t)=>{const{schema:r,doc:n,tr:i}=e.state,o=B.getMarkRange(n.resolve(t),r.marks.link);if(!o)return!1;let a=null;if(n.nodesBetween(o.from,o.to,f=>(a=f.marks.find(d=>d.type===r.marks.link),!a)),this.options.openOnClick&&(a!=null&&a.attrs.href)&&t!==o.to)return window.open(a.attrs.href,a.attrs.target||"_self"),!0;const s=n.resolve(o.from),l=n.resolve(o.to),u=i.setSelection(new B.TextSelection(s,l));e.dispatch(u)}}})]}});function cd(e){const{t}=q.useLocale(),[r,n]=w.useState({text:"",link:""}),[i,o]=w.useState(!1),a=w.useRef(null),s=w.useRef(null);w.useEffect(()=>{const u=()=>{var S,j,E,C;const{from:f,to:d,empty:h}=e.editor.state.selection,p=(S=e.editor.extensionManager.extensions.find(k=>k.name===sd.name))==null?void 0:S.options;let m="",x="",g=(j=p==null?void 0:p.HTMLAttributes)==null?void 0:j.target;const v=e.editor.state.doc.nodeAt(f);if(v){const k=v.marks.find(L=>L.type.name==="link");k?(x=k.attrs.href||"",g=k.attrs.target,h?m=v.text||"":m=e.editor.state.doc.textBetween(f,d," ")):m=e.editor.state.doc.textBetween(f,d," ")}v||(m=e.editor.state.doc.textBetween(f,d," ")),n({link:x,text:m}),o(e.target?e.target==="_blank":g==="_blank"),e.open&&(m===""?(E=a.current)==null||E.focus():(C=s.current)==null||C.focus())};return u(),e.editor.on("selectionUpdate",u),()=>{e.editor.off("selectionUpdate",u)}},[e.editor,e.open]);function l(u){u.preventDefault(),u.stopPropagation(),e==null||e.onSetLink(r.link,r.text,i),n({text:"",link:""})}return c.jsx("div",{className:"border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black",children:c.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-2",children:[c.jsx(Ue,{className:"mb-[6px]",children:t("editor.link.dialog.text")}),c.jsx("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:c.jsx(Ie,{ref:a,className:"richtext-w-80",onChange:u=>n({...r,text:u.target.value}),placeholder:"Text",required:!0,type:"text",value:r.text})})}),c.jsx(Ue,{className:"mb-[6px]",children:t("editor.link.dialog.link")}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsxs("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:[c.jsx(Ie,{ref:s,className:"richtext-pl-10",onChange:u=>n({...r,link:u.target.value}),required:!0,type:"url",value:r.link}),c.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2",children:c.jsx(xe,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),!e.target&&c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-space-x-2",children:[c.jsx(Ue,{children:t("editor.link.dialog.openInNewTab")}),c.jsx(Ka,{checked:i,onCheckedChange:u=>{o(u)}})]}),c.jsx(we,{className:"richtext-mt-2 richtext-self-end",onClick:l,type:"button",children:t("editor.link.dialog.button.apply")})]})})}function s1(e){const{t}=q.useLocale();return c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800",children:[c.jsx("a",{href:e==null?void 0:e.link,target:"_blank",rel:"noopener noreferrer",className:"richtext-text-sm richtext-underline richtext-break-all",children:lx(e==null?void 0:e.link,{length:50,omission:"…"})}),(e==null?void 0:e.link)&&c.jsx(Be,{orientation:"vertical",className:"!richtext-h-4"}),c.jsxs("div",{className:"richtext-flex richtext-flex-nowrap",children:[c.jsx(W,{icon:"Pencil",tooltip:t("editor.link.edit.tooltip"),action:()=>{e==null||e.onEdit()},tooltipOptions:{sideOffset:15}}),c.jsx(W,{icon:"Unlink",tooltip:t("editor.link.unlink.tooltip"),action:()=>{e==null||e.onClear()},tooltipOptions:{sideOffset:15}})]})]})}function c1({editor:e,disabled:t}){const[r,n]=w.useState(!1),i=w.useMemo(()=>{const{href:l}=e.getAttributes("link");return l},[e]),o=w.useCallback(({editor:l})=>l.isActive("link"),[]),a=(l,u,f)=>{const d=e.state.selection,{from:h}=d,p=(u==null?void 0:u.length)??0,m=h+p;e.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:f?"_blank":""}}]}).setLink({href:l}).setTextSelection({from:h,to:m}).focus().run(),n(!1)},s=w.useCallback(()=>{e.chain().extendMarkRange("link").unsetLink().focus().run(),n(!1)},[e]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e,shouldShow:o,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n(!1)}},children:t?c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{children:r?c.jsx(cd,{onSetLink:a,editor:e}):c.jsx(s1,{editor:e,onClear:s,onEdit:()=>{n(!0)},link:i})})})})}const l1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Ba=B.Node.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",B.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[B.nodeInputRule({find:l1,type:this.type,getAttributes:e=>{const[,,t,r,n]=e;return{src:r,alt:t,title:n}}})]}}),Cr=Ne.Root,jr=Ne.Trigger,u1=Ne.Portal,ld=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Overlay,{ref:r,className:te("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 richtext- 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",e),...t}));ld.displayName=Ne.Overlay.displayName;const Ft=oe.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(u1,{children:[c.jsx(ld,{}),c.jsxs(Ne.Content,{ref:n,className:te("richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 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-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",e),...r,children:[t,c.jsxs(Ne.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[c.jsx(M.X,{className:"richtext-h-4 richtext-w-4"}),c.jsx("span",{className:"richtext-sr-only",children:"Close"})]})]})]}));Ft.displayName=Ne.Content.displayName;function ud({className:e,...t}){return c.jsx("div",{className:te("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",e),...t})}ud.displayName="DialogHeader";function In({className:e,...t}){return c.jsx("div",{className:te("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",e),...t})}In.displayName="DialogFooter";const Ut=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Title,{ref:r,className:te("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight",e),...t}));Ut.displayName=Ne.Title.displayName;const d1=oe.forwardRef(({className:e,...t},r)=>c.jsx(Ne.Description,{ref:r,className:te("richtext-text-sm richtext-text-muted-foreground",e),...t}));d1.displayName=Ne.Description.displayName;const oc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=me.clsx,Rn=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ac(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:o}=t,a=Object.keys(i).map(u=>{const f=r==null?void 0:r[u],d=o==null?void 0:o[u];if(f===null)return null;const h=oc(f)||oc(d);return i[u][h]}),s=r&&Object.entries(r).reduce((u,f)=>{let[d,h]=f;return h===void 0||(u[d]=h),u},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:d,className:h,...p}=f;return Object.entries(p).every(m=>{let[x,g]=m;return Array.isArray(g)?g.includes({...o,...s}[x]):{...o,...s}[x]===g})?[...u,d,h]:u},[]);return ac(e,a,l,r==null?void 0:r.class,r==null?void 0:r.className)},f1=Rn("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-h-10 richtext-w-10"}},defaultVariants:{variant:"default",size:"default"}}),we=oe.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...i},o)=>{const a=n?tu.Slot:"button";return c.jsx(a,{className:te(f1({variant:t,size:r,className:e})),ref:o,...i})});we.displayName="Button";function h1(e){return e.replace(/^.*\/|\..+$/g,"")}function p1(e){return e.split(".").pop()}function m1(e){return e<1024?`${e} Byte`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function g1(e){return e?e==="application/pdf"?"pdf":e.startsWith("application/")&&[".document","word"].some(t=>e.includes(t))?"word":e.startsWith("application/")&&["presentation"].some(t=>e.includes(t))?"excel":e.startsWith("application/")&&["sheet"].some(t=>e.includes(t))?"ppt":e.startsWith("image")?"image":e.startsWith("audio")?"audio":e.startsWith("video")?"video":"file":"file"}function x1(e){return new Promise(t=>{const r=new FileReader;r.addEventListener("load",()=>{t({alt:e.name,src:r.result})},!1),r.readAsDataURL(e)})}function dd(e,t){const r=e.split(","),n=r[0].match(/:(.*?);/)[1],i=atob(r[r.length-1]);let o=i.length;const a=new Uint8Array(o);for(;o--;)a[o]=i.charCodeAt(o);return new File([a],t,{type:n})}function v1(e,t){const r=e.type,n=e.name.toLowerCase(),i=n.split(".").pop();if(!i)return!1;const a=r||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[i];return t.some(s=>{if(s.startsWith("."))return n.endsWith(s);if(s.endsWith("/*")){const l=s.split("/")[0];return a==null?void 0:a.startsWith(l+"/")}return a===s})}function fd(e,t){const{acceptMimes:r,maxSize:n,t:i,toast:o}=t,a=[];return(Array.isArray(e)?e:Object.values(e)).forEach(l=>{if(!v1(l,r)){t.onError?t.onError({type:"type",message:i("editor.upload.fileTypeNotSupported",{fileName:l.name}),file:l}):o({variant:"default",title:i("editor.upload.fileTypeNotSupported",{fileName:l.name})});return}if(l.size>n){const u=(n/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:u}),file:l}):o({variant:"default",title:i("editor.upload.fileSizeTooBig",{fileName:l.name,size:u})});return}a.push(l)}),a}function y1({editor:e,imageInline:t,onClose:r,disabled:n,alt:i}){var _,T;const{t:o}=q.useLocale(),{toast:a}=Nn(),[s,l]=w.useState(!1),[u,f]=w.useState(!1),d=w.useRef(null),[h,p]=w.useState(),[m,x]=w.useState(""),g=w.useRef(null),[v,S]=w.useState({src:"",file:null}),j=w.useMemo(()=>{var A;return(A=e.extensionManager.extensions.find(O=>O.name===Ht.name))==null?void 0:A.options},[e]);function E(A){if(d.current&&A.width&&A.height){const O=C(d.current,A);x(O)}}function C(A,O){const D=document.createElement("canvas"),U=A.naturalWidth/A.width,H=A.naturalHeight/A.height;D.width=O.width*U,D.height=O.height*H;const K=D.getContext("2d");return K&&(K.imageSmoothingEnabled=!1,K.drawImage(A,O.x*U,O.y*H,O.width*U,O.height*H,0,0,O.width*U,O.height*H)),D.toDataURL("image/png",1)}const k=w.useCallback(async()=>{var A;if(!u){f(!0);try{const O=dd(m,((A=v==null?void 0:v.file)==null?void 0:A.name)||"image.png");let D="";j.upload?D=await j.upload(O):D=URL.createObjectURL(O),e.chain().focus().setImageInline({src:D,inline:t,alt:i}).run(),l(!1),S({src:"",file:null}),P(),r()}catch(O){console.log("Error cropping image",O)}finally{f(!1)}}},[m,e,t,u,r,(_=v==null?void 0:v.file)==null?void 0:_.name,j]);function L(A){var O;A.preventDefault(),(O=g.current)==null||O.click()}const N=async A=>{var K;const O=(K=A==null?void 0:A.target)==null?void 0:K.files;if(!e||e.isDestroyed||O.length===0){A.target.value="";return}const D=fd(O,{acceptMimes:j==null?void 0:j.acceptMimes,maxSize:j==null?void 0:j.maxSize,t:o,toast:a,onError:j.onError});if(D.length<=0){A.target.value="";return}const U=D[0],H=await x1(U);l(!0),S({src:H.src,file:U})},P=()=>{g.current&&(g.current.value="")};return c.jsxs(c.Fragment,{children:[c.jsx(we,{className:"richtext-mt-1 richtext-w-full",disabled:n,onClick:L,size:"sm",children:o("editor.image.dialog.tab.uploadCrop")}),c.jsxs(Cr,{open:s,onOpenChange:A=>{l(A),A||(S({src:"",file:null}),P())},children:[c.jsx(jr,{}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:o("editor.image.dialog.tab.uploadCrop")}),c.jsx("div",{children:v.src&&c.jsx(Cf,{className:"richtext-w-full",crop:h,onChange:A=>p(A),onComplete:A=>E(A),children:c.jsx("img",{alt:"Crop me",ref:d,src:v.src})})}),c.jsxs(In,{children:[c.jsxs(we,{disabled:u,onClick:()=>{l(!1),S({src:"",file:null}),P()},children:[o("editor.imageUpload.cancel"),c.jsx(xe,{className:"richtext-ml-1",name:"Trash2"})]}),c.jsx(we,{className:"richtext-w-fit",disabled:u||!h,onClick:k,children:u?c.jsxs(c.Fragment,{children:[o("editor.imageUpload.uploading"),c.jsx(xe,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):c.jsxs(c.Fragment,{children:[o("editor.imageUpload.crop"),c.jsx(xe,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),c.jsx("input",{accept:((T=j==null?void 0:j.acceptMimes)==null?void 0:T.join(","))||"image/*",multiple:!1,onChange:N,ref:g,style:{display:"none"},type:"file"})]})}function On(e){function t(){const o=w.useRef(e),a=w.useCallback(()=>o.current,[]),s=w.useRef(new Set),l=w.useCallback(f=>{o.current={...o.current,...f},s.current.forEach(d=>d())},[]),u=w.useCallback(f=>(s.current.add(f),()=>s.current.delete(f)),[]);return{get:a,set:l,subscribe:u}}const r=w.createContext(null);function n({children:o}){return c.jsx(r.Provider,{value:t(),children:o})}function i(o){const a=w.useContext(r);if(!a)throw new Error("Store not found");return[w.useSyncExternalStore(a.subscribe,()=>o(a.get()),()=>o(e)),a.set]}return{Provider:n,useStore:i}}On({value:!1});On({value:!1});const{Provider:b1,useStore:hd}=On({value:!1}),{Provider:w1,useStore:pd}=On({value:"light"});q.d("0");function xr(e,t){return window.addEventListener(e,t),()=>{window.removeEventListener(e,t)}}function Pn(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}const vt={UPLOAD_IMAGE:e=>`UPLOAD_IMAGE-${e}`,UPLOAD_VIDEO:e=>`UPLOAD_VIDEO-${e}`,EDIT:e=>`EDIT-${e}`,UPDATE_THEME:e=>`UPDATE_THEME-${e}`,SEARCH_REPLCE:"SEARCH_REPLACE"},md={setOpen:(e,t)=>{Pn(vt.UPLOAD_IMAGE(e),t)}};function S1(e){var E;const{t}=q.useLocale(),{toast:r}=Nn(),[n,i]=w.useState(!1),[o,a]=w.useState(!1),s=C=>{i(C.detail)},[l,u]=w.useState(""),[f,d]=w.useState(""),h=w.useRef(null),p=((E=e.editor.extensionManager.extensions.find(C=>C.name===Ht.name))==null?void 0:E.options.defaultInline)||!1,[m,x]=w.useState(p),g=w.useMemo(()=>{var k;return(k=e.editor.extensionManager.extensions.find(L=>L.name===Ht.name))==null?void 0:k.options},[e.editor]);w.useEffect(()=>{const C=xr(vt.UPLOAD_IMAGE(e.editor.id),s);return()=>{C()}},[]);async function v(C){var N;const k=(N=C==null?void 0:C.target)==null?void 0:N.files;if(!e.editor||e.editor.isDestroyed||k.length===0||o){C.target.value="";return}const L=fd(k,{acceptMimes:g==null?void 0:g.acceptMimes,maxSize:g==null?void 0:g.maxSize,t,toast:r,onError:g.onError});if(L.length<=0){C.target.value="";return}a(!0);try{if(g!=null&&g.multiple){const P=L.map(async T=>{let A="";return g.upload?A=await g.upload(T):A=URL.createObjectURL(T),A});(await Promise.all(P)).forEach(T=>{e.editor.chain().focus().setImageInline({src:T,inline:m,alt:f}).run()})}else{const P=L[0];let _="";g.upload?_=await g.upload(P):_=URL.createObjectURL(P),e.editor.chain().focus().setImageInline({src:_,inline:m,alt:f}).run()}i(!1),d(""),x(p)}catch(P){console.error("Error uploading image",P),g.onError?g.onError({type:"upload",message:t("editor.upload.error")}):r({variant:"destructive",title:t("editor.upload.error")})}finally{a(!1),C.target.value=""}}function S(C){C.preventDefault(),C.stopPropagation(),e.editor.chain().focus().setImageInline({src:l,inline:m,alt:f}).run(),i(!1),x(p),u(""),d("")}function j(C){var k;C.preventDefault(),(k=h.current)==null||k.click()}return c.jsxs(Cr,{onOpenChange:i,open:n,children:[c.jsx(jr,{asChild:!0,children:c.jsx(W,{action:()=>i(!0),icon:e.icon,tooltip:e.tooltip})}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:t("editor.image.dialog.title")}),c.jsxs(Sd,{activationMode:"manual",defaultValue:g.resourceImage==="both"||g.resourceImage==="upload"?"upload":"link",children:[g.resourceImage==="both"&&c.jsxs(Xa,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[c.jsx(yr,{value:"upload",children:t("editor.image.dialog.tab.upload")}),c.jsx(yr,{value:"link",children:t("editor.image.dialog.tab.url")})]}),c.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[c.jsx(Id,{checked:m,onCheckedChange:C=>{x(C)}}),c.jsx(Ue,{children:t("editor.link.dialog.inline")})]}),g.enableAlt&&c.jsxs("div",{className:"richtext-my-[10px] ",children:[c.jsx(Ue,{className:"mb-[6px]",children:t("editor.imageUpload.alt")}),c.jsx(Ie,{onChange:C=>d(C.target.value),required:!0,type:"text",value:f})]}),c.jsxs(br,{value:"upload",children:[c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[c.jsx(we,{className:"richtext-mt-1 richtext-w-full",disabled:o,onClick:j,size:"sm",children:o?c.jsxs(c.Fragment,{children:[t("editor.imageUpload.uploading"),c.jsx(xe,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):t("editor.image.dialog.tab.upload")}),c.jsx(y1,{alt:f,disabled:o,editor:e.editor,imageInline:m,onClose:()=>{md.setOpen(e.editor.id,!1),d("")}})]}),c.jsx("input",{accept:g.acceptMimes.join(",")||"image/*",multiple:g.multiple,onChange:v,ref:h,style:{display:"none"},type:"file"})]}),c.jsx(br,{value:"link",children:c.jsx("form",{onSubmit:S,children:c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[c.jsx(Ie,{autoFocus:!0,onChange:C=>u(C.target.value),placeholder:t("editor.image.dialog.placeholder"),required:!0,type:"url",value:l}),c.jsx(we,{type:"submit",children:t("editor.image.dialog.button.apply")})]})})})]})]})]})}const Dr={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function A1(e){var N,P,_;const[t,r]=w.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[n,i]=w.useState({width:0,height:0}),[o]=w.useState([Dr.TOP_LEFT,Dr.TOP_RIGHT,Dr.BOTTOM_LEFT,Dr.BOTTOM_RIGHT]),[a,s]=w.useState(!1),[l,u]=w.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f,inline:d}=(N=e==null?void 0:e.node)==null?void 0:N.attrs,h=d&&(f==="left"||f==="right"),p=w.useMemo(()=>{var Se;const{src:T,alt:A,width:O,height:D,flipX:U,flipY:H}=(Se=e==null?void 0:e.node)==null?void 0:Se.attrs,K=Kr(O)?`${O}px`:O,re=Kr(D)?`${D}px`:D,ie=[];U&&ie.push("rotateX(180deg)"),H&&ie.push("rotateY(180deg)");const he=ie.join(" ");return{src:T||void 0,alt:A||void 0,style:{width:K||void 0,height:re||void 0,transform:he||"none",...h?{float:f}:{}}}},[(P=e==null?void 0:e.node)==null?void 0:P.attrs]),m=w.useMemo(()=>{const{style:{width:T}}=p;return{width:T==="100%"?T:void 0}},[p]);function x(T){i({width:T.target.width,height:T.target.height})}function g(){const{editor:T,getPos:A}=e;T.commands.setNodeSelection(A())}const v=w.useCallback(Bt(()=>{const{editor:T}=e,{width:A}=getComputedStyle(T.view.dom);r(O=>({...O,width:Number.parseInt(A,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function S(T,A){T.preventDefault(),T.stopPropagation();const O=n.width,D=n.height,U=O/D;let H=Number(e.node.attrs.width),K=Number(e.node.attrs.height);const re=t.width;H&&!K?(H=H>re?re:H,K=Math.round(H/U)):K&&!H?(H=Math.round(K*U),H=H>re?re:H):!H&&!K?(H=O>re?re:O,K=Math.round(H/U)):H=H>re?re:H,s(!0),u({x:T.clientX,y:T.clientY,w:H,h:K,dir:A})}const j=w.useCallback(Bt(T=>{if(T.preventDefault(),T.stopPropagation(),!a)return;const{x:A,w:O,dir:D}=l,U=(T.clientX-A)*(/l/.test(D)?-1:1),H=Eu(O+U,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:H,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[a,l,t,e.updateAttributes]),E=w.useCallback(T=>{T.preventDefault(),T.stopPropagation(),a&&(u({x:0,y:0,w:0,h:0,dir:""}),s(!1),g())},[a,g]),C=w.useCallback(()=>{document==null||document.addEventListener("mousemove",j,!0),document==null||document.addEventListener("mouseup",E,!0)},[j,E]),k=w.useCallback(()=>{document==null||document.removeEventListener("mousemove",j,!0),document==null||document.removeEventListener("mouseup",E,!0)},[j,E]);w.useEffect(()=>(a?C():k(),()=>{k()}),[a,C,k]);const L=w.useMemo(()=>new ResizeObserver(()=>v()),[v]);return w.useEffect(()=>(L.observe(e.editor.view.dom),()=>{L.disconnect()}),[e.editor.view.dom,L]),c.jsx(me.NodeViewWrapper,{as:d?"span":"div",className:"image-view",style:{float:h?f:void 0,margin:h?f==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:d?"inline":"block",textAlign:h?void 0:f,width:((_=p.style)==null?void 0:_.width)??"auto",...h?{}:m},children:c.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:m,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${a?"image-view__body--resizing":""}`,children:[c.jsx("img",{alt:p.alt,className:"image-view__body__image block",height:"auto",onClick:g,onLoad:x,src:p.src,style:p.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||a)&&c.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(T=>c.jsx("span",{className:`image-resizer__handler image-resizer__handler--${T}`,onMouseDown:A=>S(A,T)},`image-dir-${T}`))})]})})}const Dt=new B.PluginKey("upload-image");function C1(){return new B.Plugin({key:Dt,state:{init(){return B.DecorationSet.empty},apply(e,t){t=t.map(e.mapping,e.doc);const r=e.getMeta(Dt);if(r!=null&&r.add)for(const{id:n,pos:i,src:o}of r.add){const a=j1(o),s=B.Decoration.widget(i,a,{id:n});t=t.add(e.doc,[s])}else if(r!=null&&r.remove)for(const n of r.remove)t=t.remove(t.find(void 0,void 0,i=>i.id===n));return t}},props:{decorations(e){return this.getState(e)}}})}function j1(e){const t=document.createElement("div"),r=document.createElement("img");return r.setAttribute("class","opacity-50"),r.src=e,r.addEventListener("load",()=>{t.setAttribute("class","img-placeholder")}),t.append(r),t}function T1(e,t){var i;const n=Dt.getState(e).find(void 0,void 0,o=>o.id===t);return n.length>0?(i=n[0])==null?void 0:i.from:null}function E1({validateFn:e,onUpload:t,postUpload:r,defaultInline:n=!1}){return(i,o,a)=>{for(const s of i){if(e&&!e(s))continue;const l=Date.now().toString(),u=o.state.tr;u.selection.empty||u.deleteSelection();const f=URL.createObjectURL(s);u.setMeta(Dt,{add:[{id:l,pos:a,src:f}]}),o.dispatch(u),t(s).then(async d=>{var S;r&&typeof d=="string"&&(d=await r(d));const{schema:h}=o.state;let p=T1(o.state,l);if(p===null)return;const m=typeof d=="object"?f:d,x=(S=h.nodes.image)==null?void 0:S.create({src:m,inline:n});if(!x)return;const{doc:g}=o.state;p>g.content.size&&(p=g.content.size-1);const v=o.state.tr.replaceWith(p,p,x).setMeta(Dt,{remove:[l]});o.dispatch(v)},()=>{const d=o.state.tr.delete(a,a).setMeta(Dt,{remove:[l]});o.dispatch(d)})}}}function I1(e,t,r){var i;const n=[...((i=t.clipboardData)==null?void 0:i.files)||[]];if(n.length>0){t.preventDefault();const o=e.state.selection.from;return r(n,e,o+1),!0}return!1}function R1(e,t,r,n){var o;const i=[...((o=t.dataTransfer)==null?void 0:o.files)||[]];if(!r&&i.length>0){t.preventDefault();const a=e.posAtCoords({left:t.clientX,top:t.clientY});if(a)return n(i,e,a.pos+1),!0}return!1}const O1={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},Ht=Ba.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...O1,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:r,t:n})=>{var i,o;return{component:S1,componentProps:{action:()=>!0,upload:r.options.upload,disabled:!((o=(i=t.can()).setImage)!=null&&o.call(i,{})),icon:"ImageUp",tooltip:n("editor.image.tooltip"),editor:t}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||null;return r?Number.parseInt(r,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return me.ReactNodeViewRenderer(A1)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageInline:t=>({commands:r})=>r.insertContent({type:this.name,attrs:{...t,inline:t.inline??this.options.defaultInline}}),updateImage:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImage:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:r,align:n,inline:i}=e,o=i&&(n==="left"||n==="right"),a=t||r?`transform: rotateX(${t?"180":"0"}deg) rotateY(${r?"180":"0"}deg);`:"",s=o?"":`text-align: ${n};`,f=`${o?`float: ${n};`:""}${o?n==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${a}`;return[i?"span":"div",{style:s,class:"image"},["img",B.mergeAttributes({height:"auto",style:f},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var o;const t=e==null?void 0:e.parentElement,r=e==null?void 0:e.getAttribute("width"),n=(e==null?void 0:e.getAttribute("flipx"))||!1,i=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(e==null?void 0:e.getAttribute("align"))||((o=t==null?void 0:t.style)==null?void 0:o.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:n==="true",flipY:i==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width"),n=(t==null?void 0:t.getAttribute("flipx"))||!1,i=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:n==="true",flipY:i==="true"}}},{tag:'img[src]:not([src^="data:"])'}]},addProseMirrorPlugins(){const t=E1({validateFn:r=>!(!this.options.acceptMimes.includes(r.type)||r.size>this.options.maxSize),onUpload:this.options.upload,defaultInline:this.options.defaultInline});return[C1(),new B.Plugin({key:new B.PluginKey("image"),props:{handlePaste:(r,n)=>{var a;if(!(n.clipboardData&&n.clipboardData.files&&((a=n.clipboardData.files)==null?void 0:a.length)))return;if([...n.clipboardData.files||[]].some(s=>s.type==="text/html"))return!1;if(n.clipboardData.items.length==2){n.clipboardData.items[0].getAsString(s=>{let l="";if(s.replace(/src\s*=\s*"(.*)"/,(u,f)=>l=f),l&&typeof l=="string"){const u=r.state.schema.nodes.image.create({src:l}),f=r.state.tr.replaceSelectionWith(u);r.dispatch(f)}});return}return I1(r,n,t)},handleDrop:(r,n,i,o)=>{if(!(n instanceof DragEvent)||!n.dataTransfer)return!1;if(n.dataTransfer.items.length==2){n.dataTransfer.items[0].getAsString(a=>{let s="";if(a.replace(/src\s*=\s*"(.*)"/,(l,u)=>s=u),s&&typeof s=="string"){const l=r.state.schema.nodes.image.create({src:s}),u=r.state.tr.replaceSelectionWith(l);r.dispatch(u)}});return}return R1(r,n,o,t),!1}}})]}});async function P1(e){var n;const r=await(await fetch(`https://api.giphy.com/v1/gifs/trending?q=&limit=15&api_key=${e}`)).json();return(n=r==null?void 0:r.data)==null?void 0:n.map(i=>{var o,a,s;return{id:i==null?void 0:i.id,src:(o=i==null?void 0:i.images.original)==null?void 0:o.url,width:+((a=i==null?void 0:i.images.original)==null?void 0:a.width),height:+((s=i==null?void 0:i.images.original)==null?void 0:s.width)}})}async function k1(e,t){var i;const n=await(await fetch(`https://api.giphy.com/v1/gifs/search?q=${e}&limit=15&api_key=${t}`)).json();return(i=n==null?void 0:n.data)==null?void 0:i.map(o=>{var a,s,l;return{id:o==null?void 0:o.id,src:(a=o==null?void 0:o.images.original)==null?void 0:a.url,width:+((s=o==null?void 0:o.images.original)==null?void 0:s.width),height:+((l=o==null?void 0:o.images.original)==null?void 0:l.width)}})}async function N1(e){var o,a;const t=await fetch(`https://tenor.googleapis.com/v2/trending_terms?key=${e}&limit=10`),r=await(t==null?void 0:t.json()),i=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${e}&q=${(o=r==null?void 0:r.results)==null?void 0:o[0]}&limit=15`)).json();return(a=i==null?void 0:i.results)==null?void 0:a.map(s=>{var l,u,f,d,h,p,m,x;return{id:s==null?void 0:s.id,src:(u=(l=s==null?void 0:s.media_formats)==null?void 0:l.gif)==null?void 0:u.url,width:(h=(d=(f=s==null?void 0:s.media_formats)==null?void 0:f.gif)==null?void 0:d.dims)==null?void 0:h[0],height:(x=(m=(p=s==null?void 0:s.media_formats)==null?void 0:p.gif)==null?void 0:m.dims)==null?void 0:x[1]}})}async function M1(e,t){var i;const n=await(await fetch(`https://tenor.googleapis.com/v2/search?key=${t}&q=${e}&limit=15`)).json();return(i=n==null?void 0:n.results)==null?void 0:i.map(o=>{var a,s,l,u,f,d,h,p;return{id:o==null?void 0:o.id,src:(s=(a=o==null?void 0:o.media_formats)==null?void 0:a.gif)==null?void 0:s.url,width:(f=(u=(l=o==null?void 0:o.media_formats)==null?void 0:l.gif)==null?void 0:u.dims)==null?void 0:f[0],height:(p=(h=(d=o==null?void 0:o.media_formats)==null?void 0:d.gif)==null?void 0:h.dims)==null?void 0:p[1]}})}function L1(e,t){return{searchTrending:async()=>t?e==="giphy"?P1(t):e==="tenor"?N1(t):[]:[],searchWord:async i=>t?e==="giphy"?k1(i,t):e==="tenor"?M1(i,t):[]:[]}}function $1({selectImage:e,apiKey:t,provider:r,children:n}){const[i,o]=w.useState([]),a=w.useRef(null),{searchTrending:s,searchWord:l}=L1(r,t);w.useEffect(()=>{(async()=>{const f=await s();o(f)})()},[]);const u=w.useCallback(Ar(async f=>{if(!f.target.value){const h=await s();o(h);return}const d=await l(f.target.value);o(d)},350),[]);return c.jsxs(Wt,{modal:!0,children:[c.jsx(Gt,{asChild:!0,children:n}),c.jsx(It,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"richtext-mb-[10px] richtext-w-full",children:c.jsx(Ie,{onChange:u,placeholder:"Search GIF",ref:a,type:"text"})}),c.jsx("div",{className:"richtext-max-h-[280px] !richtext-max-w-[400px] richtext-overflow-y-auto",children:c.jsx("div",{className:"richtext-grid richtext-grid-cols-2 richtext-gap-1 ",children:i!=null&&i.length?i==null?void 0:i.map(f=>c.jsx("img",{alt:"",className:"richtext-cursor-pointer richtext-object-contain richtext-text-center",onClick:()=>e(f.src),src:f.src},f.id)):c.jsx("p",{children:"No GIFs found"})})})]}):c.jsx("div",{children:c.jsx("p",{children:"Missing Giphy API Key"})})})]})}function _1({editor:e,icon:t,provider:r,apiKey:n,...i}){const o=a=>{e.chain().focus().setImageGif({src:a}).run()};return c.jsx($1,{apiKey:n,provider:r,selectImage:o,children:c.jsx(W,{icon:t,tooltip:i==null?void 0:i.tooltip})})}const Br={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function D1(e){var k,L;const[t,r]=w.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[n,i]=w.useState({width:0,height:0}),[o]=w.useState([Br.TOP_LEFT,Br.TOP_RIGHT,Br.BOTTOM_LEFT,Br.BOTTOM_RIGHT]),[a,s]=w.useState(!1),[l,u]=w.useState({x:0,y:0,w:0,h:0,dir:""}),{align:f}=(k=e==null?void 0:e.node)==null?void 0:k.attrs,d=w.useMemo(()=>{var D;const{src:N,alt:P,width:_,height:T}=(D=e==null?void 0:e.node)==null?void 0:D.attrs,A=Kr(_)?`${_}px`:_,O=Kr(T)?`${T}px`:T;return{src:N||void 0,alt:P||void 0,style:{width:A||void 0,height:O||void 0}}},[(L=e==null?void 0:e.node)==null?void 0:L.attrs]),h=w.useMemo(()=>{const{style:{width:N}}=d;return{width:N==="100%"?N:void 0}},[d]);function p(N){i({width:N.target.width,height:N.target.height})}function m(){const{editor:N,getPos:P}=e;N.commands.setNodeSelection(P())}const x=w.useCallback(Bt(()=>{const{editor:N}=e,{width:P}=getComputedStyle(N.view.dom);r(_=>({..._,width:Number.parseInt(P,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function g(N,P){N.preventDefault(),N.stopPropagation();const _=n.width,T=n.height,A=_/T;let O=Number(e.node.attrs.width),D=Number(e.node.attrs.height);const U=t.width;O&&!D?(O=O>U?U:O,D=Math.round(O/A)):D&&!O?(O=Math.round(D*A),O=O>U?U:O):!O&&!D?(O=_>U?U:_,D=Math.round(O/A)):O=O>U?U:O,s(!0),u({x:N.clientX,y:N.clientY,w:O,h:D,dir:P})}const v=w.useCallback(Bt(N=>{if(N.preventDefault(),N.stopPropagation(),!a)return;const{x:P,w:_,dir:T}=l,A=(N.clientX-P)*(/l/.test(T)?-1:1),O=Eu(_+A,q.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:O,height:null})},q.IMAGE_THROTTLE_WAIT_TIME),[a,l,t,e.updateAttributes]),S=w.useCallback(N=>{N.preventDefault(),N.stopPropagation(),a&&(u({x:0,y:0,w:0,h:0,dir:""}),s(!1),m())},[a,m]),j=w.useCallback(()=>{document==null||document.addEventListener("mousemove",v,!0),document==null||document.addEventListener("mouseup",S,!0)},[v,S]),E=w.useCallback(()=>{document==null||document.removeEventListener("mousemove",v,!0),document==null||document.removeEventListener("mouseup",S,!0)},[v,S]);w.useEffect(()=>(a?j():E(),()=>{E()}),[a,j,E]);const C=w.useMemo(()=>new ResizeObserver(()=>x()),[x]);return w.useEffect(()=>(C.observe(e.editor.view.dom),()=>{C.disconnect()}),[e.editor.view.dom,C]),c.jsx(me.NodeViewWrapper,{className:"image-view",style:{...h,width:"100%",textAlign:f},children:c.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:h,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${a?"image-view__body--resizing":""}`,children:[c.jsx("img",{alt:d.alt,className:"image-view__body__image block",height:"auto",onClick:m,onLoad:p,src:d.src,style:d.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||a)&&c.jsx("div",{className:"image-resizer",children:o==null?void 0:o.map(N=>c.jsx("span",{className:`image-resizer__handler image-resizer__handler--${N}`,onMouseDown:P=>g(P,N)},`image-dir-${N}`))})]})})}const za=Ba.extend({name:"imageGif",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),inline:!1,content:"",marks:"",group:"block",API_KEY:"",provider:"giphy",draggable:!1,selectable:!0,atom:!0,button:({editor:t,extension:r,t:n})=>{var a,s;const i=((a=r==null?void 0:r.options)==null?void 0:a.provider)||"",o=((s=r==null?void 0:r.options)==null?void 0:s.API_KEY)||"";return{component:_1,componentProps:{editor:t,action:()=>{},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:n("editor.imageGif.tooltip"),apiKey:o,provider:i}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),width:{default:null,parseHTML:t=>{const r=t.style.width||t.getAttribute("width")||"10";return r===void 0?null:Number.parseInt(`${r}`,10)},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})}}},addNodeView(){return me.ReactNodeViewRenderer(D1)},addCommands(){var e;return{...(e=this.parent)==null?void 0:e.call(this),setImageGif:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t}),updateImageGif:t=>({commands:r})=>r.updateAttributes(this.name,t),setAlignImageGif:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:e}){const{align:t}=e;return["div",{style:t?`text-align: ${t};`:"",class:"imageGIf"},["img",B.mergeAttributes({height:"auto"},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:e=>{const t=e.querySelector("img"),r=t==null?void 0:t.getAttribute("width");return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),title:t==null?void 0:t.getAttribute("title"),width:r?Number.parseInt(r,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null}}}]}});function B1(e,t){let r;try{r=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const i=n.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(r.hostname)}return r.hostname.includes(n)})}function z1(e){const{t}=q.useLocale(),[r,n]=w.useState(""),i=w.useRef(null),[o,a]=w.useState(""),[s,l]=w.useState(!1),u=m=>{l(m.detail)};w.useEffect(()=>{const m=xr(vt.UPLOAD_VIDEO(e.editor.id),u);return()=>{m()}},[]);const f=w.useMemo(()=>{var x;return(x=e.editor.extensionManager.extensions.find(g=>g.name===Ha.name))==null?void 0:x.options},[e.editor]);async function d(m){var S;const x=(S=m==null?void 0:m.target)==null?void 0:S.files;if(!e.editor||e.editor.isDestroyed||x.length===0)return;const g=x[0];let v="";f.upload?v=await f.upload(g):v=URL.createObjectURL(g),e.editor.chain().focus().setVideo({src:v,width:"100%"}).run(),l(!1)}function h(m){m.preventDefault(),m.stopPropagation(),r&&(e.editor.chain().focus().setVideo({src:r,width:"100%"}).run(),l(!1),n(""))}function p(m){var x;m.preventDefault(),(x=i.current)==null||x.click()}return c.jsxs(Cr,{onOpenChange:l,open:s,children:[c.jsx(jr,{asChild:!0,children:c.jsx(W,{action:()=>l(!0),icon:e.icon,tooltip:e.tooltip})}),c.jsxs(Ft,{children:[c.jsx(Ut,{children:t("editor.video.dialog.title")}),c.jsxs(Sd,{activationMode:"manual",defaultValue:(f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="upload"?"upload":"link",children:[c.jsxs(Xa,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="upload")&&c.jsx(yr,{value:"upload",children:t("editor.video.dialog.tab.upload")}),((f==null?void 0:f.resourceVideo)==="both"||(f==null?void 0:f.resourceVideo)==="link")&&c.jsx(yr,{value:"link",children:t("editor.video.dialog.link")})]}),c.jsxs(br,{value:"upload",children:[c.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:c.jsx(we,{className:"richtext-mt-1 richtext-w-full",onClick:p,size:"sm",children:t("editor.video.dialog.tab.upload")})}),c.jsx("input",{accept:"video/*",multiple:!0,onChange:d,ref:i,type:"file",style:{display:"none"}})]}),c.jsxs(br,{value:"link",children:[c.jsx("div",{children:c.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[c.jsx(Ie,{autoFocus:!0,placeholder:t("editor.video.dialog.placeholder"),required:!0,type:"url",value:r,onChange:m=>{n(m.target.value)},onBlur:m=>{const x=m.target.value,g=f.videoProviders||["."];x&&!B1(x,g)?a("Invalid video URL"):a("")}}),c.jsx(we,{type:"button",onClick:h,children:t("editor.video.dialog.button.apply")})]})}),o&&c.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:o})]})]})]})]})}function H1(e,t,r){return e<t?t:e>r?r:e}const q1=e=>typeof e=="number",F1=e=>typeof e=="string",U1=e=>typeof e=="function";function W1(e,t="px"){if(!e)return e;const r=q1(e)?String(e):e,n=Number.parseFloat(r),i=r.match(/[%a-z]+$/i),o=i?i[0]:t;return Number.isNaN(n)?e:n+o}function gd(e,t){if(!e)return!1;const{extensions:r=[]}=(e==null?void 0:e.extensionManager)??{};return!!r.find(i=>i.name===t)}function G1(e){return e.map(t=>F1(t)?{value:t,name:t}:t)}function V1(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const r=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(r){const i=r[1],o=r[2];o?e=`https://player.vimeo.com/video/${i}?h=${o}`:e=`https://player.vimeo.com/video/${i}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const Ha=B.Node.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:q.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var r,n;return{component:z1,componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(r=e.can()).setVideo)!=null&&n.call(r,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?V1(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:W1(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:r="center"}=e??{},n={...e,width:"100%",height:"100%"},i=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,o=`flex: 1;padding-bottom: ${9/16*100}%;`,f=["div",{style:`display: flex; justify-content: ${r};`},["div",{style:i},["div",{style:o}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},f]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}}),qa={maxWidth:"auto",zIndex:20,appendTo:"parent",moveTransition:"transform 0.1s ease-out"};function Fa({item:e,disabled:t,editor:r}){var i;const n=e.component;return n?c.jsx(w.Fragment,{children:e.type==="divider"?c.jsx(Be,{className:"!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",orientation:"vertical"}):c.jsx(n,{...e.componentProps,disabled:t||((i=e==null?void 0:e.componentProps)==null?void 0:i.disabled),editor:r})}):c.jsx(c.Fragment,{})}function K1(e){return e.type.name===Ht.name}function X1(e){return e.type.name===za.name}function Y1(e){return e.type.name===Ha.name}function J1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(K1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:Yx(e.editor),[e.disabled,e.editor,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-${o}`))})}):c.jsx(c.Fragment,{})})})}function Z1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(X1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:Jx(e.editor),[e.disabled,e.editor,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-image-gif-${o}`))})}):c.jsx(c.Fragment,{})})})}function Q1(e){const{lang:t}=q.useLocale(),r=({editor:i})=>{const{selection:o}=i.view.state,{$from:a,to:s}=o;let l=!1;return i.view.state.doc.nodesBetween(a.pos,s,u=>{if(Y1(u))return l=!0,!1}),l},n=w.useMemo(()=>e.disabled?[]:e0(e.editor),[e.editor,e.disabled,t]);return c.jsx(c.Fragment,{children:c.jsx(me.BubbleMenu,{editor:e==null?void 0:e.editor,shouldShow:r,tippyOptions:qa,children:n!=null&&n.length?c.jsx("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap",children:n==null?void 0:n.map((i,o)=>c.jsx(Fa,{disabled:e.disabled,editor:e.editor,item:i},`bubbleMenu-video-${o}`))})}):c.jsx(c.Fragment,{})})})}function ev(e,t,r=null){return r?e.createChecked({index:t},r):e.createAndFill({index:t})}function tv(e){if(e.cached.columnsNodeTypes)return e.cached.columnsNodeTypes;const t={columns:e.nodes.columns,column:e.nodes.column};return e.cached.columnsNodeTypes=t,t}function rv(e,t,r=null){const n=tv(e),i=[];for(let o=0;o<t;o+=1){const a=ev(n.column,o,r);a&&i.push(a)}return n.columns.createChecked({cols:t},i)}function ai({state:e,dispatch:t,type:r}){const n=B.findParentNode(o=>o.type.name===vr.name)(e.selection),i=B.findParentNode(o=>o.type.name===Ua.name)(e.selection);if(t&&n&&i){const o=n.node,a=i.node.attrs.index,s=o.toJSON();let l=a;r==="delete"?(l=a-1,s.content.splice(a,1)):(l=r==="addBefore"?a:a+1,s.content.splice(l,0,{type:"column",attrs:{index:a},content:[{type:"paragraph"}]})),s.attrs.cols=s.content.length,s.content.forEach((h,p)=>{h.attrs.index=p});const u=B.Node$1.fromJSON(e.schema,s);let f=n.pos;u.content.forEach((h,p,m)=>{m<l&&(f+=h.nodeSize)});const d=e.tr.setTime(Date.now());d.replaceWith(n.pos,n.pos+n.node.nodeSize,u).setSelection(B.TextSelection.near(d.doc.resolve(f))),t(d)}return!0}function sc({state:e,dispatch:t,type:r}){const n=B.findParentNode(o=>o.type.name===vr.name)(e.selection),i=B.findParentNode(o=>o.type.name===Ua.name)(e.selection);if(t&&n&&i){const o=n.node,a=i.node.attrs.index;let s=0;r==="before"?s=(a-1+o.attrs.cols)%o.attrs.cols:s=(a+1)%o.attrs.cols;let l=n.pos;o.content.forEach((f,d,h)=>{h<s&&(l+=f.nodeSize)});const u=e.tr.setTime(Date.now());return u.setSelection(B.TextSelection.near(u.doc.resolve(l))),t(u),!0}return!1}const Ua=B.Node.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:e=>e.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:e}){return["div",B.mergeAttributes(this.options.HTMLAttributes,e),0]}}),nv=B.Extension.create({name:"columnActionButton",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r})=>({component:W,componentProps:{action:()=>{t.chain().focus().insertColumns({cols:2}).run()},icon:"Columns",tooltip:r("editor.columns.tooltip")}})}}}),xd=200,vr=B.Node.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:xd,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:e=>e.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:e}){return["div",B.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{insertColumns:e=>({tr:t,dispatch:r,editor:n})=>{const i=rv(n.schema,e&&e.cols||3);if(r){const o=t.selection.anchor+1;t.replaceSelectionWith(i).scrollIntoView().setSelection(B.TextSelection.near(t.doc.resolve(o)))}return!0},addColBefore:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"addBefore"}),addColAfter:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"addAfter"}),deleteCol:()=>({dispatch:e,state:t})=>ai({dispatch:e,state:t,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>sc({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>sc({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}});function Wa(e,t){const{state:r}=t,n=r.selection.$anchor;let i=!1;if(n.depth)for(let o=n.depth;o>0;o--)n.node(o).type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(r.tr.delete(n.before(o),n.after(o)).scrollIntoView()),i=!0);else{const o=r.selection.node;o&&o.type.name===e&&(t.chain().deleteSelection().run(),i=!0)}if(!i){const o=n.pos;if(o){const a=r.tr.doc.nodeAt(o);a&&a.type.name===e&&(t.dispatchTransaction&&t.dispatchTransaction(r.tr.delete(o,o+a.nodeSize)),i=!0)}}return i}function iv({editor:e}){const{t}=q.useLocale(),r=w.useCallback(()=>e.isActive(vr.name),[e]),n=w.useCallback(()=>Wa(vr.name,e),[e]),i=w.useCallback(()=>e.chain().focus().addColBefore().run(),[e]),o=w.useCallback(()=>e.chain().focus().addColAfter().run(),[e]),a=w.useCallback(()=>e.chain().focus().deleteCol().run(),[e]);return c.jsx(me.BubbleMenu,{editor:e,pluginKey:"columns-bubble-menu",shouldShow:r,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:c.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[c.jsx(W,{action:i,icon:"ColumnAddLeft",tooltip:t("editor.table.menu.insertColumnBefore")}),c.jsx(W,{action:o,icon:"ColumnAddRight",tooltip:t("editor.table.menu.insertColumnAfter")}),c.jsx(W,{action:a,icon:"DeleteColumn",tooltip:t("editor.table.menu.deleteColumn")}),c.jsx(W,{action:n,icon:"Trash2",tooltip:t("editor.table.menu.delete_column")})]})})}const vd=fe.Root,yd=fe.Trigger,cc=fe.Portal,lc=fe.Sub,pa=oe.forwardRef(({className:e,inset:t,children:r,...n},i)=>c.jsxs(fe.SubTrigger,{ref:i,className:te("richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",t&&"richtext-pl-8",e),...n,children:[r,c.jsx(M.ChevronRight,{className:"richtext-ml-auto richtext-h-4 richtext-w-4"})]}));pa.displayName=fe.SubTrigger.displayName;const ma=oe.forwardRef(({className:e,...t},r)=>c.jsx(fe.SubContent,{ref:r,className:te("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg 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",e),...t}));ma.displayName=fe.SubContent.displayName;const Ga=oe.forwardRef(({className:e,sideOffset:t=4,...r},n)=>c.jsx(fe.Portal,{children:c.jsx(fe.Content,{ref:n,sideOffset:t,className:te("richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md 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",e),...r})}));Ga.displayName=fe.Content.displayName;const ze=oe.forwardRef(({className:e,inset:t,...r},n)=>c.jsx(fe.Item,{ref:n,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",t&&"richtext-pl-8",e),...r}));ze.displayName=fe.Item.displayName;const bd=oe.forwardRef(({className:e,children:t,checked:r,...n},i)=>c.jsxs(fe.CheckboxItem,{ref:i,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),checked:r,...n,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:c.jsx(fe.ItemIndicator,{children:c.jsx(M.Check,{className:"richtext-h-4 richtext-w-4"})})}),t]}));bd.displayName=fe.CheckboxItem.displayName;const ov=oe.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(fe.RadioItem,{ref:n,className:te("richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",e),...r,children:[c.jsx("span",{className:"richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center",children:c.jsx(fe.ItemIndicator,{children:c.jsx(M.Circle,{className:"richtext-h-2 richtext-w-2 richtext-fill-current"})})}),t]}));ov.displayName=fe.RadioItem.displayName;const av=oe.forwardRef(({className:e,inset:t,...r},n)=>c.jsx(fe.Label,{ref:n,className:te("richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",t&&"richtext-pl-8",e),...r}));av.displayName=fe.Label.displayName;const Va=oe.forwardRef(({className:e,...t},r)=>c.jsx(fe.Separator,{ref:r,className:te("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted",e),...t}));Va.displayName=fe.Separator.displayName;function wd({className:e,...t}){return c.jsx("span",{className:te("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",e),...t})}wd.displayName="DropdownMenuShortcut";const Ie=oe.forwardRef(({className:e,type:t,...r},n)=>c.jsx("input",{type:t,className:te("richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",e),ref:n,...r}));Ie.displayName="Input";const sv=Rn("richtext-text-sm richtext-font-medium richtext-leading-none peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"),Ue=oe.forwardRef(({className:e,...t},r)=>c.jsx(ou.Root,{ref:r,className:te(sv(),e),...t}));Ue.displayName=ou.Root.displayName;const Wt=dr.Root,Gt=dr.Trigger,It=oe.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},i)=>c.jsx(dr.Portal,{children:c.jsx(dr.Content,{ref:i,align:t,sideOffset:r,className:te("richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-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",e),...n})}));It.displayName=dr.Content.displayName;const Be=oe.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},i)=>c.jsx(nu.Root,{ref:i,decorative:r,orientation:t,className:te("richtext-shrink-0 richtext-bg-border",t==="horizontal"?"richtext-h-[1px] richtext-w-full":"richtext-h-full richtext-w-[1px]",e),...n}));Be.displayName=nu.Root.displayName;const Ka=oe.forwardRef(({className:e,...t},r)=>c.jsx(Vo.Root,{className:te("richtext-peer richtext-inline-flex richtext-h-6 richtext-w-11 richtext-shrink-0 richtext-cursor-pointer richtext-items-center richtext-rounded-full richtext-border-2 richtext-border-transparent richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 focus-visible:richtext-ring-offset-background disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=unchecked]:richtext-bg-input",e),...t,ref:r,children:c.jsx(Vo.Thumb,{className:te("richtext-pointer-events-none richtext-block richtext-h-5 richtext-w-5 richtext-rounded-full richtext-bg-background richtext-shadow-lg richtext-ring-0 richtext-transition-transform data-[state=checked]:richtext-translate-x-5 data-[state=unchecked]:richtext-translate-x-0")})}));Ka.displayName=Vo.Root.displayName;const Sd=jt.Root,Xa=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.List,{ref:r,className:te("richtext-inline-flex richtext-h-10 richtext-items-center richtext-justify-center richtext-rounded-md richtext-bg-muted richtext-p-1 richtext-text-muted-foreground",e),...t}));Xa.displayName=jt.List.displayName;const yr=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.Trigger,{ref:r,className:te("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-sm richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-all focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=active]:richtext-bg-background data-[state=active]:richtext-text-foreground data-[state=active]:richtext-shadow-sm",e),...t}));yr.displayName=jt.Trigger.displayName;const br=oe.forwardRef(({className:e,...t},r)=>c.jsx(jt.Content,{ref:r,className:te("richtext-mt-2 richtext-ring-offset-background focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2",e),...t}));br.displayName=jt.Content.displayName;const cv=Oe.Provider,Ad=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Viewport,{ref:r,className:te("richtext-fixed richtext-top-0 richtext-z-[100] richtext-flex richtext-max-h-screen richtext-w-full richtext-flex-col-reverse richtext-p-4 sm:richtext-bottom-0 sm:richtext-right-0 sm:richtext-top-auto sm:richtext-flex-col md:richtext-max-w-[420px]",e),...t}));Ad.displayName=Oe.Viewport.displayName;const lv=Rn("richtext-group richtext-pointer-events-auto richtext-relative richtext-flex richtext-w-full richtext-items-center richtext-justify-between richtext-space-x-4 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-p-6 richtext-pr-8 richtext-shadow-lg richtext-transition-all data-[swipe=cancel]:richtext-translate-x-0 data-[swipe=end]:richtext-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:richtext-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:richtext-transition-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[swipe=end]:richtext-animate-out data-[state=closed]:richtext-fade-out-80 data-[state=closed]:richtext-slide-out-to-right-full data-[state=open]:richtext-slide-in-from-top-full data-[state=open]:sm:richtext-slide-in-from-bottom-full",{variants:{variant:{default:"richtext-border richtext-bg-background richtext-text-foreground",destructive:"richtext-destructive richtext-group richtext-border-destructive richtext-bg-destructive richtext-text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Cd=oe.forwardRef(({className:e,variant:t,...r},n)=>c.jsx(Oe.Root,{ref:n,className:te(lv({variant:t}),e),...r}));Cd.displayName=Oe.Root.displayName;const uv=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Action,{ref:r,className:te("richtext-inline-flex richtext-h-8 richtext-shrink-0 richtext-items-center richtext-justify-center richtext-rounded-md !richtext-border richtext-bg-transparent richtext-px-3 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-secondary focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 group-[.destructive]:richtext-border-muted/40 group-[.destructive]:hover:richtext-border-destructive/30 group-[.destructive]:hover:richtext-bg-destructive group-[.destructive]:hover:richtext-text-destructive-foreground group-[.destructive]:focus:richtext-ring-destructive",e),...t}));uv.displayName=Oe.Action.displayName;const jd=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Close,{ref:r,className:te("richtext-absolute richtext-right-2 richtext-top-2 richtext-rounded-md richtext-p-1 richtext-text-foreground/50 richtext-opacity-0 richtext-transition-opacity hover:richtext-text-foreground focus:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 group-hover:richtext-opacity-100 group-[.destructive]:richtext-text-red-300 group-[.destructive]:hover:richtext-text-red-50 group-[.destructive]:focus:richtext-ring-red-400 group-[.destructive]:focus:richtext-ring-offset-red-600",e),"toast-close":"",...t,children:c.jsx(M.X,{className:"richtext-h-4 richtext-w-4"})}));jd.displayName=Oe.Close.displayName;const Td=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Title,{ref:r,className:te("richtext-text-sm richtext-font-semibold",e),...t}));Td.displayName=Oe.Title.displayName;const Ed=oe.forwardRef(({className:e,...t},r)=>c.jsx(Oe.Description,{ref:r,className:te("richtext-text-sm richtext-opacity-90",e),...t}));Ed.displayName=Oe.Description.displayName;const dv=Rn("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ya=oe.forwardRef(({className:e,variant:t,size:r,...n},i)=>c.jsx(iu.Root,{ref:i,className:te(dv({variant:t,size:r,className:e})),...n}));Ya.displayName=iu.Root.displayName;const fv=Sr.Provider,Ja=Sr.Root,Za=Sr.Trigger,kn=oe.forwardRef(({className:e,sideOffset:t=4,...r},n)=>c.jsx(Sr.Content,{ref:n,sideOffset:t,className:te("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 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",e),...r}));kn.displayName=Sr.Content.displayName;const hv=1,pv=1e6;let si=0;function mv(){return si=(si+1)%Number.MAX_SAFE_INTEGER,si.toString()}const ci=new Map;function uc(e){if(ci.has(e))return;const t=setTimeout(()=>{ci.delete(e),ur({type:"REMOVE_TOAST",toastId:e})},pv);ci.set(e,t)}function gv(e,t){switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,hv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?uc(r):e.toasts.forEach(n=>{uc(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}}const Ur=[];let Wr={toasts:[]};function ur(e){Wr=gv(Wr,e),Ur.forEach(t=>{t(Wr)})}function xv({...e}){const t=mv(),r=i=>ur({type:"UPDATE_TOAST",toast:{...i,id:t}}),n=()=>ur({type:"DISMISS_TOAST",toastId:t});return ur({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||n()}}}),{id:t,dismiss:n,update:r}}function Nn(){const[e,t]=oe.useState(Wr);return oe.useEffect(()=>(Ur.push(t),()=>{const r=Ur.indexOf(t);r>-1&&Ur.splice(r,1)}),[e]),{...e,toast:xv,dismiss:r=>ur({type:"DISMISS_TOAST",toastId:r})}}const Id=oe.forwardRef(({className:e,...t},r)=>c.jsx(Go.Root,{ref:r,className:te("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-p-0 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-2 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...t,children:c.jsx(Go.Indicator,{className:te("!richtext-flex !richtext-p-0 !richtext-items-center !richtext-justify-center !richtext-text-current"),children:c.jsx(M.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));Id.displayName=Go.Root.displayName;const vv={padding:"0 12px 12px"},Rd=({width:e,maxWidth:t,height:r,onOk:n,children:i})=>{const{t:o}=q.useLocale(),[a,s]=w.useState({width:"",height:"",maxWidth:""});w.useEffect(()=>{s({width:e,height:r,maxWidth:t})},[r,t,e]);function l(u){u.preventDefault(),u.stopPropagation(),n(a)}return c.jsxs(Wt,{modal:!0,children:[c.jsx(Gt,{asChild:!0,children:i}),c.jsx(It,{children:c.jsx("div",{style:vv,children:c.jsxs("form",{className:"richtext-flex richtext-flex-col richtext-gap-2",onSubmit:l,children:[c.jsx(Ue,{className:"mb-[6px]",children:"Width"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.width,required:!0,onChange:u=>s({...a,width:u.target.value})})})}),c.jsx(Ue,{className:"mb-[6px]",children:"Max Width"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.maxWidth,required:!0,onChange:u=>s({...a,maxWidth:u.target.value})})})}),c.jsx(Ue,{className:"mb-[6px]",children:"Height"}),c.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:c.jsx("div",{className:"richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm",children:c.jsx(Ie,{type:"number",value:a.height,required:!0,onChange:u=>s({...a,height:u.target.value})})})}),c.jsx(we,{type:"submit",className:"richtext-self-end richtext-mt-2",children:o("editor.link.dialog.button.apply")})]})})})]})},Vt={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function yv(e){const t=Vt.youtube,r=e.matchedUrl;e.validLink=!0;const n=r.split("="),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}/${o}`,e.validId=!0}return e}function bv(e){const t=Vt.youku,r=e.matchedUrl,n=t.idRule,i=new RegExp(n),o=r.match(i);if(o&&o.length>0){const a=o[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${a}`}else e.validId=!1;return e}function wv(e){const t=Vt.bilibili,n=e.matchedUrl.split("/"),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function Sv(e){const t=Vt.qqvideo,n=e.matchedUrl.split("/"),i=n.length;if(i>0){const o=n[i-1];e.src=`${t.srcPrefix}=${o}`,e.validId=!0}return e}function Av(e,t){return t.src=e,t.validId=!0,t}function Cv(e,t){return t.src=e,t.validId=!0,t}function jv(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function Tv(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function Ev(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function Iv(e){const t=Vt.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function Rv(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function Ov(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Pv(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function kv(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function Nv(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function Mv(e,t,r){if(e==="googlemaps")return r.validLink=!0,r.matchedUrl=t,r;const i=Vt[e].linkRule;for(const o of i){const a=new RegExp(o),s=t.match(a);if(s&&s.length>0)return r.validLink=!0,r.matchedUrl=e==="youtube"?s[1]:s[0],r}return r}function Lv(e){var r,n;let t="iframe";return((r=e.includes)!=null&&r.call(e,"youtube")||(n=e.includes)!=null&&n.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function Od(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const r=Lv(e);if(t=Mv(r,e,t),!t.validLink)return t;switch(r){case"youtube":return yv(t);case"youku":return bv(t);case"bilibili":return wv(t);case"qqvideo":return Sv(t);case"amap":return Av(e,t);case"baidu_map":return Cv(e,t);case"googlemaps":return jv(e,t);case"modao":return Tv(t);case"lanhu":return Ev(t);case"figma":return Iv(t);case"canva":return Rv(e,t);case"processon":return Ov(e,t);case"codepen":return Pv(t);case"jinshuju":return kv(e,t);case"iframe":return Nv(e,t);default:return e}}function Pd(){const[e]=hd(t=>t.value);return e}const $v={setDisable:(e,t)=>{Pn(vt.EDIT(e),t)}},_v="_wrap_5y04w_1",Dv="_innerWrap_5y04w_15",dc={wrap:_v,innerWrap:Dv};function Bv({editor:e,node:t,updateAttributes:r}){const n=Pd(),{src:i,width:o,height:a}=t.attrs,[s,l]=w.useState("");function u(){if(!s)return;const d=Od(s);e.chain().updateAttributes(St.name,{src:(d==null?void 0:d.src)||s}).setNodeSelection(e.state.selection.from).focus().run()}const f=w.useCallback(d=>{r({width:d.width,height:d.height})},[r]);return c.jsxs(me.NodeViewWrapper,{children:[!i&&c.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-[#ccc] richtext-p-[10px]",children:[c.jsx(Ie,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>l(d.target.value),placeholder:"Enter link",type:"url",value:s}),c.jsx(we,{className:"richtext-w-[60px]",onClick:u,children:"OK"})]}),i&&c.jsx(Af.Resizable,{size:{width:Number.parseInt(o),height:Number.parseInt(a)},onResizeStop:(d,h,p,m)=>{f({width:Number.parseInt(o)+m.width,height:Number.parseInt(a)+m.height})},children:c.jsx("div",{className:me.clsx(dc.wrap,"render-wrapper"),children:c.jsx("div",{className:dc.innerWrap,style:{pointerEvents:n?"none":"auto"},children:c.jsx("iframe",{className:"richtext-my-[12px] ",src:i})})})})]})}const St=B.Node.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:r,t:n})=>({component:W,componentProps:{action:i=>t.commands.setIframe(i),upload:r.options.upload,disabled:!t.can().setIframe({}),icon:"Iframe",tooltip:n("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:me.getDatasetAttribute("width")},height:{default:300,parseHTML:me.getDatasetAttribute("height")},src:{default:null,parseHTML:me.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",B.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:r,chain:n})=>{var o,a,s;if(((s=(a=(o=t.selection)==null?void 0:o.node)==null?void 0:a.type)==null?void 0:s.name)==this.name)return r.updateAttributes(this.name,e);const i=e||{url:""};return n().insertContent({type:this.name,attrs:i}).run()}}},addInputRules(){return[B.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return me.ReactNodeViewRenderer(Bv)}});var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nd(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var li,fc;function Md(){if(fc)return li;fc=1;var e=Object.prototype.toString;return li=function(r){var n=e.call(r),i=n==="[object Arguments]";return i||(i=n!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&e.call(r.callee)==="[object Function]"),i},li}var ui,hc;function zv(){if(hc)return ui;hc=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Md(),i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(h){var p=h.constructor;return p&&p.prototype===h},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if(typeof window>"u")return!1;for(var h in window)try{if(!u["$"+h]&&t.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{l(window[h])}catch{return!0}}catch{return!0}return!1}(),d=function(h){if(typeof window>"u"||!f)return l(h);try{return l(h)}catch{return!1}};e=function(p){var m=p!==null&&typeof p=="object",x=r.call(p)==="[object Function]",g=n(p),v=m&&r.call(p)==="[object String]",S=[];if(!m&&!x&&!g)throw new TypeError("Object.keys called on a non-object");var j=a&&x;if(v&&p.length>0&&!t.call(p,0))for(var E=0;E<p.length;++E)S.push(String(E));if(g&&p.length>0)for(var C=0;C<p.length;++C)S.push(String(C));else for(var k in p)!(j&&k==="prototype")&&t.call(p,k)&&S.push(String(k));if(o)for(var L=d(p),N=0;N<s.length;++N)!(L&&s[N]==="constructor")&&t.call(p,s[N])&&S.push(s[N]);return S}}return ui=e,ui}var di,pc;function Qa(){if(pc)return di;pc=1;var e=Array.prototype.slice,t=Md(),r=Object.keys,n=r?function(a){return r(a)}:zv(),i=Object.keys;return n.shim=function(){if(Object.keys){var a=function(){var s=Object.keys(arguments);return s&&s.length===arguments.length}(1,2);a||(Object.keys=function(l){return t(l)?i(e.call(l)):i(l)})}else Object.keys=n;return Object.keys||n},di=n,di}var fi,mc;function Mn(){if(mc)return fi;mc=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return fi=e,fi}var hi,gc;function es(){return gc||(gc=1,hi=SyntaxError),hi}var pi,xc;function Le(){return xc||(xc=1,pi=TypeError),pi}var mi,vc;function Hv(){return vc||(vc=1,mi=Object.getOwnPropertyDescriptor),mi}var gi,yc;function Rt(){if(yc)return gi;yc=1;var e=Hv();if(e)try{e([],"length")}catch{e=null}return gi=e,gi}var xi,bc;function ts(){if(bc)return xi;bc=1;var e=Mn(),t=es(),r=Le(),n=Rt();return xi=function(o,a,s){if(!o||typeof o!="object"&&typeof o!="function")throw new r("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,h=!!n&&n(o,a);if(e)e(o,a,{configurable:f===null&&h?h.configurable:!f,enumerable:l===null&&h?h.enumerable:!l,value:s,writable:u===null&&h?h.writable:!u});else if(d||!l&&!u&&!f)o[a]=s;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},xi}var vi,wc;function rs(){if(wc)return vi;wc=1;var e=Mn(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},vi=t,vi}var yi,Sc;function Ot(){if(Sc)return yi;Sc=1;var e=Qa(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",r=Object.prototype.toString,n=Array.prototype.concat,i=ts(),o=function(u){return typeof u=="function"&&r.call(u)==="[object Function]"},a=rs()(),s=function(u,f,d,h){if(f in u){if(h===!0){if(u[f]===d)return}else if(!o(h)||!h())return}a?i(u,f,d,!0):i(u,f,d)},l=function(u,f){var d=arguments.length>2?arguments[2]:{},h=e(f);t&&(h=n.call(h,Object.getOwnPropertySymbols(f)));for(var p=0;p<h.length;p+=1)s(u,h[p],f[h[p]],d[h[p]])};return l.supportsDescriptors=!!a,yi=l,yi}var bi={exports:{}},wi,Ac;function ns(){return Ac||(Ac=1,wi=Object),wi}var Si,Cc;function Ld(){return Cc||(Cc=1,Si=Error),Si}var Ai,jc;function qv(){return jc||(jc=1,Ai=EvalError),Ai}var Ci,Tc;function Fv(){return Tc||(Tc=1,Ci=RangeError),Ci}var ji,Ec;function Uv(){return Ec||(Ec=1,ji=ReferenceError),ji}var Ti,Ic;function Wv(){return Ic||(Ic=1,Ti=URIError),Ti}var Ei,Rc;function Gv(){return Rc||(Rc=1,Ei=Math.abs),Ei}var Ii,Oc;function Vv(){return Oc||(Oc=1,Ii=Math.floor),Ii}var Ri,Pc;function Kv(){return Pc||(Pc=1,Ri=Math.max),Ri}var Oi,kc;function Xv(){return kc||(kc=1,Oi=Math.min),Oi}var Pi,Nc;function Yv(){return Nc||(Nc=1,Pi=Math.pow),Pi}var ki,Mc;function Jv(){return Mc||(Mc=1,ki=Math.round),ki}var Ni,Lc;function Zv(){return Lc||(Lc=1,Ni=Number.isNaN||function(t){return t!==t}),Ni}var Mi,$c;function Qv(){if($c)return Mi;$c=1;var e=Zv();return Mi=function(r){return e(r)||r===0?r:r<0?-1:1},Mi}var Li,_c;function Ln(){return _c||(_c=1,Li=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),Li}var $i,Dc;function is(){if(Dc)return $i;Dc=1;var e=typeof Symbol<"u"&&Symbol,t=Ln();return $i=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},$i}var _i,Bc;function $d(){return Bc||(Bc=1,_i=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),_i}var Di,zc;function _d(){if(zc)return Di;zc=1;var e=ns();return Di=e.getPrototypeOf||null,Di}var Bi,Hc;function ey(){if(Hc)return Bi;Hc=1;var e="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,r=Math.max,n="[object Function]",i=function(l,u){for(var f=[],d=0;d<l.length;d+=1)f[d]=l[d];for(var h=0;h<u.length;h+=1)f[h+l.length]=u[h];return f},o=function(l,u){for(var f=[],d=u,h=0;d<l.length;d+=1,h+=1)f[h]=l[d];return f},a=function(s,l){for(var u="",f=0;f<s.length;f+=1)u+=s[f],f+1<s.length&&(u+=l);return u};return Bi=function(l){var u=this;if(typeof u!="function"||t.apply(u)!==n)throw new TypeError(e+u);for(var f=o(arguments,1),d,h=function(){if(this instanceof d){var v=u.apply(this,i(f,arguments));return Object(v)===v?v:this}return u.apply(l,i(f,arguments))},p=r(0,u.length-f.length),m=[],x=0;x<p;x++)m[x]="$"+x;if(d=Function("binder","return function ("+a(m,",")+"){ return binder.apply(this,arguments); }")(h),u.prototype){var g=function(){};g.prototype=u.prototype,d.prototype=new g,g.prototype=null}return d},Bi}var zi,qc;function Tr(){if(qc)return zi;qc=1;var e=ey();return zi=Function.prototype.bind||e,zi}var Hi,Fc;function os(){return Fc||(Fc=1,Hi=Function.prototype.call),Hi}var qi,Uc;function as(){return Uc||(Uc=1,qi=Function.prototype.apply),qi}var Fi,Wc;function ty(){return Wc||(Wc=1,Fi=typeof Reflect<"u"&&Reflect&&Reflect.apply),Fi}var Ui,Gc;function Dd(){if(Gc)return Ui;Gc=1;var e=Tr(),t=as(),r=os(),n=ty();return Ui=n||e.call(r,t),Ui}var Wi,Vc;function ss(){if(Vc)return Wi;Vc=1;var e=Tr(),t=Le(),r=os(),n=Dd();return Wi=function(o){if(o.length<1||typeof o[0]!="function")throw new t("a function is required");return n(e,r,o)},Wi}var Gi,Kc;function ry(){if(Kc)return Gi;Kc=1;var e=ss(),t=Rt(),r;try{r=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var n=!!r&&t&&t(Object.prototype,"__proto__"),i=Object,o=i.getPrototypeOf;return Gi=n&&typeof n.get=="function"?e([n.get]):typeof o=="function"?function(s){return o(s==null?s:i(s))}:!1,Gi}var Vi,Xc;function Bd(){if(Xc)return Vi;Xc=1;var e=$d(),t=_d(),r=ry();return Vi=e?function(i){return e(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:r?function(i){return r(i)}:null,Vi}var Ki,Yc;function cs(){if(Yc)return Ki;Yc=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=Tr();return Ki=r.call(e,t),Ki}var Xi,Jc;function at(){if(Jc)return Xi;Jc=1;var e,t=ns(),r=Ld(),n=qv(),i=Fv(),o=Uv(),a=es(),s=Le(),l=Wv(),u=Gv(),f=Vv(),d=Kv(),h=Xv(),p=Yv(),m=Jv(),x=Qv(),g=Function,v=function(ne){try{return g('"use strict"; return ('+ne+").constructor;")()}catch{}},S=Rt(),j=Mn(),E=function(){throw new s},C=S?function(){try{return arguments.callee,E}catch{try{return S(arguments,"callee").get}catch{return E}}}():E,k=is()(),L=Bd(),N=_d(),P=$d(),_=as(),T=os(),A={},O=typeof Uint8Array>"u"||!L?e:L(Uint8Array),D={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":k&&L?L([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k&&L?L(L([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!k||!L?e:L(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":i,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!k||!L?e:L(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k&&L?L(""[Symbol.iterator]()):e,"%Symbol%":k?Symbol:e,"%SyntaxError%":a,"%ThrowTypeError%":C,"%TypedArray%":O,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":l,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":_,"%Object.defineProperty%":j,"%Object.getPrototypeOf%":N,"%Math.abs%":u,"%Math.floor%":f,"%Math.max%":d,"%Math.min%":h,"%Math.pow%":p,"%Math.round%":m,"%Math.sign%":x,"%Reflect.getPrototypeOf%":P};if(L)try{null.error}catch(ne){var U=L(L(ne));D["%Error.prototype%"]=U}var H=function ne(F){var G;if(F==="%AsyncFunction%")G=v("async function () {}");else if(F==="%GeneratorFunction%")G=v("function* () {}");else if(F==="%AsyncGeneratorFunction%")G=v("async function* () {}");else if(F==="%AsyncGenerator%"){var z=ne("%AsyncGeneratorFunction%");z&&(G=z.prototype)}else if(F==="%AsyncIteratorPrototype%"){var J=ne("%AsyncGenerator%");J&&L&&(G=L(J.prototype))}return D[F]=G,G},K={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Tr(),ie=cs(),he=re.call(T,Array.prototype.concat),ge=re.call(_,Array.prototype.splice),Se=re.call(T,String.prototype.replace),$e=re.call(T,String.prototype.slice),I=re.call(T,RegExp.prototype.exec),$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,V=function(F){var G=$e(F,0,1),z=$e(F,-1);if(G==="%"&&z!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(z==="%"&&G!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var J=[];return Se(F,$,function(ve,ye,be,Ae){J[J.length]=be?Se(Ae,X,"$1"):ye||ve}),J},ee=function(F,G){var z=F,J;if(ie(K,z)&&(J=K[z],z="%"+J[0]+"%"),ie(D,z)){var ve=D[z];if(ve===A&&(ve=H(z)),typeof ve>"u"&&!G)throw new s("intrinsic "+F+" exists, but is not available. Please file an issue!");return{alias:J,name:z,value:ve}}throw new a("intrinsic "+F+" does not exist!")};return Xi=function(F,G){if(typeof F!="string"||F.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof G!="boolean")throw new s('"allowMissing" argument must be a boolean');if(I(/^%?[^%]*%?$/,F)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var z=V(F),J=z.length>0?z[0]:"",ve=ee("%"+J+"%",G),ye=ve.name,be=ve.value,Ae=!1,je=ve.alias;je&&(J=je[0],ge(z,he([0,1],je)));for(var Ke=1,_e=!0;Ke<z.length;Ke+=1){var Te=z[Ke],Xe=$e(Te,0,1),Ye=$e(Te,-1);if((Xe==='"'||Xe==="'"||Xe==="`"||Ye==='"'||Ye==="'"||Ye==="`")&&Xe!==Ye)throw new a("property names with quotes must have matching quotes");if((Te==="constructor"||!_e)&&(Ae=!0),J+="."+Te,ye="%"+J+"%",ie(D,ye))be=D[ye];else if(be!=null){if(!(Te in be)){if(!G)throw new s("base intrinsic for "+F+" exists, but the property is not available.");return}if(S&&Ke+1>=z.length){var Je=S(be,Te);_e=!!Je,_e&&"get"in Je&&!("originalValue"in Je.get)?be=Je.get:be=be[Te]}else _e=ie(be,Te),be=be[Te];_e&&!Ae&&(D[ye]=be)}}return be},Xi}var Yi,Zc;function ny(){if(Zc)return Yi;Zc=1;var e=at(),t=ts(),r=rs()(),n=Rt(),i=Le(),o=e("%Math.floor%");return Yi=function(s,l){if(typeof s!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],f=!0,d=!0;if("length"in s&&n){var h=n(s,"length");h&&!h.configurable&&(f=!1),h&&!h.writable&&(d=!1)}return(f||d||!u)&&(r?t(s,"length",l,!0,!0):t(s,"length",l)),s},Yi}var Ji,Qc;function iy(){if(Qc)return Ji;Qc=1;var e=Tr(),t=as(),r=Dd();return Ji=function(){return r(e,t,arguments)},Ji}var el;function Kt(){return el||(el=1,function(e){var t=ny(),r=Mn(),n=ss(),i=iy();e.exports=function(a){var s=n(arguments),l=a.length-(arguments.length-1);return t(s,1+(l>0?l:0),!0)},r?r(e.exports,"apply",{value:i}):e.exports.apply=i}(bi)),bi.exports}var Zi,tl;function Ce(){if(tl)return Zi;tl=1;var e=at(),t=ss(),r=t([e("%String.prototype.indexOf%")]);return Zi=function(i,o){var a=e(i,!!o);return typeof a=="function"&&r(i,".prototype.")>-1?t([a]):a},Zi}var Qi,rl;function zd(){if(rl)return Qi;rl=1;var e=Qa(),t=Ln()(),r=Ce(),n=ns(),i=r("Array.prototype.push"),o=r("Object.prototype.propertyIsEnumerable"),a=t?n.getOwnPropertySymbols:null;return Qi=function(l,u){if(l==null)throw new TypeError("target must be an object");var f=n(l);if(arguments.length===1)return f;for(var d=1;d<arguments.length;++d){var h=n(arguments[d]),p=e(h),m=t&&(n.getOwnPropertySymbols||a);if(m)for(var x=m(h),g=0;g<x.length;++g){var v=x[g];o(h,v)&&i(p,v)}for(var S=0;S<p.length;++S){var j=p[S];if(o(h,j)){var E=h[j];f[j]=E}}}return f},Qi}var eo,nl;function Hd(){if(nl)return eo;nl=1;var e=zd(),t=function(){if(!Object.assign)return!1;for(var n="abcdefghijklmnopqrst",i=n.split(""),o={},a=0;a<i.length;++a)o[i[a]]=i[a];var s=Object.assign({},o),l="";for(var u in s)l+=u;return n!==l},r=function(){if(!Object.assign||!Object.preventExtensions)return!1;var n=Object.preventExtensions({1:2});try{Object.assign(n,"xy")}catch{return n[1]==="y"}return!1};return eo=function(){return!Object.assign||t()||r()?e:Object.assign},eo}var to,il;function oy(){if(il)return to;il=1;var e=Ot(),t=Hd();return to=function(){var n=t();return e(Object,{assign:n},{assign:function(){return Object.assign!==n}}),n},to}var ro,ol;function ay(){if(ol)return ro;ol=1;var e=Ot(),t=Kt(),r=zd(),n=Hd(),i=oy(),o=t.apply(n()),a=function(l,u){return o(Object,arguments)};return e(a,{getPolyfill:n,implementation:r,shim:i}),ro=a,ro}var no,al;function qd(){if(al)return no;al=1;var e=at(),t=Kt(),r=t(e("String.prototype.indexOf"));return no=function(i,o){var a=e(i,!!o);return typeof a=="function"&&r(i,".prototype.")>-1?t(a):a},no}var io,sl;function sy(){if(sl)return io;sl=1;var e=function(){return typeof(function(){}).name=="string"},t=Object.getOwnPropertyDescriptor;if(t)try{t([],"length")}catch{t=null}e.functionsHaveConfigurableNames=function(){if(!e()||!t)return!1;var i=t(function(){},"name");return!!i&&!!i.configurable};var r=Function.prototype.bind;return e.boundFunctionsHaveNames=function(){return e()&&typeof r=="function"&&(function(){}).bind().name!==""},io=e,io}var oo,cl;function cy(){if(cl)return oo;cl=1;var e=ts(),t=rs()(),r=sy().functionsHaveConfigurableNames(),n=Le();return oo=function(o,a){if(typeof o!="function")throw new n("`fn` is not a function");var s=arguments.length>2&&!!arguments[2];return(!s||r)&&(t?e(o,"name",a,!0,!0):e(o,"name",a)),o},oo}var ao,ll;function Fd(){if(ll)return ao;ll=1;var e=cy(),t=Le(),r=Object;return ao=e(function(){if(this==null||this!==r(this))throw new t("RegExp.prototype.flags getter called on non-object");var i="";return this.hasIndices&&(i+="d"),this.global&&(i+="g"),this.ignoreCase&&(i+="i"),this.multiline&&(i+="m"),this.dotAll&&(i+="s"),this.unicode&&(i+="u"),this.unicodeSets&&(i+="v"),this.sticky&&(i+="y"),i},"get flags",!0),ao}var so,ul;function Ud(){if(ul)return so;ul=1;var e=Fd(),t=Ot().supportsDescriptors,r=Object.getOwnPropertyDescriptor;return so=function(){if(t&&/a/mig.flags==="gim"){var i=r(RegExp.prototype,"flags");if(i&&typeof i.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var o="",a={};if(Object.defineProperty(a,"hasIndices",{get:function(){o+="d"}}),Object.defineProperty(a,"sticky",{get:function(){o+="y"}}),i.get.call(a),o==="dy")return i.get}}return e},so}var co,dl;function ly(){if(dl)return co;dl=1;var e=Ot().supportsDescriptors,t=Ud(),r=Rt(),n=Object.defineProperty,i=Ld(),o=Bd(),a=/a/;return co=function(){if(!e||!o)throw new i("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var l=t(),u=o(a),f=r(u,"flags");return(!f||f.get!==l)&&n(u,"flags",{configurable:!0,enumerable:!1,get:l}),l},co}var lo,fl;function uy(){if(fl)return lo;fl=1;var e=Ot(),t=Kt(),r=Fd(),n=Ud(),i=ly(),o=t(n());return e(o,{getPolyfill:n,implementation:r,shim:i}),lo=o,lo}var tr={exports:{}},uo,hl;function Pt(){if(hl)return uo;hl=1;var e=Ln();return uo=function(){return e()&&!!Symbol.toStringTag},uo}var fo,pl;function Wd(){if(pl)return fo;pl=1;var e=Pt()(),t=Ce(),r=t("Object.prototype.toString"),n=function(s){return e&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:r(s)==="[object Arguments]"},i=function(s){return n(s)?!0:s!==null&&typeof s=="object"&&"length"in s&&typeof s.length=="number"&&s.length>=0&&r(s)!=="[object Array]"&&"callee"in s&&r(s.callee)==="[object Function]"},o=function(){return n(arguments)}();return n.isLegacyArguments=i,fo=o?n:i,fo}const dy={},fy=Object.freeze(Object.defineProperty({__proto__:null,default:dy},Symbol.toStringTag,{value:"Module"})),hy=Nd(fy);var ho,ml;function $n(){if(ml)return ho;ml=1;var e=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,r=e&&t&&typeof t.get=="function"?t.get:null,n=e&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&o&&typeof o.get=="function"?o.get:null,s=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,f=typeof WeakSet=="function"&&WeakSet.prototype,d=f?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,p=h?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,x=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,S=String.prototype.slice,j=String.prototype.replace,E=String.prototype.toUpperCase,C=String.prototype.toLowerCase,k=RegExp.prototype.test,L=Array.prototype.concat,N=Array.prototype.join,P=Array.prototype.slice,_=Math.floor,T=typeof BigInt=="function"?BigInt.prototype.valueOf:null,A=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,D=typeof Symbol=="function"&&typeof Symbol.iterator=="object",U=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===D||!0)?Symbol.toStringTag:null,H=Object.prototype.propertyIsEnumerable,K=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(y){return y.__proto__}:null);function re(y,b){if(y===1/0||y===-1/0||y!==y||y&&y>-1e3&&y<1e3||k.call(/e/,b))return b;var ae=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof y=="number"){var se=y<0?-_(-y):_(y);if(se!==y){var ce=String(se),Q=S.call(b,ce.length+1);return j.call(ce,ae,"$&_")+"."+j.call(j.call(Q,/([0-9]{3})/g,"$&_"),/_$/,"")}}return j.call(b,ae,"$&_")}var ie=hy,he=ie.custom,ge=ve(he)?he:null,Se={__proto__:null,double:'"',single:"'"},$e={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};ho=function y(b,ae,se,ce){var Q=ae||{};if(Ae(Q,"quoteStyle")&&!Ae(Se,Q.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ae(Q,"maxStringLength")&&(typeof Q.maxStringLength=="number"?Q.maxStringLength<0&&Q.maxStringLength!==1/0:Q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var lt=Ae(Q,"customInspect")?Q.customInspect:!0;if(typeof lt!="boolean"&&lt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ae(Q,"indent")&&Q.indent!==null&&Q.indent!==" "&&!(parseInt(Q.indent,10)===Q.indent&&Q.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ae(Q,"numericSeparator")&&typeof Q.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var bt=Q.numericSeparator;if(typeof b>"u")return"undefined";if(b===null)return"null";if(typeof b=="boolean")return b?"true":"false";if(typeof b=="string")return kt(b,Q);if(typeof b=="number"){if(b===0)return 1/0/b>0?"0":"-0";var Re=String(b);return bt?re(b,Re):Re}if(typeof b=="bigint"){var ut=String(b)+"n";return bt?re(b,ut):ut}var Bn=typeof Q.depth>"u"?5:Q.depth;if(typeof se>"u"&&(se=0),se>=Bn&&Bn>0&&typeof b=="object")return V(b)?"[Array]":"[Object]";var Nt=df(Q,se);if(typeof ce>"u")ce=[];else if(_e(ce,b)>=0)return"[Circular]";function De(Mt,Or,hf){if(Or&&(ce=P.call(ce),ce.push(Or)),hf){var vs={depth:Q.depth};return Ae(Q,"quoteStyle")&&(vs.quoteStyle=Q.quoteStyle),y(Mt,vs,se+1,ce)}return y(Mt,Q,se+1,ce)}if(typeof b=="function"&&!ne(b)){var ds=Ke(b),fs=Ir(b,De);return"[Function"+(ds?": "+ds:" (anonymous)")+"]"+(fs.length>0?" { "+N.call(fs,", ")+" }":"")}if(ve(b)){var hs=D?j.call(String(b),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(b);return typeof b=="object"&&!D?ct(hs):hs}if(st(b)){for(var Yt="<"+C.call(String(b.nodeName)),zn=b.attributes||[],Rr=0;Rr<zn.length;Rr++)Yt+=" "+zn[Rr].name+"="+I($(zn[Rr].value),"double",Q);return Yt+=">",b.childNodes&&b.childNodes.length&&(Yt+="..."),Yt+="</"+C.call(String(b.nodeName))+">",Yt}if(V(b)){if(b.length===0)return"[]";var Hn=Ir(b,De);return Nt&&!uf(Hn)?"["+Dn(Hn,Nt)+"]":"[ "+N.call(Hn,", ")+" ]"}if(F(b)){var qn=Ir(b,De);return!("cause"in Error.prototype)&&"cause"in b&&!H.call(b,"cause")?"{ ["+String(b)+"] "+N.call(L.call("[cause]: "+De(b.cause),qn),", ")+" }":qn.length===0?"["+String(b)+"]":"{ ["+String(b)+"] "+N.call(qn,", ")+" }"}if(typeof b=="object"&&lt){if(ge&&typeof b[ge]=="function"&&ie)return ie(b,{depth:Bn-se});if(lt!=="symbol"&&typeof b.inspect=="function")return b.inspect()}if(Te(b)){var ps=[];return n&&n.call(b,function(Mt,Or){ps.push(De(Or,b,!0)+" => "+De(Mt,b))}),us("Map",r.call(b),ps,Nt)}if(Je(b)){var ms=[];return s&&s.call(b,function(Mt){ms.push(De(Mt,b))}),us("Set",a.call(b),ms,Nt)}if(Xe(b))return _n("WeakMap");if(Er(b))return _n("WeakSet");if(Ye(b))return _n("WeakRef");if(z(b))return ct(De(Number(b)));if(ye(b))return ct(De(T.call(b)));if(J(b))return ct(m.call(b));if(G(b))return ct(De(String(b)));if(typeof window<"u"&&b===window)return"{ [object Window] }";if(typeof globalThis<"u"&&b===globalThis||typeof wr<"u"&&b===wr)return"{ [object globalThis] }";if(!ee(b)&&!ne(b)){var Fn=Ir(b,De),gs=K?K(b)===Object.prototype:b instanceof Object||b.constructor===Object,Un=b instanceof Object?"":"null prototype",xs=!gs&&U&&Object(b)===b&&U in b?S.call(je(b),8,-1):Un?"Object":"",ff=gs||typeof b.constructor!="function"?"":b.constructor.name?b.constructor.name+" ":"",Wn=ff+(xs||Un?"["+N.call(L.call([],xs||[],Un||[]),": ")+"] ":"");return Fn.length===0?Wn+"{}":Nt?Wn+"{"+Dn(Fn,Nt)+"}":Wn+"{ "+N.call(Fn,", ")+" }"}return String(b)};function I(y,b,ae){var se=ae.quoteStyle||b,ce=Se[se];return ce+y+ce}function $(y){return j.call(String(y),/"/g,"&quot;")}function X(y){return!U||!(typeof y=="object"&&(U in y||typeof y[U]<"u"))}function V(y){return je(y)==="[object Array]"&&X(y)}function ee(y){return je(y)==="[object Date]"&&X(y)}function ne(y){return je(y)==="[object RegExp]"&&X(y)}function F(y){return je(y)==="[object Error]"&&X(y)}function G(y){return je(y)==="[object String]"&&X(y)}function z(y){return je(y)==="[object Number]"&&X(y)}function J(y){return je(y)==="[object Boolean]"&&X(y)}function ve(y){if(D)return y&&typeof y=="object"&&y instanceof Symbol;if(typeof y=="symbol")return!0;if(!y||typeof y!="object"||!O)return!1;try{return O.call(y),!0}catch{}return!1}function ye(y){if(!y||typeof y!="object"||!T)return!1;try{return T.call(y),!0}catch{}return!1}var be=Object.prototype.hasOwnProperty||function(y){return y in this};function Ae(y,b){return be.call(y,b)}function je(y){return x.call(y)}function Ke(y){if(y.name)return y.name;var b=v.call(g.call(y),/^function\s*([\w$]+)/);return b?b[1]:null}function _e(y,b){if(y.indexOf)return y.indexOf(b);for(var ae=0,se=y.length;ae<se;ae++)if(y[ae]===b)return ae;return-1}function Te(y){if(!r||!y||typeof y!="object")return!1;try{r.call(y);try{a.call(y)}catch{return!0}return y instanceof Map}catch{}return!1}function Xe(y){if(!u||!y||typeof y!="object")return!1;try{u.call(y,u);try{d.call(y,d)}catch{return!0}return y instanceof WeakMap}catch{}return!1}function Ye(y){if(!p||!y||typeof y!="object")return!1;try{return p.call(y),!0}catch{}return!1}function Je(y){if(!a||!y||typeof y!="object")return!1;try{a.call(y);try{r.call(y)}catch{return!0}return y instanceof Set}catch{}return!1}function Er(y){if(!d||!y||typeof y!="object")return!1;try{d.call(y,d);try{u.call(y,u)}catch{return!0}return y instanceof WeakSet}catch{}return!1}function st(y){return!y||typeof y!="object"?!1:typeof HTMLElement<"u"&&y instanceof HTMLElement?!0:typeof y.nodeName=="string"&&typeof y.getAttribute=="function"}function kt(y,b){if(y.length>b.maxStringLength){var ae=y.length-b.maxStringLength,se="... "+ae+" more character"+(ae>1?"s":"");return kt(S.call(y,0,b.maxStringLength),b)+se}var ce=$e[b.quoteStyle||"single"];ce.lastIndex=0;var Q=j.call(j.call(y,ce,"\\$1"),/[\x00-\x1f]/g,Xt);return I(Q,"single",b)}function Xt(y){var b=y.charCodeAt(0),ae={8:"b",9:"t",10:"n",12:"f",13:"r"}[b];return ae?"\\"+ae:"\\x"+(b<16?"0":"")+E.call(b.toString(16))}function ct(y){return"Object("+y+")"}function _n(y){return y+" { ? }"}function us(y,b,ae,se){var ce=se?Dn(ae,se):N.call(ae,", ");return y+" ("+b+") {"+ce+"}"}function uf(y){for(var b=0;b<y.length;b++)if(_e(y[b],`
6
6
  `)>=0)return!1;return!0}function df(y,b){var ae;if(y.indent===" ")ae=" ";else if(typeof y.indent=="number"&&y.indent>0)ae=N.call(Array(y.indent+1)," ");else return null;return{base:ae,prev:N.call(Array(b+1),ae)}}function Dn(y,b){if(y.length===0)return"";var ae=`
7
7
  `+b.prev+b.base;return ae+N.call(y,","+ae)+`
8
8
  `+b.prev}function Ir(y,b){var ae=V(y),se=[];if(ae){se.length=y.length;for(var ce=0;ce<y.length;ce++)se[ce]=Ae(y,ce)?b(y[ce],y):""}var Q=typeof A=="function"?A(y):[],lt;if(D){lt={};for(var bt=0;bt<Q.length;bt++)lt["$"+Q[bt]]=Q[bt]}for(var Re in y)Ae(y,Re)&&(ae&&String(Number(Re))===Re&&Re<y.length||D&&lt["$"+Re]instanceof Symbol||(k.call(/[^\w$]/,Re)?se.push(b(Re,y)+": "+b(y[Re],y)):se.push(Re+": "+b(y[Re],y))));if(typeof A=="function")for(var ut=0;ut<Q.length;ut++)H.call(y,Q[ut])&&se.push("["+b(Q[ut])+"]: "+b(y[Q[ut]],y));return se}return ho}var po,gl;function py(){if(gl)return po;gl=1;var e=$n(),t=Le(),r=function(s,l,u){for(var f=s,d;(d=f.next)!=null;f=d)if(d.key===l)return f.next=d.next,u||(d.next=s.next,s.next=d),d},n=function(s,l){if(s){var u=r(s,l);return u&&u.value}},i=function(s,l,u){var f=r(s,l);f?f.value=u:s.next={key:l,next:s.next,value:u}},o=function(s,l){return s?!!r(s,l):!1},a=function(s,l){if(s)return r(s,l,!0)};return po=function(){var l,u={assert:function(f){if(!u.has(f))throw new t("Side channel does not contain "+e(f))},delete:function(f){var d=l&&l.next,h=a(l,f);return h&&d&&d===h&&(l=void 0),!!h},get:function(f){return n(l,f)},has:function(f){return o(l,f)},set:function(f,d){l||(l={next:void 0}),i(l,f,d)}};return u},po}var mo,xl;function Gd(){if(xl)return mo;xl=1;var e=at(),t=Ce(),r=$n(),n=Le(),i=e("%Map%",!0),o=t("Map.prototype.get",!0),a=t("Map.prototype.set",!0),s=t("Map.prototype.has",!0),l=t("Map.prototype.delete",!0),u=t("Map.prototype.size",!0);return mo=!!i&&function(){var d,h={assert:function(p){if(!h.has(p))throw new n("Side channel does not contain "+r(p))},delete:function(p){if(d){var m=l(d,p);return u(d)===0&&(d=void 0),m}return!1},get:function(p){if(d)return o(d,p)},has:function(p){return d?s(d,p):!1},set:function(p,m){d||(d=new i),a(d,p,m)}};return h},mo}var go,vl;function my(){if(vl)return go;vl=1;var e=at(),t=Ce(),r=$n(),n=Gd(),i=Le(),o=e("%WeakMap%",!0),a=t("WeakMap.prototype.get",!0),s=t("WeakMap.prototype.set",!0),l=t("WeakMap.prototype.has",!0),u=t("WeakMap.prototype.delete",!0);return go=o?function(){var d,h,p={assert:function(m){if(!p.has(m))throw new i("Side channel does not contain "+r(m))},delete:function(m){if(o&&m&&(typeof m=="object"||typeof m=="function")){if(d)return u(d,m)}else if(n&&h)return h.delete(m);return!1},get:function(m){return o&&m&&(typeof m=="object"||typeof m=="function")&&d?a(d,m):h&&h.get(m)},has:function(m){return o&&m&&(typeof m=="object"||typeof m=="function")&&d?l(d,m):!!h&&h.has(m)},set:function(m,x){o&&m&&(typeof m=="object"||typeof m=="function")?(d||(d=new o),s(d,m,x)):n&&(h||(h=n()),h.set(m,x))}};return p}:n,go}var xo,yl;function Vd(){if(yl)return xo;yl=1;var e=Le(),t=$n(),r=py(),n=Gd(),i=my(),o=i||n||r;return xo=function(){var s,l={assert:function(u){if(!l.has(u))throw new e("Side channel does not contain "+t(u))},delete:function(u){return!!s&&s.delete(u)},get:function(u){return s&&s.get(u)},has:function(u){return!!s&&s.has(u)},set:function(u,f){s||(s=o()),s.set(u,f)}};return l},xo}var vo,bl;function gy(){if(bl)return vo;bl=1;var e=cs(),t=Vd()(),r=Le(),n={assert:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`O` is not an object");if(typeof o!="string")throw new r("`slot` must be a string");if(t.assert(i),!n.has(i,o))throw new r("`"+o+"` is not present on `O`")},get:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`O` is not an object");if(typeof o!="string")throw new r("`slot` must be a string");var a=t.get(i);return a&&a["$"+o]},has:function(i,o){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`O` is not an object");if(typeof o!="string")throw new r("`slot` must be a string");var a=t.get(i);return!!a&&e(a,"$"+o)},set:function(i,o,a){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`O` is not an object");if(typeof o!="string")throw new r("`slot` must be a string");var s=t.get(i);s||(s={},t.set(i,s)),s["$"+o]=a}};return Object.freeze&&Object.freeze(n),vo=n,vo}var yo,wl;function xy(){if(wl)return yo;wl=1;var e=gy(),t=es(),r=typeof StopIteration=="object"?StopIteration:null;return yo=function(i){if(!r)throw new t("this environment lacks StopIteration");e.set(i,"[[Done]]",!1);var o={next:function(){var s=e.get(this,"[[Iterator]]"),l=!!e.get(s,"[[Done]]");try{return{done:l,value:l?void 0:s.next()}}catch(u){if(e.set(s,"[[Done]]",!0),u!==r)throw u;return{done:!0,value:void 0}}}};return e.set(o,"[[Iterator]]",i),o},yo}var bo,Sl;function Kd(){if(Sl)return bo;Sl=1;var e={}.toString;return bo=Array.isArray||function(t){return e.call(t)=="[object Array]"},bo}var wo,Al;function Xd(){if(Al)return wo;Al=1;var e=Ce(),t=e("String.prototype.valueOf"),r=function(s){try{return t(s),!0}catch{return!1}},n=e("Object.prototype.toString"),i="[object String]",o=Pt()();return wo=function(s){return typeof s=="string"?!0:!s||typeof s!="object"?!1:o?r(s):n(s)===i},wo}var So,Cl;function Yd(){if(Cl)return So;Cl=1;var e=typeof Map=="function"&&Map.prototype?Map:null,t=typeof Set=="function"&&Set.prototype?Set:null,r;e||(r=function(a){return!1});var n=e?Map.prototype.has:null,i=t?Set.prototype.has:null;return!r&&!n&&(r=function(a){return!1}),So=r||function(a){if(!a||typeof a!="object")return!1;try{if(n.call(a),i)try{i.call(a)}catch{return!0}return a instanceof e}catch{}return!1},So}var Ao,jl;function Jd(){if(jl)return Ao;jl=1;var e=typeof Map=="function"&&Map.prototype?Map:null,t=typeof Set=="function"&&Set.prototype?Set:null,r;t||(r=function(a){return!1});var n=e?Map.prototype.has:null,i=t?Set.prototype.has:null;return!r&&!i&&(r=function(a){return!1}),Ao=r||function(a){if(!a||typeof a!="object")return!1;try{if(i.call(a),n)try{n.call(a)}catch{return!0}return a instanceof t}catch{}return!1},Ao}var Tl;function vy(){if(Tl)return tr.exports;Tl=1;var e=Wd(),t=xy();if(is()()||Ln()()){var r=Symbol.iterator;tr.exports=function(P){if(P!=null&&typeof P[r]<"u")return P[r]();if(e(P))return Array.prototype[r].call(P)}}else{var n=Kd(),i=Xd(),o=at(),a=o("%Map%",!0),s=o("%Set%",!0),l=qd(),u=l("Array.prototype.push"),f=l("String.prototype.charCodeAt"),d=l("String.prototype.slice"),h=function(P,_){var T=P.length;if(_+1>=T)return _+1;var A=f(P,_);if(A<55296||A>56319)return _+1;var O=f(P,_+1);return O<56320||O>57343?_+1:_+2},p=function(P){var _=0;return{next:function(){var A=_>=P.length,O;return A||(O=P[_],_+=1),{done:A,value:O}}}},m=function(P,_){if(n(P)||e(P))return p(P);if(i(P)){var T=0;return{next:function(){var O=h(P,T),D=d(P,T,O);return T=O,{done:O>P.length,value:D}}}}if(_&&typeof P["_es6-shim iterator_"]<"u")return P["_es6-shim iterator_"]()};if(!a&&!s)tr.exports=function(P){if(P!=null)return m(P,!0)};else{var x=Yd(),g=Jd(),v=l("Map.prototype.forEach",!0),S=l("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var j=l("Map.prototype.iterator",!0),E=l("Set.prototype.iterator",!0);var C=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),k=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0),L=function(P){if(x(P)){if(j)return t(j(P));if(C)return C(P);if(v){var _=[];return v(P,function(A,O){u(_,[O,A])}),p(_)}}if(g(P)){if(E)return t(E(P));if(k)return k(P);if(S){var T=[];return S(P,function(A){u(T,A)}),p(T)}}};tr.exports=function(P){return L(P)||m(P)}}}return tr.exports}var Co,El;function Zd(){if(El)return Co;El=1;var e=function(t){return t!==t};return Co=function(r,n){return r===0&&n===0?1/r===1/n:!!(r===n||e(r)&&e(n))},Co}var jo,Il;function Qd(){if(Il)return jo;Il=1;var e=Zd();return jo=function(){return typeof Object.is=="function"?Object.is:e},jo}var To,Rl;function yy(){if(Rl)return To;Rl=1;var e=Qd(),t=Ot();return To=function(){var n=e();return t(Object,{is:n},{is:function(){return Object.is!==n}}),n},To}var Eo,Ol;function by(){if(Ol)return Eo;Ol=1;var e=Ot(),t=Kt(),r=Zd(),n=Qd(),i=yy(),o=t(n(),Object);return e(o,{getPolyfill:n,implementation:r,shim:i}),Eo=o,Eo}var Io,Pl;function ef(){if(Pl)return Io;Pl=1;var e=Kt(),t=Ce(),r=at(),n=r("%ArrayBuffer%",!0),i=t("ArrayBuffer.prototype.byteLength",!0),o=t("Object.prototype.toString"),a=!!n&&!i&&new n(0).slice,s=!!a&&e(a);return Io=i||s?function(u){if(!u||typeof u!="object")return!1;try{return i?i(u):s(u,0),!0}catch{return!1}}:n?function(u){return o(u)==="[object ArrayBuffer]"}:function(u){return!1},Io}var Ro,kl;function wy(){if(kl)return Ro;kl=1;var e=Ce(),t=e("Date.prototype.getDay"),r=function(s){try{return t(s),!0}catch{return!1}},n=e("Object.prototype.toString"),i="[object Date]",o=Pt()();return Ro=function(s){return typeof s!="object"||s===null?!1:o?r(s):n(s)===i},Ro}var Oo,Nl;function tf(){if(Nl)return Oo;Nl=1;var e=Ce(),t=Pt()(),r=cs(),n=Rt(),i;if(t){var o=e("RegExp.prototype.exec"),a={},s=function(){throw a},l={toString:s,valueOf:s};typeof Symbol.toPrimitive=="symbol"&&(l[Symbol.toPrimitive]=s),i=function(h){if(!h||typeof h!="object")return!1;var p=n(h,"lastIndex"),m=p&&r(p,"value");if(!m)return!1;try{o(h,l)}catch(x){return x===a}}}else{var u=e("Object.prototype.toString"),f="[object RegExp]";i=function(h){return!h||typeof h!="object"&&typeof h!="function"?!1:u(h)===f}}return Oo=i,Oo}var Po,Ml;function Sy(){if(Ml)return Po;Ml=1;var e=Ce(),t=e("SharedArrayBuffer.prototype.byteLength",!0);return Po=t?function(n){if(!n||typeof n!="object")return!1;try{return t(n),!0}catch{return!1}}:function(n){return!1},Po}var ko,Ll;function Ay(){if(Ll)return ko;Ll=1;var e=Ce(),t=e("Number.prototype.toString"),r=function(s){try{return t(s),!0}catch{return!1}},n=e("Object.prototype.toString"),i="[object Number]",o=Pt()();return ko=function(s){return typeof s=="number"?!0:!s||typeof s!="object"?!1:o?r(s):n(s)===i},ko}var No,$l;function Cy(){if($l)return No;$l=1;var e=Ce(),t=e("Boolean.prototype.toString"),r=e("Object.prototype.toString"),n=function(s){try{return t(s),!0}catch{return!1}},i="[object Boolean]",o=Pt()();return No=function(s){return typeof s=="boolean"?!0:s===null||typeof s!="object"?!1:o?n(s):r(s)===i},No}var zr={exports:{}},Mo,_l;function jy(){if(_l)return Mo;_l=1;var e=Ce(),t=tf(),r=e("RegExp.prototype.exec"),n=Le();return Mo=function(o){if(!t(o))throw new n("`regex` must be a RegExp");return function(s){return r(o,s)!==null}},Mo}var Dl;function Ty(){if(Dl)return zr.exports;Dl=1;var e=Ce(),t=e("Object.prototype.toString"),r=is()(),n=jy();if(r){var i=e("Symbol.prototype.toString"),o=n(/^Symbol\(.*\)$/),a=function(l){return typeof l.valueOf()!="symbol"?!1:o(i(l))};zr.exports=function(l){if(typeof l=="symbol")return!0;if(!l||typeof l!="object"||t(l)!=="[object Symbol]")return!1;try{return a(l)}catch{return!1}}}else zr.exports=function(l){return!1};return zr.exports}var Hr={exports:{}},Lo,Bl;function Ey(){if(Bl)return Lo;Bl=1;var e=typeof BigInt<"u"&&BigInt;return Lo=function(){return typeof e=="function"&&typeof BigInt=="function"&&typeof e(42)=="bigint"&&typeof BigInt(42)=="bigint"},Lo}var zl;function Iy(){if(zl)return Hr.exports;zl=1;var e=Ey()();if(e){var t=BigInt.prototype.valueOf,r=function(i){try{return t.call(i),!0}catch{}return!1};Hr.exports=function(i){return i===null||typeof i>"u"||typeof i=="boolean"||typeof i=="string"||typeof i=="number"||typeof i=="symbol"||typeof i=="function"?!1:typeof i=="bigint"?!0:r(i)}}else Hr.exports=function(i){return!1};return Hr.exports}var $o,Hl;function Ry(){if(Hl)return $o;Hl=1;var e=Xd(),t=Ay(),r=Cy(),n=Ty(),i=Iy();return $o=function(a){if(a==null||typeof a!="object"&&typeof a!="function")return null;if(e(a))return"String";if(t(a))return"Number";if(r(a))return"Boolean";if(n(a))return"Symbol";if(i(a))return"BigInt"},$o}var _o,ql;function Oy(){if(ql)return _o;ql=1;var e=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,t=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,r;e||(r=function(a){return!1});var n=e?e.prototype.has:null,i=t?t.prototype.has:null;return!r&&!n&&(r=function(a){return!1}),_o=r||function(a){if(!a||typeof a!="object")return!1;try{if(n.call(a,n),i)try{i.call(a,i)}catch{return!0}return a instanceof e}catch{}return!1},_o}var qr={exports:{}},Fl;function Py(){if(Fl)return qr.exports;Fl=1;var e=at(),t=Ce(),r=e("%WeakSet%",!0),n=t("WeakSet.prototype.has",!0);if(n){var i=t("WeakMap.prototype.has",!0);qr.exports=function(a){if(!a||typeof a!="object")return!1;try{if(n(a,n),i)try{i(a,i)}catch{return!0}return a instanceof r}catch{}return!1}}else qr.exports=function(a){return!1};return qr.exports}var Do,Ul;function ky(){if(Ul)return Do;Ul=1;var e=Yd(),t=Jd(),r=Oy(),n=Py();return Do=function(o){if(o&&typeof o=="object"){if(e(o))return"Map";if(t(o))return"Set";if(r(o))return"WeakMap";if(n(o))return"WeakSet"}return!1},Do}var Bo,Wl;function Ny(){if(Wl)return Bo;Wl=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},t(function(){throw 42},null,r)}catch(S){S!==n&&(t=null)}else t=null;var i=/^\s*class\b/,o=function(j){try{var E=e.call(j);return i.test(E)}catch{return!1}},a=function(j){try{return o(j)?!1:(e.call(j),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",u="[object Function]",f="[object GeneratorFunction]",d="[object HTMLAllCollection]",h="[object HTML document.all class]",p="[object HTMLCollection]",m=typeof Symbol=="function"&&!!Symbol.toStringTag,x=!(0 in[,]),g=function(){return!1};if(typeof document=="object"){var v=document.all;s.call(v)===s.call(document.all)&&(g=function(j){if((x||!j)&&(typeof j>"u"||typeof j=="object"))try{var E=s.call(j);return(E===d||E===h||E===p||E===l)&&j("")==null}catch{}return!1})}return Bo=t?function(j){if(g(j))return!0;if(!j||typeof j!="function"&&typeof j!="object")return!1;try{t(j,null,r)}catch(E){if(E!==n)return!1}return!o(j)&&a(j)}:function(j){if(g(j))return!0;if(!j||typeof j!="function"&&typeof j!="object")return!1;if(m)return a(j);if(o(j))return!1;var E=s.call(j);return E!==u&&E!==f&&!/^\[object HTML/.test(E)?!1:a(j)},Bo}var zo,Gl;function My(){if(Gl)return zo;Gl=1;var e=Ny(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(l,u,f){for(var d=0,h=l.length;d<h;d++)r.call(l,d)&&(f==null?u(l[d],d,l):u.call(f,l[d],d,l))},i=function(l,u,f){for(var d=0,h=l.length;d<h;d++)f==null?u(l.charAt(d),d,l):u.call(f,l.charAt(d),d,l)},o=function(l,u,f){for(var d in l)r.call(l,d)&&(f==null?u(l[d],d,l):u.call(f,l[d],d,l))};function a(s){return t.call(s)==="[object Array]"}return zo=function(l,u,f){if(!e(u))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=f),a(l)?n(l,u,d):typeof l=="string"?i(l,u,d):o(l,u,d)},zo}var Ho,Vl;function Ly(){return Vl||(Vl=1,Ho=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ho}var qo,Kl;function $y(){if(Kl)return qo;Kl=1;var e=Ly(),t=typeof globalThis>"u"?wr:globalThis;return qo=function(){for(var n=[],i=0;i<e.length;i++)typeof t[e[i]]=="function"&&(n[n.length]=e[i]);return n},qo}var Fo,Xl;function _y(){if(Xl)return Fo;Xl=1;var e=My(),t=$y(),r=Kt(),n=Ce(),i=Rt(),o=n("Object.prototype.toString"),a=Pt()(),s=typeof globalThis>"u"?wr:globalThis,l=t(),u=n("String.prototype.slice"),f=Object.getPrototypeOf,d=n("Array.prototype.indexOf",!0)||function(g,v){for(var S=0;S<g.length;S+=1)if(g[S]===v)return S;return-1},h={__proto__:null};a&&i&&f?e(l,function(x){var g=new s[x];if(Symbol.toStringTag in g){var v=f(g),S=i(v,Symbol.toStringTag);if(!S){var j=f(v);S=i(j,Symbol.toStringTag)}h["$"+x]=r(S.get)}}):e(l,function(x){var g=new s[x],v=g.slice||g.set;v&&(h["$"+x]=r(v))});var p=function(g){var v=!1;return e(h,function(S,j){if(!v)try{"$"+S(g)===j&&(v=u(j,1))}catch{}}),v},m=function(g){var v=!1;return e(h,function(S,j){if(!v)try{S(g),v=u(j,1)}catch{}}),v};return Fo=function(g){if(!g||typeof g!="object")return!1;if(!a){var v=u(o(g),8,-1);return d(l,v)>-1?v:v!=="Object"?!1:m(g)}return i?p(g):null},Fo}var Uo,Yl;function Dy(){if(Yl)return Uo;Yl=1;var e=Ce(),t=e("ArrayBuffer.prototype.byteLength",!0),r=ef();return Uo=function(i){return r(i)?t?t(i):i.byteLength:NaN},Uo}var Wo,Jl;function By(){if(Jl)return Wo;Jl=1;var e=ay(),t=qd(),r=uy(),n=at(),i=vy(),o=Vd(),a=by(),s=Wd(),l=Kd(),u=ef(),f=wy(),d=tf(),h=Sy(),p=Qa(),m=Ry(),x=ky(),g=_y(),v=Dy(),S=t("SharedArrayBuffer.prototype.byteLength",!0),j=t("Date.prototype.getTime"),E=Object.getPrototypeOf,C=t("Object.prototype.toString"),k=n("%Set%",!0),L=t("Map.prototype.has",!0),N=t("Map.prototype.get",!0),P=t("Map.prototype.size",!0),_=t("Set.prototype.add",!0),T=t("Set.prototype.delete",!0),A=t("Set.prototype.has",!0),O=t("Set.prototype.size",!0);function D(I,$,X,V){for(var ee=i(I),ne;(ne=ee.next())&&!ne.done;)if(ie($,ne.value,X,V))return T(I,ne.value),!0;return!1}function U(I){if(typeof I>"u")return null;if(typeof I!="object")return typeof I=="symbol"?!1:typeof I=="string"||typeof I=="number"?+I==+I:!0}function H(I,$,X,V,ee,ne){var F=U(X);if(F!=null)return F;var G=N($,F),z=e({},ee,{strict:!1});return typeof G>"u"&&!L($,F)||!ie(V,G,z,ne)?!1:!L(I,F)&&ie(V,G,z,ne)}function K(I,$,X){var V=U(X);return V??(A($,V)&&!A(I,V))}function re(I,$,X,V,ee,ne){for(var F=i(I),G,z;(G=F.next())&&!G.done;)if(z=G.value,ie(X,z,ee,ne)&&ie(V,N($,z),ee,ne))return T(I,z),!0;return!1}function ie(I,$,X,V){var ee=X||{};if(ee.strict?a(I,$):I===$)return!0;var ne=m(I),F=m($);if(ne!==F)return!1;if(!I||!$||typeof I!="object"&&typeof $!="object")return ee.strict?a(I,$):I==$;var G=V.has(I),z=V.has($),J;if(G&&z){if(V.get(I)===V.get($))return!0}else J={};return G||V.set(I,J),z||V.set($,J),$e(I,$,ee,V)}function he(I){return!I||typeof I!="object"||typeof I.length!="number"||typeof I.copy!="function"||typeof I.slice!="function"||I.length>0&&typeof I[0]!="number"?!1:!!(I.constructor&&I.constructor.isBuffer&&I.constructor.isBuffer(I))}function ge(I,$,X,V){if(O(I)!==O($))return!1;for(var ee=i(I),ne=i($),F,G,z;(F=ee.next())&&!F.done;)if(F.value&&typeof F.value=="object")z||(z=new k),_(z,F.value);else if(!A($,F.value)){if(X.strict||!K(I,$,F.value))return!1;z||(z=new k),_(z,F.value)}if(z){for(;(G=ne.next())&&!G.done;)if(G.value&&typeof G.value=="object"){if(!D(z,G.value,X.strict,V))return!1}else if(!X.strict&&!A(I,G.value)&&!D(z,G.value,X.strict,V))return!1;return O(z)===0}return!0}function Se(I,$,X,V){if(P(I)!==P($))return!1;for(var ee=i(I),ne=i($),F,G,z,J,ve,ye;(F=ee.next())&&!F.done;)if(J=F.value[0],ve=F.value[1],J&&typeof J=="object")z||(z=new k),_(z,J);else if(ye=N($,J),typeof ye>"u"&&!L($,J)||!ie(ve,ye,X,V)){if(X.strict||!H(I,$,J,ve,X,V))return!1;z||(z=new k),_(z,J)}if(z){for(;(G=ne.next())&&!G.done;)if(J=G.value[0],ye=G.value[1],J&&typeof J=="object"){if(!re(z,I,J,ye,X,V))return!1}else if(!X.strict&&(!I.has(J)||!ie(N(I,J),ye,X,V))&&!re(z,I,J,ye,e({},X,{strict:!1}),V))return!1;return O(z)===0}return!0}function $e(I,$,X,V){var ee,ne;if(typeof I!=typeof $||I==null||$==null||C(I)!==C($)||s(I)!==s($))return!1;var F=l(I),G=l($);if(F!==G)return!1;var z=I instanceof Error,J=$ instanceof Error;if(z!==J||(z||J)&&(I.name!==$.name||I.message!==$.message))return!1;var ve=d(I),ye=d($);if(ve!==ye||(ve||ye)&&(I.source!==$.source||r(I)!==r($)))return!1;var be=f(I),Ae=f($);if(be!==Ae||(be||Ae)&&j(I)!==j($)||X.strict&&E&&E(I)!==E($))return!1;var je=g(I),Ke=g($);if(je!==Ke)return!1;if(je||Ke){if(I.length!==$.length)return!1;for(ee=0;ee<I.length;ee++)if(I[ee]!==$[ee])return!1;return!0}var _e=he(I),Te=he($);if(_e!==Te)return!1;if(_e||Te){if(I.length!==$.length)return!1;for(ee=0;ee<I.length;ee++)if(I[ee]!==$[ee])return!1;return!0}var Xe=u(I),Ye=u($);if(Xe!==Ye)return!1;if(Xe||Ye)return v(I)!==v($)?!1:typeof Uint8Array=="function"&&ie(new Uint8Array(I),new Uint8Array($),X,V);var Je=h(I),Er=h($);if(Je!==Er)return!1;if(Je||Er)return S(I)!==S($)?!1:typeof Uint8Array=="function"&&ie(new Uint8Array(I),new Uint8Array($),X,V);if(typeof I!=typeof $)return!1;var st=p(I),kt=p($);if(st.length!==kt.length)return!1;for(st.sort(),kt.sort(),ee=st.length-1;ee>=0;ee--)if(st[ee]!=kt[ee])return!1;for(ee=st.length-1;ee>=0;ee--)if(ne=st[ee],!ie(I[ne],$[ne],X,V))return!1;var Xt=x(I),ct=x($);return Xt!==ct?!1:Xt==="Set"||ct==="Set"?ge(I,$,X,V):Xt==="Map"?Se(I,$,X,V):!0}return Wo=function($,X,V){return ie($,X,V,o())},Wo}var zy=By();const rf=kd(zy);function Hy(e){return e}function nf(e,t,r,n){const i=Hy,[o,a]=w.useState(i(r)),s=w.useRef(o);return w.useEffect(()=>{const l=()=>{const u={...r,...e.getAttributes(t)};Object.keys(u).forEach(d=>{(u[d]===null||u[d]===void 0)&&(u[d]=r?r[d]:null)});const f=i(u);rf(s.current,f)||(a(f),s.current=f)};return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e,r,t,i]),o}function qy({editor:e}){const{t}=q.useLocale(),{width:r,height:n,src:i}=nf(e,St.name,{width:0,height:0,src:"",defaultShowPicker:!1}),[o,a]=w.useState(!1),[s,l]=w.useState(""),u=w.useCallback(()=>{a(!1)},[a]);w.useEffect(()=>{o&&l(i)},[o,i]);const f=w.useCallback(()=>{const g=Od(s);e.chain().updateAttributes(St.name,{src:(g==null?void 0:g.src)||s}).setNodeSelection(e.state.selection.from).focus().run(),a(!1)},[e,s,a]),d=w.useCallback(()=>{window.open(i,"_blank")},[i]),h=w.useCallback(()=>{a(!0)},[a]),p=w.useCallback(g=>{e.chain().updateAttributes(St.name,g).setNodeSelection(e.state.selection.from).focus().run()},[e]),m=w.useCallback(()=>e.isActive(St.name)&&!i,[e,i]),x=w.useCallback(()=>Wa(St.name,e),[e]);return c.jsxs(c.Fragment,{children:[c.jsx(me.BubbleMenu,{className:"bubble-menu",editor:e,pluginKey:"iframe-bubble-menu",shouldShow:m,tippyOptions:{popperOptions:{modifiers:[{name:"flip",enabled:!1}]},placement:"bottom-start",offset:[-2,16],zIndex:9999},children:c.jsxs("div",{className:"richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800",children:[c.jsx(W,{action:d,icon:"Eye",tooltip:"Visit Link"}),c.jsx(W,{action:h,icon:"Pencil",tooltip:"Open Edit Link"}),c.jsx(Rd,{height:n,onOk:p,width:r,children:c.jsx(W,{icon:"Settings",tooltip:t("editor.settings")})}),c.jsx(W,{action:x,icon:"Trash2",tooltip:t("editor.delete")})]})}),c.jsxs(Cr,{onOpenChange:a,open:o,children:[c.jsx(jr,{}),c.jsxs(Ft,{children:[c.jsx(ud,{children:c.jsx(Ut,{children:"Edit Link Iframe"})}),c.jsx(Ie,{autoFocus:!0,onInput:g=>l(g.target.value),placeholder:"Enter link",type:"url",value:s}),c.jsxs(In,{children:[c.jsx(we,{onClick:u,children:"Cancel"}),c.jsx(we,{onClick:f,children:"OK"})]})]})]})]})}function Fy({editor:e,disabled:t,bubbleMenu:r}){const n=e.extensionManager.extensions.map(o=>o.name),i=()=>{var o,a,s,l,u,f,d,h,p,m,x;return[n.includes("columns")&&!((o=r==null?void 0:r.columnConfig)!=null&&o.hidden)?c.jsx(iv,{editor:e},"columns"):null,n.includes("table")&&!((a=r==null?void 0:r.tableConfig)!=null&&a.hidden)?c.jsx(M0,{actions:(s=r==null?void 0:r.tableConfig)==null?void 0:s.actions,editor:e,hiddenActions:(l=r==null?void 0:r.tableConfig)==null?void 0:l.hiddenActions},"table"):null,n.includes("link")&&!((u=r==null?void 0:r.linkConfig)!=null&&u.hidden)?c.jsx(c1,{disabled:t,editor:e},"link"):null,n.includes(Ht.name)&&!((f=r==null?void 0:r.imageConfig)!=null&&f.hidden)?c.jsx(J1,{disabled:t,editor:e},"image"):null,n.includes(za.name)&&!((d=r==null?void 0:r.imageGifConfig)!=null&&d.hidden)?c.jsx(Z1,{disabled:t,editor:e},"imageGif"):null,n.includes("video")&&!((h=r==null?void 0:r.videoConfig)!=null&&h.hidden)?c.jsx(Q1,{disabled:t,editor:e},"video"):null,n.includes("iframe")&&!((p=r==null?void 0:r.iframeConfig)!=null&&p.hidden)?c.jsx(qy,{disabled:t,editor:e},"iframe"):null,(m=r==null?void 0:r.floatingMenuConfig)!=null&&m.hidden?null:c.jsx(l0,{disabled:t,editor:e},"content"),(x=r==null?void 0:r.textConfig)!=null&&x.hidden?null:c.jsx(f0,{disabled:t,editor:e},"text")]};return r!=null&&r.render?r.render({editor:e,disabled:t||!1,extensionsNames:n,bubbleMenu:r},i()):i().filter(Boolean)}function Zl(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:c.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"})})}function of(e){const{t}=q.useLocale(),{highlight:r=!1,disabled:n=!1,selectedColor:i,setSelectedColor:o,onChange:a,colors:s=q.COLORS_LIST}=e,l=w.useMemo(()=>{const p=s,m=[];for(let x=0;x<p.length;x+=10)m.push(p.slice(x,x+10));return m},[s]),[u,f]=w.useState([]),d=p=>{const m=[...u],x=m.indexOf(p);x!==-1&&m.splice(x,1),m.unshift(p),m.length>10&&m.pop(),f(m)};function h(p){if(p===void 0){o==null||o(p),a==null||a(p);return}/^#([\da-f]{3}){1,2}$/i.test(p)&&(o==null||o(p),a==null||a(p),d(p))}return c.jsxs(Wt,{modal:!0,children:[c.jsx(Gt,{asChild:!0,className:"!richtext-p-0",disabled:n,children:e==null?void 0:e.children}),c.jsx(It,{align:"start",className:"richtext-size-full richtext-p-2",hideWhenDetached:!0,side:"bottom",children:c.jsxs("div",{className:"richtext-flex richtext-flex-col",children:[r?c.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>h(void 0),children:[c.jsx(Zl,{}),c.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.nofill")})]}):c.jsxs("div",{className:"rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",onClick:()=>{h(void 0)},children:[c.jsx(Zl,{}),c.jsx("span",{className:"richtext-ml-1 richtext-text-sm",children:t("editor.default")})]}),l.map((p,m)=>c.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:p.map((x,g)=>c.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:()=>h(x),children:c.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:x},children:x===i?c.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:c.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})}):c.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:c.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-${g}`))},m)),c.jsxs("div",{children:[c.jsx("div",{className:"richtext-my-1 richtext-text-sm",children:t("editor.recent")}),c.jsx("span",{className:"richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",children:u==null?void 0:u.map((p,m)=>c.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:()=>h(p),children:c.jsx("span",{className:"richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",style:{backgroundColor:p},children:c.jsx("svg",{viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"},children:c.jsx("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"})})})},`sub-color-recent-${m}`))})]}),c.jsx(Uy,{setColor:h})]})})]})}function Uy({setColor:e}){const[t,r]=w.useState("#000000"),[n,i]=w.useState(!1),{t:o}=q.useLocale();return w.useEffect(()=>()=>{i(!1)},[]),c.jsxs(Wt,{open:n,children:[c.jsx(Gt,{asChild:!0,children:c.jsxs("div",{className:"richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent",onClick:a=>{a.preventDefault(),i(!0)},children:[o("editor.color.more"),"..."]})}),c.jsxs(It,{children:[c.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-items-center richtext-justify-center",children:[c.jsx(Ef.HexColorPicker,{color:t,onChange:r}),c.jsx(Ie,{className:"richtext-mt-[8px] richtext-w-full",type:"text",value:t.slice(1),onChange:a=>{a.preventDefault(),r(`#${a.target.value}`)}})]}),c.jsx(Be,{className:"richtext-my-[10px]"}),c.jsx(we,{className:"richtext-w-full",onClick:a=>{a.preventDefault(),e(t),i(!1)},children:c.jsx(M.Plus,{size:16})})]})]})}function Wy({editor:e,disabled:t,toolbar:r}){const{t:n,lang:i}=q.useLocale(),o=w.useMemo(()=>{const u=[...e.extensionManager.extensions].sort((d,h)=>{const p=d.options.sort??-1,m=h.options.sort??-1;return p-m});let f=[];for(const d of u){const{button:h,divider:p=!1,spacer:m=!1,toolbar:x=!0}=d.options;if(!h||!U1(h)||!x)continue;const g=h({editor:e,extension:d,t:n});if(Array.isArray(g)){const v=g.map((S,j)=>({button:S,divider:j===g.length-1?p:!1,spacer:j===0?m:!1,type:d.type,name:d.name}));f=[...f,...v];continue}f.push({button:g,divider:p,spacer:m,type:d.type,name:d.name})}return f},[e,n,i]),a=l=>c.jsx("div",{className:"richtext-px-1 richtext-py-2 !richtext-border-b",style:{pointerEvents:t?"none":"auto",opacity:t?.5:1},children:c.jsx("div",{className:"richtext-relative richtext-flex richtext-flex-wrap richtext-h-auto richtext-gap-y-1 richtext-gap-x-1",children:l})}),s=o.map((l,u)=>{var d,h;const f=l.button.component;return c.jsxs("div",{className:"richtext-flex richtext-items-center",children:[(l==null?void 0:l.spacer)&&c.jsx(Be,{orientation:"vertical",className:"!richtext-h-[16px] !richtext-mx-[10px]"}),c.jsx(f,{...l.button.componentProps,disabled:t||((h=(d=l==null?void 0:l.button)==null?void 0:d.componentProps)==null?void 0:h.disabled)}),(l==null?void 0:l.divider)&&c.jsx(Be,{orientation:"vertical",className:"!richtext-h-auto !richtext-mx-2"})]},`toolbar-item-${u}`)});return r&&(r!=null&&r.render)?r.render({editor:e,disabled:t||!1},o,s,a):a(s)}function Gy({editor:e,extensions:t}){const{t:r}=q.useLocale(),n=w.useMemo(()=>{var i,o,a;return(a=(o=(i=t==null?void 0:t.find(s=>s.name==="base-kit"))==null?void 0:i.options)==null?void 0:o.characterCount)==null?void 0:a.limit},[t]);return n?c.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t",children:c.jsx("div",{className:"richtext-flex richtext-flex-col",children:c.jsx("div",{className:"richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm",children:c.jsxs("span",{children:[e.storage.characterCount.characters(),"/",n," ",r("editor.characters")]})})})}):c.jsx("div",{className:"richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t",children:c.jsx("div",{className:"richtext-flex richtext-flex-col",children:c.jsx("div",{className:"richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm",children:c.jsxs("span",{children:[e.storage.characterCount.characters()," ",r("editor.characters")]})})})})}function Vy(){const{toasts:e}=Nn();return c.jsxs(cv,{children:[e.map(({id:t,title:r,description:n,action:i,...o})=>c.jsxs(Cd,{...o,children:[c.jsxs("div",{className:"richtext-grid richtext-gap-1",children:[r&&c.jsx(Td,{children:r}),n&&c.jsx(Ed,{children:n})]}),i,c.jsx(jd,{})]},t)),c.jsx(Ad,{})]})}const Ky=`