@blinkk/root-cms 3.1.1 → 3.1.3

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 (95) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-GXV4UQ6Z.js → chunk-4G7S2LJH.js} +2 -2
  3. package/dist/core/plugin.d.ts +1 -1
  4. package/dist/core/translations.d.ts +19 -4
  5. package/dist/plugin.js +34 -4
  6. package/dist/shared/translation-languages.d.ts +67 -0
  7. package/dist/ui/AIPage-VOTAEVJE.js +1 -0
  8. package/dist/ui/AssetsPage-EWGRMRPJ.js +1 -0
  9. package/dist/ui/{CollectionPage-CU3VDEXA.js → CollectionPage-N5JIAUDS.js} +1 -1
  10. package/dist/ui/ComparePage-JDPVU2VA.js +1 -0
  11. package/dist/ui/{DataPage-XIXFKXDN.js → DataPage-37D4CMLZ.js} +1 -1
  12. package/dist/ui/{DataSourcePage-ORIEQH3Y.js → DataSourcePage-LX5ASYQN.js} +1 -1
  13. package/dist/ui/DocTranslationsPage-V5M4KB7X.js +1 -0
  14. package/dist/ui/DocumentPage-SURTQJPG.js +1 -0
  15. package/dist/ui/{EditDataSourcePage-HIGZZQJC.js → EditDataSourcePage-O7DOV5LX.js} +1 -1
  16. package/dist/ui/{EditReleasePage-KUHBU2HQ.js → EditReleasePage-NDYTKGXY.js} +1 -1
  17. package/dist/ui/{EmbeddedAIPage-CJWZE5FC.js → EmbeddedAIPage-RJOUIPF2.js} +1 -1
  18. package/dist/ui/EmbeddedDocumentPage-SLEULNNI.js +1 -0
  19. package/dist/ui/LogsPage-ZGBP3I35.js +1 -0
  20. package/dist/ui/{NewDataSourcePage-7TUUE6ZL.js → NewDataSourcePage-GQONTMP4.js} +1 -1
  21. package/dist/ui/NewReleasePage-7ZKXHDTD.js +1 -0
  22. package/dist/ui/{NotFoundPage-AW6UC6II.js → NotFoundPage-WXEZQZK6.js} +1 -1
  23. package/dist/ui/ProjectPage-F7W7X6YO.js +1 -0
  24. package/dist/ui/{ReleasePage-W2R3DIFX.js → ReleasePage-ZKMNYPML.js} +1 -1
  25. package/dist/ui/{ReleasesPage-HBBUGE7D.js → ReleasesPage-JHCE6AEJ.js} +1 -1
  26. package/dist/ui/SettingsPage-MWCPZPGE.js +1 -0
  27. package/dist/ui/SidebarToolsPage-API53RRR.js +1 -0
  28. package/dist/ui/TaskPage-73NLAR4J.js +1 -0
  29. package/dist/ui/TasksPage-IKPW2OQO.js +1 -0
  30. package/dist/ui/{TranslationsArbPage-AJLM5VSD.js → TranslationsArbPage-QVN66DIW.js} +1 -1
  31. package/dist/ui/TranslationsEditPage-ZOELF5PK.js +1 -0
  32. package/dist/ui/{TranslationsPage-HPYAJQ4Q.js → TranslationsPage-NGGZB4L6.js} +32 -32
  33. package/dist/ui/{chunk-3T4ZWQR4.js → chunk-2EPQJUGM.js} +1 -1
  34. package/dist/ui/{chunk-2KSMCQ6H.js → chunk-2RAVKX2Z.js} +1 -1
  35. package/dist/ui/{chunk-B6M55OFE.js → chunk-4FGASIIX.js} +1 -1
  36. package/dist/ui/chunk-AAHM6RYJ.js +1 -0
  37. package/dist/ui/{chunk-OXVYTSIZ.js → chunk-BOER3EAW.js} +1 -1
  38. package/dist/ui/{chunk-GU24U5RM.js → chunk-BT2NTAW2.js} +1 -1
  39. package/dist/ui/chunk-BUNR5EU3.js +1 -0
  40. package/dist/ui/{chunk-O5P3CPJ4.js → chunk-BW2MKGNP.js} +1 -1
  41. package/dist/ui/chunk-C2BLMTPR.js +3 -0
  42. package/dist/ui/{chunk-RAXWL656.js → chunk-DIFPCF7I.js} +1 -1
  43. package/dist/ui/{chunk-R6B3W5AJ.js → chunk-DS27MO63.js} +1 -1
  44. package/dist/ui/{chunk-MZTOPPWQ.js → chunk-ENQKSLGJ.js} +1 -1
  45. package/dist/ui/chunk-FXIR2RBE.js +1 -0
  46. package/dist/ui/chunk-G5ZZDHWA.js +1 -0
  47. package/dist/ui/{chunk-76ZGLKLT.js → chunk-GT5EQSEX.js} +1 -1
  48. package/dist/ui/{chunk-AZCGXQTL.js → chunk-IOR72US3.js} +1 -1
  49. package/dist/ui/{chunk-XT5FNJCX.js → chunk-MSYTAJBV.js} +1 -1
  50. package/dist/ui/{chunk-E76ECIOX.js → chunk-NJMNOITA.js} +1 -1
  51. package/dist/ui/chunk-NSI5JSVV.js +1 -0
  52. package/dist/ui/{chunk-OWQL5DVE.js → chunk-PPYM4O5N.js} +1 -1
  53. package/dist/ui/{chunk-WKF7CSWS.js → chunk-QF3GPZTI.js} +1 -1
  54. package/dist/ui/{chunk-TDUBSLEC.js → chunk-T77VOWHP.js} +1 -1
  55. package/dist/ui/chunk-TOGLZDK3.js +1 -0
  56. package/dist/ui/{chunk-V4CTOC6E.js → chunk-TPJCPCRR.js} +1 -1
  57. package/dist/ui/{chunk-GQ5IRK43.js → chunk-TVYAZN2Q.js} +1 -1
  58. package/dist/ui/chunk-UPDL6UXI.js +1 -0
  59. package/dist/ui/{chunk-764W6634.js → chunk-VPHBKJ3I.js} +1 -1
  60. package/dist/ui/{chunk-U7PWJV6F.js → chunk-W6LP22IK.js} +1 -1
  61. package/dist/ui/{chunk-WXT7LTQM.js → chunk-WYJJZTCI.js} +1 -1
  62. package/dist/ui/chunk-Y3MCFLQU.js +141 -0
  63. package/dist/ui/chunk-YUU6LWQK.js +1 -0
  64. package/dist/ui/chunk-Z6DBYLIM.js +1 -0
  65. package/dist/ui/chunk-ZMS6NIGG.js +1 -0
  66. package/dist/ui/ui.css +1 -1
  67. package/dist/ui/ui.js +1 -1
  68. package/package.json +3 -3
  69. package/dist/ui/AIPage-EL6DQYII.js +0 -1
  70. package/dist/ui/AssetsPage-5S6PNMF6.js +0 -1
  71. package/dist/ui/ComparePage-FTZLYO2O.js +0 -1
  72. package/dist/ui/DocTranslationsPage-4OVBIPSG.js +0 -1
  73. package/dist/ui/DocumentPage-3JPFJF3E.js +0 -1
  74. package/dist/ui/EmbeddedDocumentPage-6XQHYIAO.js +0 -1
  75. package/dist/ui/LogsPage-4DVGYXZY.js +0 -1
  76. package/dist/ui/NewReleasePage-6UT36HDW.js +0 -1
  77. package/dist/ui/ProjectPage-US5FJGFK.js +0 -1
  78. package/dist/ui/SettingsPage-7JQQILUV.js +0 -1
  79. package/dist/ui/SidebarToolsPage-MIYXKHF2.js +0 -1
  80. package/dist/ui/TaskPage-JYUQEGRB.js +0 -1
  81. package/dist/ui/TasksPage-4VFQF243.js +0 -1
  82. package/dist/ui/TranslationsEditPage-RTTGTIGI.js +0 -1
  83. package/dist/ui/chunk-5AVRMJVW.js +0 -1
  84. package/dist/ui/chunk-FFHV5S6A.js +0 -1
  85. package/dist/ui/chunk-FSVNOZ6F.js +0 -1
  86. package/dist/ui/chunk-GDXNSFLE.js +0 -1
  87. package/dist/ui/chunk-M3T56ZRP.js +0 -1
  88. package/dist/ui/chunk-MXGHX55S.js +0 -141
  89. package/dist/ui/chunk-QEE7XS6O.js +0 -1
  90. package/dist/ui/chunk-SRX7EWL4.js +0 -1
  91. package/dist/ui/chunk-TFB3VGWP.js +0 -1
  92. package/dist/ui/chunk-YLSRRNSE.js +0 -1
  93. package/dist/ui/chunk-ZN2Y5OUF.js +0 -3
  94. /package/dist/ui/{chunk-E76ECIOX.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
  95. /package/dist/ui/{chunk-MXGHX55S.js.LEGAL.txt → chunk-Y3MCFLQU.js.LEGAL.txt} +0 -0
@@ -1,141 +0,0 @@
1
- import{c as tw,e as pw}from"./chunk-WFQU7V3W.js";import{a as ru}from"./chunk-RAXWL656.js";import{a as aw,b as lw}from"./chunk-QEE7XS6O.js";import{a as rw}from"./chunk-WXT7LTQM.js";import{a as nw,b as ow,c as Kh}from"./chunk-OXVYTSIZ.js";import{a as aa}from"./chunk-3E6CASIN.js";import{a as cw}from"./chunk-FBSBL476.js";import{a as GE,d as YE}from"./chunk-HO3W4RVG.js";import{a as jE}from"./chunk-3T4ZWQR4.js";import{c as Uh}from"./chunk-E76ECIOX.js";import{b as VE,d as WE}from"./chunk-344GZOGG.js";import{a as XE}from"./chunk-5AVRMJVW.js";import{a as JE}from"./chunk-MZTOPPWQ.js";import{a as Cr}from"./chunk-XT5FNJCX.js";import{a as nE,d as iw,e as sw,h as uw}from"./chunk-TDUBSLEC.js";import{g as QE,h as sa,i as ew}from"./chunk-OWQL5DVE.js";import{c as eE,d as tE,f as Bd}from"./chunk-R6B3W5AJ.js";import{a as ZE}from"./chunk-FJLNXXE3.js";import{a as dw}from"./chunk-76ZGLKLT.js";import{a as Et,c as it}from"./chunk-HARRKJFZ.js";import{a as ta,b as na,c as Ad,d as MC}from"./chunk-JS6TK4OP.js";import{c as OC}from"./chunk-JDW4UORS.js";import{a as Ln,b as Go,d as Ih,e as tt,g as QC}from"./chunk-5MV6XVGA.js";import{$ as Fd,B as VC,D as WC,M as GC,N as YC,Q as oa,S as qC,U as JC,V as Rd,W as XC,X as ZC,_ as Pd,a as Md,b as Al,c as LC,d as So,e as BC,f as $C,l as zC,v as HC,w as UC,x as Dh}from"./chunk-TFB3VGWP.js";import{b as Ld,e as Oh,f as xr,h as KC,i as jC}from"./chunk-ZN2Y5OUF.js";import{a as ou,b as qE}from"./chunk-W5DOO6ID.js";import{a as nu}from"./chunk-NSOTG64N.js";import{a as Il,b as br}from"./chunk-J5E457OI.js";import{a as ce,b as wt,c as Ol}from"./chunk-QHJOTXYB.js";import{a as ns}from"./chunk-O5P3CPJ4.js";import{a as Zi,d as IC,e as AC,f as Id}from"./chunk-KRNQ6L35.js";import{a as Sd,c as kd,e as kC,p as NC,q as Nd,s as Dd,u as Od,v as ea}from"./chunk-VD6G5NV4.js";import{d as DC,f as Ce}from"./chunk-YLSRRNSE.js";import{$a as sE,$b as NE,A as xC,Ac as Bh,Ba as po,Bb as gE,Bc as BE,Cc as Jd,Da as SC,Dc as $E,Ea as Td,Ec as zE,Fa as Oe,Ga as f,Gb as mE,Gc as ko,Hb as jd,Hc as $h,Ia as Ah,Ib as _E,Ic as HE,Ja as oE,Jb as bE,Jc as Xd,Kb as yE,Kc as Zd,Lb as xE,Lc as Qd,Ma as li,Mb as vE,Mc as eu,Pb as Rl,Qa as ra,Qb as Vd,Qc as Fl,R as vC,Rb as CE,Rc as Jn,Sb as EE,Sc as tu,Ta as $d,Tb as es,Tc as UE,U as Sh,Ua as Mh,Ub as wE,V as Ft,Va as rE,Vb as TE,W as Me,Xa as iE,Y as un,Yb as SE,Yc as zh,Za as Qi,Zb as Wd,_ as _r,_a as fo,_b as kE,_c as Hh,a as L,aa as CC,ab as aE,ac as DE,ad as KE,b as hC,bb as lE,bc as Gd,c as P,cb as cE,d as mn,da as X,db as zd,dc as OE,e as q,ea as uo,eb as Lh,fa as pn,fc as IE,g as J,ga as EC,gb as Hd,h as De,i as ht,j as ke,jb as Ud,k as gC,kc as AE,l as mC,la as Qs,lb as Kd,lc as Pl,m as Wo,mc as Yd,na as _n,nb as dE,nc as Rh,o as vd,oa as Cd,oc as Ph,p as _C,pa as Ed,pc as ME,q as ii,qa as G,qb as uE,qc as LE,r as bC,ra as Xi,s as yC,sa as wC,sc as RE,tb as ia,tc as PE,u as Dl,ua as qn,uc as FE,v as rt,va as TC,vb as pE,w as si,wb as vr,x as wh,xb as fE,xc as ts,y as bt,ya as wd,yb as hE,yc as Fh,z as Th,za as Mn,zb as Ll,zc as qd}from"./chunk-LROR6N3B.js";import{b as Ji,d as Ne,e as fC,j as ft,k as ri}from"./chunk-KUCVLANF.js";import{h as ai,i as RC,j as PC,k as kh,l as yr,m as Nh,n as Ml,p as FC}from"./chunk-7SK47HHZ.js";import{b as Ch,c as ze,d as Eh,e as UR}from"./chunk-PVAE643M.js";var jw=Ch(Kw=>{"use strict";var Bl=(bt(),UR(wh));function DP(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var OP=typeof Object.is=="function"?Object.is:DP,IP=Bl.useSyncExternalStore,AP=Bl.useRef,MP=Bl.useEffect,LP=Bl.useMemo,RP=Bl.useDebugValue;Kw.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=AP(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=LP(function(){function l(h){if(!c){if(c=!0,d=h,h=o(h),r!==void 0&&s.hasValue){var g=s.value;if(r(g,h))return u=g}return u=h}if(g=u,OP(d,h))return g;var m=o(h);return r!==void 0&&r(g,m)?(d=h,g):(d=h,u=m)}var c=!1,d,u,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,o,r]);var a=IP(t,i[0],i[1]);return MP(function(){s.hasValue=!0,s.value=a},[a]),RP(a),a}});var Ww=Ch((Sq,Vw)=>{"use strict";Vw.exports=jw()});var Vv=Ch((Vle,dh)=>{"use strict";var hW=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var ie=(function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,o={},r={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function m(_){return _ instanceof i?new i(_.type,m(_.content),_.alias):Array.isArray(_)?_.map(m):_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++n}),m.__id},clone:function m(_,b){b=b||{};var y,v;switch(r.util.type(_)){case"Object":if(v=r.util.objId(_),b[v])return b[v];y={},b[v]=y;for(var x in _)_.hasOwnProperty(x)&&(y[x]=m(_[x],b));return y;case"Array":return v=r.util.objId(_),b[v]?b[v]:(y=[],b[v]=y,_.forEach(function(E,C){y[C]=m(E,b)}),y);default:return _}},getLanguage:function(m){for(;m;){var _=e.exec(m.className);if(_)return _[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,_){m.className=m.className.replace(RegExp(e,"gi"),""),m.classList.add("language-"+_)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(m){var _=document.getElementsByTagName("script");for(var b in _)if(_[b].src==m)return _[b]}return null}},isActive:function(m,_,b){for(var y="no-"+_;m;){var v=m.classList;if(v.contains(_))return!0;if(v.contains(y))return!1;m=m.parentElement}return!!b}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,_){var b=r.util.clone(r.languages[m]);for(var y in _)b[y]=_[y];return b},insertBefore:function(m,_,b,y){y=y||r.languages;var v=y[m],x={};for(var E in v)if(v.hasOwnProperty(E)){if(E==_)for(var C in b)b.hasOwnProperty(C)&&(x[C]=b[C]);b.hasOwnProperty(E)||(x[E]=v[E])}var k=y[m];return y[m]=x,r.languages.DFS(r.languages,function(T,w){w===k&&T!=m&&(this[T]=x)}),x},DFS:function m(_,b,y,v){v=v||{};var x=r.util.objId;for(var E in _)if(_.hasOwnProperty(E)){b.call(_,E,_[E],y||E);var C=_[E],k=r.util.type(C);k==="Object"&&!v[x(C)]?(v[x(C)]=!0,m(C,b,null,v)):k==="Array"&&!v[x(C)]&&(v[x(C)]=!0,m(C,b,E,v))}}},plugins:{},highlightAll:function(m,_){r.highlightAllUnder(document,m,_)},highlightAllUnder:function(m,_,b){var y={callback:b,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),r.hooks.run("before-all-elements-highlight",y);for(var v=0,x;x=y.elements[v++];)r.highlightElement(x,_===!0,y.callback)},highlightElement:function(m,_,b){var y=r.util.getLanguage(m),v=r.languages[y];r.util.setLanguage(m,y);var x=m.parentElement;x&&x.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(x,y);var E=m.textContent,C={element:m,language:y,grammar:v,code:E};function k(w){C.highlightedCode=w,r.hooks.run("before-insert",C),C.element.innerHTML=C.highlightedCode,r.hooks.run("after-highlight",C),r.hooks.run("complete",C),b&&b.call(C.element)}if(r.hooks.run("before-sanity-check",C),x=C.element.parentElement,x&&x.nodeName.toLowerCase()==="pre"&&!x.hasAttribute("tabindex")&&x.setAttribute("tabindex","0"),!C.code){r.hooks.run("complete",C),b&&b.call(C.element);return}if(r.hooks.run("before-highlight",C),!C.grammar){k(r.util.encode(C.code));return}if(_&&t.Worker){var T=new Worker(r.filename);T.onmessage=function(w){k(w.data)},T.postMessage(JSON.stringify({language:C.language,code:C.code,immediateClose:!0}))}else k(r.highlight(C.code,C.grammar,C.language))},highlight:function(m,_,b){var y={code:m,grammar:_,language:b};if(r.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=r.tokenize(y.code,y.grammar),r.hooks.run("after-tokenize",y),i.stringify(r.util.encode(y.tokens),y.language)},tokenize:function(m,_){var b=_.rest;if(b){for(var y in b)_[y]=b[y];delete _.rest}var v=new l;return c(v,v.head,m),a(m,v,_,v.head,0),u(v)},hooks:{all:{},add:function(m,_){var b=r.hooks.all;b[m]=b[m]||[],b[m].push(_)},run:function(m,_){var b=r.hooks.all[m];if(!(!b||!b.length))for(var y=0,v;v=b[y++];)v(_)}},Token:i};t.Prism=r;function i(m,_,b,y){this.type=m,this.content=_,this.alias=b,this.length=(y||"").length|0}i.stringify=function m(_,b){if(typeof _=="string")return _;if(Array.isArray(_)){var y="";return _.forEach(function(k){y+=m(k,b)}),y}var v={type:_.type,content:m(_.content,b),tag:"span",classes:["token",_.type],attributes:{},language:b},x=_.alias;x&&(Array.isArray(x)?Array.prototype.push.apply(v.classes,x):v.classes.push(x)),r.hooks.run("wrap",v);var E="";for(var C in v.attributes)E+=" "+C+'="'+(v.attributes[C]||"").replace(/"/g,"&quot;")+'"';return"<"+v.tag+' class="'+v.classes.join(" ")+'"'+E+">"+v.content+"</"+v.tag+">"};function s(m,_,b,y){m.lastIndex=_;var v=m.exec(b);if(v&&y&&v[1]){var x=v[1].length;v.index+=x,v[0]=v[0].slice(x)}return v}function a(m,_,b,y,v,x){for(var E in b)if(!(!b.hasOwnProperty(E)||!b[E])){var C=b[E];C=Array.isArray(C)?C:[C];for(var k=0;k<C.length;++k){if(x&&x.cause==E+","+k)return;var T=C[k],w=T.inside,S=!!T.lookbehind,N=!!T.greedy,D=T.alias;if(N&&!T.pattern.global){var O=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,O+"g")}for(var A=T.pattern||T,I=y.next,R=v;I!==_.tail&&!(x&&R>=x.reach);R+=I.value.length,I=I.next){var z=I.value;if(_.length>m.length)return;if(!(z instanceof i)){var W=1,Z;if(N){if(Z=s(A,R,m,S),!Z||Z.index>=m.length)break;var ut=Z.index,F=Z.index+Z[0].length,se=R;for(se+=I.value.length;ut>=se;)I=I.next,se+=I.value.length;if(se-=I.value.length,R=se,I.value instanceof i)continue;for(var ye=I;ye!==_.tail&&(se<F||typeof ye.value=="string");ye=ye.next)W++,se+=ye.value.length;W--,z=m.slice(R,se),Z.index-=R}else if(Z=s(A,0,z,S),!Z)continue;var ut=Z.index,Rt=Z[0],ot=z.slice(0,ut),pt=z.slice(ut+Rt.length),oe=R+z.length;x&&oe>x.reach&&(x.reach=oe);var ee=I.prev;ot&&(ee=c(_,ee,ot),R+=ot.length),d(_,ee,W);var xe=new i(E,w?r.tokenize(Rt,w):Rt,D,Rt);if(I=c(_,ee,xe),pt&&c(_,I,pt),W>1){var Be={cause:E+","+k,reach:oe};a(m,_,b,I.prev,R,Be),x&&Be.reach>x.reach&&(x.reach=Be.reach)}}}}}}function l(){var m={value:null,prev:null,next:null},_={value:null,prev:m,next:null};m.next=_,this.head=m,this.tail=_,this.length=0}function c(m,_,b){var y=_.next,v={value:b,prev:_,next:y};return _.next=v,y.prev=v,m.length++,v}function d(m,_,b){for(var y=_.next,v=0;v<b&&y!==m.tail;v++)y=y.next;_.next=y,y.prev=_,m.length-=v}function u(m){for(var _=[],b=m.head.next;b!==m.tail;)_.push(b.value),b=b.next;return _}if(!t.document)return t.addEventListener&&(r.disableWorkerMessageHandler||t.addEventListener("message",function(m){var _=JSON.parse(m.data),b=_.language,y=_.code,v=_.immediateClose;t.postMessage(r.highlight(y,r.languages[b],b)),v&&t.close()},!1)),r;var p=r.util.currentScript();p&&(r.filename=p.src,p.hasAttribute("data-manual")&&(r.manual=!0));function h(){r.manual||r.highlightAll()}if(!r.manual){var g=document.readyState;g==="loading"||g==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return r})(hW);typeof dh<"u"&&dh.exports&&(dh.exports=ie);typeof global<"u"&&(global.Prism=ie);ie.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};ie.languages.markup.tag.inside["attr-value"].inside.entity=ie.languages.markup.entity;ie.languages.markup.doctype.inside["internal-subset"].inside=ie.languages.markup;ie.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(ie.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:ie.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:ie.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},ie.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(ie.languages.markup.tag,"addAttribute",{value:function(t,e){ie.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:ie.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});ie.languages.html=ie.languages.markup;ie.languages.mathml=ie.languages.markup;ie.languages.svg=ie.languages.markup;ie.languages.xml=ie.languages.extend("markup",{});ie.languages.ssml=ie.languages.xml;ie.languages.atom=ie.languages.xml;ie.languages.rss=ie.languages.xml;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(ie);ie.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};ie.languages.javascript=ie.languages.extend("clike",{"class-name":[ie.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});ie.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;ie.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:ie.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:ie.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:ie.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:ie.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:ie.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});ie.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:ie.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});ie.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});ie.languages.markup&&(ie.languages.markup.tag.addInlined("script","javascript"),ie.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));ie.languages.js=ie.languages.javascript;(function(){if(typeof ie>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t="Loading\u2026",e=function(p,h){return"\u2716 Error "+p+" while fetching file: "+h},n="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",i="loading",s="loaded",a="failed",l="pre[data-src]:not(["+r+'="'+s+'"]):not(['+r+'="'+i+'"])';function c(p,h,g){var m=new XMLHttpRequest;m.open("GET",p,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?h(m.responseText):m.status>=400?g(e(m.status,m.statusText)):g(n))},m.send(null)}function d(p){var h=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(h){var g=Number(h[1]),m=h[2],_=h[3];return m?_?[g,Number(_)]:[g,void 0]:[g,g]}}ie.hooks.add("before-highlightall",function(p){p.selector+=", "+l}),ie.hooks.add("before-sanity-check",function(p){var h=p.element;if(h.matches(l)){p.code="",h.setAttribute(r,i);var g=h.appendChild(document.createElement("CODE"));g.textContent=t;var m=h.getAttribute("data-src"),_=p.language;if(_==="none"){var b=(/\.(\w+)$/.exec(m)||[,"none"])[1];_=o[b]||b}ie.util.setLanguage(g,_),ie.util.setLanguage(h,_);var y=ie.plugins.autoloader;y&&y.loadLanguages(_),c(m,function(v){h.setAttribute(r,s);var x=d(h.getAttribute("data-range"));if(x){var E=v.split(/\r\n?|\n/g),C=x[0],k=x[1]==null?E.length:x[1];C<0&&(C+=E.length),C=Math.max(0,Math.min(C-1,E.length)),k<0&&(k+=E.length),k=Math.max(0,Math.min(k,E.length)),v=E.slice(C,k).join(`
2
- `),h.hasAttribute("data-start")||h.setAttribute("data-start",String(C+1))}g.textContent=v,ie.highlightElement(g)},function(v){h.setAttribute(r,a),g.textContent=v})}}),ie.plugins.fileHighlight={highlight:function(h){for(var g=(h||document).querySelectorAll(l),m=0,_;_=g[m++];)ie.highlightElement(_)}};var u=!1;ie.fileHighlight=function(){u||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),u=!0),ie.plugins.fileHighlight.highlight.apply(this,arguments)}})()});ke();ke();ke();function iu(t){return f(ts,{className:t.className,size:t.size})}function mw(t){let[e,n]=L(null),[o,r]=L("");if(P(()=>{let a=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let c=await l.json();a&&n(c)}).catch(l=>{a&&r(String(l))}),()=>{a=!1}},[]),!e&&!o)return f("div",{className:"AiEditModal__ChatPanel__loading",children:f(Ft,{size:"sm",color:"gray"})});if(!(!!e?.enabled&&(e.models?.length||0)>0))return f("div",{className:"AiEditModal__ChatPanel__notConfigured",children:[f("div",{className:"AiEditModal__ChatPanel__notConfigured__icon",children:f(ts,{size:32})}),f("div",{className:"AiEditModal__ChatPanel__notConfigured__title",children:"Root AI is not configured for this project."}),f("div",{className:"AiEditModal__ChatPanel__notConfigured__body",children:["Add an ",f("code",{children:"ai.models"})," entry to ",f("code",{children:"cmsPlugin()"})," in"," ",f("code",{children:"root.config.ts"}),"."]}),o&&f("pre",{className:"AiEditModal__ChatPanel__notConfigured__error",children:o})]});let s=e.models.find(a=>a.id===e.defaultModel)||e.models[0];return f(KR,{model:s,editModeData:t.editModeData,onEditModeResponse:t.onEditModeResponse,welcome:t.children})}function KR(t){let e=q(t.editModeData);e.current=t.editModeData;let n=J(()=>new VE({api:"/cms/api/ai.edit_object",credentials:"include",prepareSendMessagesRequest:({messages:p})=>({body:{messages:p,modelId:t.model.id,editData:e.current}})}),[t.model.id]),o=q(t.onEditModeResponse);o.current=t.onEditModeResponse;let r=q(new Map),{messages:i,sendMessage:s,status:a,error:l,stop:c,addToolOutput:d}=GE({transport:n,sendAutomaticallyWhen:WE,onToolCall:async({toolCall:p})=>{let h=await YE(p.toolName,p.input);d({tool:p.toolName,toolCallId:p.toolCallId,output:h})}}),u=a==="streaming"||a==="submitted";return P(()=>{let p=o.current;if(p)for(let h=i.length-1;h>=0;h--){let g=i[h];if(g.role!=="assistant")continue;let m=nP(g),_=oP(m);if(!_||r.current.get(g.id)===_)return;try{let y=JSON.parse(_);y&&typeof y=="object"&&(r.current.set(g.id,_),p({message:"",data:y}))}catch{}return}},[i]),f(Ne,{children:[f(jR,{messages:i,isStreaming:u,welcome:t.welcome}),l&&f("div",{className:"AiEditModal__ChatPanel__error",children:[f("strong",{children:"Error:"})," ",l.message]}),f(JR,{canAttach:t.model.capabilities.attachments,isStreaming:u,onStop:c,onSend:(p,h)=>{if(!p&&h.length===0)return;let g=XR(h),m=[p,g.text].filter(Boolean).join(`
3
-
4
- `);s({text:m,files:g.files.map(_=>({type:"file",mediaType:_.mediaType,url:_.url,filename:_.filename}))})}})]})}function jR(t){let e=q(null);return P(()=>{let n=e.current;n&&(n.scrollTop=n.scrollHeight)},[t.messages]),t.messages.length===0?f("div",{className:"AiEditModal__ChatPanel__transcript AiEditModal__ChatPanel__transcript--empty",ref:e,children:f("div",{className:"AiEditModal__ChatPanel__welcome",children:[f("div",{className:"AiEditModal__ChatPanel__welcome__icon",children:f(iu,{})}),f("div",{className:"AiEditModal__ChatPanel__welcome__title",children:"Edit with Root AI"}),t.welcome&&f("div",{className:"AiEditModal__ChatPanel__welcome__body",children:t.welcome})]})}):f("div",{className:"AiEditModal__ChatPanel__transcript",ref:e,children:f("div",{className:"AiEditModal__ChatPanel__transcript__inner",children:[t.messages.map(n=>f(VR,{message:n},n.id)),t.isStreaming&&f("div",{className:"AiEditModal__ChatPanel__streamingIndicator",children:[f(Ft,{size:"xs",color:"gray"}),f("span",{children:"Thinking\u2026"})]})]})})}function VR(t){let e=t.message,n=e.role==="user",o=n?"You":"Root AI",r=n?window.firebase.user?.photoURL:null;return f("div",{className:Ce("AiEditModal__ChatPanel__message",`AiEditModal__ChatPanel__message--${e.role}`),children:[f("div",{className:"AiEditModal__ChatPanel__message__avatar",children:r?f("img",{src:r,alt:o}):f(ts,{size:18})}),f("div",{className:"AiEditModal__ChatPanel__message__body",children:[f("div",{className:"AiEditModal__ChatPanel__message__username",children:o}),f("div",{className:"AiEditModal__ChatPanel__message__parts",children:(e.parts||[]).map((i,s)=>f(WR,{part:i},s))})]})]})}function WR(t){let e=t.part;if(e.type==="text"){if(!e.text)return null;let n=rP(e.text);return n?f("div",{className:"AiEditModal__ChatPanel__textPart",children:f(Uh,{code:n})}):null}return e.type==="reasoning"?f(GR,{text:e.text}):e.type==="file"?f(YR,{part:e}):typeof e.type=="string"&&e.type.startsWith("tool-")?f(fw,{part:e}):e.type==="dynamic-tool"?f(fw,{part:e}):(e.type==="step-start",null)}function GR(t){let[e,n]=L(!1);return t.text?f("div",{className:Ce("AiEditModal__ChatPanel__reasoning",e&&"AiEditModal__ChatPanel__reasoning--open"),children:[f("button",{type:"button",className:"AiEditModal__ChatPanel__reasoning__toggle",onClick:()=>n(!e),children:[f(fo,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),f("span",{children:"Thinking"})]}),e&&f("div",{className:"AiEditModal__ChatPanel__reasoning__body",children:f(Uh,{code:t.text})})]}):null}function YR(t){let e=t.part;return e.mediaType?.startsWith("image/")?f("div",{className:"AiEditModal__ChatPanel__filePart",children:f("img",{src:e.url,alt:e.filename||"attachment"})}):f("a",{className:"AiEditModal__ChatPanel__filePart AiEditModal__ChatPanel__filePart--link",href:e.url,target:"_blank",children:[f(Pl,{size:14}),f("span",{children:e.filename||e.url})]})}function fw(t){let e=t.part,n=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",o=e.state||"",[r,i]=L(!1);return f("div",{className:"AiEditModal__ChatPanel__tool",children:[f("button",{type:"button",className:"AiEditModal__ChatPanel__tool__header",onClick:()=>i(!r),children:[f(Fl,{size:14}),f("code",{children:n}),f("span",{className:"AiEditModal__ChatPanel__tool__state",children:qR(o)}),f(fo,{size:14,style:{marginLeft:"auto",transform:r?"rotate(0deg)":"rotate(-90deg)"}})]}),r&&f("div",{className:"AiEditModal__ChatPanel__tool__body",children:[e.input&&f("details",{open:!0,children:[f("summary",{children:"Input"}),f("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&f("details",{open:!0,children:[f("summary",{children:"Output"}),f("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&f("div",{className:"AiEditModal__ChatPanel__tool__error",children:e.errorText})]})]})}function qR(t){switch(t){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return t}}function JR(t){let[e,n]=L(""),[o,r]=L([]),[i,s]=L(!1),a=q(null),l=q(null);P(()=>{window.requestAnimationFrame(()=>{let g=l.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,200)}px`)})},[e,o]);let d=De(()=>{t.isStreaming||!e&&o.length===0||(t.onSend(e,o),n(""),r([]),a.current&&(a.current.value=""))},[e,o,t.isStreaming]),u=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},p=async g=>{s(!0);try{let m=g.type||tP(g.name),_=await QR(g,m),b=await ai(g,{disableGci:!0});r(y=>[...y,{url:b.src,filename:b.filename||g.name,mediaType:m,textContent:_?.text,textTruncated:_?.truncated,width:b.width,height:b.height}])}catch(m){console.error("upload failed",m)}finally{s(!1),a.current&&(a.current.value="")}},h=g=>{let m=g.target;Array.from(m.files||[]).forEach(p)};return f("div",{className:"AiEditModal__ChatPanel__composer",children:[f("div",{className:Ce("AiEditModal__ChatPanel__composer__prompt",(i||o.length>0)&&"AiEditModal__ChatPanel__composer__prompt--hasImage"),children:[t.canAttach&&f("label",{className:"AiEditModal__ChatPanel__composer__imageUpload",children:[f("input",{ref:a,type:"file",className:"AiEditModal__ChatPanel__composer__imageUpload__input",onChange:h}),f(Oe,{label:"Upload file",children:f(Me,{component:"div",className:"AiEditModal__ChatPanel__composer__imageUpload__icon",radius:"xl",children:f(Pl,{size:18})})})]}),f("textarea",{ref:l,className:"AiEditModal__ChatPanel__composer__textInput",placeholder:"Tell me what you want to change...",value:e,rows:1,autofocus:!0,onKeyDown:u,onChange:g=>n(g.target.value),onPaste:g=>{let m=g.clipboardData?.items||[];for(let _ of m)if(_.kind==="file"){let b=_.getAsFile();b&&t.canAttach&&p(b)}}}),(i||o.length>0)&&f("div",{className:"AiEditModal__ChatPanel__composer__attachments",children:[i&&f(Ft,{size:"sm"}),o.map((g,m)=>f(Oe,{label:g.filename,transition:"pop",position:"top",withArrow:!0,children:f("button",{className:"AiEditModal__ChatPanel__composer__attachment",onClick:()=>r(_=>_.filter((b,y)=>y!==m)),children:[g.mediaType.startsWith("image/")?f("img",{src:g.url,alt:g.filename}):f("span",{className:"AiEditModal__ChatPanel__composer__attachment__name",children:g.filename}),f("div",{className:"AiEditModal__ChatPanel__composer__attachment__close",children:f(zh,{size:20,color:"white"})})]})},m))]}),t.isStreaming?f(Me,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",onClick:t.onStop,title:"Stop",children:f(zh,{size:18})}):f(Me,{className:"AiEditModal__ChatPanel__composer__submit",variant:"filled",color:"dark",radius:"xl",disabled:i||!e&&o.length===0,onClick:d,title:"Send",children:f($E,{size:18})})]}),f("div",{className:"AiEditModal__ChatPanel__composer__disclaimer",children:"Root AI is experimental and makes mistakes. Check all info."})]})}var hw=1e5;function XR(t){let e=t.filter(gw),n=t.filter(o=>!gw(o)).map(ZR);return{files:e,text:n.length?`Attached files:
5
-
6
- ${n.join(`
7
-
8
- `)}`:""}}function gw(t){return t.mediaType.startsWith("image/")}function ZR(t){let e=`File: ${t.filename} (${t.mediaType})`;if(t.textContent!==void 0){let n=t.textTruncated?`
9
-
10
- [Content truncated before sending to the model.]`:"";return`${e}
11
- URL: ${t.url}
12
-
13
- ~~~
14
- ${t.textContent}${n}
15
- ~~~`}return`${e}
16
- URL: ${t.url}
17
-
18
- [The file was uploaded, but its binary content was not inlined into this chat message.]`}async function QR(t,e){if(!eP(t.name,e))return null;let n=await t.text();return n.length<=hw?{text:n,truncated:!1}:{text:n.slice(0,hw),truncated:!0}}function eP(t,e){return e.startsWith("text/")?!0:[".css",".js",".jsx",".json",".md",".mdx",".mjs",".scss",".ts",".tsx",".txt",".yaml",".yml"].some(n=>t.toLowerCase().endsWith(n))}function tP(t){let e=t.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".webp")?"image/webp":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".pdf")?"application/pdf":e.endsWith(".json")?"application/json":e.endsWith(".csv")?"text/csv":e.endsWith(".md")?"text/markdown":e.endsWith(".txt")?"text/plain":"application/octet-stream"}function nP(t){return(t.parts||[]).filter(e=>e.type==="text"&&typeof e.text=="string").map(e=>e.text).join("")}function oP(t){if(!t)return null;let e=/```(?:json)?\s*\n([\s\S]*?)```/gi,n,o=null;for(;(n=e.exec(t))!==null;)o=n[1].trim();return o}function rP(t){if(!t)return t;let e=/```(?:json)?\s*\n[\s\S]*?```/gi,n=Array.from(t.matchAll(e)),o=t;if(n.length>0){let i=n[n.length-1],s=i.index??-1,a=s+i[0].length;s!==-1&&/^\s*$/.test(o.slice(a))&&(o=o.slice(0,s))}if((o.match(/```/g)||[]).length%2===1){let i=o.lastIndexOf("```");i!==-1&&(o=o.slice(0,i))}return o.trim()}var jh="AiEditModal";function _w(){let t=Et(),e=it();return{open:n=>{t.openContextModal(jh,{...e,title:n.title||"Edit with AI (Experimental)",innerProps:n,size:"calc(min(1920px, calc(100% - 96px)))",centered:!0})},close:()=>{t.closeModal(jh)}}}function iP(t){let{innerProps:e,context:n,id:o}=t,r=q(null),i=J(()=>JSON.stringify(e.data||{},null,2),[e.data]),[s,a]=L(i),l=J(()=>{if(!s)return null;try{return JSON.parse(s)}catch{return null}},[s]),c=J(()=>s!==i,[s,i]),d=De(()=>{if(!l)return;let p=Fd(l);e.onSave&&e.onSave(p)},[l]),u=De(p=>{if(p?.data){let h=JSON.stringify(p.data,null,2);a(h),r.current?.click()}},[]);return f("div",{className:"AiEditModal",children:[f("div",{className:"AiEditModal__SplitPanel",children:[f("div",{className:"AiEditModal__SplitPanel__ChatPanel",children:f(mw,{editModeData:l,onEditModeResponse:u,children:[f("p",{children:"Tell me what you want to change. I can make simple text edits, replace content within a module, or answer questions about the content."}),f("p",{children:"Just enter simple instructions, or attach a screenshot and ask me to use it as reference."})]})}),f("div",{className:"AiEditModal__SplitPanel__JsonPanel",children:f(Td,{className:"AiEditModal__Tabs",grow:!0,children:[f(Td.Tab,{label:"JSON",icon:f(CE,{size:20}),children:f("div",{className:"AiEditModal__JsonEditor",children:f(Cd,{value:s,onChange:p=>a(p),formatOnBlur:!0,height:"100%",className:"AiEditModal__JsonInput"})})}),f(Td.Tab,{ref:r,label:"Diff",icon:f(fE,{size:20}),children:f("div",{className:"AiEditModal__JsonDiffViewer",children:e.data&&s&&f(jE,{oldCode:i,newCode:s})})})]})})]}),f("div",{className:"AiEditModal__buttons",children:[f(X,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(X,{variant:"default",size:"xs",type:"button",leftIcon:f(li,{size:16}),disabled:!c,onClick:()=>a(i),children:"Reset"}),f(X,{leftIcon:f(Qi,{size:16}),variant:"filled",size:"xs",color:"green",disabled:!l||!c,onClick:d,children:"Accept changes"})]})]})}iP.id=jh;var Vh="AssetPickerModal";function bw(){let t=null;try{t=Et()}catch{t=null}let e=it();return{enabled:t!==null,open:n=>{if(!t){console.warn("useAssetPickerModal() requires a <ModalsProvider> context.");return}t.openContextModal(Vh,{...e,title:"Select from asset library",innerProps:n,size:"800px",overflow:"inside"})},close:()=>{t?.closeModal(Vh)}}}function sP(t){let{innerProps:e,context:n,id:o}=t;function r(i){e.onSelect&&e.onSelect(i),n.closeModal(o)}return f("div",{className:"AssetPickerModal",children:f(XE,{mode:"pick",accept:e.accept,initialFolder:e.initialFolder,onFolderChange:$C,onPickFile:r})})}sP.id=Vh;ke();var Wh="ComponentPickerModal",aP="root::ComponentPickerModal:layout",lP=3;function yw(){let t=Et(),e=it();return{open:n=>{t.openContextModal(Wh,{...e,innerProps:n,size:"720px",overflow:"inside",title:"Select a component"})},close:()=>{t.closeModal(Wh)}}}function Gh(t){let{innerProps:e}=t,[n,o]=L(""),[r,i]=ZE(aP,"list"),[s,a]=L(0),l=q(null),c=J(()=>{let h=n.trim().toLowerCase();return h?e.options.filter(g=>[g.schema.name,g.schema.label,g.schema.description,g.preset?.id,g.preset?.label,g.preset?.description].filter(Boolean).join(" ").toLowerCase().includes(h)):e.options},[e.options,n]);P(()=>{a(c.length>0?0:-1)},[c]),P(()=>{if(s<0||!l.current)return;l.current.querySelectorAll(".ComponentPickerModal__Card")[s]?.scrollIntoView({block:"nearest"})},[s]);function d(h){if(c.length===0)return;let g=r==="grid"?lP:1,m=c.length-1;if(h.key==="ArrowDown")h.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+g));else if(h.key==="ArrowUp")h.preventDefault(),a(_=>Math.max(0,_-g));else if(h.key==="ArrowRight"&&r==="grid")h.preventDefault(),a(_=>Math.min(m,Math.max(0,_)+1));else if(h.key==="ArrowLeft"&&r==="grid")h.preventDefault(),a(_=>Math.max(0,_-1));else if(h.key==="Enter"&&s>=0){let _=c[s];_&&(h.preventDefault(),e.onSelect(_))}}let u=!!e.onRemove&&!n.trim();return f("div",{className:`ComponentPickerModal ${r==="grid"?"ComponentPickerModal--grid":"ComponentPickerModal--list"}`,onKeyDown:d,children:[f("div",{className:"ComponentPickerModal__controls",children:[f(qn,{"data-autofocus":!0,placeholder:e.searchPlaceholder||"Search components...",value:n,onChange:h=>o(h.target.value),icon:f(Jd,{size:16}),size:"xs",className:"ComponentPickerModal__controls__search"}),f(wd,{className:"ComponentPickerModal__controls__layout",size:"xs",value:r,onChange:h=>i(h),data:[{value:"list",label:f("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"List layout",title:"List layout",children:f(TE,{size:14})})},{value:"grid",label:f("span",{className:"ComponentPickerModal__controls__layout__option","aria-label":"Grid layout",title:"Grid layout",children:f(wE,{size:14})})}]})]}),c.length===0?f("div",{className:"ComponentPickerModal__empty",children:e.options.length===0?"No component types available.":"No components match your search."}):f("div",{className:"ComponentPickerModal__cards",ref:l,children:c.map((h,g)=>f(Gh.Card,{option:h,layout:r,focused:g===s,onMouseEnter:()=>a(g),onSelect:()=>e.onSelect(h)},h.key))}),u&&f("div",{className:"ComponentPickerModal__footer",children:f(X,{variant:"subtle",color:"red",size:"xs",leftIcon:f(Jn,{size:14}),onClick:()=>e.onRemove?.(),children:"Clear selection"})})]})}Gh.Card=t=>{let{schema:e,preset:n}=t.option,o=n?.label||n?.id||e.label||e.name,r=n?.description??e.description??"",i=n?.image||e.image,s=n?e.label||e.name:"",l=t.layout==="grid"?180:120,c=t.layout==="grid"?120:90,d=["ComponentPickerModal__Card",t.focused?"ComponentPickerModal__Card--focused":""].filter(Boolean).join(" ");return f("button",{type:"button",className:d,onClick:t.onSelect,onMouseEnter:t.onMouseEnter,children:[f("div",{className:"ComponentPickerModal__Card__image",children:f(Qs,{src:i,width:l,height:c,withPlaceholder:!i,alt:o})}),f("div",{className:"ComponentPickerModal__Card__content",children:[s&&f("div",{className:"ComponentPickerModal__Card__content__subtitle",children:s}),f("div",{className:"ComponentPickerModal__Card__content__title",children:o}),r&&f("div",{className:"ComponentPickerModal__Card__content__description",children:r})]})]})};Gh.id=Wh;ke();var Yh="EditJsonModal";function qh(){let t=Et(),e=it();return{open:n=>{t.openContextModal(Yh,{...e,title:n.title||"Edit JSON",innerProps:n,size:"680px",centered:!0})},close:()=>{t.closeModal(Yh)}}}function cP(t){let{innerProps:e,context:n,id:o}=t,r=JSON.stringify(e.data||{},null,2),[i,s]=L(r),[a,l]=L(!0),[c,d]=L(!1),[u,p]=L(!1);function h(_){s(_),d(!1);try{JSON.parse(_),l(!0)}catch{l(!1)}p(_!==r)}function g(){navigator.clipboard.writeText(i).then(()=>d(!0))}function m(){let _=JSON.parse(i),b=Fd(_);e.onSave&&e.onSave(b)}return f("div",{className:"EditJsonModal",children:[f(Cd,{value:i,onChange:h,formatOnBlur:!0,autosize:!0,minRows:4,maxRows:25}),f("div",{className:"EditJsonModal__buttons",children:[f(X,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(X,{leftIcon:f(Hd,{size:16}),variant:"filled",size:"xs",color:"dark",disabled:!a,type:"button",onClick:g,children:c?"Copied!":"Copy"}),f(X,{variant:"default",size:"xs",type:"button",leftIcon:f(li,{size:16}),disabled:!u,onClick:()=>{s(r),l(!0),p(!1)},children:"Reset"}),f(X,{leftIcon:f(uE,{size:16}),variant:"filled",size:"xs",color:"blue",disabled:!a||!u,onClick:m,children:"Save"})]})]})}cP.id=Yh;ke();ke();function vw(t){let{docId:e,deepKey:n,translatable:o}=t,[r,i]=L(!0),[s,a]=L([]),l=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return P(()=>{async function c(){i(!0);let[d,u]=await Promise.all([qC(e),JC(e,"draft")]),p=d.versions,h=[];if(u){let m=Go(u,n);h.push({value:xw(m),modifiedBy:u.sys?.modifiedBy||"Unknown",modifiedAt:u.sys?.modifiedAt?.toDate?.()||new Date,versionId:"draft"})}for(let m of p){let _=Go(m,n);h.push({value:xw(_),modifiedBy:m.sys?.modifiedBy||"Unknown",modifiedAt:m.sys?.modifiedAt?.toDate?.()||new Date,versionId:m._versionId})}let g=[];for(let m of h){let _=g[g.length-1];(!_||_.value!==m.value)&&g.push(m)}a(g),i(!1)}c()},[e,n]),r?f("div",{className:"FieldHistory__loading",children:f(Ft,{size:"sm"})}):s.length===0?f("div",{className:"FieldHistory__empty",children:"No history available."}):f("div",{className:"FieldHistory",children:s.map((c,d)=>f("div",{className:"FieldHistory__entry",children:[f("div",{className:"FieldHistory__entry__header",children:[f("span",{className:"FieldHistory__entry__author",children:c.modifiedBy}),f("span",{className:"FieldHistory__entry__date",children:l.format(c.modifiedAt)}),d===0&&f("span",{className:"FieldHistory__entry__badge",children:"Current"}),o&&c.value&&f("span",{className:"FieldHistory__entry__translationsLink",children:f(dP,{value:c.value})})]}),f("div",{className:"FieldHistory__entry__value",children:c.value||f("span",{className:"FieldHistory__entry__empty",children:"(empty)"})})]},c.versionId))})}function dP(t){let[e,n]=L("");return P(()=>{xr(t.value).then(o=>{n(`/cms/translations/${o}`)})},[t.value]),e?f(Oe,{label:"Open in Translations Editor",withArrow:!0,position:"right",children:f(Me,{component:"a",href:e,target:"_blank",variant:"transparent",size:"sm",children:f(es,{size:16})})}):null}function xw(t){return t==null?"":typeof t=="string"?t:JSON.stringify(t)}var Jh="EditTranslationsModal";function Ew(){let t=Et(),e=it();return{open:n=>{t.openContextModal(Jh,{...e,innerProps:n,size:"900px",title:"Edit translations",overflow:"inside",className:"EditTranslationsModalWrap"})},close:()=>{t.closeModal(Jh)}}}function Xh(t){let{innerProps:e,context:n,id:o}=t,r=e.strings||[],s=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"],[a,l]=L({}),[c,d]=L([]),[u,p]=L(!1),[h,g]=L(!1),[m,_]=L(!0),[b,y]=L(!1),[v,x]=L(""),[E,C]=L(!1),[k,T]=L("translations"),w=e.draft||null;P(()=>{if(e.field?.deepKey&&w?.controller){let A=Cw(e.field.deepKey),I=w.controller.getValue(A)||{};y(I.translate===!1),x(I.description||"")}},[e.field?.deepKey,w?.controller]),P(()=>{Ld({tags:[e.docId]}).then(A=>{let I={};Object.values(A).forEach(R=>{I[R.source]=R}),l(I),_(!1)})},[e.docId]);async function S(){g(!0),await br(async()=>{let A=`edit-translations-${e.docId}`;if(ce({id:A,loading:!0,title:"Saving translations",message:`Updating for ${e.docId}...`,autoClose:!1,disallowClose:!0}),e.field?.deepKey&&w?.controller){let I=Cw(e.field.deepKey),R=w.controller.getValue(I)||{};b?R.translate=!1:delete R.translate,v?R.description=v:delete R.description,Object.keys(R).length>0?await w.controller.updateKey(I,R):await w.controller.removeKey(I),await w.controller.flush()}if(!b&&c.length>0){let I=[];c.forEach(R=>{let z=a[R];I.push(z)}),await oa(e.docId,I)}wt({id:A,title:"Saved translations",message:`Updated translations for ${e.docId}!`,autoClose:!1})}),g(!1)}function N(A){l(I=>{let R={...I};return R[A.source]=A,R}),d(I=>{let R=new Set(I);return R.add(A.source),Array.from(R)}),p(!0)}async function D(){if(r.length!==0){C(!0);try{await br(async()=>{for(let A of r){let I=a[A]||{source:A},R={};s.forEach(F=>{I[F]&&(R[F]=I[F])});let z=s.filter(F=>!I[F]);if(z.length===0)continue;let W=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:A,targetLocales:z,description:v||void 0,existingTranslations:R})});if(W.status!==200){let F=await W.text();throw new Error(`Translation failed: ${F}`)}let Z=await W.json();if(Z.success&&Z.translations){let F={...I};Object.entries(Z.translations).forEach(([se,ye])=>{F[se]=ye}),N(F)}}ce({message:"Finished generating AI translations",color:"green"})})}finally{C(!1)}}}function O(){if(!!!(window.__ROOT_CTX?.experiments||{}).ai)return!1;for(let R of r){let z=a[R]||{};for(let W of s)if(!z[W])return!0}return!1}return f("div",{className:"EditTranslationsModal",children:[m?f(Ft,{}):f(Ne,{children:[e.field?.deepKey&&f("div",{className:"EditTranslationsModal__tabs",children:[f("button",{type:"button",className:Ce("EditTranslationsModal__tabs__tab",k==="translations"&&"active"),onClick:()=>T("translations"),children:"Translations"}),f("button",{type:"button",className:Ce("EditTranslationsModal__tabs__tab",k==="history"&&"active"),onClick:()=>T("history"),children:"History"})]}),k==="history"&&e.field?.deepKey?f(vw,{docId:e.docId,deepKey:e.field.deepKey,translatable:!0}):f(Ne,{children:[f("div",{className:"EditTranslationsModal__controls",children:[f("div",{className:"EditTranslationsModal__controls__doNotTranslate",children:[f(uo,{label:"Do not translate",checked:b,onChange:A=>{y(A.currentTarget.checked),p(!0)},size:"sm"}),f(Oe,{label:"Prevent the string from being included for translation",withArrow:!0,position:"right",children:f(Rl,{size:14,style:{marginLeft:"6px"}})})]}),f("div",{className:"EditTranslationsModal__controls__description",children:[f("div",{className:"EditTranslationsModal__controls__description__label",children:[f("span",{children:"Description"}),f(Oe,{label:"Translator notes may be included when the string is extracted and sent for translation",withArrow:!0,position:"right",children:f(Rl,{size:14,style:{marginLeft:"6px"}})})]}),f(_n,{size:"sm",autosize:!0,minRows:1,maxRows:6,value:v,placeholder:"Add context or notes for translators...",onChange:A=>{x(A.currentTarget.value),p(!0)}})]})]}),f("table",{className:"EditTranslationsModal__table",children:[f("thead",{style:{display:b?"none":"table-header-group"},children:f("tr",{children:[f("th",{children:f(Cr,{size:"h4",weight:"semi-bold",children:"SOURCE"})}),f("th",{children:f("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[f(Cr,{size:"h4",weight:"semi-bold",children:"TRANSLATIONS"}),O()&&f(Oe,{label:"Generate quick translations using AI",withArrow:!0,position:"left",children:f(Me,{variant:"outline",onClick:D,loading:E,disabled:E,sx:{height:30,width:30,borderColor:"#ced4da"},children:E?f(Gd,{size:16}):f(ko,{size:16,fill:"currentColor",stroke:1.5})})})]})})]})}),f("tbody",{children:r.map(A=>f("tr",{style:{display:b?"none":"table-row"},children:[f("td",{children:f("div",{className:"EditTranslationsModal__table__source",children:A})}),f("td",{children:f(Xh.StringsEditor,{source:A,locales:s,translations:a[A]||{},onChange:N})})]}))})]})]})]}),f("div",{className:"EditTranslationsModal__footer",children:[f("div",{className:"EditTranslationsModal__footer__left",children:[f(X,{component:"a",href:`/cms/translations/${e.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:f(vr,{size:14}),children:"Open Translations Editor"}),e.l10nSheet&&f("div",{className:"EditTranslationsModal__footer__gsheet",children:[f("strong",{children:"NOTE:"})," Translations for this doc are managed in"," ",f("a",{href:na(e.l10nSheet),target:"_blank",rel:"noopener noreferrer",children:"Google Sheets"})]})]}),f("div",{className:"EditTranslationsModal__footer__buttons",children:[f(X,{variant:"default",size:"xs",color:"dark",type:"button",onClick:()=>n.closeModal(o),children:"Cancel"}),f(X,{variant:"filled",size:"xs",color:"dark",onClick:()=>S(),disabled:!u,loading:h,children:"Save"})]})]})]})}Xh.StringsEditor=t=>{let e=t.locales,[n,o]=L(t.translations||{}),[r,i]=L(!1);P(()=>{o(t.translations||{})},[t.translations]);function s(a,l){i(!0),o(c=>{let d={...c,source:t.source};return d[a]=l,d})}return P(()=>{r&&t.onChange(n)},[r,n]),f("div",{className:"EditTranslationsModal__StringsEditor",children:e.map(a=>f("div",{className:"EditTranslationsModal__StringsEditor__row",children:[f("div",{className:"EditTranslationsModal__StringsEditor__row__locale",children:a}),f("div",{className:Ce("EditTranslationsModal__StringsEditor__row__translation",n[a]?"hasValue":"empty"),children:f(_n,{size:"xs",radius:0,autosize:!0,minRows:1,maxRows:10,value:n[a],onChange:l=>{s(a,l.currentTarget.value)}})})]}))})};Xh.id=Jh;function Cw(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}si();ke();var ww="ExportSheetModal";function Tw(){let t=Et(),e=it();return{open:n=>{t.openContextModal(ww,{...e,title:"Export to Google Sheet",innerProps:n,size:"650px"})}}}function Zh(t){let{innerProps:e,context:n,id:o}=t,[r,i]=L(!1),[s,a]=L("new-sheet"),[l,c]=L(""),[d,u]=L(!1),p=aa(),h=tw(),g=q(),m=MC(h.settings.googleDriveFolder),_=[{value:"new-sheet",label:"Create Google Sheet",help:"Creates a new Google Sheet and exports strings to the sheet."},{value:"add-tab",label:"Add tab in Google Sheet",help:"Adds a new tab in an existing Google Sheet and exports strings to the sheet."},{value:"link-sheet",label:"Link Google Sheet",help:"Links an existing Google Sheet without exporting strings."}],b=!1;(s==="add-tab"||s==="link-sheet")&&(b=!0,l&&Ad(l)?.spreadsheetId&&(b=!1));async function y(k,T){let w=T?.isNew||!1,{headers:S,rows:N}=e.csvData;w?(await k.replaceSheet(S,N),await k.applyL10nTheme()):await k.updateValuesMap(N,{keyedBy:"source",preserveColumns:e.locales})}async function v(){p.isLoggedIn()||await p.login();let k=window.__ROOT_CTX.rootConfig,T=k.projectName||k.projectId||"Root CMS",w,S,N="create-google-sheet";try{if(ce({id:N,loading:!0,title:"Creating Google Sheet...",message:"Creating Google Sheet for localization.",autoClose:!1,disallowClose:!0}),w=await ta.create({title:`${T} Localization`,parent:m,share:g.current?.checked}),S=await w.getSheet(0),!S)throw new Error("could not find sheet gid=0");S.setTitle(e.docId)}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),wt({id:N,title:"Failed to create Google Sheet",message:String(O),color:"red",autoClose:!1});return}try{wt({id:N,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let D={spreadsheetId:w.spreadsheetId,gid:0};await Rd(e.docId,D)}catch(D){console.error(D),wt({id:N,title:"Failed to link Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{wt({id:N,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(S,{isNew:!0})}catch(D){console.error(D);let O=D;typeof D=="object"&&D.body&&(O=String(D.body)),wt({id:N,title:"Failed to export strings to Google Sheet",message:O,color:"red",autoClose:!1});return}c(S.getUrl()),u(!0),wt({id:N,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function x(){p.isLoggedIn()||await p.login();let k=Ad(l);if(!k?.spreadsheetId)throw new Error("failed to parse spreadsheet id");let T=new ta(k.spreadsheetId),w,S="add-tab-google-sheet";try{ce({id:S,loading:!0,title:"Creating tab in Google Sheet...",message:"Adding tab in existing Google Sheet",autoClose:!1,disallowClose:!0}),w=await T.createSheet({title:e.docId})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),wt({id:S,title:"Failed to create Google Sheet",message:String(D),color:"red",autoClose:!1});return}try{wt({id:S,loading:!0,title:"Created Google Sheet!",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0});let N={spreadsheetId:T.spreadsheetId,gid:w.gid};await Rd(e.docId,N)}catch(N){console.error(N),wt({id:S,title:"Failed to link Google Sheet",message:String(N),color:"red",autoClose:!1});return}try{wt({id:S,loading:!0,title:"Linked Google Sheet!",message:"Exporting strings to sheet...",autoClose:!1,disallowClose:!0}),await y(w,{isNew:!0})}catch(N){console.error(N);let D=N;typeof N=="object"&&N.body&&(D=String(N.body)),wt({id:S,title:"Failed to export strings to Google Sheet",message:D,color:"red",autoClose:!1});return}u(!0),wt({id:S,title:"Done! Exported strings to Google Sheet.",message:w.getUrl(),autoClose:!1})}async function E(){let k="link-google-sheet",T=Ad(l);if(!T?.spreadsheetId)throw new Error("failed to parse spreadsheet id");try{ce({id:k,loading:!0,title:"Link Google Sheet",message:`Linking sheet to ${e.docId}...`,autoClose:!1,disallowClose:!0}),await Rd(e.docId,T)}catch(w){console.error(w),wt({id:k,title:"Failed to link Google Sheet",message:String(w),color:"red",autoClose:!1});return}u(!0),wt({id:k,title:`Done! Linked ${e.docId} to Google Sheet.`,message:na(T),autoClose:!1})}async function C(){console.log(s),i(!0),s==="new-sheet"?await br(v):s==="add-tab"?await br(x):s==="link-sheet"&&await br(E),i(!1)}return f("div",{className:"ExportSheetModal",children:f("div",{className:"ExportSheetModal__content",children:[f("div",{className:"ExportSheetModal__content__body",children:"Export strings to Google Sheet or link an existing Google Sheet for managing translations."}),f("form",{className:"ExportSheetModal__form",children:[f("div",{className:"ExportSheetModal__form__section",children:[f("div",{className:"ExportSheetModal__form__description",children:"Export options:"}),f(Mn,{disabled:d||r,itemComponent:Zh.SelectItem,data:_,onChange:k=>{a(k),k==="new-sheet"&&c("")},value:s})]}),f("div",{className:"ExportSheetModal__form__section",children:[f("div",{className:"ExportSheetModal__form__description",children:"Google Sheet URL:"}),s==="new-sheet"?f(qn,{disabled:!0,placeholder:h.settings.googleDriveFolder?"A new Google Sheet will be created in the project's Google Drive folder.":'A new Google Sheet will be created in your "My Drive" folder.'}):f(qn,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:l,disabled:d||r,onChange:k=>c(k.currentTarget.value)})]}),s==="new-sheet"&&f("div",{className:"ExportSheetModal__form__section",children:f(Oe,{label:"Whether to share the Google Sheet with Admins and Editors upon creation. If your site has a Google Drive folder configured, the sheet will be created within it and inherit its permissions.",wrapLines:!0,width:320,withArrow:!0,position:"bottom",children:f(uo,{disabled:d||r,ref:g,name:"share",value:"true",label:"Share Google Sheet with collaborators",defaultChecked:!m})})}),f("div",{className:"ExportSheetModal__form__buttons",children:d?f(Ne,{children:[f(X,{component:"a",target:"_blank",rel:"noopener noreferrer",href:l,variant:"default",size:"xs",color:"dark",rightIcon:f(vr,{size:16}),children:"Open Google Sheet"}),f(X,{variant:"filled",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"primary",children:"Done"})]}):f(Ne,{children:[f(X,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),f(X,{variant:"filled",size:"xs",color:"primary",loading:r,disabled:b,onClick:()=>C(),children:s==="link-sheet"?"Link Google Sheet":"Export to Google Sheet"})]})})]})]})})}Zh.SelectItem=Wo(t=>{let{label:e,help:n,...o}=t;return f("div",{className:"ExportSheetModal__SelectItem",...o,children:[f(ns,{className:"ExportSheetModal__SelectItem__label",size:"body",children:e}),f(ns,{className:"ExportSheetModal__SelectItem__help",size:"body-sm",children:n})]})});Zh.id=ww;ke();ke();function Sw(t){let{labels:e}=t,[n,o]=L(0);return P(()=>{let r=setTimeout(()=>{o(i=>(i+1)%e.length)},2e3);return()=>clearTimeout(r)},[n,e.length]),f("div",{className:"ProgressiveLoader",children:[f(Ft,{color:"gray",size:"md"}),f("div",{className:"ProgressiveLoader__labels",children:f(un,{size:"sm",color:"dimmed",className:"ProgressiveLoader__label--entering",children:e[n]},n)})]})}var kw="LocalizationModal";function Nw(){let t=Et(),e=it();return{open:n=>{let o=new URLSearchParams(window.location.search);o.set("modal","localization"),window.history.replaceState(null,"",`${window.location.pathname}?${o}`),t.openContextModal(kw,{...e,innerProps:n,size:"clamp(80%, 1024px, 1280px)",onClose:()=>{n.draft?.flush({quiet:!0});let r=new URLSearchParams(window.location.search);r.delete("modal");let i=r.toString()?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,"",i)}})}}}function Yo(t){let e=t.innerProps;return f("div",{className:"LocalizationModal",children:f("div",{className:"LocalizationModal__layout",children:[f(Yo.ConfigLocales,{...e}),f(Yo.Translations,{...e})]})})}Yo.id=kw;Yo.ConfigLocales=t=>{let[e,n]=L(()=>t.draft?t.draft.getLocales():["en"]),o=window.__ROOT_CTX.rootConfig.i18n||{},r=o.locales||["en"],i=o.groups||{default:{label:"",locales:r}};function s(c){return e.filter(d=>(i[c].locales||[]).includes(d))}function a(c,d){let u=new Set(e),p=i[c].locales||[];for(let g of p)d.includes(g)?u.add(g):u.delete(g);let h=Array.from(u.values()).sort();l(h)}function l(c){n(c),t.draft.setLocales(c)}return f("div",{className:"LocalizationModal__locales",children:f(po,{spacing:30,children:[f(pn,{children:[f(Cr,{className:"LocalizationModal__iconTitle LocalizationModal__locales__title",size:"h2",children:[f(IE,{strokeWidth:1.5}),f("span",{children:"Locales"})]}),f(Yo.AllNoneButtons,{onAllClicked:()=>l(r),onNoneClicked:()=>l([])})]}),f(po,{spacing:40,children:Object.keys(i).map(c=>{let d=i[c],u=s(c);return f(Yo.LocaleGroup,{group:d,groupEnabledLocales:u,allEnabledLocales:e,onChange:p=>a(c,p)})})})]})})};Yo.LocaleGroup=t=>{let e=t.groupEnabledLocales||[],n=t.group.locales||[],o=t.allEnabledLocales||[];function r(s){t.onChange&&t.onChange(s)}function i(s){let a=e.indexOf(s);a===-1?e.push(s):e.splice(a,1),r(e)}return f(po,{spacing:16,children:[t.group.label&&f(pn,{position:"apart",children:[f(Cr,{size:"h4",weight:"semi-bold",children:t.group.label}),f(Yo.AllNoneButtons,{onAllClicked:()=>r(n),onNoneClicked:()=>r([])})]}),f(pn,{children:n.map(s=>{let a=e.includes(s),l=o.length<=1&&a;return f(uo,{value:s,checked:a,disabled:l,label:Dw(s),onChange:()=>i(s),size:"xs"})})})]})};Yo.AllNoneButtons=t=>f(pn,{spacing:"8px",children:[f(X,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onAllClicked,children:"All"}),"/",f(X,{className:"LocalizationModal__allNoneBtn",variant:"subtle",size:"xs",compact:!0,onClick:t.onNoneClicked,children:"None"})]});Yo.Translations=t=>{let[e,n]=L(!0),[o,r]=L([]),i=window.__ROOT_CTX.rootConfig.i18n?.locales||[],s=t.locale||i.find(U=>U!=="en")||"en",[a,l]=L(s),[c,d]=L(!1),[u,p]=L({}),h=J(()=>{if(!a)return{};let U={};return Object.values(u).forEach(re=>{U[re.source]=re[a]||""}),U},[a,u]),g=aa(),[m,_]=L(null),b=Tw(),y=rw(),[v,x]=L(new Set),E=v.size,[C,k]=L({}),[T,w]=L(!1),[S,N]=L(!1),[D,O]=L(null),A=q(!1),I=q(null),R=Object.keys(C).length;function z(U,re,ge){k(ae=>{let ve={...ae};ve[U]||(ve[U]={}),ve[U]={...ve[U],[re]:ge};let Ve=h[U]||"";return ge===Ve&&(delete ve[U][re],Object.keys(ve[U]).length===0&&delete ve[U]),ve})}async function W(){w(!0);try{let U=Object.entries(C).map(([ae,ve])=>({source:ae,locales:ve}));await jC(U,{tags:[t.docId]});let re=await Promise.all(U.map(async ae=>({hash:await xr(ae.source),source:ae.source,locales:ae.locales}))),ge=[t.docId];p(ae=>{let ve={...ae};for(let{hash:Ve,source:Dt,locales:Pt}of re){let dn=ve[Ve],ti=dn?.tags||[],In=Array.from(new Set([...ti,...ge]));dn?ve[Ve]={...dn,...Pt,tags:In}:ve[Ve]={source:Dt,...Pt,tags:In}}return ve}),k({}),ce({title:"Saved!",message:`Updated ${U.length} translation(s).`,autoClose:2500})}catch(U){console.error(U),ce({title:"Error saving translations",message:String(U),color:"red",autoClose:!1})}w(!1)}function Z(){return!!!(window.__ROOT_CTX?.experiments||{}).ai||!a?!1:o.some(ge=>{let ae=C[ge]?.[a];return ae!==void 0?!ae:!h[ge]})}function F(){A.current=!0,I.current?.abort()}async function se(){if(!(!a||o.length===0)){A.current=!1,N(!0);try{for(let U of o){if(A.current)break;if(C[U]?.[a]||h[U])continue;O(U);let ge=new AbortController;I.current=ge;let ae={},ve=ut[U];ve&&i.forEach(Pt=>{ve[Pt]&&(ae[Pt]=ve[Pt])});let Ve=await window.fetch("/cms/api/ai.translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sourceText:U,targetLocales:[a],existingTranslations:ae}),signal:ge.signal});if(Ve.status!==200){let Pt=await Ve.text();throw new Error(`Translation failed: ${Pt}`)}let Dt=await Ve.json();Dt.success&&Dt.translations?.[a]&&z(U,a,Dt.translations[a])}A.current?ce({message:"AI translation stopped",color:"yellow"}):ce({message:"Finished generating AI translations",color:"green"})}catch(U){U instanceof DOMException&&U.name==="AbortError"||(console.error(U),ce({title:"Error generating translations",message:String(U),color:"red"}))}finally{N(!1),O(null),A.current=!1,I.current=null}}}let ye=q(!1);P(()=>{if(e)return;if(!ye.current){ye.current=!0;return}let U=!1;async function re(){let ge=[t.docId],ae=await Promise.all(o.map(async Ve=>({source:Ve,hash:await xr(Ve)})));if(U)return;let ve=new Set;for(let{source:Ve,hash:Dt}of ae)if(u[Dt]){let Pt=u[Dt].tags||[];ge.every(ti=>Pt.includes(ti))||ve.add(Ve)}U||x(ve)}return re(),()=>{U=!0}},[t.docId,o,u,e]);let ut=J(()=>{let U={};return Object.values(u).forEach(re=>{U[re.source]=re}),U},[u]),Rt=i.map(U=>({value:U,label:Dw(U)})),ot=J(()=>!a||o.length===0?0:o.filter(U=>{let re=C[U]?.[a];return re!==void 0?!re:!h[U]}).length,[o,h,a,C]);P(()=>{n(!0),Promise.all([nw(t.docId),Ld(),ZC(t.docId)]).then(async([U,re,ge])=>{let ae=[t.docId],ve=await Promise.all(U.map(async Dt=>({source:Dt,hash:await xr(Dt)}))),Ve=new Set;for(let{source:Dt,hash:Pt}of ve)if(re[Pt]){let dn=re[Pt].tags||[];ae.every(In=>dn.includes(In))||Ve.add(Dt)}r(U),p(re),_(ge),x(Ve),n(!1)}).catch(U=>{console.error("Failed to load translations:",U),n(!1),ce({title:"Error",message:String(U?.message||U),color:"red",autoClose:!1})})},[t.docId]);function pt(U,re){let ge=ut[U];return ge&&ge[re]||""}function oe(){let U=i.filter(ae=>ae!=="en"&&!KC(ae)),re=["source","en",...U],ge=[];return o.forEach(ae=>{let ve={source:ae,en:pt(ae,"en")||ae};U.forEach(Ve=>{ve[Ve]=pt(ae,Ve)}),ge.push(ve)}),{headers:re,rows:ge}}async function ee(){let{headers:U,rows:re}=oe(),ge=await window.fetch("/cms/api/csv.download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:U,rows:re})});if(ge.status!==200){console.error("csv.download failed:");let Ve=await ge.text();console.error(Ve)}let ae=await ge.blob(),ve=window.URL.createObjectURL(ae);window.location.assign(ve),window.URL.revokeObjectURL(ve)}async function xe(){let U=document.createElement("input");U.type="file",U.accept=".csv",U.addEventListener("change",async()=>{let re=U.files?.[0];if(re){let ge=new FormData;ge.append("file",re);try{let ae=await fetch("/cms/api/csv.import",{method:"POST",body:ge});if(ae.status!==200){let Dt=await ae.text();throw new Error(`RPCError: ${Dt}`)}let ve=(await ae.json()).data,Ve=await oa(t.docId,ve);p(Dt=>Qh(Dt,Ve)),ce({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}catch(ae){console.error(ae),ce({title:"Failed to import CSV",message:String(ae),color:"red",autoClose:!1})}}}),U.click()}async function Be(){if(g.isLoggedIn()||await g.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let re=await new ta(m.spreadsheetId).getSheet(m.gid??0);if(!re)throw new Error(`sheet not found: ${JSON.stringify(m)}`);await cn(re),ce({title:"Exported strings to Google Sheet",message:re.getUrl(),autoClose:!1})}async function cn(U,re){let ge=re?.isNew||!1,{headers:ae,rows:ve}=oe();ge?(await U.replaceSheet(ae,ve),await U.applyL10nTheme()):await U.updateValuesMap(ve,{keyedBy:"source",preserveColumns:i}),Id("doc.export_to_sheet",{metadata:{docId:t.docId,sheetId:{spreadsheetId:U.spreadsheet.spreadsheetId,gid:U.gid}}})}async function $e(){if(g.isLoggedIn()||await g.login(),!m?.spreadsheetId)throw new Error("no sheet linked");let re=await new ta(m.spreadsheetId).getSheet(m.gid??0);if(!re)throw new Error(`sheet not found: ${JSON.stringify(m)}`);console.log("importing google sheet");let ge=await re.getValuesMap(),ae=await oa(t.docId,ge);p(ve=>Qh(ve,ae)),ce({title:"Saved!",message:`Imported translations for ${t.docId}.`,autoClose:5e3})}async function nn(){await XC(t.docId),_(null),ce({title:"Unlinked Google Sheet",message:`${t.docId} is no longer connected to a Google Sheet.`,autoClose:5e3})}async function Sl(){n(!0);let U=[],re=[t.docId];for(let ge of o){let ae=await xr(ge);if(u[ae]){let ve=u[ae].tags||[],Ve=Array.from(new Set([...ve,...re]));U.push({hash:ae,tags:Ve})}}U.length>0?(await Oh(U,{mode:"union"}),p(ge=>{let ae={...ge};return U.forEach(({hash:ve,tags:Ve})=>{ae[ve]&&(ae[ve]={...ae[ve],tags:Ve})}),ae}),ce({title:"Tags Applied",message:`Applied tag "${t.docId}" to ${U.length} string(s).`,color:"green"})):ce({title:"No strings updated",message:"No existing translations found to tag.",color:"blue"}),n(!1)}async function mr(U){try{await U()}catch(re){console.error(re);let ge;typeof re=="object"&&re.body?ge=String(re.body):ge=String(re),ce({title:"Error",message:ge,color:"red",autoClose:!1})}}function co(U){switch(U){case"EXPORT_DOWNLOAD_CSV":{mr(ee);return}case"EXPORT_GOOGLE_SHEET_LINKED":{mr(Be);return}case"EXPORT_GOOGLE_SHEET_SHOW_OPTIONS":{b.open({docId:t.docId,csvData:oe(),locales:i});return}case"IMPORT_CSV":{mr(xe);return}case"IMPORT_GOOGLE_SHEET_LINKED":{mr($e);return}case"UNLINK_GOOGLE_SHEET":{mr(nn);return}default:console.log("unhandled action: "+U)}}async function xd(U,re){let ae=(window.__ROOT_CTX.translations||[]).find(ve=>ve.id===U)?.label||U;await mr(async()=>{let ve=re==="export"?await ow(t.docId):null,Ve=o.map(dn=>{let ti={};i.forEach(jt=>{ti[jt]=pt(dn,jt)??""});let In=ve?.get(dn)?.description;return{source:dn,translations:ti,...In?{description:In}:{}}}),Dt=re==="import"||re==="export"?re:(()=>{throw new Error("Invalid translations action")})(),Pt=`translations-${Dt}-${U}`;ce({id:Pt,message:re==="import"?`Importing from ${ae}...`:`Exporting to ${ae}...`,loading:!0,autoClose:!1,disallowClose:!0});try{let dn=await window.fetch(`/cms/api/translations.${Dt}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:U,docId:t.docId,data:Ve})});if(!(dn.headers.get("content-type")||"").includes("application/json"))throw new Error(`Unexpected response (${dn.status}). Please reload the page and try again.`);let In=await dn.json();if(!In.success)throw new Error(In.error||"Unknown error");if(re==="import")if(Array.isArray(In.data)){let jt=In.data.map(ni=>{let Vo={source:String(ni?.source??"")},oi=ni?.translations;return oi&&typeof oi=="object"&&i.forEach(Zs=>{let Nl=oi[Zs];Nl!=null&&(Vo[Zs]=String(Nl))}),Vo}),kl=await oa(t.docId,jt,{actionMetadata:{service:U,numStrings:jt.length,locales:i},actionLinks:[{label:"Open translations",url:`/cms/content/${t.docId}?modal=localization`}]});p(ni=>Qh(ni,kl));let qi=[t.docId],An=[];for(let ni of jt){let Vo=await xr(ni.source),Zs=u[Vo]?.tags||[],Nl=Array.from(new Set([...Zs,...qi]));An.push({hash:Vo,tags:Nl})}An.length>0&&(await Oh(An,{mode:"union"}),p(ni=>{let Vo={...ni};return An.forEach(({hash:oi,tags:Zs})=>{Vo[oi]&&(Vo[oi]={...Vo[oi],tags:Zs})}),Vo})),wt({id:Pt,title:"Imported!",message:`Imported translations from ${ae}.`,loading:!1,autoClose:5e3})}else{let jt=In.data||{},kl=jt.title||"Import complete",qi=jt.message||`Imported translations from ${ae}.`,An=jt.link;wt({id:Pt,title:kl,color:jt.status==="success"?"green":jt.status==="error"?"red":void 0,message:An?.url?f("div",{children:[f("div",{children:qi}),f(X,{component:"a",href:An.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:f(ra,{size:14}),style:{marginTop:"8px"},children:An.label||"Open"})]}):qi,loading:!1,autoClose:An?.url?1e4:5e3})}else{let jt=In.data||{},kl=jt.title||"Exported!",qi=jt.message||`Exported translations to ${ae}.`,An=jt.link;wt({id:Pt,title:kl,color:jt.status==="success"?"green":jt.status==="error"?"red":void 0,message:An?.url?f("div",{children:[f("div",{children:qi}),f(X,{component:"a",href:An.url,target:"_blank",rel:"noopener noreferrer",size:"xs",variant:"default",rightIcon:f(ra,{size:14}),style:{marginTop:"8px"},children:An.label||"Open"})]}):qi,loading:!1,autoClose:An?.url?1e4:5e3})}}catch(dn){throw Ol(Pt),dn}})}return f("div",{className:"LocalizationModal__translations",children:[f("div",{className:"LocalizationModal__translations__topWrapper",children:[f("div",{className:"LocalizationModal__translations__header",children:[f("div",{className:"LocalizationModal__translations__titleWrap",children:f(Cr,{className:"LocalizationModal__translations__title LocalizationModal__iconTitle",size:"h2",children:[f(es,{strokeWidth:1.5})," ",f("span",{children:"Translations"})]})}),f("div",{className:"LocalizationModal__translations__header__buttons",children:[g.enabled&&m?.spreadsheetId&&f(Oe,{label:"Open Google Sheet",children:f(Me,{component:"a",href:na(m),target:"_blank",variant:"filled",color:"green",size:"sm",children:f(eu,{size:16,strokeWidth:2.25})})}),f(X,{component:"a",href:`/cms/translations/${t.docId}`,target:"_blank",variant:"default",size:"xs",rightIcon:f(ra,{size:14,strokeWidth:1.75}),children:"Open Editor"}),f(pP,{onAction:co,onServiceAction:xd,gapiClient:g,linkedSheet:m}),f(fP,{onAction:co,onServiceAction:xd,gapiClient:g,linkedSheet:m}),f(G,{className:"LocalizationModal__translations__menu",control:f(Oe,{label:"Tools",children:f(Me,{className:"LocalizationModal__translations__menu__dots",variant:"default",children:f(Fl,{size:16})})}),size:220,children:f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:f(BE,{size:16}),onClick:()=>y.open({docId:t.docId,sourceStrings:o,onPruned:U=>{p(re=>{let ge={...re};return U.forEach(ae=>delete ge[ae]),ge})}}),children:"Prune unused strings"})})]})]}),e&&f(Sw,{labels:["Transmogrifying...","Deciphering the vibes...","Consulting the Rosetta Stone...","Untangling the syntax...","Babel-ing..."]}),!e&&E>0&&f("div",{className:"LocalizationModal__missingTags",children:[f("div",{className:"LocalizationModal__missingTags__message",children:[f(Ah,{}),E>1?f(un,{size:"sm",children:[f("b",{children:[E," strings"]}),' are missing the "',t.docId,'" tag.']}):f(un,{size:"sm",children:[f("b",{children:[E," string"]}),' is missing the "',t.docId,'" tag.']})]}),f(X,{variant:"filled",size:"xs",onClick:()=>mr(Sl),loading:e,leftIcon:f(Fl,{size:16}),children:"Fix missing tags"})]}),!e&&f("table",{className:"LocalizationModal__translations__table",children:[f("tr",{className:"LocalizationModal__translations__table__row LocalizationModal__translations__table__row--header",children:[f("th",{className:"LocalizationModal__translations__table__header",children:f(Cr,{size:"h4",weight:"semi-bold",children:"SOURCE STRING"})}),f("th",{className:"LocalizationModal__translations__table__header",children:f("div",{className:"LocalizationModal__translations__localeHeader",children:[f(Cr,{className:"LocalizationModal__translations__localeSelect",size:"h4",weight:"semi-bold",children:[f("span",{children:"LOCALE: "})," ",f(Mn,{data:Rt,size:"xs",placeholder:"select locale",allowDeselect:!0,value:a,onChange:U=>l(U)})]}),f("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a&&ot>0&&f(Oe,{label:c?"Show all translations":"Show only missing translations",position:"top",withArrow:!0,children:f("button",{className:`LocalizationModal__translations__missingToggle${c?" LocalizationModal__translations__missingToggle--active":""}`,onClick:()=>d(U=>!U),children:[f(gE,{size:14}),f("span",{children:[ot," missing"]})]})},c?"active":"inactive"),a&&o.length>0&&ot===0&&R===0&&f("div",{className:"LocalizationModal__translations__fullyTranslated",children:[f(Qi,{size:14}),f("span",{children:"Translated"})]}),Z()&&!S&&f(Oe,{label:"Generate translations using AI",withArrow:!0,position:"top",children:f(Me,{variant:"default",size:"sm",onClick:se,children:f(ko,{size:14,fill:"black"})})}),S&&f(Oe,{label:"Stop generating",withArrow:!0,position:"top",children:f(Me,{variant:"default",size:"sm",onClick:F,children:f(RE,{size:14,fill:"black"})})}),S&&f(Gd,{size:18,className:"LocalizationModal__spinner"})]})]})})]}),o.filter(U=>!c||!a?!0:!h[U]).map((U,re)=>f("tr",{className:"LocalizationModal__translations__table__row",children:[f("td",{className:"LocalizationModal__translations__table__col",children:f("div",{className:"LocalizationModal__sourceCell",children:[f("span",{className:"LocalizationModal__sourceCell__text",children:U}),(ut[U]||v.has(U))&&f("div",{className:"LocalizationModal__sourceCell__icons",children:[ut[U]&&f(Me,{className:"LocalizationModal__sourceCell__link",size:"sm",variant:"subtle",onClick:async()=>{let ge=await xr(U);window.open(`/cms/translations/${ge}`,"_blank")},children:f(vr,{size:16})}),v.has(U)&&f(Oe,{label:`Missing "${t.docId}" tag`,position:"top",withArrow:!0,children:f(Me,{className:"LocalizationModal__sourceCell__missingTag",size:"sm",variant:"subtle",children:f(Ah,{size:14})})})]})]})}),f("td",{className:"LocalizationModal__translations__table__col",children:f(uP,{source:U,locale:a,savedValue:h[U]||"",pendingValue:C[U]?.[a],isAiGenerating:D===U,readOnly:S,onEdit:ge=>z(U,a,ge)})})]},re))]})]}),f("div",{className:"LocalizationModal__translations__saveBar",children:[f("span",{className:"LocalizationModal__translations__saveBar__status",children:R>0?`${R} unsaved change${R!==1?"s":""}`:""}),R>0&&f(X,{variant:"default",size:"xs",leftIcon:f(li,{size:14}),onClick:()=>k({}),children:"Discard changes"}),f(X,{variant:"filled",size:"xs",color:"dark",leftIcon:f(Qi,{size:14}),onClick:W,loading:T,disabled:R===0,children:"Save"})]})]})};function uP(t){let e=t.pendingValue!==void 0?t.pendingValue:t.savedValue,o=[t.pendingValue!==void 0?"LocalizationModal__translations__cell--edited":"",t.isAiGenerating?"LocalizationModal__translations__cell--ai-generating":"",e?"":"LocalizationModal__translations__cell--empty"].filter(Boolean).join(" ")||void 0;return f(_n,{size:"xs",autosize:!0,minRows:1,value:e,placeholder:"",readOnly:t.readOnly,onChange:r=>t.onEdit(r.currentTarget.value),className:o,styles:{root:{height:"100%"},wrapper:{height:"100%"},input:{fontSize:"12px",minHeight:"100%"}}})}function pP(t){function e(r){t.onAction&&t.onAction(r)}let n=t.linkedSheet,o=(window.__ROOT_CTX.translations||[]).filter(r=>r.hasImport);return f(G,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"end",control:f(X,{variant:"default",color:"dark",size:"xs",leftIcon:f(Ll,{size:16,strokeWidth:1.75}),rightIcon:f(fo,{size:16,strokeWidth:1.75}),children:"Import"}),children:[t.gapiClient.enabled&&f(Ne,{children:[f(G.Label,{children:"Google Sheets"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",disabled:!n?.spreadsheetId,onClick:()=>e("IMPORT_GOOGLE_SHEET_LINKED"),children:"Import Google Sheet"}),f(_r,{})]}),f(G.Label,{children:"File"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("IMPORT_CSV"),children:"Import .csv"}),o.length>0&&f(Ne,{children:[f(_r,{}),f(G.Label,{children:"Services"}),o.map(r=>f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:r.icon?f("img",{src:r.icon,alt:r.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(r.id,"import"),children:["Import from ",r.label]},r.id))]})]})}function fP(t){async function e(i){t.onAction&&t.onAction(i)}let o=!!t.linkedSheet?.spreadsheetId,r=(window.__ROOT_CTX.translations||[]).filter(i=>i.hasExport);return f(G,{className:"LocalizationModal__translations__menu",position:"bottom",placement:"start",control:f(X,{variant:"default",color:"dark",size:"xs",leftIcon:f(hE,{size:16,strokeWidth:1.75}),rightIcon:f(fo,{size:16,strokeWidth:1.75}),children:"Export"}),children:[t.gapiClient.enabled&&f(Ne,{children:[f(G.Label,{children:"Google Sheets"}),o?f(Ne,{children:f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_LINKED"),children:"Export to Google Sheet"})}):f(Ne,{children:f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_GOOGLE_SHEET_SHOW_OPTIONS"),children:"Export to Google Sheet"})}),f(_r,{})]}),f(G.Label,{children:"File"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("EXPORT_DOWNLOAD_CSV"),children:"Download .csv"}),r.length>0&&f(Ne,{children:[f(_r,{}),f(G.Label,{children:"Services"}),r.map(i=>f(G.Item,{className:"LocalizationModal__translations__menu__item",icon:i.icon?f("img",{src:i.icon,alt:i.label,style:{width:16,height:16}}):void 0,onClick:()=>t.onServiceAction?.(i.id,"export"),children:["Export to ",i.label]},i.id))]}),o&&f(Ne,{children:[f(_r,{}),f(G.Label,{children:"Danger zone"}),f(G.Item,{className:"LocalizationModal__translations__menu__item",onClick:()=>e("UNLINK_GOOGLE_SHEET"),color:"red",children:"Unlink Google Sheet"})]})]})}function Qh(t,e){let n={...t};for(let[o,r]of Object.entries(e)){let i=n[o];n[o]=i?{...i,...r}:r}return n}function Dw(t){let e=t.split("_"),n=e[0];if(n==="ALL"){let i=String(e[1]).toUpperCase();return`${new Intl.DisplayNames(["en"],{type:"region"}).of(i)||t} (${t})`}return`${new Intl.DisplayNames(["en"],{type:"language"}).of(n)||t} (${t})`}ke();function Ow(t){let e=new Set;return eg(t,e),Array.from(e)}function eg(t,e){if(!(!t||typeof t!="object")){if(Array.isArray(t)){for(let n of t)eg(n,e);return}if(hP(t)){e.add(t.id);return}for(let n of Object.keys(t))eg(t[n],e)}}function hP(t){return typeof t.id=="string"&&typeof t.collection=="string"&&typeof t.slug=="string"&&t.id.includes("/")}var Iw="PublishDocModal";function Aw(t){let e=Et(),n=it();return{open:()=>{e.openContextModal(Iw,{...n,title:`Publish ${t.docId}`,innerProps:t,size:"850px"})}}}function gP(t){let{innerProps:e,context:n,id:o}=t,[r,i]=L(""),[s,a]=L(""),[l,c]=L(!1),[d,u]=L(""),[p,h]=L(!1),g=q(null),m=Et(),_=it(),b=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai),{roles:y,loading:v}=nu(),x=window.firebase.user.email||"",E=ou(y,x),C=r==="scheduled"?"Schedule":"Publish";async function k(){try{c(!0),await VC(e.docId,{publishMessage:d.trim()||void 0}),c(!1),ce({title:"Published!",message:`Succesfully published ${e.docId}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=Il(D);ce({title:"Publish failed",message:`Failed to publish ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function T(){try{c(!0);let D=Math.floor(new Date(s).getTime());await WC(e.docId,D,{publishMessage:d.trim()||void 0}),c(!1),ce({title:"Scheduled!",message:`${e.docId} will go live ${s}.`,autoClose:1e4}),m.closeAll()}catch(D){console.error(D);let O=Il(D);ce({title:"Schedule failed",message:`Failed to schedule ${e.docId}: ${O}`,color:"red",autoClose:!1})}}async function w(){try{h(!0);let O=await(await window.fetch("/cms/api/ai.publish_message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({docId:e.docId})})).json();O.success&&O.message?u(O.message):ce({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}catch(D){console.error(D),ce({title:"Generation failed",message:"Failed to generate publish message.",color:"red",autoClose:5e3})}finally{h(!1)}}function S(){m.openConfirmModal({..._,title:`${C} ${e.docId}`,children:f(Ne,{children:[f(ns,{size:"body-sm",weight:"semi-bold",className:"PublishDocModal__confirmText",children:["Are you sure you want to publish the following doc? The doc will go live ",r==="now"?"now":`at ${s}`,"."]}),f(iw,{docId:e.docId})]}),labels:{confirm:C,cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{r==="now"?k():r==="scheduled"&&T()}})}let N=!0;return(r==="now"||r==="scheduled"&&s)&&(N=!1),(v||!E)&&(N=!0),f("div",{className:"PublishDocModal",children:f("div",{className:"PublishDocModal__content",children:[f("form",{className:"PublishDocModal__form",onSubmit:D=>{D.preventDefault(),S()},children:[f("div",{className:"PublishDocModal__form__publishOptions",children:f("div",{className:"PublishDocModal__form__publishOptions__options",children:[f("label",{className:Ce("PublishDocModal__form__publishOptions__option",r==="now"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="now"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[f("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[f("input",{type:"radio",name:"publish-option",value:"now",checked:r==="now",onChange:()=>i("now")})," ","Now"]}),f("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live immediately."})]}),f("label",{className:Ce("PublishDocModal__form__publishOptions__option",r==="scheduled"&&"PublishDocModal__form__publishOptions__option--selected",r&&r!=="scheduled"&&"PublishDocModal__form__publishOptions__option--unselected"),children:[f("div",{className:"PublishDocModal__form__publishOptions__option__input",children:[f("input",{type:"radio",name:"publish-option",value:"scheduled",checked:r==="scheduled",onChange:()=>i("scheduled")}),f("div",{children:"Scheduled"})]}),f("div",{className:"PublishDocModal__form__publishOptions__option__help",children:"Content will go live at the date and time specified below."}),f("div",{className:"PublishDocModal__form__publishOptions__option__input2",children:[f("input",{ref:g,type:"datetime-local",disabled:r!=="scheduled",value:s,min:AC(),onChange:D=>{let O=D.target;a(O.value)}}),f("div",{className:"PublishDocModal__form__publishOptions__option__input2__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]})]})]})}),f("div",{className:"PublishDocModal__form__publishMessage",children:f("div",{className:"PublishDocModal__form__publishMessage__wrapper",children:[f("textarea",{className:"PublishDocModal__form__publishMessage__textarea",placeholder:"Optional: Add a message to describe the changes",value:d,rows:3,onInput:D=>{let O=D.target;u(O.value)}}),b&&f("button",{type:"button",className:"PublishDocModal__form__publishMessage__sparkle",onClick:w,disabled:p,children:f(Oe,{label:"Generate message",withArrow:!0,position:"left",allowPointerEvents:!0,wrapLines:!0,children:p?f(Ft,{size:16}):f(ko,{size:16,stroke:1.5})})})]})}),f("div",{className:"PublishDocModal__form__buttons",children:[f(X,{variant:"outline",onClick:()=>n.closeModal(o),type:"button",size:"xs",color:"dark",children:"Cancel"}),f(X,{variant:"filled",size:"xs",color:"dark",disabled:N,loading:l,type:"submit",children:C})]})]}),f("div",{className:"PublishDocModal__DiffWrapper",children:[f(bP,{docId:e.docId}),b&&f(aw,{docId:e.docId,beforeVersion:"published",afterVersion:"draft"}),f(mP,{docId:e.docId})]})]})})}function mP(t){let e=t.docId,[n,o]=L(!1);function r(){o(!0)}return f("div",{className:"PublishDocModal__ShowChanges",children:f(Sh,{iconPosition:"right",onChange:()=>r(),disableIconRotation:!0,children:f(Sh.Item,{label:"Compare JSON data",icon:f(mE,{stroke:1.5}),iconPosition:"left",children:n&&f(lw,{left:{docId:e,versionId:"published"},right:{docId:e,versionId:"draft"},showExpandButton:!0,showAiSummary:!1})})})})}function _P(t){let e=t?.sys;return e?!!(!e.publishedAt||e.modifiedAt&&e.modifiedAt>e.publishedAt):!1}function bP(t){let[e,n]=L(!0),[o,r]=L([]);P(()=>{async function a(){n(!0);try{let l=await Al(t.docId);if(!l?.fields){n(!1);return}let c=Ow(l.fields).filter(u=>u!==t.docId);if(c.length===0){n(!1);return}let d=[];await Promise.all(c.map(async u=>{try{let p=await Al(u);p&&_P(p)&&d.push(u)}catch(p){console.warn(`Failed to fetch reference doc: ${u}`,p)}})),r(d.sort())}catch(l){console.error("Failed to load reference docs",l)}n(!1)}a()},[t.docId]);let i=[t.docId,...o],s=nE({docIds:i});return e?f("div",{className:"PublishDocModal__ReferenceDocs",children:f(Ft,{color:"gray",size:"sm"})}):o.length===0?null:f("div",{className:"PublishDocModal__ReferenceDocs",children:[f("div",{className:"PublishDocModal__ReferenceDocs__header",children:[f("div",{className:"PublishDocModal__ReferenceDocs__header__label",children:["Referenced docs with unpublished changes (",o.length,")"]}),f(X,{variant:"outline",size:"xs",color:"dark",leftIcon:f(AE,{size:16}),onClick:()=>s.open(),children:"Bundle all docs into a release"})]}),f("div",{className:"PublishDocModal__ReferenceDocs__list",children:o.map(a=>f(Bd,{docId:a,variant:"compact",statusBadges:!0,clickable:!0},a))})]})}gP.id=Iw;ri();ke();function Mw(t){let e=t?.scrollToDeeplink;return typeof e=="object"&&e!==null&&typeof e.deepKey=="string"}function su(t,e){let n;return(...o)=>{window.clearTimeout(n),n=window.setTimeout(()=>{t(...o)},e)}}var ho=class{constructor(){this.events=new Map}on(e,n){let o=So(6),r=this.events.get(e);return r||(r=new Map,this.events.set(e,r)),r.set(o,n),()=>{this.off(e,o)}}off(e,n){let o=this.events.get(e);o&&(o.delete(n),o.size===0&&this.events.delete(e))}dispatch(e,...n){let o=this.events.get(e);o&&o.forEach(r=>r(...n))}dispose(){this.events.clear()}};var au=class{constructor(){this.subscribers=new Set;this.subtreeSubscribers=new Set;this.children=new Map}},lu=class extends ho{constructor(n){super();this.root=new au;this.data=n||{}}get(n){return this.getValueFromPath(n,this.data)}set(n,o){if(n===""){Ln(o)&&this.setData(o);return}this.update({[n]:o})}update(n){let o=new Map,r=(s,a,l)=>{if(o.set(s,l),!Ln(a)&&!Ln(l))return;let c=Ln(a)?Object.keys(a):[],d=Ln(l)?Object.keys(l):[];new Set([...c,...d]).forEach(p=>{let h=Ln(a)?a[p]:void 0,g=Ln(l)?l[p]:void 0;Ih(h,g)||r(`${s}.${p}`,h,g)})};Object.entries(n).forEach(([s,a])=>{let l=this.data,c=s.split("."),d=c.pop();for(let p of c)l[p]||(l[p]={}),l=l[p];let u=l[d];l[d]=a,this.dispatch("VALUE_CHANGE",s,a),r(s,u,a)});let i=new Map;o.forEach((s,a)=>{this.collectSubtreeNotifications(a,i)}),o.forEach((s,a)=>{let l=this.getTrieNode(a);l&&l.subscribers.size>0&&l.subscribers.forEach(c=>c(s))}),i.forEach((s,a)=>{let l=this.get(a);s.subtreeSubscribers.forEach(c=>c(l))}),this.dispatch("CHANGE",this.data)}setData(n){let o=this.data;this.notifyOnUpdate(this.root,"",o,n),this.data=n,this.dispatch("CHANGE",this.data)}subscribe(n,o){let r=this.getTrieNode(n,!0);return r.subscribers.add(o),window.setTimeout(()=>{let i=this.get(n);i!==void 0&&o(i)}),()=>{r.subscribers.delete(o)}}subscribeSubtree(n,o){let r=this.getTrieNode(n,!0);return r.subtreeSubscribers.add(o),window.setTimeout(()=>{let i=this.get(n);i!==void 0&&o(i)}),()=>{r.subtreeSubscribers.delete(o)}}getDataSnapshot(){return this.data}dispose(){super.dispose(),this.data={},this.root.subscribers.clear(),this.root.subtreeSubscribers.clear(),this.root.children.clear()}notifyOnUpdate(n,o,r,i){let s=this.getValueFromPath(o,r),a=this.getValueFromPath(o,i);Ih(s,a)||(n.subscribers.forEach(l=>l(a)),n.subtreeSubscribers.forEach(l=>l(a))),n.children.forEach((l,c)=>{let d=o?`${o}.${c}`:c;this.notifyOnUpdate(l,d,r,i)})}collectSubtreeNotifications(n,o){let r=this.root;if(r.subtreeSubscribers.size>0&&o.set("",r),!n)return;let i="";for(let s of n.split(".")){if(r=r.children.get(s),!r)return;i=i?`${i}.${s}`:s,r.subtreeSubscribers.size>0&&o.set(i,r)}}getValueFromPath(n,o){if(!n)return o;let r=n.split("."),i=o;for(let s of r){if(i===null||typeof i!="object"||!(s in i))return;i=i[s]}return i}getTrieNode(n,o=!1){if(!n)return this.root;let r=n.split("."),i=this.root;for(let s of r){if(!i.children.has(s))if(o)i.children.set(s,new au);else return;i=i.children.get(s)}return i}};var Lw=3*Zi.second,yP=5*Zi.minute;var xP=30*Zi.second,tg=class extends ho{constructor(n){super();this.pendingUpdates=new Map;this.saveState="NO_CHANGES";this.autolock=!1;this.autolockReason="autolock";this.autolockApplied=!1;this.mightHaveAssetChanges=!1;this.readOnly=!1;this.autoSave=!0;this.flushOnStop=!0;this.started=!1;this.queueChanges=su(()=>this.flush(),Lw);this.projectId=window.__ROOT_CTX.rootConfig.projectId;let[o,r]=n.split("/");this.docId=n,this.collectionId=o,this.slug=r,this.db=window.firebase.db,this.docRef=kd(this.db,"Projects",this.projectId,"Collections",o,"Drafts",r),this.store=new lu({id:this.docId,collection:this.collectionId,slug:this.slug,sys:{}}),this.store.on("CHANGE",s=>{this.dispatch("CHANGE",s)}),this.store.on("VALUE_CHANGE",(s,a)=>{this.dispatch("VALUE_CHANGE",s,a)});let i=window.__ROOT_CTX.collections[o];i&&(this.autolock=!!i.autolock,i.autolockReason&&(this.autolockReason=i.autolockReason))}async start(){if(this.started)return;this.started=!0;let n=!0;this.dbUnsubscribe=Dd(this.docRef,o=>{if(o.metadata.hasPendingWrites)return;let r=o.data()||{};this.pendingUpdates.size>0&&Pw(r,Object.fromEntries(this.pendingUpdates)),this.store.setData(r),n&&(n=!1,Array.isArray(r?.sys?.assets)||(this.mightHaveAssetChanges=!0))})}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.flushOnStop&&this.flush(),this.started=!1)}onChange(n){return this.on("CHANGE",n)}onSaveStateChange(n){return this.on("SAVE_STATE_CHANGE",n)}onFlush(n){return this.on("FLUSH",n)}subscribe(n,o){return this.store.subscribe(n,o)}subscribeSubtree(n,o){return this.store.subscribeSubtree(n,o)}getData(){return this.store.getDataSnapshot()}getValue(n){return this.store.get(n)}async updateKey(n,o){this.readOnly||(o===void 0?this.setPendingUpdate(n,Od()):this.setPendingUpdate(n,o),this.store.set(n,o),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges())}async updateKeys(n){if(!this.readOnly){for(let o in n){let r=n[o];r==null?this.setPendingUpdate(o,Od()):this.setPendingUpdate(o,r)}this.store.update(n),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges()}}async removeKey(n){this.readOnly||(this.setPendingUpdate(n,Od()),this.store.set(n,void 0),this.setSaveState("UPDATE_PENDING"),this.autoSave&&this.queueChanges())}setPendingUpdate(n,o){for(let r of this.pendingUpdates.keys())wP(r,n)&&this.pendingUpdates.delete(r);this.pendingUpdates.set(n,o),!this.mightHaveAssetChanges&&n.startsWith("fields")&&(Dh(o)||Dh(this.store.get(n)))&&(this.mightHaveAssetChanges=!0)}getPendingUpdates(){return CP(Object.fromEntries(this.pendingUpdates))}setSaveState(n){let o=this.saveState;n==="SAVED"&&o!=="SAVING"||(this.saveState=n,n==="SAVED"&&window.setTimeout(()=>{this.saveState==="SAVED"&&this.setSaveState("NO_CHANGES")},Lw),this.dispatch("SAVE_STATE_CHANGE",n))}removePublishingLock(){this.autolockApplied=!0,this.removeKey("sys.publishingLocked"),this.flush()}async flush(n){if(this.readOnly||this.pendingUpdates.size===0)return;let o=this.getPendingUpdates();if(o["sys.modifiedAt"]=ea(),o["sys.modifiedBy"]=window.firebase.user.email,this.mightHaveAssetChanges){let r=UC(this.store.get("fields")||{}),i=this.store.get("sys.assets")||[];TP(r,i)||(o["sys.assets"]=r)}this.autolock&&!this.autolockApplied&&!this.store.get("sys.publishingLocked")&&(this.autolockApplied=!0,o["sys.publishingLocked"]={lockedAt:ea(),lockedBy:window.firebase.user.email,reason:this.autolockReason}),this.pendingUpdates.clear();try{this.setSaveState("SAVING"),await Nd(this.docRef,o),this.mightHaveAssetChanges=!1,this.setSaveState("SAVED"),n?.quiet||this.dispatch("FLUSH"),Id("doc.save",{metadata:{docId:this.docId},throttle:yP,throttleId:this.docId})}catch(r){console.error("failed to update doc:",r),this.setSaveState("ERROR");let i=Il(r);ce({title:`Failed to save ${this.slug}`,message:i||`Something went wrong while saving ${this.slug}`,color:"red",autoClose:!1});for(let s in o)s.startsWith("sys.")||this.pendingUpdates.has(s)||(this.pendingUpdates.set(s,o[s]),this.queueChanges(),console.log("re-queued updates"),console.log(this.pendingUpdates))}}getLocales(){let n=this.store.get("sys.locales");return n||["en"]}setLocales(n){this.updateKey("sys.locales",n)}async dispose(){super.dispose(),this.stop()}};function Pw(t,e){for(let n in e){let o=e[n];if(n.includes(".")){let[r,i]=vP(n);t[r]??={},Pw(t[r],{[i]:o})}else typeof o>"u"?delete t[n]:t[n]=o}}function vP(t){let e=t.indexOf("."),n=t.substring(0,e),o=t.substring(e+1);return[n,o]}function CP(t){let e={...t};for(let n in e)EP(n,e)&&delete e[n];return e}function EP(t,e){let n=t.split(".");for(let o=1;o<n.length;o++)if(n.slice(0,o).join(".")in e)return!0;return!1}function wP(t,e){return t.startsWith(`${e}.`)}function TP(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}var ng=ft(null);function Fw(t){let[e,n]=L(!0),o=J(()=>new tg(t.docId),[t.docId]);o.readOnly=t.readOnly??!1,o.autoSave=t.autoSave??!0,o.flushOnStop=t.flushOnStop??!0,P(()=>(n(!0),o.onChange(i=>{n(!1),LC(i.id,i)}),o.start(),()=>o.dispose()),[o]),P(()=>{let i,s=()=>{document.hidden||document.visibilityState!=="visible"?i=window.setTimeout(()=>{o.stop()},xP):(i&&(clearTimeout(i),i=void 0),o.started||o.start())};return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s),i&&clearTimeout(i)}},[o]);let r=J(()=>({loading:e,controller:o}),[e,o]);return f(ng.Provider,{value:r,children:t.children})}function cu(t){return f(ng.Provider,{value:t.value,children:t.children})}function on(){let t=ht(ng);if(!t)throw new Error("useDraftDoc() should be used within a <DraftDocProvider>");return t}function Bw(t){let{controller:e}=on();P(()=>e.onSaveStateChange(t),[e])}function bq(t){let{controller:e}=on();P(()=>e.onChange(t),[e])}function qo(t,e){let{controller:n}=on();P(()=>n.subscribe(t,e),[n])}function Ot(t,e){let{controller:n}=on(),[o,r]=L(n.getValue(t)??e);return P(()=>n.subscribe(t,s=>{r(s)}),[n]),[o,s=>{r(s),s==null?n.removeKey(t):n.updateKey(t,s)}]}bt();bt();function bn(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var SP=typeof Symbol=="function"&&Symbol.observable||"@@observable",$w=SP,og=()=>Math.random().toString(36).substring(7).split("").join("."),kP={INIT:`@@redux/INIT${og()}`,REPLACE:`@@redux/REPLACE${og()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${og()}`},zw=kP;function NP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function rg(t,e,n){if(typeof t!="function")throw new Error(bn(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(bn(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(bn(1));return n(rg)(t,e)}let o=t,r=e,i=new Map,s=i,a=0,l=!1;function c(){s===i&&(s=new Map,i.forEach((_,b)=>{s.set(b,_)}))}function d(){if(l)throw new Error(bn(3));return r}function u(_){if(typeof _!="function")throw new Error(bn(4));if(l)throw new Error(bn(5));let b=!0;c();let y=a++;return s.set(y,_),function(){if(b){if(l)throw new Error(bn(6));b=!1,c(),s.delete(y),i=null}}}function p(_){if(!NP(_))throw new Error(bn(7));if(typeof _.type>"u")throw new Error(bn(8));if(typeof _.type!="string")throw new Error(bn(17));if(l)throw new Error(bn(9));try{l=!0,r=o(r,_)}finally{l=!1}return(i=s).forEach(y=>{y()}),_}function h(_){if(typeof _!="function")throw new Error(bn(10));o=_,p({type:zw.REPLACE})}function g(){let _=u;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(bn(11));function y(){let x=b;x.next&&x.next(d())}return y(),{unsubscribe:_(y)}},[$w](){return this}}}return p({type:zw.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:h,[$w]:g}}function Hw(t,e){return function(...n){return e(t.apply(this,n))}}function ig(t,e){if(typeof t=="function")return Hw(t,e);if(typeof t!="object"||t===null)throw new Error(bn(16));let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=Hw(r,e))}return n}function sg(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...o)=>e(n(...o)))}function Uw(...t){return e=>(n,o)=>{let r=e(n,o),i=()=>{throw new Error(bn(15))},s={getState:r.getState,dispatch:(l,...c)=>i(l,...c)},a=t.map(l=>l(s));return i=sg(...a)(r.dispatch),{...r,dispatch:i}}}bt();var OF=Eh(Ww(),1),PP=bC.startsWith("19"),FP=Symbol.for(PP?"react.transitional.element":"react.element"),BP=Symbol.for("react.portal"),$P=Symbol.for("react.fragment"),zP=Symbol.for("react.strict_mode"),HP=Symbol.for("react.profiler"),UP=Symbol.for("react.consumer"),KP=Symbol.for("react.context"),Qw=Symbol.for("react.forward_ref"),jP=Symbol.for("react.suspense"),VP=Symbol.for("react.suspense_list"),dg=Symbol.for("react.memo"),WP=Symbol.for("react.lazy");var GP=Qw,YP=dg;function qP(t){if(typeof t=="object"&&t!==null){let{$$typeof:e}=t;switch(e){case FP:switch(t=t.type,t){case $P:case HP:case zP:case jP:case VP:return t;default:switch(t=t&&t.$$typeof,t){case KP:case Qw:case WP:case dg:return t;case UP:return t;default:return e}}case BP:return e}}}function JP(t){return qP(t)===dg}function XP(t,e,n,o,{areStatesEqual:r,areOwnPropsEqual:i,areStatePropsEqual:s}){let a=!1,l,c,d,u,p;function h(y,v){return l=y,c=v,d=t(l,c),u=e(o,c),p=n(d,u,c),a=!0,p}function g(){return d=t(l,c),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function m(){return t.dependsOnOwnProps&&(d=t(l,c)),e.dependsOnOwnProps&&(u=e(o,c)),p=n(d,u,c),p}function _(){let y=t(l,c),v=!s(y,d);return d=y,v&&(p=n(d,u,c)),p}function b(y,v){let x=!i(v,c),E=!r(y,l,v,c);return l=y,c=v,x&&E?g():x?m():E?_():p}return function(v,x){return a?b(v,x):h(v,x)}}function ZP(t,{initMapStateToProps:e,initMapDispatchToProps:n,initMergeProps:o,...r}){let i=e(t,r),s=n(t,r),a=o(t,r);return XP(i,s,a,t,r)}function QP(t,e){let n={};for(let o in t){let r=t[o];typeof r=="function"&&(n[o]=(...i)=>e(r(...i)))}return n}function lg(t){return function(n){let o=t(n);function r(){return o}return r.dependsOnOwnProps=!1,r}}function Gw(t){return t.dependsOnOwnProps?!!t.dependsOnOwnProps:t.length!==1}function e0(t,e){return function(o,{displayName:r}){let i=function(a,l){return i.dependsOnOwnProps?i.mapToProps(a,l):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,l){i.mapToProps=t,i.dependsOnOwnProps=Gw(t);let c=i(a,l);return typeof c=="function"&&(i.mapToProps=c,i.dependsOnOwnProps=Gw(c),c=i(a,l)),c},i}}function ug(t,e){return(n,o)=>{throw new Error(`Invalid value of type ${typeof t} for ${e} argument when connecting component ${o.wrappedComponentName}.`)}}function eF(t){return t&&typeof t=="object"?lg(e=>QP(t,e)):t?typeof t=="function"?e0(t,"mapDispatchToProps"):ug(t,"mapDispatchToProps"):lg(e=>({dispatch:e}))}function tF(t){return t?typeof t=="function"?e0(t,"mapStateToProps"):ug(t,"mapStateToProps"):lg(()=>({}))}function nF(t,e,n){return{...n,...t,...e}}function oF(t){return function(n,{displayName:o,areMergedPropsEqual:r}){let i=!1,s;return function(l,c,d){let u=t(l,c,d);return i?r(u,s)||(s=u):(i=!0,s=u),s}}}function rF(t){return t?typeof t=="function"?oF(t):ug(t,"mergeProps"):()=>nF}function iF(t){t()}function sF(){let t=null,e=null;return{clear(){t=null,e=null},notify(){iF(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){let n=[],o=t;for(;o;)n.push(o),o=o.next;return n},subscribe(n){let o=!0,r=e={callback:n,next:null,prev:e};return r.prev?r.prev.next=r:t=r,function(){!o||t===null||(o=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}var Yw={notify(){},get:()=>[]};function t0(t,e){let n,o=Yw,r=0,i=!1;function s(m){d();let _=o.subscribe(m),b=!1;return()=>{b||(b=!0,_(),u())}}function a(){o.notify()}function l(){g.onStateChange&&g.onStateChange()}function c(){return i}function d(){r++,n||(n=e?e.addNestedSub(l):t.subscribe(l),o=sF())}function u(){r--,n&&r===0&&(n(),n=void 0,o.clear(),o=Yw)}function p(){i||(i=!0,d())}function h(){i&&(i=!1,u())}let g={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>o};return g}var aF=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lF=aF(),cF=()=>typeof navigator<"u"&&navigator.product==="ReactNative",dF=cF(),uF=()=>lF||dF?mn:P,du=uF();function qw(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function ag(t,e){if(qw(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!qw(t[n[r]],e[n[r]]))return!1;return!0}var pF={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},fF={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},hF={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},n0={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},gF={[GP]:hF,[YP]:n0};function Jw(t){return JP(t)?n0:gF[t.$$typeof]||pF}var mF=Object.defineProperty,_F=Object.getOwnPropertyNames,Xw=Object.getOwnPropertySymbols,bF=Object.getOwnPropertyDescriptor,yF=Object.getPrototypeOf,Zw=Object.prototype;function cg(t,e){if(typeof e!="string"){if(Zw){let i=yF(e);i&&i!==Zw&&cg(t,i)}let n=_F(e);Xw&&(n=n.concat(Xw(e)));let o=Jw(t),r=Jw(e);for(let i=0;i<n.length;++i){let s=n[i];if(!fF[s]&&!(r&&r[s])&&!(o&&o[s])){let a=bF(e,s);try{mF(t,s,a)}catch{}}}}return t}var xF=Symbol.for("react-redux-context"),vF=typeof globalThis<"u"?globalThis:{};function CF(){if(!ft)return{};let t=vF[xF]??=new Map,e=t.get(ft);return e||(e=ft(null),t.set(ft,e)),e}var o0=CF(),EF=[null,null];function wF(t,e,n){du(()=>t(...e),n)}function TF(t,e,n,o,r,i){t.current=o,n.current=!1,r.current&&(r.current=null,i())}function SF(t,e,n,o,r,i,s,a,l,c,d){if(!t)return()=>{};let u=!1,p=null,h=()=>{if(u||!a.current)return;let m=e.getState(),_,b;try{_=o(m,r.current)}catch(y){b=y,p=y}b||(p=null),_===i.current?s.current||c():(i.current=_,l.current=_,s.current=!0,d())};return n.onStateChange=h,n.trySubscribe(),h(),()=>{if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,p)throw p}}function kF(t,e){return t===e}function NF(t,e,n,{pure:o,areStatesEqual:r=kF,areOwnPropsEqual:i=ag,areStatePropsEqual:s=ag,areMergedPropsEqual:a=ag,forwardRef:l=!1,context:c=o0}={}){let d=c,u=tF(t),p=eF(e),h=rF(n),g=!!t;return _=>{let b=_.displayName||_.name||"Component",y=`Connect(${b})`,v={shouldHandleStateChanges:g,displayName:y,wrappedComponentName:b,WrappedComponent:_,initMapStateToProps:u,initMapDispatchToProps:p,initMergeProps:h,areStatesEqual:r,areStatePropsEqual:s,areOwnPropsEqual:i,areMergedPropsEqual:a};function x(k){let[T,w,S]=J(()=>{let{reactReduxForwardedRef:$e,...nn}=k;return[k.context,$e,nn]},[k]),N=J(()=>{let $e=d;return T?.Consumer,$e},[T,d]),D=ht(N),O=!!k.store&&!!k.store.getState&&!!k.store.dispatch,A=!!D&&!!D.store,I=O?k.store:D.store,R=A?D.getServerState:I.getState,z=J(()=>ZP(I.dispatch,v),[I]),[W,Z]=J(()=>{if(!g)return EF;let $e=t0(I,O?void 0:D.subscription),nn=$e.notifyNestedSubs.bind($e);return[$e,nn]},[I,O,D]),F=J(()=>O?D:{...D,subscription:W},[O,D,W]),se=q(void 0),ye=q(S),ut=q(void 0),Rt=q(!1),ot=q(!1),pt=q(void 0);du(()=>(ot.current=!0,()=>{ot.current=!1}),[]);let oe=J(()=>()=>ut.current&&S===ye.current?ut.current:z(I.getState(),S),[I,S]),ee=J(()=>nn=>W?SF(g,I,W,z,ye,se,Rt,ot,ut,Z,nn):()=>{},[W]);wF(TF,[ye,se,Rt,S,ut,Z]);let xe;try{xe=gC(ee,oe,R?()=>z(R(),S):oe)}catch($e){throw pt.current&&($e.message+=`
19
- The error may be correlated with this previous error:
20
- ${pt.current.stack}
21
-
22
- `),$e}du(()=>{pt.current=void 0,ut.current=void 0,se.current=xe});let Be=J(()=>Ji(_,{...xe,ref:w}),[w,_,xe]);return J(()=>g?Ji(N.Provider,{value:F},Be):Be,[N,Be,F])}let C=mC(x);if(C.WrappedComponent=_,C.displayName=x.displayName=y,l){let T=Wo(function(S,N){return Ji(C,{...S,reactReduxForwardedRef:N})});return T.displayName=y,T.WrappedComponent=_,cg(T,_)}return cg(C,_)}}var pg=NF;function DF(t){let{children:e,context:n,serverState:o,store:r}=t,i=J(()=>{let l=t0(r);return{store:r,subscription:l,getServerState:o?()=>o:void 0}},[r,o]),s=J(()=>r.getState(),[r]);return du(()=>{let{subscription:l}=i;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),s!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[i,s]),Ji((n||o0).Provider,{value:i},e)}var r0=DF;var IF=!0,fg="Invariant failed";function i0(t,e){if(!t){if(IF)throw new Error(fg);var n=typeof e=="function"?e():e,o=n?"".concat(fg,": ").concat(n):fg;throw new Error(o)}}var mo=function(e){var n=e.top,o=e.right,r=e.bottom,i=e.left,s=o-i,a=r-n,l={top:n,right:o,bottom:r,left:i,width:s,height:a,x:i,y:n,center:{x:(o+i)/2,y:(r+n)/2}};return l},uu=function(e,n){return{top:e.top-n.top,left:e.left-n.left,bottom:e.bottom+n.bottom,right:e.right+n.right}},s0=function(e,n){return{top:e.top+n.top,left:e.left+n.left,bottom:e.bottom-n.bottom,right:e.right-n.right}},AF=function(e,n){return{top:e.top+n.y,left:e.left+n.x,bottom:e.bottom+n.y,right:e.right+n.x}},hg={top:0,right:0,bottom:0,left:0},pu=function(e){var n=e.borderBox,o=e.margin,r=o===void 0?hg:o,i=e.border,s=i===void 0?hg:i,a=e.padding,l=a===void 0?hg:a,c=mo(uu(n,r)),d=mo(s0(n,s)),u=mo(s0(d,l));return{marginBox:c,borderBox:mo(n),paddingBox:d,contentBox:u,margin:r,border:s,padding:l}},go=function(e){var n=e.slice(0,-2),o=e.slice(-2);if(o!=="px")return 0;var r=Number(n);return isNaN(r)&&i0(!1),r},MF=function(){return{x:window.pageXOffset,y:window.pageYOffset}},$l=function(e,n){var o=e.borderBox,r=e.border,i=e.margin,s=e.padding,a=AF(o,n);return pu({borderBox:a,border:r,margin:i,padding:s})},zl=function(e,n){return n===void 0&&(n=MF()),$l(e,n)},gg=function(e,n){var o={top:go(n.marginTop),right:go(n.marginRight),bottom:go(n.marginBottom),left:go(n.marginLeft)},r={top:go(n.paddingTop),right:go(n.paddingRight),bottom:go(n.paddingBottom),left:go(n.paddingLeft)},i={top:go(n.borderTopWidth),right:go(n.borderRightWidth),bottom:go(n.borderBottomWidth),left:go(n.borderLeftWidth)};return pu({borderBox:e,margin:o,padding:r,border:i})},mg=function(e){var n=e.getBoundingClientRect(),o=window.getComputedStyle(e);return gg(n,o)};var LF=function(e){var n=[],o=null,r=function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];n=a,!o&&(o=requestAnimationFrame(function(){o=null,e.apply(void 0,n)}))};return r.cancel=function(){o&&(cancelAnimationFrame(o),o=null)},r},la=LF;var RF=!0,PF=/[ \t]{2,}/g,FF=/^[ \t]*/gm,a0=t=>t.replace(PF," ").replace(FF,"").trim(),BF=t=>a0(`
23
- %c@hello-pangea/dnd
24
-
25
- %c${a0(t)}
26
-
27
- %c\u{1F477}\u200D This is a development only message. It will be removed in production builds.
28
- `),$F=t=>[BF(t),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"],zF="__@hello-pangea/dnd-disable-dev-warnings";function R0(t,e){RF||typeof window<"u"&&window[zF]||console[t](...$F(e))}var zq=R0.bind(null,"warn"),HF=R0.bind(null,"error");function ci(){}function UF(t,e){return{...t,...e}}function _o(t,e,n){let o=e.map(r=>{let i=UF(n,r.options);return t.addEventListener(r.eventName,r.fn,i),function(){t.removeEventListener(r.eventName,r.fn,i)}});return function(){o.forEach(i=>{i()})}}var KF=!0,l0="Invariant failed",is=class extends Error{};is.prototype.toString=function(){return this.message};function j(t,e){throw KF?new is(l0):new is(`${l0}: ${e||""}`)}var kg=class extends rt.Component{constructor(...e){super(...e),this.callbacks=null,this.unbind=ci,this.onWindowError=n=>{let o=this.getCallbacks();o.isDragging()&&o.tryAbort(),n.error instanceof is&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=_o(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(e){if(e instanceof is){this.setState({});return}throw e}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}},jF=`
29
- Press space bar to start a drag.
30
- When dragging you can use the arrow keys to move the item around and escape to cancel.
31
- Some screen readers may require you to be in focus mode or to use your pass through key
32
- `,_u=t=>t+1,VF=t=>`
33
- You have lifted an item in position ${_u(t.source.index)}
34
- `,P0=(t,e)=>{let n=t.droppableId===e.droppableId,o=_u(t.index),r=_u(e.index);return n?`
35
- You have moved the item from position ${o}
36
- to position ${r}
37
- `:`
38
- You have moved the item from position ${o}
39
- in list ${t.droppableId}
40
- to list ${e.droppableId}
41
- in position ${r}
42
- `},F0=(t,e,n)=>e.droppableId===n.droppableId?`
43
- The item ${t}
44
- has been combined with ${n.draggableId}`:`
45
- The item ${t}
46
- in list ${e.droppableId}
47
- has been combined with ${n.draggableId}
48
- in list ${n.droppableId}
49
- `,WF=t=>{let e=t.destination;if(e)return P0(t.source,e);let n=t.combine;return n?F0(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},c0=t=>`
50
- The item has returned to its starting position
51
- of ${_u(t.index)}
52
- `,GF=t=>{if(t.reason==="CANCEL")return`
53
- Movement cancelled.
54
- ${c0(t.source)}
55
- `;let e=t.destination,n=t.combine;return e?`
56
- You have dropped the item.
57
- ${P0(t.source,e)}
58
- `:n?`
59
- You have dropped the item.
60
- ${F0(t.draggableId,t.source,n)}
61
- `:`
62
- The item has been dropped while not over a drop area.
63
- ${c0(t.source)}
64
- `},mu={dragHandleUsageInstructions:jF,onDragStart:VF,onDragUpdate:WF,onDragEnd:GF};function YF(t,e){return!!(t===e||Number.isNaN(t)&&Number.isNaN(e))}function B0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!YF(t[n],e[n]))return!1;return!0}function Fe(t,e){let n=L(()=>({inputs:e,result:t()}))[0],o=q(!0),r=q(n),s=o.current||!!(e&&r.current.inputs&&B0(e,r.current.inputs))?r.current:{inputs:e,result:t()};return P(()=>{o.current=!1,r.current=s},[s]),s.result}function de(t,e){return Fe(()=>t,e)}var Wt={x:0,y:0},rn=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),Xn=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),di=(t,e)=>t.x===e.x&&t.y===e.y,pa=t=>({x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}),ss=(t,e,n=0)=>t==="x"?{x:e,y:n}:{x:n,y:e},Wl=(t,e)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),d0=(t,e)=>Math.min(...e.map(n=>Wl(t,n))),$0=t=>e=>({x:t(e.x),y:t(e.y)}),qF=(t,e)=>{let n=mo({top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left)});return n.width<=0||n.height<=0?null:n},Ql=(t,e)=>({top:t.top+e.y,left:t.left+e.x,bottom:t.bottom+e.y,right:t.right+e.x}),u0=t=>[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}],JF={top:0,right:0,bottom:0,left:0},XF=(t,e)=>e?Ql(t,e.scroll.diff.displacement):t,ZF=(t,e,n)=>n&&n.increasedBy?{...t,[e.end]:t[e.end]+n.increasedBy[e.line]}:t,QF=(t,e)=>e&&e.shouldClipSubject?qF(e.pageMarginBox,t):mo(t),ca=({page:t,withPlaceholder:e,axis:n,frame:o})=>{let r=XF(t.marginBox,o),i=ZF(r,n,e),s=QF(i,o);return{page:t,withPlaceholder:e,active:s}},Rg=(t,e)=>{t.frame||j();let n=t.frame,o=Xn(e,n.scroll.initial),r=pa(o),i={...n,scroll:{initial:n.scroll.initial,current:e,diff:{value:o,displacement:r},max:n.scroll.max}},s=ca({page:t.subject.page,withPlaceholder:t.subject.withPlaceholder,axis:t.axis,frame:i});return{...t,frame:i,subject:s}};function Vt(t,e=B0){let n=null;function o(...r){if(n&&n.lastThis===this&&e(r,n.lastArgs))return n.lastResult;let i=t.apply(this,r);return n={lastResult:i,lastArgs:r,lastThis:this},i}return o.clear=function(){n=null},o}var z0=Vt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),H0=Vt(t=>t.reduce((e,n)=>(e[n.descriptor.id]=n,e),{})),xu=Vt(t=>Object.values(t)),eB=Vt(t=>Object.values(t)),fa=Vt((t,e)=>eB(e).filter(o=>t===o.descriptor.droppableId).sort((o,r)=>o.descriptor.index-r.descriptor.index));function Pg(t){return t.at&&t.at.type==="REORDER"?t.at.destination:null}function vu(t){return t.at&&t.at.type==="COMBINE"?t.at.combine:null}var Cu=Vt((t,e)=>e.filter(n=>n.descriptor.id!==t.descriptor.id)),tB=({isMovingForward:t,draggable:e,destination:n,insideDestination:o,previousImpact:r})=>{if(!n.isCombineEnabled||!Pg(r))return null;function s(h){let g={type:"COMBINE",combine:{draggableId:h,droppableId:n.descriptor.id}};return{...r,at:g}}let a=r.displaced.all,l=a.length?a[0]:null;if(t)return l?s(l):null;let c=Cu(e,o);if(!l){if(!c.length)return null;let h=c[c.length-1];return s(h.descriptor.id)}let d=c.findIndex(h=>h.descriptor.id===l);d===-1&&j();let u=d-1;if(u<0)return null;let p=c[u];return s(p.descriptor.id)},ha=(t,e)=>t.descriptor.droppableId===e.descriptor.id,U0={point:Wt,value:0},Gl={invisible:{},visible:{},all:[]},nB={displaced:Gl,displacedBy:U0,at:null},bo=(t,e)=>n=>t<=n&&n<=e,K0=t=>{let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return o=>{if(e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right))return!0;let i=e(o.top)||e(o.bottom),s=n(o.left)||n(o.right);if(i&&s)return!0;let l=o.top<t.top&&o.bottom>t.bottom,c=o.left<t.left&&o.right>t.right;return l&&c?!0:l&&s||c&&i}},oB=t=>{let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return o=>e(o.top)&&e(o.bottom)&&n(o.left)&&n(o.right)},Fg={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},j0={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},rB=t=>e=>{let n=bo(e.top,e.bottom),o=bo(e.left,e.right);return r=>t===Fg?n(r.top)&&n(r.bottom):o(r.left)&&o(r.right)},iB=(t,e)=>{let n=e.frame?e.frame.scroll.diff.displacement:Wt;return Ql(t,n)},sB=(t,e,n)=>e.subject.active?n(e.subject.active)(t):!1,aB=(t,e,n)=>n(e)(t),Bg=({target:t,destination:e,viewport:n,withDroppableDisplacement:o,isVisibleThroughFrameFn:r})=>{let i=o?iB(t,e):t;return sB(i,e,r)&&aB(i,n,r)},lB=t=>Bg({...t,isVisibleThroughFrameFn:K0}),V0=t=>Bg({...t,isVisibleThroughFrameFn:oB}),cB=t=>Bg({...t,isVisibleThroughFrameFn:rB(t.destination.axis)}),dB=(t,e,n)=>{if(typeof n=="boolean")return n;if(!e)return!0;let{invisible:o,visible:r}=e;if(o[t])return!1;let i=r[t];return i?i.shouldAnimate:!0};function uB(t,e){let n=t.page.marginBox,o={top:e.point.y,right:0,bottom:0,left:e.point.x};return mo(uu(n,o))}function Yl({afterDragging:t,destination:e,displacedBy:n,viewport:o,forceShouldAnimate:r,last:i}){return t.reduce(function(a,l){let c=uB(l,n),d=l.descriptor.id;if(a.all.push(d),!lB({target:c,destination:e,viewport:o,withDroppableDisplacement:!0}))return a.invisible[l.descriptor.id]=!0,a;let p=dB(d,i,r),h={draggableId:d,shouldAnimate:p};return a.visible[d]=h,a},{all:[],visible:{},invisible:{}})}function pB(t,e){if(!t.length)return 0;let n=t[t.length-1].descriptor.index;return e.inHomeList?n:n+1}function p0({insideDestination:t,inHomeList:e,displacedBy:n,destination:o}){let r=pB(t,{inHomeList:e});return{displaced:Gl,displacedBy:n,at:{type:"REORDER",destination:{droppableId:o.descriptor.id,index:r}}}}function bu({draggable:t,insideDestination:e,destination:n,viewport:o,displacedBy:r,last:i,index:s,forceShouldAnimate:a}){let l=ha(t,n);if(s==null)return p0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let c=e.find(g=>g.descriptor.index===s);if(!c)return p0({insideDestination:e,inHomeList:l,displacedBy:r,destination:n});let d=Cu(t,e),u=e.indexOf(c),p=d.slice(u);return{displaced:Yl({afterDragging:p,destination:n,displacedBy:r,last:i,viewport:o.frame,forceShouldAnimate:a}),displacedBy:r,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:s}}}}function ui(t,e){return!!e.effected[t]}var fB=({isMovingForward:t,destination:e,draggables:n,combine:o,afterCritical:r})=>{if(!e.isCombineEnabled)return null;let i=o.draggableId,a=n[i].descriptor.index;return ui(i,r)?t?a:a-1:t?a+1:a},hB=({isMovingForward:t,isInHomeList:e,insideDestination:n,location:o})=>{if(!n.length)return null;let r=o.index,i=t?r+1:r-1,s=n[0].descriptor.index,a=n[n.length-1].descriptor.index,l=e?a:a+1;return i<s||i>l?null:i},gB=({isMovingForward:t,isInHomeList:e,draggable:n,draggables:o,destination:r,insideDestination:i,previousImpact:s,viewport:a,afterCritical:l})=>{let c=s.at;if(c||j(),c.type==="REORDER"){let u=hB({isMovingForward:t,isInHomeList:e,location:c.destination,insideDestination:i});return u==null?null:bu({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:u})}let d=fB({isMovingForward:t,destination:r,displaced:s.displaced,draggables:o,combine:c.combine,afterCritical:l});return d==null?null:bu({draggable:n,insideDestination:i,destination:r,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:d})},mB=({displaced:t,afterCritical:e,combineWith:n,displacedBy:o})=>{let r=!!(t.visible[n]||t.invisible[n]);return ui(n,e)?r?Wt:pa(o.point):r?o.point:Wt},_B=({afterCritical:t,impact:e,draggables:n})=>{let o=vu(e);o||j();let r=o.draggableId,i=n[r].page.borderBox.center,s=mB({displaced:e.displaced,afterCritical:t,combineWith:r,displacedBy:e.displacedBy});return rn(i,s)},W0=(t,e)=>e.margin[t.start]+e.borderBox[t.size]/2,bB=(t,e)=>e.margin[t.end]+e.borderBox[t.size]/2,$g=(t,e,n)=>e[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2,f0=({axis:t,moveRelativeTo:e,isMoving:n})=>ss(t.line,e.marginBox[t.end]+W0(t,n),$g(t,e.marginBox,n)),h0=({axis:t,moveRelativeTo:e,isMoving:n})=>ss(t.line,e.marginBox[t.start]-bB(t,n),$g(t,e.marginBox,n)),yB=({axis:t,moveInto:e,isMoving:n})=>ss(t.line,e.contentBox[t.start]+W0(t,n),$g(t,e.contentBox,n)),xB=({impact:t,draggable:e,draggables:n,droppable:o,afterCritical:r})=>{let i=fa(o.descriptor.id,n),s=e.page,a=o.axis;if(!i.length)return yB({axis:a,moveInto:o.page,isMoving:s});let{displaced:l,displacedBy:c}=t,d=l.all[0];if(d){let p=n[d];if(ui(d,r))return h0({axis:a,moveRelativeTo:p.page,isMoving:s});let h=$l(p.page,c.point);return h0({axis:a,moveRelativeTo:h,isMoving:s})}let u=i[i.length-1];if(u.descriptor.id===e.descriptor.id)return s.borderBox.center;if(ui(u.descriptor.id,r)){let p=$l(u.page,pa(r.displacedBy.point));return f0({axis:a,moveRelativeTo:p,isMoving:s})}return f0({axis:a,moveRelativeTo:u.page,isMoving:s})},Ng=(t,e)=>{let n=t.frame;return n?rn(e,n.scroll.diff.displacement):e},vB=({impact:t,draggable:e,droppable:n,draggables:o,afterCritical:r})=>{let i=e.page.borderBox.center,s=t.at;return!n||!s?i:s.type==="REORDER"?xB({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:r}):_B({impact:t,draggables:o,afterCritical:r})},Eu=t=>{let e=vB(t),n=t.droppable;return n?Ng(n,e):e},G0=(t,e)=>{let n=Xn(e,t.scroll.initial),o=pa(n);return{frame:mo({top:e.y,bottom:e.y+t.frame.height,left:e.x,right:e.x+t.frame.width}),scroll:{initial:t.scroll.initial,max:t.scroll.max,current:e,diff:{value:n,displacement:o}}}};function g0(t,e){return t.map(n=>e[n])}function CB(t,e){for(let n=0;n<e.length;n++){let o=e[n].visible[t];if(o)return o}return null}var EB=({impact:t,viewport:e,destination:n,draggables:o,maxScrollChange:r})=>{let i=G0(e,rn(e.scroll.current,r)),s=n.frame?Rg(n,rn(n.frame.scroll.current,r)):n,a=t.displaced,l=Yl({afterDragging:g0(a.all,o),destination:n,displacedBy:t.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),c=Yl({afterDragging:g0(a.all,o),destination:s,displacedBy:t.displacedBy,viewport:e.frame,last:a,forceShouldAnimate:!1}),d={},u={},p=[a,l,c];return a.all.forEach(g=>{let m=CB(g,p);if(m){u[g]=m;return}d[g]=!0}),{...t,displaced:{all:a.all,invisible:d,visible:u}}},wB=(t,e)=>rn(t.scroll.diff.displacement,e),zg=({pageBorderBoxCenter:t,draggable:e,viewport:n})=>{let o=wB(n,t),r=Xn(o,e.page.borderBox.center);return rn(e.client.borderBox.center,r)},Y0=({draggable:t,destination:e,newPageBorderBoxCenter:n,viewport:o,withDroppableDisplacement:r,onlyOnMainAxis:i=!1})=>{let s=Xn(n,t.page.borderBox.center),l={target:Ql(t.page.borderBox,s),destination:e,withDroppableDisplacement:r,viewport:o};return i?cB(l):V0(l)},TB=({isMovingForward:t,draggable:e,destination:n,draggables:o,previousImpact:r,viewport:i,previousPageBorderBoxCenter:s,previousClientSelection:a,afterCritical:l})=>{if(!n.isEnabled)return null;let c=fa(n.descriptor.id,o),d=ha(e,n),u=tB({isMovingForward:t,draggable:e,destination:n,insideDestination:c,previousImpact:r})||gB({isMovingForward:t,isInHomeList:d,draggable:e,draggables:o,destination:n,insideDestination:c,previousImpact:r,viewport:i,afterCritical:l});if(!u)return null;let p=Eu({impact:u,draggable:e,droppable:n,draggables:o,afterCritical:l});if(Y0({draggable:e,destination:n,newPageBorderBoxCenter:p,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:zg({pageBorderBoxCenter:p,draggable:e,viewport:i}),impact:u,scrollJumpRequest:null};let g=Xn(p,s),m=EB({impact:u,viewport:i,destination:n,draggables:o,maxScrollChange:g});return{clientSelection:a,impact:m,scrollJumpRequest:g}},yn=t=>{let e=t.subject.active;return e||j(),e},SB=({isMovingForward:t,pageBorderBoxCenter:e,source:n,droppables:o,viewport:r})=>{let i=n.subject.active;if(!i)return null;let s=n.axis,a=bo(i[s.start],i[s.end]),l=xu(o).filter(d=>d!==n).filter(d=>d.isEnabled).filter(d=>!!d.subject.active).filter(d=>K0(r.frame)(yn(d))).filter(d=>{let u=yn(d);return t?i[s.crossAxisEnd]<u[s.crossAxisEnd]:u[s.crossAxisStart]<i[s.crossAxisStart]}).filter(d=>{let u=yn(d),p=bo(u[s.start],u[s.end]);return a(u[s.start])||a(u[s.end])||p(i[s.start])||p(i[s.end])}).sort((d,u)=>{let p=yn(d)[s.crossAxisStart],h=yn(u)[s.crossAxisStart];return t?p-h:h-p}).filter((d,u,p)=>yn(d)[s.crossAxisStart]===yn(p[0])[s.crossAxisStart]);if(!l.length)return null;if(l.length===1)return l[0];let c=l.filter(d=>bo(yn(d)[s.start],yn(d)[s.end])(e[s.line]));return c.length===1?c[0]:c.length>1?c.sort((d,u)=>yn(d)[s.start]-yn(u)[s.start])[0]:l.sort((d,u)=>{let p=d0(e,u0(yn(d))),h=d0(e,u0(yn(u)));return p!==h?p-h:yn(d)[s.start]-yn(u)[s.start]})[0]},m0=(t,e)=>{let n=t.page.borderBox.center;return ui(t.descriptor.id,e)?Xn(n,e.displacedBy.point):n},kB=(t,e)=>{let n=t.page.borderBox;return ui(t.descriptor.id,e)?Ql(n,pa(e.displacedBy.point)):n},NB=({pageBorderBoxCenter:t,viewport:e,destination:n,insideDestination:o,afterCritical:r})=>o.filter(s=>V0({target:kB(s,r),destination:n,viewport:e.frame,withDroppableDisplacement:!0})).sort((s,a)=>{let l=Wl(t,Ng(n,m0(s,r))),c=Wl(t,Ng(n,m0(a,r)));return l<c?-1:c<l?1:s.descriptor.index-a.descriptor.index})[0]||null,ec=Vt(function(e,n){let o=n[e.line];return{value:o,point:ss(e.line,o)}}),DB=(t,e,n)=>{let o=t.axis;if(t.descriptor.mode==="virtual")return ss(o.line,e[o.line]);let r=t.subject.page.contentBox[o.size],l=fa(t.descriptor.id,n).reduce((c,d)=>c+d.client.marginBox[o.size],0)+e[o.line]-r;return l<=0?null:ss(o.line,l)},q0=(t,e)=>({...t,scroll:{...t.scroll,max:e}}),J0=(t,e,n)=>{let o=t.frame;ha(e,t)&&j(),t.subject.withPlaceholder&&j();let r=ec(t.axis,e.displaceBy).point,i=DB(t,r,n),s={placeholderSize:r,increasedBy:i,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!o){let d=ca({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:t.frame});return{...t,subject:d}}let a=i?rn(o.scroll.max,i):o.scroll.max,l=q0(o,a),c=ca({page:t.subject.page,withPlaceholder:s,axis:t.axis,frame:l});return{...t,subject:c,frame:l}},OB=t=>{let e=t.subject.withPlaceholder;e||j();let n=t.frame;if(!n){let s=ca({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return{...t,subject:s}}let o=e.oldFrameMaxScroll;o||j();let r=q0(n,o),i=ca({page:t.subject.page,axis:t.axis,frame:r,withPlaceholder:null});return{...t,subject:i,frame:r}},IB=({previousPageBorderBoxCenter:t,moveRelativeTo:e,insideDestination:n,draggable:o,draggables:r,destination:i,viewport:s,afterCritical:a})=>{if(!e){if(n.length)return null;let u={displaced:Gl,displacedBy:U0,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},p=Eu({impact:u,draggable:o,droppable:i,draggables:r,afterCritical:a}),h=ha(o,i)?i:J0(i,o,r);return Y0({draggable:o,destination:h,newPageBorderBoxCenter:p,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?u:null}let l=t[i.axis.line]<=e.page.borderBox.center[i.axis.line],c=(()=>{let u=e.descriptor.index;return e.descriptor.id===o.descriptor.id||l?u:u+1})(),d=ec(i.axis,o.displaceBy);return bu({draggable:o,insideDestination:n,destination:i,viewport:s,displacedBy:d,last:Gl,index:c})},AB=({isMovingForward:t,previousPageBorderBoxCenter:e,draggable:n,isOver:o,draggables:r,droppables:i,viewport:s,afterCritical:a})=>{let l=SB({isMovingForward:t,pageBorderBoxCenter:e,source:o,droppables:i,viewport:s});if(!l)return null;let c=fa(l.descriptor.id,r),d=NB({pageBorderBoxCenter:e,viewport:s,destination:l,insideDestination:c,afterCritical:a}),u=IB({previousPageBorderBoxCenter:e,destination:l,draggable:n,draggables:r,moveRelativeTo:d,insideDestination:c,viewport:s,afterCritical:a});if(!u)return null;let p=Eu({impact:u,draggable:n,droppable:l,draggables:r,afterCritical:a});return{clientSelection:zg({pageBorderBoxCenter:p,draggable:n,viewport:s}),impact:u,scrollJumpRequest:null}},Zn=t=>{let e=t.at;return e?e.type==="REORDER"?e.destination.droppableId:e.combine.droppableId:null},MB=(t,e)=>{let n=Zn(t);return n?e[n]:null},LB=({state:t,type:e})=>{let n=MB(t.impact,t.dimensions.droppables),o=!!n,r=t.dimensions.droppables[t.critical.droppable.id],i=n||r,s=i.axis.direction,a=s==="vertical"&&(e==="MOVE_UP"||e==="MOVE_DOWN")||s==="horizontal"&&(e==="MOVE_LEFT"||e==="MOVE_RIGHT");if(a&&!o)return null;let l=e==="MOVE_DOWN"||e==="MOVE_RIGHT",c=t.dimensions.draggables[t.critical.draggable.id],d=t.current.page.borderBoxCenter,{draggables:u,droppables:p}=t.dimensions;return a?TB({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:u,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):AB({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:u,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function rs(t){return t.phase==="DRAGGING"||t.phase==="COLLECTING"}function X0(t){let e=bo(t.top,t.bottom),n=bo(t.left,t.right);return function(r){return e(r.y)&&n(r.x)}}function RB(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function PB({pageBorderBox:t,draggable:e,candidates:n}){let o=e.page.borderBox.center,r=n.map(i=>{let s=i.axis,a=ss(i.axis.line,t.center[s.line],i.page.borderBox.center[s.crossAxisLine]);return{id:i.descriptor.id,distance:Wl(o,a)}}).sort((i,s)=>s.distance-i.distance);return r[0]?r[0].id:null}function FB({pageBorderBox:t,draggable:e,droppables:n}){let o=xu(n).filter(r=>{if(!r.isEnabled)return!1;let i=r.subject.active;if(!i||!RB(t,i))return!1;if(X0(i)(t.center))return!0;let s=r.axis,a=i.center[s.crossAxisLine],l=t[s.crossAxisStart],c=t[s.crossAxisEnd],d=bo(i[s.crossAxisStart],i[s.crossAxisEnd]),u=d(l),p=d(c);return!u&&!p?!0:u?l<a:c>a});return o.length?o.length===1?o[0].descriptor.id:PB({pageBorderBox:t,draggable:e,candidates:o}):null}var Z0=(t,e)=>mo(Ql(t,e)),BB=(t,e)=>{let n=t.frame;return n?Z0(e,n.scroll.diff.value):e};function Q0({displaced:t,id:e}){return!!(t.visible[e]||t.invisible[e])}function $B({draggable:t,closest:e,inHomeList:n}){return e?n&&e.descriptor.index>t.descriptor.index?e.descriptor.index-1:e.descriptor.index:null}var zB=({pageBorderBoxWithDroppableScroll:t,draggable:e,destination:n,insideDestination:o,last:r,viewport:i,afterCritical:s})=>{let a=n.axis,l=ec(n.axis,e.displaceBy),c=l.value,d=t[a.start],u=t[a.end],h=Cu(e,o).find(m=>{let _=m.descriptor.id,b=m.page.borderBox.center[a.line],y=ui(_,s),v=Q0({displaced:r,id:_});return y?v?u<=b:d<b-c:v?u<=b+c:d<b})||null,g=$B({draggable:e,closest:h,inHomeList:ha(e,n)});return bu({draggable:e,insideDestination:o,destination:n,viewport:i,last:r,displacedBy:l,index:g})},HB=4,UB=({draggable:t,pageBorderBoxWithDroppableScroll:e,previousImpact:n,destination:o,insideDestination:r,afterCritical:i})=>{if(!o.isCombineEnabled)return null;let s=o.axis,a=ec(o.axis,t.displaceBy),l=a.value,c=e[s.start],d=e[s.end],p=Cu(t,r).find(g=>{let m=g.descriptor.id,_=g.page.borderBox,y=_[s.size]/HB,v=ui(m,i),x=Q0({displaced:n.displaced,id:m});return v?x?d>_[s.start]+y&&d<_[s.end]-y:c>_[s.start]-l+y&&c<_[s.end]-l-y:x?d>_[s.start]+l+y&&d<_[s.end]+l-y:c>_[s.start]+y&&c<_[s.end]-y});return p?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:o.descriptor.id}}}:null},eT=({pageOffset:t,draggable:e,draggables:n,droppables:o,previousImpact:r,viewport:i,afterCritical:s})=>{let a=Z0(e.page.borderBox,t),l=FB({pageBorderBox:a,draggable:e,droppables:o});if(!l)return nB;let c=o[l],d=fa(c.descriptor.id,n),u=BB(c,a);return UB({pageBorderBoxWithDroppableScroll:u,draggable:e,previousImpact:r,destination:c,insideDestination:d,afterCritical:s})||zB({pageBorderBoxWithDroppableScroll:u,draggable:e,destination:c,insideDestination:d,last:r.displaced,viewport:i,afterCritical:s})},Hg=(t,e)=>({...t,[e.descriptor.id]:e}),KB=({previousImpact:t,impact:e,droppables:n})=>{let o=Zn(t),r=Zn(e);if(!o||o===r)return n;let i=n[o];if(!i.subject.withPlaceholder)return n;let s=OB(i);return Hg(n,s)},jB=({draggable:t,draggables:e,droppables:n,previousImpact:o,impact:r})=>{let i=KB({previousImpact:o,impact:r,droppables:n}),s=Zn(r);if(!s)return i;let a=n[s];if(ha(t,a)||a.subject.withPlaceholder)return i;let l=J0(a,t,e);return Hg(i,l)},jl=({state:t,clientSelection:e,dimensions:n,viewport:o,impact:r,scrollJumpRequest:i})=>{let s=o||t.viewport,a=n||t.dimensions,l=e||t.current.client.selection,c=Xn(l,t.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:rn(t.initial.client.borderBoxCenter,c)},u={selection:rn(d.selection,s.scroll.current),borderBoxCenter:rn(d.borderBoxCenter,s.scroll.current),offset:rn(d.offset,s.scroll.diff.value)},p={client:d,page:u};if(t.phase==="COLLECTING")return{...t,dimensions:a,viewport:s,current:p};let h=a.draggables[t.critical.draggable.id],g=r||eT({pageOffset:u.offset,draggable:h,draggables:a.draggables,droppables:a.droppables,previousImpact:t.impact,viewport:s,afterCritical:t.afterCritical}),m=jB({draggable:h,impact:g,previousImpact:t.impact,draggables:a.draggables,droppables:a.droppables});return{...t,current:p,dimensions:{draggables:a.draggables,droppables:m},impact:g,viewport:s,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function VB(t,e){return t.map(n=>e[n])}var tT=({impact:t,viewport:e,draggables:n,destination:o,forceShouldAnimate:r})=>{let i=t.displaced,s=VB(i.all,n),a=Yl({afterDragging:s,destination:o,displacedBy:t.displacedBy,viewport:e.frame,forceShouldAnimate:r,last:i});return{...t,displaced:a}},nT=({impact:t,draggable:e,droppable:n,draggables:o,viewport:r,afterCritical:i})=>{let s=Eu({impact:t,draggable:e,draggables:o,droppable:n,afterCritical:i});return zg({pageBorderBoxCenter:s,draggable:e,viewport:r})},oT=({state:t,dimensions:e,viewport:n})=>{t.movementMode!=="SNAP"&&j();let o=t.impact,r=n||t.viewport,i=e||t.dimensions,{draggables:s,droppables:a}=i,l=s[t.critical.draggable.id],c=Zn(o);c||j();let d=a[c],u=tT({impact:o,viewport:r,destination:d,draggables:s}),p=nT({impact:u,draggable:l,droppable:d,draggables:s,viewport:r,afterCritical:t.afterCritical});return jl({impact:u,clientSelection:p,state:t,dimensions:i,viewport:r})},WB=t=>({index:t.index,droppableId:t.droppableId}),rT=({draggable:t,home:e,draggables:n,viewport:o})=>{let r=ec(e.axis,t.displaceBy),i=fa(e.descriptor.id,n),s=i.indexOf(t);s===-1&&j();let a=i.slice(s+1),l=a.reduce((p,h)=>(p[h.descriptor.id]=!0,p),{}),c={inVirtualList:e.descriptor.mode==="virtual",displacedBy:r,effected:l};return{impact:{displaced:Yl({afterDragging:a,destination:e,displacedBy:r,last:null,viewport:o.frame,forceShouldAnimate:!1}),displacedBy:r,at:{type:"REORDER",destination:WB(t.descriptor)}},afterCritical:c}},GB=(t,e)=>({draggables:t.draggables,droppables:Hg(t.droppables,e)}),tc=t=>{},nc=t=>{},YB=({draggable:t,offset:e,initialWindowScroll:n})=>{let o=$l(t.client,e),r=zl(o,n);return{...t,placeholder:{...t.placeholder,client:o},client:o,page:r}},qB=t=>{let e=t.frame;return e||j(),e},JB=({additions:t,updatedDroppables:e,viewport:n})=>{let o=n.scroll.diff.value;return t.map(r=>{let i=r.descriptor.droppableId,s=e[i],l=qB(s).scroll.diff.value,c=rn(o,l);return YB({draggable:r,offset:c,initialWindowScroll:n.scroll.initial})})},XB=({state:t,published:e})=>{tc();let n=e.modified.map(b=>{let y=t.dimensions.droppables[b.droppableId];return Rg(y,b.scroll)}),o={...t.dimensions.droppables,...z0(n)},r=H0(JB({additions:e.additions,updatedDroppables:o,viewport:t.viewport})),i={...t.dimensions.draggables,...r};e.removals.forEach(b=>{delete i[b]});let s={droppables:o,draggables:i},a=Zn(t.impact),l=a?s.droppables[a]:null,c=s.draggables[t.critical.draggable.id],d=s.droppables[t.critical.droppable.id],{impact:u,afterCritical:p}=rT({draggable:c,home:d,draggables:i,viewport:t.viewport}),h=l&&l.isCombineEnabled?t.impact:u,g=eT({pageOffset:t.current.page.offset,draggable:s.draggables[t.critical.draggable.id],draggables:s.draggables,droppables:s.droppables,previousImpact:h,viewport:t.viewport,afterCritical:p});nc();let m={...t,phase:"DRAGGING",impact:g,onLiftImpact:u,dimensions:s,afterCritical:p,forceShouldAnimate:!1};return t.phase==="COLLECTING"?m:{...m,phase:"DROP_PENDING",reason:t.reason,isWaiting:!1}},Dg=t=>t.movementMode==="SNAP",_g=(t,e,n)=>{let o=GB(t.dimensions,e);return!Dg(t)||n?jl({state:t,dimensions:o}):oT({state:t,dimensions:o})};function bg(t){return t.isDragging&&t.movementMode==="SNAP"?{...t,scrollJumpRequest:null}:t}var _0={phase:"IDLE",completed:null,shouldFlush:!1},ZB=(t=_0,e)=>{if(e.type==="FLUSH")return{..._0,shouldFlush:!0};if(e.type==="INITIAL_PUBLISH"){t.phase!=="IDLE"&&j();let{critical:n,clientSelection:o,viewport:r,dimensions:i,movementMode:s}=e.payload,a=i.draggables[n.draggable.id],l=i.droppables[n.droppable.id],c={selection:o,borderBoxCenter:a.client.borderBox.center,offset:Wt},d={client:c,page:{selection:rn(c.selection,r.scroll.initial),borderBoxCenter:rn(c.selection,r.scroll.initial),offset:rn(c.selection,r.scroll.diff.value)}},u=xu(i.droppables).every(m=>!m.isFixedOnPage),{impact:p,afterCritical:h}=rT({draggable:a,home:l,draggables:i.draggables,viewport:r});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:s,dimensions:i,initial:d,current:d,isWindowScrollAllowed:u,impact:p,afterCritical:h,onLiftImpact:p,viewport:r,scrollJumpRequest:null,forceShouldAnimate:null}}if(e.type==="COLLECTION_STARTING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"?t:(t.phase!=="DRAGGING"&&j(),{...t,phase:"COLLECTING"});if(e.type==="PUBLISH_WHILE_DRAGGING")return t.phase==="COLLECTING"||t.phase==="DROP_PENDING"||j(),XB({state:t,published:e.payload});if(e.type==="MOVE"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{client:n}=e.payload;return di(n,t.current.client.selection)?t:jl({state:t,clientSelection:n,impact:Dg(t)?t.impact:null})}if(e.type==="UPDATE_DROPPABLE_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="COLLECTING")return bg(t);rs(t)||j();let{id:n,newScroll:o}=e.payload,r=t.dimensions.droppables[n];if(!r)return t;let i=Rg(r,o);return _g(t,i,!1)}if(e.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{id:n,isEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isEnabled===o&&j();let i={...r,isEnabled:o};return _g(t,i,!0)}if(e.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(t.phase==="DROP_PENDING")return t;rs(t)||j();let{id:n,isCombineEnabled:o}=e.payload,r=t.dimensions.droppables[n];r||j(),r.isCombineEnabled===o&&j();let i={...r,isCombineEnabled:o};return _g(t,i,!0)}if(e.type==="MOVE_BY_WINDOW_SCROLL"){if(t.phase==="DROP_PENDING"||t.phase==="DROP_ANIMATING")return t;rs(t)||j(),t.isWindowScrollAllowed||j();let n=e.payload.newScroll;if(di(t.viewport.scroll.current,n))return bg(t);let o=G0(t.viewport,n);return Dg(t)?oT({state:t,viewport:o}):jl({state:t,viewport:o})}if(e.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!rs(t))return t;let n=e.payload.maxScroll;if(di(n,t.viewport.scroll.max))return t;let o={...t.viewport,scroll:{...t.viewport.scroll,max:n}};return{...t,viewport:o}}if(e.type==="MOVE_UP"||e.type==="MOVE_DOWN"||e.type==="MOVE_LEFT"||e.type==="MOVE_RIGHT"){if(t.phase==="COLLECTING"||t.phase==="DROP_PENDING")return t;t.phase!=="DRAGGING"&&j();let n=LB({state:t,type:e.type});return n?jl({state:t,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):t}if(e.type==="DROP_PENDING"){let n=e.payload.reason;return t.phase!=="COLLECTING"&&j(),{...t,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(e.type==="DROP_ANIMATE"){let{completed:n,dropDuration:o,newHomeClientOffset:r}=e.payload;return t.phase==="DRAGGING"||t.phase==="DROP_PENDING"||j(),{phase:"DROP_ANIMATING",completed:n,dropDuration:o,newHomeClientOffset:r,dimensions:t.dimensions}}if(e.type==="DROP_COMPLETE"){let{completed:n}=e.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return t};function We(t,e){return t instanceof Object&&"type"in t&&t.type===e}var QB=t=>({type:"BEFORE_INITIAL_CAPTURE",payload:t}),e2=t=>({type:"LIFT",payload:t}),t2=t=>({type:"INITIAL_PUBLISH",payload:t}),n2=t=>({type:"PUBLISH_WHILE_DRAGGING",payload:t}),o2=()=>({type:"COLLECTION_STARTING",payload:null}),r2=t=>({type:"UPDATE_DROPPABLE_SCROLL",payload:t}),i2=t=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}),s2=t=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}),iT=t=>({type:"MOVE",payload:t}),a2=t=>({type:"MOVE_BY_WINDOW_SCROLL",payload:t}),l2=t=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}),c2=()=>({type:"MOVE_UP",payload:null}),d2=()=>({type:"MOVE_DOWN",payload:null}),u2=()=>({type:"MOVE_RIGHT",payload:null}),p2=()=>({type:"MOVE_LEFT",payload:null}),Ug=()=>({type:"FLUSH",payload:null}),f2=t=>({type:"DROP_ANIMATE",payload:t}),Kg=t=>({type:"DROP_COMPLETE",payload:t}),sT=t=>({type:"DROP",payload:t}),h2=t=>({type:"DROP_PENDING",payload:t}),aT=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var g2=t=>({getState:e,dispatch:n})=>o=>r=>{if(!We(r,"LIFT")){o(r);return}let{id:i,clientSelection:s,movementMode:a}=r.payload,l=e();l.phase==="DROP_ANIMATING"&&n(Kg({completed:l.completed})),e().phase!=="IDLE"&&j(),n(Ug()),n(QB({draggableId:i,movementMode:a}));let d={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:u,dimensions:p,viewport:h}=t.startPublishing(d);n(t2({critical:u,dimensions:p,clientSelection:s,movementMode:a,viewport:h}))},m2=t=>()=>e=>n=>{We(n,"INITIAL_PUBLISH")&&t.dragging(),We(n,"DROP_ANIMATE")&&t.dropping(n.payload.completed.result.reason),(We(n,"FLUSH")||We(n,"DROP_COMPLETE"))&&t.resting(),e(n)},jg={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},ql={opacity:{drop:0,combining:.7},scale:{drop:.75}},lT={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},os=`${lT.outOfTheWay}s ${jg.outOfTheWay}`,Vl={fluid:`opacity ${os}`,snap:`transform ${os}, opacity ${os}`,drop:t=>{let e=`${t}s ${jg.drop}`;return`transform ${e}, opacity ${e}`},outOfTheWay:`transform ${os}`,placeholder:`height ${os}, width ${os}, margin ${os}`},b0=t=>di(t,Wt)?void 0:`translate(${t.x}px, ${t.y}px)`,Og={moveTo:b0,drop:(t,e)=>{let n=b0(t);if(n)return e?`${n} scale(${ql.scale.drop})`:n}},{minDropTime:Ig,maxDropTime:cT}=lT,_2=cT-Ig,y0=1500,b2=.6,y2=({current:t,destination:e,reason:n})=>{let o=Wl(t,e);if(o<=0)return Ig;if(o>=y0)return cT;let r=o/y0,i=Ig+_2*r,s=n==="CANCEL"?i*b2:i;return Number(s.toFixed(2))},x2=({impact:t,draggable:e,dimensions:n,viewport:o,afterCritical:r})=>{let{draggables:i,droppables:s}=n,a=Zn(t),l=a?s[a]:null,c=s[e.descriptor.droppableId],d=nT({impact:t,draggable:e,draggables:i,afterCritical:r,droppable:l||c,viewport:o});return Xn(d,e.client.borderBox.center)},v2=({draggables:t,reason:e,lastImpact:n,home:o,viewport:r,onLiftImpact:i})=>!n.at||e!=="DROP"?{impact:tT({draggables:t,impact:i,destination:o,viewport:r,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Gl},didDropInsideDroppable:!0},C2=({getState:t,dispatch:e})=>n=>o=>{if(!We(o,"DROP")){n(o);return}let r=t(),i=o.payload.reason;if(r.phase==="COLLECTING"){e(h2({reason:i}));return}if(r.phase==="IDLE")return;r.phase==="DROP_PENDING"&&r.isWaiting&&j(),r.phase==="DRAGGING"||r.phase==="DROP_PENDING"||j();let a=r.critical,l=r.dimensions,c=l.draggables[r.critical.draggable.id],{impact:d,didDropInsideDroppable:u}=v2({reason:i,lastImpact:r.impact,afterCritical:r.afterCritical,onLiftImpact:r.onLiftImpact,home:r.dimensions.droppables[r.critical.droppable.id],viewport:r.viewport,draggables:r.dimensions.draggables}),p=u?Pg(d):null,h=u?vu(d):null,g={index:a.draggable.index,droppableId:a.droppable.id},m={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:i,mode:r.movementMode,destination:p,combine:h},_=x2({impact:d,draggable:c,dimensions:l,viewport:r.viewport,afterCritical:r.afterCritical}),b={critical:r.critical,afterCritical:r.afterCritical,result:m,impact:d};if(!(!di(r.current.client.offset,_)||!!m.combine)){e(Kg({completed:b}));return}let v=y2({current:r.current.client.offset,destination:_,reason:i});e(f2({newHomeClientOffset:_,dropDuration:v,completed:b}))},dT=()=>({x:window.pageXOffset,y:window.pageYOffset});function E2(t){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:e=>{e.target!==window&&e.target!==window.document||t()}}}function w2({onWindowScroll:t}){function e(){t(dT())}let n=la(e),o=E2(n),r=ci;function i(){return r!==ci}function s(){i()&&j(),r=_o(window,[o])}function a(){i()||j(),n.cancel(),r(),r=ci}return{start:s,stop:a,isActive:i}}var T2=t=>We(t,"DROP_COMPLETE")||We(t,"DROP_ANIMATE")||We(t,"FLUSH"),S2=t=>{let e=w2({onWindowScroll:n=>{t.dispatch(a2({newScroll:n}))}});return n=>o=>{!e.isActive()&&We(o,"INITIAL_PUBLISH")&&e.start(),e.isActive()&&T2(o)&&e.stop(),n(o)}},k2=t=>{let e=!1,n=!1,o=setTimeout(()=>{n=!0}),r=i=>{e||n||(e=!0,t(i),clearTimeout(o))};return r.wasCalled=()=>e,r},N2=()=>{let t=[],e=r=>{let i=t.findIndex(a=>a.timerId===r);i===-1&&j();let[s]=t.splice(i,1);s.callback()};return{add:r=>{let i=setTimeout(()=>e(i)),s={timerId:i,callback:r};t.push(s)},flush:()=>{if(!t.length)return;let r=[...t];t.length=0,r.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}},D2=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.droppableId===e.droppableId&&t.index===e.index,O2=(t,e)=>t==null&&e==null?!0:t==null||e==null?!1:t.draggableId===e.draggableId&&t.droppableId===e.droppableId,I2=(t,e)=>{if(t===e)return!0;let n=t.draggable.id===e.draggable.id&&t.draggable.droppableId===e.draggable.droppableId&&t.draggable.type===e.draggable.type&&t.draggable.index===e.draggable.index,o=t.droppable.id===e.droppable.id&&t.droppable.type===e.droppable.type;return n&&o},Hl=(t,e)=>{tc(),e(),nc()},fu=(t,e)=>({draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:e});function yg(t,e,n,o){if(!t){n(o(e));return}let r=k2(n);t(e,{announce:r}),r.wasCalled()||n(o(e))}var A2=(t,e)=>{let n=N2(),o=null,r=(u,p)=>{o&&j(),Hl("onBeforeCapture",()=>{let h=t().onBeforeCapture;h&&h({draggableId:u,mode:p})})},i=(u,p)=>{o&&j(),Hl("onBeforeDragStart",()=>{let h=t().onBeforeDragStart;h&&h(fu(u,p))})},s=(u,p)=>{o&&j();let h=fu(u,p);o={mode:p,lastCritical:u,lastLocation:h.source,lastCombine:null},n.add(()=>{Hl("onDragStart",()=>yg(t().onDragStart,h,e,mu.onDragStart))})},a=(u,p)=>{let h=Pg(p),g=vu(p);o||j();let m=!I2(u,o.lastCritical);m&&(o.lastCritical=u);let _=!D2(o.lastLocation,h);_&&(o.lastLocation=h);let b=!O2(o.lastCombine,g);if(b&&(o.lastCombine=g),!m&&!_&&!b)return;let y={...fu(u,o.mode),combine:g,destination:h};n.add(()=>{Hl("onDragUpdate",()=>yg(t().onDragUpdate,y,e,mu.onDragUpdate))})},l=()=>{o||j(),n.flush()},c=u=>{o||j(),o=null,Hl("onDragEnd",()=>yg(t().onDragEnd,u,e,mu.onDragEnd))};return{beforeCapture:r,beforeStart:i,start:s,update:a,flush:l,drop:c,abort:()=>{if(!o)return;let u={...fu(o.lastCritical,o.mode),combine:null,destination:null,reason:"CANCEL"};c(u)}}},M2=(t,e)=>{let n=A2(t,e);return o=>r=>i=>{if(We(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(We(i,"INITIAL_PUBLISH")){let a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),r(i),n.start(a,i.payload.movementMode);return}if(We(i,"DROP_COMPLETE")){let a=i.payload.completed.result;n.flush(),r(i),n.drop(a);return}if(r(i),We(i,"FLUSH")){n.abort();return}let s=o.getState();s.phase==="DRAGGING"&&n.update(s.critical,s.impact)}},L2=t=>e=>n=>{if(!We(n,"DROP_ANIMATION_FINISHED")){e(n);return}let o=t.getState();o.phase!=="DROP_ANIMATING"&&j(),t.dispatch(Kg({completed:o.completed}))},R2=t=>{let e=null,n=null;function o(){n&&(cancelAnimationFrame(n),n=null),e&&(e(),e=null)}return r=>i=>{if((We(i,"FLUSH")||We(i,"DROP_COMPLETE")||We(i,"DROP_ANIMATION_FINISHED"))&&o(),r(i),!We(i,"DROP_ANIMATE"))return;let s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){t.getState().phase==="DROP_ANIMATING"&&t.dispatch(aT())}};n=requestAnimationFrame(()=>{n=null,e=_o(window,[s])})}},P2=t=>()=>e=>n=>{(We(n,"DROP_COMPLETE")||We(n,"FLUSH")||We(n,"DROP_ANIMATE"))&&t.stopPublishing(),e(n)},F2=t=>{let e=!1;return()=>n=>o=>{if(We(o,"INITIAL_PUBLISH")){e=!0,t.tryRecordFocus(o.payload.critical.draggable.id),n(o),t.tryRestoreFocusRecorded();return}if(n(o),!!e){if(We(o,"FLUSH")){e=!1,t.tryRestoreFocusRecorded();return}if(We(o,"DROP_COMPLETE")){e=!1;let r=o.payload.completed.result;r.combine&&t.tryShiftRecord(r.draggableId,r.combine.draggableId),t.tryRestoreFocusRecorded()}}}},B2=t=>We(t,"DROP_COMPLETE")||We(t,"DROP_ANIMATE")||We(t,"FLUSH"),$2=t=>e=>n=>o=>{if(B2(o)){t.stop(),n(o);return}if(We(o,"INITIAL_PUBLISH")){n(o);let r=e.getState();r.phase!=="DRAGGING"&&j(),t.start(r);return}n(o),t.scroll(e.getState())},z2=t=>e=>n=>{if(e(n),!We(n,"PUBLISH_WHILE_DRAGGING"))return;let o=t.getState();o.phase==="DROP_PENDING"&&(o.isWaiting||t.dispatch(sT({reason:o.reason})))},H2=sg,U2=({dimensionMarshal:t,focusMarshal:e,styleMarshal:n,getResponders:o,announce:r,autoScroller:i})=>rg(ZB,H2(Uw(m2(n),P2(t),g2(t),C2,L2,R2,z2,$2(i),S2,F2(e),M2(o,r)))),xg=()=>({additions:{},removals:{},modified:{}});function K2({registry:t,callbacks:e}){let n=xg(),o=null,r=()=>{o||(e.collectionStarting(),o=requestAnimationFrame(()=>{o=null,tc();let{additions:l,removals:c,modified:d}=n,u=Object.keys(l).map(g=>t.draggable.getById(g).getDimension(Wt)).sort((g,m)=>g.descriptor.index-m.descriptor.index),p=Object.keys(d).map(g=>{let _=t.droppable.getById(g).callbacks.getScrollWhileDragging();return{droppableId:g,scroll:_}}),h={additions:u,removals:Object.keys(c),modified:p};n=xg(),nc(),e.publish(h)}))};return{add:l=>{let c=l.descriptor.id;n.additions[c]=l,n.modified[l.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],r()},remove:l=>{let c=l.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],r()},stop:()=>{o&&(cancelAnimationFrame(o),o=null,n=xg())}}}var uT=({scrollHeight:t,scrollWidth:e,height:n,width:o})=>{let r=Xn({x:e,y:t},{x:o,y:n});return{x:Math.max(0,r.x),y:Math.max(0,r.y)}},pT=()=>{let t=document.documentElement;return t||j(),t},fT=()=>{let t=pT();return uT({scrollHeight:t.scrollHeight,scrollWidth:t.scrollWidth,width:t.clientWidth,height:t.clientHeight})},j2=()=>{let t=dT(),e=fT(),n=t.y,o=t.x,r=pT(),i=r.clientWidth,s=r.clientHeight,a=o+i,l=n+s;return{frame:mo({top:n,left:o,right:a,bottom:l}),scroll:{initial:t,current:t,max:e,diff:{value:Wt,displacement:Wt}}}},V2=({critical:t,scrollOptions:e,registry:n})=>{tc();let o=j2(),r=o.scroll.current,i=t.droppable,s=n.droppable.getAllByType(i.type).map(d=>d.callbacks.getDimensionAndWatchScroll(r,e)),a=n.draggable.getAllByType(t.draggable.type).map(d=>d.getDimension(r)),l={draggables:H0(a),droppables:z0(s)};return nc(),{dimensions:l,critical:t,viewport:o}};function x0(t,e,n){return!(n.descriptor.id===e.id||n.descriptor.type!==e.type||t.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var W2=(t,e)=>{let n=null,o=K2({callbacks:{publish:e.publishWhileDragging,collectionStarting:e.collectionStarting},registry:t}),r=(p,h)=>{t.droppable.exists(p)||j(),n&&e.updateDroppableIsEnabled({id:p,isEnabled:h})},i=(p,h)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableIsCombineEnabled({id:p,isCombineEnabled:h}))},s=(p,h)=>{n&&(t.droppable.exists(p)||j(),e.updateDroppableScroll({id:p,newScroll:h}))},a=(p,h)=>{n&&t.droppable.getById(p).callbacks.scroll(h)},l=()=>{if(!n)return;o.stop();let p=n.critical.droppable;t.droppable.getAllByType(p.type).forEach(h=>h.callbacks.dragStopped()),n.unsubscribe(),n=null},c=p=>{n||j();let h=n.critical.draggable;p.type==="ADDITION"&&x0(t,h,p.value)&&o.add(p.value),p.type==="REMOVAL"&&x0(t,h,p.value)&&o.remove(p.value)};return{updateDroppableIsEnabled:r,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:s,startPublishing:p=>{n&&j();let h=t.draggable.getById(p.draggableId),g=t.droppable.getById(h.descriptor.droppableId),m={draggable:h.descriptor,droppable:g.descriptor},_=t.subscribe(c);return n={critical:m,unsubscribe:_},V2({critical:m,registry:t,scrollOptions:p.scrollOptions})},stopPublishing:l}},hT=(t,e)=>t.phase==="IDLE"?!0:t.phase!=="DROP_ANIMATING"||t.completed.result.draggableId===e?!1:t.completed.result.reason==="DROP",G2=t=>{window.scrollBy(t.x,t.y)},Y2=Vt(t=>xu(t).filter(e=>!(!e.isEnabled||!e.frame))),q2=(t,e)=>Y2(e).find(o=>(o.frame||j(),X0(o.frame.pageMarginBox)(t)))||null,J2=({center:t,destination:e,droppables:n})=>{if(e){let r=n[e];return r.frame?r:null}return q2(t,n)},Jl={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:t=>t**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1},X2=(t,e,n=()=>Jl)=>{let o=n(),r=t[e.size]*o.startFromPercentage,i=t[e.size]*o.maxScrollAtPercentage;return{startScrollingFrom:r,maxScrollValueAt:i}},gT=({startOfRange:t,endOfRange:e,current:n})=>{let o=e-t;return o===0?0:(n-t)/o},Vg=1,Z2=(t,e,n=()=>Jl)=>{let o=n();if(t>e.startScrollingFrom)return 0;if(t<=e.maxScrollValueAt)return o.maxPixelScroll;if(t===e.startScrollingFrom)return Vg;let i=1-gT({startOfRange:e.maxScrollValueAt,endOfRange:e.startScrollingFrom,current:t}),s=o.maxPixelScroll*o.ease(i);return Math.ceil(s)},Q2=(t,e,n)=>{let o=n(),r=o.durationDampening.accelerateAt,i=o.durationDampening.stopDampeningAt,s=e,a=i,c=Date.now()-s;if(c>=i)return t;if(c<r)return Vg;let d=gT({startOfRange:r,endOfRange:a,current:c}),u=t*o.ease(d);return Math.ceil(u)},v0=({distanceToEdge:t,thresholds:e,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:r})=>{let i=Z2(t,e,r);return i===0?0:o?Math.max(Q2(i,n,r),Vg):i},C0=({container:t,distanceToEdges:e,dragStartTime:n,axis:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=X2(t,o,i);return e[o.end]<e[o.start]?v0({distanceToEdge:e[o.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i}):-1*v0({distanceToEdge:e[o.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i})},e$=({container:t,subject:e,proposedScroll:n})=>{let o=e.height>t.height,r=e.width>t.width;return!r&&!o?n:r&&o?null:{x:r?0:n.x,y:o?0:n.y}},t$=$0(t=>t===0?0:t),mT=({dragStartTime:t,container:e,subject:n,center:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s={top:o.y-e.top,right:e.right-o.x,bottom:e.bottom-o.y,left:o.x-e.left},a=C0({container:e,distanceToEdges:s,dragStartTime:t,axis:Fg,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),l=C0({container:e,distanceToEdges:s,dragStartTime:t,axis:j0,shouldUseTimeDampening:r,getAutoScrollerOptions:i}),c=t$({x:l,y:a});if(di(c,Wt))return null;let d=e$({container:e,subject:n,proposedScroll:c});return d?di(d,Wt)?null:d:null},n$=$0(t=>t===0?0:t>0?1:-1),Wg=(()=>{let t=(e,n)=>e<0?e:e>n?e-n:0;return({current:e,max:n,change:o})=>{let r=rn(e,o),i={x:t(r.x,n.x),y:t(r.y,n.y)};return di(i,Wt)?null:i}})(),_T=({max:t,current:e,change:n})=>{let o={x:Math.max(e.x,t.x),y:Math.max(e.y,t.y)},r=n$(n),i=Wg({max:o,current:e,change:r});return!i||r.x!==0&&i.x===0||r.y!==0&&i.y===0},Gg=(t,e)=>_T({current:t.scroll.current,max:t.scroll.max,change:e}),o$=(t,e)=>{if(!Gg(t,e))return null;let n=t.scroll.max,o=t.scroll.current;return Wg({current:o,max:n,change:e})},Yg=(t,e)=>{let n=t.frame;return n?_T({current:n.scroll.current,max:n.scroll.max,change:e}):!1},r$=(t,e)=>{let n=t.frame;return!n||!Yg(t,e)?null:Wg({current:n.scroll.current,max:n.scroll.max,change:e})},i$=({viewport:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=mT({dragStartTime:o,container:t.frame,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return s&&Gg(t,s)?s:null},s$=({droppable:t,subject:e,center:n,dragStartTime:o,shouldUseTimeDampening:r,getAutoScrollerOptions:i})=>{let s=t.frame;if(!s)return null;let a=mT({dragStartTime:o,container:s.pageMarginBox,subject:e,center:n,shouldUseTimeDampening:r,getAutoScrollerOptions:i});return a&&Yg(t,a)?a:null},E0=({state:t,dragStartTime:e,shouldUseTimeDampening:n,scrollWindow:o,scrollDroppable:r,getAutoScrollerOptions:i})=>{let s=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){let u=t.viewport,p=i$({dragStartTime:e,viewport:u,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(p){o(p);return}}let c=J2({center:s,destination:Zn(t.impact),droppables:t.dimensions.droppables});if(!c)return;let d=s$({dragStartTime:e,droppable:c,subject:l,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});d&&r(c.descriptor.id,d)},a$=({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:n=()=>Jl})=>{let o=la(t),r=la(e),i=null,s=c=>{i||j();let{shouldUseTimeDampening:d,dragStartTime:u}=i;E0({state:c,scrollWindow:o,scrollDroppable:r,dragStartTime:u,shouldUseTimeDampening:d,getAutoScrollerOptions:n})};return{start:c=>{tc(),i&&j();let d=Date.now(),u=!1,p=()=>{u=!0};E0({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p,getAutoScrollerOptions:n}),i={dragStartTime:d,shouldUseTimeDampening:u},nc(),u&&s(c)},stop:()=>{i&&(o.cancel(),r.cancel(),i=null)},scroll:s}},l$=({move:t,scrollDroppable:e,scrollWindow:n})=>{let o=(a,l)=>{let c=rn(a.current.client.selection,l);t({client:c})},r=(a,l)=>{if(!Yg(a,l))return l;let c=r$(a,l);if(!c)return e(a.descriptor.id,l),null;let d=Xn(l,c);return e(a.descriptor.id,d),Xn(l,d)},i=(a,l,c)=>{if(!a||!Gg(l,c))return c;let d=o$(l,c);if(!d)return n(c),null;let u=Xn(c,d);return n(u),Xn(c,u)};return a=>{let l=a.scrollJumpRequest;if(!l)return;let c=Zn(a.impact);c||j();let d=r(a.dimensions.droppables[c],l);if(!d)return;let u=a.viewport,p=i(a.isWindowScrollAllowed,u,d);p&&o(a,p)}},c$=({scrollDroppable:t,scrollWindow:e,move:n,getAutoScrollerOptions:o})=>{let r=a$({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:o}),i=l$({move:n,scrollWindow:e,scrollDroppable:t});return{scroll:l=>{if(!(o().disabled||l.phase!=="DRAGGING")){if(l.movementMode==="FLUID"){r.scroll(l);return}l.scrollJumpRequest&&i(l)}},start:r.start,stop:r.stop}},da="data-rfd",ua=(()=>{let t=`${da}-drag-handle`;return{base:t,draggableId:`${t}-draggable-id`,contextId:`${t}-context-id`}})(),Ag=(()=>{let t=`${da}-draggable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),d$=(()=>{let t=`${da}-droppable`;return{base:t,contextId:`${t}-context-id`,id:`${t}-id`}})(),w0={contextId:`${da}-scroll-container-context-id`},u$=t=>e=>`[${e}="${t}"]`,Ul=(t,e)=>t.map(n=>{let o=n.styles[e];return o?`${n.selector} { ${o} }`:""}).join(" "),p$="pointer-events: none;",f$=t=>{let e=u$(t),n=(()=>{let a=`
65
- cursor: -webkit-grab;
66
- cursor: grab;
67
- `;return{selector:e(ua.contextId),styles:{always:`
68
- -webkit-touch-callout: none;
69
- -webkit-tap-highlight-color: rgba(0,0,0,0);
70
- touch-action: manipulation;
71
- `,resting:a,dragging:p$,dropAnimating:a}}})(),o=(()=>{let a=`
72
- transition: ${Vl.outOfTheWay};
73
- `;return{selector:e(Ag.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),r={selector:e(d$.contextId),styles:{always:"overflow-anchor: none;"}},s=[o,n,r,{selector:"body",styles:{dragging:`
74
- cursor: grabbing;
75
- cursor: -webkit-grabbing;
76
- user-select: none;
77
- -webkit-user-select: none;
78
- -moz-user-select: none;
79
- -ms-user-select: none;
80
- overflow-anchor: none;
81
- `}}];return{always:Ul(s,"always"),resting:Ul(s,"resting"),dragging:Ul(s,"dragging"),dropAnimating:Ul(s,"dropAnimating"),userCancel:Ul(s,"userCancel")}},Qn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?mn:P,vg=()=>{let t=document.querySelector("head");return t||j(),t},T0=t=>{let e=document.createElement("style");return t&&e.setAttribute("nonce",t),e.type="text/css",e};function h$(t,e){let n=Fe(()=>f$(t),[t]),o=q(null),r=q(null),i=de(Vt(u=>{let p=r.current;p||j(),p.textContent=u}),[]),s=de(u=>{let p=o.current;p||j(),p.textContent=u},[]);Qn(()=>{!o.current&&!r.current||j();let u=T0(e),p=T0(e);return o.current=u,r.current=p,u.setAttribute(`${da}-always`,t),p.setAttribute(`${da}-dynamic`,t),vg().appendChild(u),vg().appendChild(p),s(n.always),i(n.resting),()=>{let h=g=>{let m=g.current;m||j(),vg().removeChild(m),g.current=null};h(o),h(r)}},[e,s,i,n.always,n.resting,t]);let a=de(()=>i(n.dragging),[i,n.dragging]),l=de(u=>{if(u==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=de(()=>{r.current&&i(n.resting)},[i,n.resting]);return Fe(()=>({dragging:a,dropping:l,resting:c}),[a,l,c])}function bT(t,e){return Array.from(t.querySelectorAll(e))}var yT=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView:window;function oc(t){return t instanceof yT(t).HTMLElement}function xT(t,e){let n=`[${ua.contextId}="${t}"]`,o=bT(document,n);if(!o.length)return null;let r=o.find(i=>i.getAttribute(ua.draggableId)===e);return!r||!oc(r)?null:r}function g$(t){let e=q({}),n=q(null),o=q(null),r=q(!1),i=de(function(p,h){let g={id:p,focus:h};return e.current[p]=g,function(){let _=e.current;_[p]!==g&&delete _[p]}},[]),s=de(function(p){let h=xT(t,p);h&&h!==document.activeElement&&h.focus()},[t]),a=de(function(p,h){n.current===p&&(n.current=h)},[]),l=de(function(){o.current||r.current&&(o.current=requestAnimationFrame(()=>{o.current=null;let p=n.current;p&&s(p)}))},[s]),c=de(function(p){n.current=null;let h=document.activeElement;h&&h.getAttribute(ua.draggableId)===p&&(n.current=p)},[]);return Qn(()=>(r.current=!0,function(){r.current=!1;let p=o.current;p&&cancelAnimationFrame(p)}),[]),Fe(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:l,tryShiftRecord:a}),[i,c,l,a])}function m$(){let t={draggables:{},droppables:{}},e=[];function n(u){return e.push(u),function(){let h=e.indexOf(u);h!==-1&&e.splice(h,1)}}function o(u){e.length&&e.forEach(p=>p(u))}function r(u){return t.draggables[u]||null}function i(u){let p=r(u);return p||j(),p}let s={register:u=>{t.draggables[u.descriptor.id]=u,o({type:"ADDITION",value:u})},update:(u,p)=>{let h=t.draggables[p.descriptor.id];h&&h.uniqueId===u.uniqueId&&(delete t.draggables[p.descriptor.id],t.draggables[u.descriptor.id]=u)},unregister:u=>{let p=u.descriptor.id,h=r(p);h&&u.uniqueId===h.uniqueId&&(delete t.draggables[p],t.droppables[u.descriptor.droppableId]&&o({type:"REMOVAL",value:u}))},getById:i,findById:r,exists:u=>!!r(u),getAllByType:u=>Object.values(t.draggables).filter(p=>p.descriptor.type===u)};function a(u){return t.droppables[u]||null}function l(u){let p=a(u);return p||j(),p}let c={register:u=>{t.droppables[u.descriptor.id]=u},unregister:u=>{let p=a(u.descriptor.id);p&&u.uniqueId===p.uniqueId&&delete t.droppables[u.descriptor.id]},getById:l,findById:a,exists:u=>!!a(u),getAllByType:u=>Object.values(t.droppables).filter(p=>p.descriptor.type===u)};function d(){t.draggables={},t.droppables={},e.length=0}return{draggable:s,droppable:c,subscribe:n,clean:d}}function _$(){let t=Fe(m$,[]);return P(()=>function(){t.clean()},[t]),t}var qg=rt.createContext(null),Xl=()=>{let t=document.body;return t||j(),t},b$={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},y$=t=>`rfd-announcement-${t}`;function x$(t){let e=Fe(()=>y$(t),[t]),n=q(null);return P(function(){let i=document.createElement("div");return n.current=i,i.id=e,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Th(i.style,b$),Xl().appendChild(i),function(){setTimeout(function(){let l=Xl();l.contains(i)&&l.removeChild(i),i===n.current&&(n.current=null)})}},[e]),de(r=>{let i=n.current;if(i){i.textContent=r;return}},[])}var v$={separator:"::"};function Jg(t,e=v$){let n=rt.useId();return Fe(()=>`${t}${e.separator}${n}`,[e.separator,t,n])}function C$({contextId:t,uniqueId:e}){return`rfd-hidden-text-${t}-${e}`}function E$({contextId:t,text:e}){let n=Jg("hidden-text",{separator:"-"}),o=Fe(()=>C$({contextId:t,uniqueId:n}),[n,t]);return P(function(){let i=document.createElement("div");return i.id=o,i.textContent=e,i.style.display="none",Xl().appendChild(i),function(){let a=Xl();a.contains(i)&&a.removeChild(i)}},[o,e]),o}var wu=rt.createContext(null),w$={react:"^18.0.0 || ^19.0.0"},T$=/(\d+)\.(\d+)\.(\d+)/,S0=t=>{let e=T$.exec(t);e==null&&j();let n=Number(e[1]),o=Number(e[2]),r=Number(e[3]);return{major:n,minor:o,patch:r,raw:t}},S$=(t,e)=>e.major>t.major?!0:e.major<t.major?!1:e.minor>t.minor?!0:e.minor<t.minor?!1:e.patch>=t.patch,k$=(t,e)=>{let n=S0(t),o=S0(e);S$(n,o)};var N$=t=>{let e=t.doctype;e&&(e.name.toLowerCase(),e.publicId)};function rc(t,e){}function D$(){rc(()=>{k$(w$.react,rt.version),N$(document)},[])}function Xg(t){let e=q(t);return P(()=>{e.current=t}),e}function O$(){let t=null;function e(){return!!t}function n(s){return s===t}function o(s){t&&j();let a={abandon:s};return t=a,a}function r(){t||j(),t=null}function i(){t&&(t.abandon(),r())}return{isClaimed:e,isActive:n,claim:o,release:r,tryAbandon:i}}function Zl(t){return t.phase==="IDLE"||t.phase==="DROP_ANIMATING"?!1:t.isDragging}var I$=9,A$=13,Zg=27,vT=32,M$=33,L$=34,R$=35,P$=36,F$=37,B$=38,$$=39,z$=40,H$={[A$]:!0,[I$]:!0},CT=t=>{H$[t.keyCode]&&t.preventDefault()},Tu=(()=>{let t="visibilitychange";return typeof document>"u"?t:[t,`ms${t}`,`webkit${t}`,`moz${t}`,`o${t}`].find(o=>`on${o}`in document)||t})(),ET=0,k0=5;function U$(t,e){return Math.abs(e.x-t.x)>=k0||Math.abs(e.y-t.y)>=k0}var N0={type:"IDLE"};function K$({cancel:t,completed:e,getPhase:n,setPhase:o}){return[{eventName:"mousemove",fn:r=>{let{button:i,clientX:s,clientY:a}=r;if(i!==ET)return;let l={x:s,y:a},c=n();if(c.type==="DRAGGING"){r.preventDefault(),c.actions.move(l);return}c.type!=="PENDING"&&j();let d=c.point;if(!U$(d,l))return;r.preventDefault();let u=c.actions.fluidLift(l);o({type:"DRAGGING",actions:u})}},{eventName:"mouseup",fn:r=>{let i=n();if(i.type!=="DRAGGING"){t();return}r.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"mousedown",fn:r=>{n().type==="DRAGGING"&&r.preventDefault(),t()}},{eventName:"keydown",fn:r=>{if(n().type==="PENDING"){t();return}if(r.keyCode===Zg){r.preventDefault(),t();return}CT(r)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:r=>{let i=n();if(i.type==="IDLE"&&j(),i.actions.shouldRespectForcePress()){t();return}r.preventDefault()}},{eventName:Tu,fn:t}]}function j$(t){let e=q(N0),n=q(ci),o=Fe(()=>({eventName:"mousedown",fn:function(u){if(u.defaultPrevented||u.button!==ET||u.ctrlKey||u.metaKey||u.shiftKey||u.altKey)return;let p=t.findClosestDraggableId(u);if(!p)return;let h=t.tryGetLock(p,s,{sourceEvent:u});if(!h)return;u.preventDefault();let g={x:u.clientX,y:u.clientY};n.current(),c(h,g)}}),[t]),r=Fe(()=>({eventName:"webkitmouseforcewillbegin",fn:d=>{if(d.defaultPrevented)return;let u=t.findClosestDraggableId(d);if(!u)return;let p=t.findOptionsForDraggable(u);p&&(p.shouldRespectForcePress||t.canGetLock(u)&&d.preventDefault())}}),[t]),i=de(function(){let u={passive:!1,capture:!0};n.current=_o(window,[r,o],u)},[r,o]),s=de(()=>{e.current.type!=="IDLE"&&(e.current=N0,n.current(),i())},[i]),a=de(()=>{let d=e.current;s(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[s]),l=de(function(){let u={capture:!0,passive:!1},p=K$({cancel:a,completed:s,getPhase:()=>e.current,setPhase:h=>{e.current=h}});n.current=_o(window,p,u)},[a,s]),c=de(function(u,p){e.current.type!=="IDLE"&&j(),e.current={type:"PENDING",point:p,actions:u},l()},[l]);Qn(function(){return i(),function(){n.current()}},[i])}function V$(){}var W$={[L$]:!0,[M$]:!0,[P$]:!0,[R$]:!0};function G$(t,e){function n(){e(),t.cancel()}function o(){e(),t.drop()}return[{eventName:"keydown",fn:r=>{if(r.keyCode===Zg){r.preventDefault(),n();return}if(r.keyCode===vT){r.preventDefault(),o();return}if(r.keyCode===z$){r.preventDefault(),t.moveDown();return}if(r.keyCode===B$){r.preventDefault(),t.moveUp();return}if(r.keyCode===$$){r.preventDefault(),t.moveRight();return}if(r.keyCode===F$){r.preventDefault(),t.moveLeft();return}if(W$[r.keyCode]){r.preventDefault();return}CT(r)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Tu,fn:n}]}function Y$(t){let e=q(V$),n=Fe(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==vT)return;let s=t.findClosestDraggableId(i);if(!s)return;let a=t.tryGetLock(s,d,{sourceEvent:i});if(!a)return;i.preventDefault();let l=!0,c=a.snapLift();e.current();function d(){l||j(),l=!1,e.current(),o()}e.current=_o(window,G$(c,d),{capture:!0,passive:!1})}}),[t]),o=de(function(){let i={passive:!1,capture:!0};e.current=_o(window,[n],i)},[n]);Qn(function(){return o(),function(){e.current()}},[o])}var Cg={type:"IDLE"},q$=120,J$=.15;function X$({cancel:t,getPhase:e}){return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(e().type!=="DRAGGING"){t();return}n.keyCode===Zg&&n.preventDefault(),t()}},{eventName:Tu,fn:t}]}function Z$({cancel:t,completed:e,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}r.hasMoved=!0;let{clientX:i,clientY:s}=o.touches[0],a={x:i,y:s};o.preventDefault(),r.actions.move(a)}},{eventName:"touchend",fn:o=>{let r=n();if(r.type!=="DRAGGING"){t();return}o.preventDefault(),r.actions.drop({shouldBlockNextClick:!0}),e()}},{eventName:"touchcancel",fn:o=>{if(n().type!=="DRAGGING"){t();return}o.preventDefault(),t()}},{eventName:"touchforcechange",fn:o=>{let r=n();r.type==="IDLE"&&j();let i=o.touches[0];if(!i||!(i.force>=J$))return;let a=r.actions.shouldRespectForcePress();if(r.type==="PENDING"){a&&t();return}if(a){if(r.hasMoved){o.preventDefault();return}t();return}o.preventDefault()}},{eventName:Tu,fn:t}]}function Q$(t){let e=q(Cg),n=q(ci),o=de(function(){return e.current},[]),r=de(function(h){e.current=h},[]),i=Fe(()=>({eventName:"touchstart",fn:function(h){if(h.defaultPrevented)return;let g=t.findClosestDraggableId(h);if(!g)return;let m=t.tryGetLock(g,a,{sourceEvent:h});if(!m)return;let _=h.touches[0],{clientX:b,clientY:y}=_,v={x:b,y};n.current(),u(m,v)}}),[t]),s=de(function(){let h={capture:!0,passive:!1};n.current=_o(window,[i],h)},[i]),a=de(()=>{let p=e.current;p.type!=="IDLE"&&(p.type==="PENDING"&&clearTimeout(p.longPressTimerId),r(Cg),n.current(),s())},[s,r]),l=de(()=>{let p=e.current;a(),p.type==="DRAGGING"&&p.actions.cancel({shouldBlockNextClick:!0}),p.type==="PENDING"&&p.actions.abort()},[a]),c=de(function(){let h={capture:!0,passive:!1},g={cancel:l,completed:a,getPhase:o},m=_o(window,Z$(g),h),_=_o(window,X$(g),h);n.current=function(){m(),_()}},[l,o,a]),d=de(function(){let h=o();h.type!=="PENDING"&&j();let g=h.actions.fluidLift(h.point);r({type:"DRAGGING",actions:g,hasMoved:!1})},[o,r]),u=de(function(h,g){o().type!=="IDLE"&&j();let m=setTimeout(d,q$);r({type:"PENDING",point:g,actions:h,longPressTimerId:m}),c()},[c,o,r,d]);Qn(function(){return s(),function(){n.current();let g=o();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),r(Cg))}},[o,s,r]),Qn(function(){return _o(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function ez(t){}var tz=["input","button","textarea","select","option","optgroup","video","audio"];function wT(t,e){if(e==null)return!1;if(tz.includes(e.tagName.toLowerCase()))return!0;let o=e.getAttribute("contenteditable");return o==="true"||o===""?!0:e===t?!1:wT(t,e.parentElement)}function nz(t,e){let n=e.target;return oc(n)?wT(t,n):!1}var oz=t=>mo(t.getBoundingClientRect()).center;function rz(t){return t instanceof yT(t).Element}var iz=(()=>{let t="matches";return typeof document>"u"?t:[t,"msMatchesSelector","webkitMatchesSelector"].find(o=>o in Element.prototype)||t})();function TT(t,e){return t==null?null:t[iz](e)?t:TT(t.parentElement,e)}function sz(t,e){return t.closest?t.closest(e):TT(t,e)}function az(t){return`[${ua.contextId}="${t}"]`}function lz(t,e){let n=e.target;if(!rz(n))return null;let o=az(t),r=sz(n,o);return!r||!oc(r)?null:r}function cz(t,e){let n=lz(t,e);return n?n.getAttribute(ua.draggableId):null}function dz(t,e){let n=`[${Ag.contextId}="${t}"]`,r=bT(document,n).find(i=>i.getAttribute(Ag.id)===e);return!r||!oc(r)?null:r}function uz(t){t.preventDefault()}function hu({expected:t,phase:e,isLockActive:n,shouldWarn:o}){return!(!n()||t!==e)}function ST({lockAPI:t,store:e,registry:n,draggableId:o}){if(t.isClaimed())return!1;let r=n.draggable.findById(o);return!(!r||!r.options.isEnabled||!hT(e.getState(),o))}function pz({lockAPI:t,contextId:e,store:n,registry:o,draggableId:r,forceSensorStop:i,sourceEvent:s}){if(!ST({lockAPI:t,store:n,registry:o,draggableId:r}))return null;let l=o.draggable.getById(r),c=dz(e,l.descriptor.id);if(!c||s&&!l.options.canDragInteractiveElements&&nz(c,s))return null;let d=t.claim(i||ci),u="PRE_DRAG";function p(){return l.options.shouldRespectForcePress}function h(){return t.isActive(d)}function g(E,C){hu({expected:E,phase:u,isLockActive:h,shouldWarn:!0})&&n.dispatch(C())}let m=g.bind(null,"DRAGGING");function _(E){function C(){t.release(),u="COMPLETED"}u!=="PRE_DRAG"&&(C(),j()),n.dispatch(e2(E.liftActionArgs)),u="DRAGGING";function k(T,w={shouldBlockNextClick:!1}){if(E.cleanup(),w.shouldBlockNextClick){let S=_o(window,[{eventName:"click",fn:uz,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(S)}C(),n.dispatch(sT({reason:T}))}return{isActive:()=>hu({expected:"DRAGGING",phase:u,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:p,drop:T=>k("DROP",T),cancel:T=>k("CANCEL",T),...E.actions}}function b(E){let C=la(T=>{m(()=>iT({client:T}))});return{..._({liftActionArgs:{id:r,clientSelection:E,movementMode:"FLUID"},cleanup:()=>C.cancel(),actions:{move:C}}),move:C}}function y(){let E={moveUp:()=>m(c2),moveRight:()=>m(u2),moveDown:()=>m(d2),moveLeft:()=>m(p2)};return _({liftActionArgs:{id:r,clientSelection:oz(c),movementMode:"SNAP"},cleanup:ci,actions:E})}function v(){hu({expected:"PRE_DRAG",phase:u,isLockActive:h,shouldWarn:!0})&&t.release()}return{isActive:()=>hu({expected:"PRE_DRAG",phase:u,isLockActive:h,shouldWarn:!1}),shouldRespectForcePress:p,fluidLift:b,snapLift:y,abort:v}}var fz=[j$,Y$,Q$];function hz({contextId:t,store:e,registry:n,customSensors:o,enableDefaultSensors:r}){let i=[...r?fz:[],...o||[]],s=L(()=>O$())[0],a=de(function(_,b){Zl(_)&&!Zl(b)&&s.tryAbandon()},[s]);Qn(function(){let _=e.getState();return e.subscribe(()=>{let y=e.getState();a(_,y),_=y})},[s,e,a]),Qn(()=>s.tryAbandon,[s.tryAbandon]);let l=de(m=>ST({lockAPI:s,registry:n,store:e,draggableId:m}),[s,n,e]),c=de((m,_,b)=>pz({lockAPI:s,registry:n,contextId:t,store:e,draggableId:m,forceSensorStop:_||null,sourceEvent:b&&b.sourceEvent?b.sourceEvent:null}),[t,s,n,e]),d=de(m=>cz(t,m),[t]),u=de(m=>{let _=n.draggable.findById(m);return _?_.options:null},[n.draggable]),p=de(function(){s.isClaimed()&&(s.tryAbandon(),e.getState().phase!=="IDLE"&&e.dispatch(Ug()))},[s,e]),h=de(()=>s.isClaimed(),[s]),g=Fe(()=>({canGetLock:l,tryGetLock:c,findClosestDraggableId:d,findOptionsForDraggable:u,tryReleaseLock:p,isLockClaimed:h}),[l,c,d,u,p,h]);ez(i);for(let m=0;m<i.length;m++)i[m](g)}var gz=t=>({onBeforeCapture:e=>{Dl(()=>{t.onBeforeCapture&&t.onBeforeCapture(e)})},onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}),mz=t=>({...Jl,...t.autoScrollerOptions,durationDampening:{...Jl.durationDampening,...t.autoScrollerOptions}});function Kl(t){return t.current||j(),t.current}function _z(t){let{contextId:e,setCallbacks:n,sensors:o,nonce:r,dragHandleUsageInstructions:i}=t,s=q(null);D$();let a=Xg(t),l=de(()=>gz(a.current),[a]),c=de(()=>mz(a.current),[a]),d=x$(e),u=E$({contextId:e,text:i}),p=h$(e,r),h=de(S=>{Kl(s).dispatch(S)},[]),g=Fe(()=>ig({publishWhileDragging:n2,updateDroppableScroll:r2,updateDroppableIsEnabled:i2,updateDroppableIsCombineEnabled:s2,collectionStarting:o2},h),[h]),m=_$(),_=Fe(()=>W2(m,g),[m,g]),b=Fe(()=>c$({scrollWindow:G2,scrollDroppable:_.scrollDroppable,getAutoScrollerOptions:c,...ig({move:iT},h)}),[_.scrollDroppable,h,c]),y=g$(e),v=Fe(()=>U2({announce:d,autoScroller:b,dimensionMarshal:_,focusMarshal:y,getResponders:l,styleMarshal:p}),[d,b,_,y,l,p]);s.current=v;let x=de(()=>{let S=Kl(s);S.getState().phase!=="IDLE"&&S.dispatch(Ug())},[]),E=de(()=>{let S=Kl(s).getState();return S.phase==="DROP_ANIMATING"?!0:S.phase==="IDLE"?!1:S.isDragging},[]),C=Fe(()=>({isDragging:E,tryAbort:x}),[E,x]);n(C);let k=de(S=>hT(Kl(s).getState(),S),[]),T=de(()=>rs(Kl(s).getState()),[]),w=Fe(()=>({marshal:_,focus:y,contextId:e,canLift:k,isMovementAllowed:T,dragHandleUsageInstructionsId:u,registry:m}),[e,_,u,y,k,T,m]);return hz({contextId:e,store:v,registry:m,customSensors:o||null,enableDefaultSensors:t.enableDefaultSensors!==!1}),P(()=>x,[x]),rt.createElement(wu.Provider,{value:w},rt.createElement(r0,{context:qg,store:v},t.children))}function bz(){return rt.useId()}function Su(t){let e=bz(),n=t.dragHandleUsageInstructions||mu.dragHandleUsageInstructions;return rt.createElement(kg,null,o=>rt.createElement(_z,{nonce:t.nonce,contextId:e,setCallbacks:o,dragHandleUsageInstructions:n,enableDefaultSensors:t.enableDefaultSensors,sensors:t.sensors,onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragUpdate:t.onDragUpdate,onDragEnd:t.onDragEnd,autoScrollerOptions:t.autoScrollerOptions},t.children))}var D0={dragging:5e3,dropAnimating:4500},yz=(t,e)=>e?Vl.drop(e.duration):t?Vl.snap:Vl.fluid,xz=(t,e)=>{if(t)return e?ql.opacity.drop:ql.opacity.combining},vz=t=>t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP";function Cz(t){let n=t.dimension.client,{offset:o,combineWith:r,dropping:i}=t,s=!!r,a=vz(t),l=!!i,c=l?Og.drop(o,s):Og.moveTo(o);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:yz(a,i),transform:c,opacity:xz(s,l),zIndex:l?D0.dropAnimating:D0.dragging,pointerEvents:"none"}}function Ez(t){return{transform:Og.moveTo(t.offset),transition:t.shouldAnimateDisplacement?void 0:"none"}}function wz(t){return t.type==="DRAGGING"?Cz(t):Ez(t)}function Tz(t,e,n=Wt){let o=window.getComputedStyle(e),r=e.getBoundingClientRect(),i=gg(r,o),s=zl(i,n),a={client:i,tagName:e.tagName.toLowerCase(),display:o.display},l={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:t,placeholder:a,displaceBy:l,client:i,page:s}}function Sz(t){let e=Jg("draggable"),{descriptor:n,registry:o,getDraggableRef:r,canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}=t,l=Fe(()=>({canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}),[i,a,s]),c=de(h=>{let g=r();return g||j(),Tz(n,g,h)},[n,r]),d=Fe(()=>({uniqueId:e,descriptor:n,options:l,getDimension:c}),[n,c,l,e]),u=q(d),p=q(!0);Qn(()=>(o.draggable.register(u.current),()=>o.draggable.unregister(u.current)),[o.draggable]),Qn(()=>{if(p.current){p.current=!1;return}let h=u.current;u.current=d,o.draggable.update(d,h)},[d,o.draggable])}var Qg=rt.createContext(null);function kT(t){t&&oc(t)||j()}function kz(t,e,n){rc(()=>{function o(i){return`Draggable[id: ${i}]: `}let r=t.draggableId;r||j(!1),typeof r!="string"&&j(!1),Number.isInteger(t.index)||j(!1),t.mapped.type!=="DRAGGING"&&(kT(n()),t.isEnabled&&(xT(e,r)||j(!1)))})}function Nz(t){}function yu(t){let e=ht(t);return e||j(),e}function Dz(t){t.preventDefault()}var Oz=t=>{let e=q(null),n=de((C=null)=>{e.current=C},[]),o=de(()=>e.current,[]),{contextId:r,dragHandleUsageInstructionsId:i,registry:s}=yu(wu),{type:a,droppableId:l}=yu(Qg),c=Fe(()=>({id:t.draggableId,index:t.index,type:a,droppableId:l}),[t.draggableId,t.index,a,l]),{children:d,draggableId:u,isEnabled:p,shouldRespectForcePress:h,canDragInteractiveElements:g,isClone:m,mapped:_,dropAnimationFinished:b}=t;if(kz(t,r,o),Nz(m),!m){let C=Fe(()=>({descriptor:c,registry:s,getDraggableRef:o,canDragInteractiveElements:g,shouldRespectForcePress:h,isEnabled:p}),[c,s,o,g,h,p]);Sz(C)}let y=Fe(()=>p?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":u,"data-rfd-drag-handle-context-id":r,draggable:!1,onDragStart:Dz}:null,[r,i,u,p]),v=de(C=>{_.type==="DRAGGING"&&_.dropping&&C.propertyName==="transform"&&Dl(b)},[b,_]),x=Fe(()=>{let C=wz(_),k=_.type==="DRAGGING"&&_.dropping?v:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":r,"data-rfd-draggable-id":u,style:C,onTransitionEnd:k},dragHandleProps:y}},[r,y,u,_,v,n]),E=Fe(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return rt.createElement(rt.Fragment,null,d(x,_.snapshot,E))},NT=(t,e)=>t===e,DT=t=>{let{combine:e,destination:n}=t;return n?n.droppableId:e?e.droppableId:null},Iz=t=>t.combine?t.combine.draggableId:null,Az=t=>t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null;function Mz(){let t=Vt((r,i)=>({x:r,y:i})),e=Vt((r,i,s=null,a=null,l=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!l,dropAnimation:l,mode:r,draggingOver:s,combineWith:a,combineTargetFor:null})),n=Vt((r,i,s,a,l=null,c=null,d=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:l,combineWith:c,mode:i,offset:r,dimension:s,forceShouldAnimate:d,snapshot:e(i,a,l,c,null)}}));return(r,i)=>{if(Zl(r)){if(r.critical.draggable.id!==i.draggableId)return null;let s=r.current.client.offset,a=r.dimensions.draggables[i.draggableId],l=Zn(r.impact),c=Az(r.impact),d=r.forceShouldAnimate;return n(t(s.x,s.y),r.movementMode,a,i.isClone,l,c,d)}if(r.phase==="DROP_ANIMATING"){let s=r.completed;if(s.result.draggableId!==i.draggableId)return null;let a=i.isClone,l=r.dimensions.draggables[i.draggableId],c=s.result,d=c.mode,u=DT(c),p=Iz(c),g={duration:r.dropDuration,curve:jg.drop,moveTo:r.newHomeClientOffset,opacity:p?ql.opacity.drop:null,scale:p?ql.scale.drop:null};return{mapped:{type:"DRAGGING",offset:r.newHomeClientOffset,dimension:l,dropping:g,draggingOver:u,combineWith:p,mode:d,forceShouldAnimate:null,snapshot:e(d,a,u,p,g)}}}return null}}function OT(t=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:t,combineWith:null}}var Lz={mapped:{type:"SECONDARY",offset:Wt,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:OT(null)}};function Rz(){let t=Vt((s,a)=>({x:s,y:a})),e=Vt(OT),n=Vt((s,a=null,l)=>({mapped:{type:"SECONDARY",offset:s,combineTargetFor:a,shouldAnimateDisplacement:l,snapshot:e(a)}})),o=s=>s?n(Wt,s,!0):null,r=(s,a,l,c)=>{let d=l.displaced.visible[s],u=!!(c.inVirtualList&&c.effected[s]),p=vu(l),h=p&&p.draggableId===s?a:null;if(!d){if(!u)return o(h);if(l.displaced.invisible[s])return null;let _=pa(c.displacedBy.point),b=t(_.x,_.y);return n(b,h,!0)}if(u)return o(h);let g=l.displacedBy.point,m=t(g.x,g.y);return n(m,h,d.shouldAnimate)};return(s,a)=>{if(Zl(s))return s.critical.draggable.id===a.draggableId?null:r(a.draggableId,s.critical.draggable.id,s.impact,s.afterCritical);if(s.phase==="DROP_ANIMATING"){let l=s.completed;return l.result.draggableId===a.draggableId?null:r(a.draggableId,l.result.draggableId,l.impact,l.afterCritical)}return null}}var Pz=()=>{let t=Mz(),e=Rz();return(o,r)=>t(o,r)||e(o,r)||Lz},Fz={dropAnimationFinished:aT},Bz=pg(Pz,Fz,null,{context:qg,areStatePropsEqual:NT})(Oz);function IT(t){return yu(Qg).isUsingCloneFor===t.draggableId&&!t.isClone?null:rt.createElement(Bz,t)}function ku(t){let e=typeof t.isDragDisabled=="boolean"?!t.isDragDisabled:!0,n=!!t.disableInteractiveElementBlocking,o=!!t.shouldRespectForcePress;return rt.createElement(IT,Th({},t,{isClone:!1,isEnabled:e,canDragInteractiveElements:n,shouldRespectForcePress:o}))}var em=t=>e=>t===e,$z=em("scroll"),zz=em("auto"),Hz=em("visible"),O0=(t,e)=>e(t.overflowX)||e(t.overflowY),Uz=(t,e)=>e(t.overflowX)&&e(t.overflowY),AT=t=>{let e=window.getComputedStyle(t),n={overflowX:e.overflowX,overflowY:e.overflowY};return O0(n,$z)||O0(n,zz)},Kz=()=>!1,MT=t=>t==null?null:t===document.body?Kz()?t:null:t===document.documentElement?null:AT(t)?t:MT(t.parentElement);var Mg=t=>({x:t.scrollLeft,y:t.scrollTop}),LT=t=>t?window.getComputedStyle(t).position==="fixed"?!0:LT(t.parentElement):!1,jz=t=>{let e=MT(t),n=LT(t);return{closestScrollable:e,isFixedOnPage:n}},Vz=({descriptor:t,isEnabled:e,isCombineEnabled:n,isFixedOnPage:o,direction:r,client:i,page:s,closest:a})=>{let l=(()=>{if(!a)return null;let{scrollSize:p,client:h}=a,g=uT({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:h.paddingBox.height,width:h.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:h,scrollSize:p,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:g,diff:{value:Wt,displacement:Wt}}}})(),c=r==="vertical"?Fg:j0,d=ca({page:s,withPlaceholder:null,axis:c,frame:l});return{descriptor:t,isCombineEnabled:n,isFixedOnPage:o,axis:c,isEnabled:e,client:i,page:s,frame:l,subject:d}},Wz=(t,e)=>{let n=mg(t);if(!e||t!==e)return n;let o=n.paddingBox.top-e.scrollTop,r=n.paddingBox.left-e.scrollLeft,i=o+e.scrollHeight,s=r+e.scrollWidth,l=uu({top:o,right:s,bottom:i,left:r},n.border);return pu({borderBox:l,margin:n.margin,border:n.border,padding:n.padding})},Gz=({ref:t,descriptor:e,env:n,windowScroll:o,direction:r,isDropDisabled:i,isCombineEnabled:s,shouldClipSubject:a})=>{let l=n.closestScrollable,c=Wz(t,l),d=zl(c,o),u=(()=>{if(!l)return null;let h=mg(l),g={scrollHeight:l.scrollHeight,scrollWidth:l.scrollWidth};return{client:h,page:zl(h,o),scroll:Mg(l),scrollSize:g,shouldClipSubject:a}})();return Vz({descriptor:e,isEnabled:!i,isCombineEnabled:s,isFixedOnPage:n.isFixedOnPage,direction:r,client:c,page:d,closest:u})},Yz={passive:!1},qz={passive:!0},I0=t=>t.shouldPublishImmediately?Yz:qz,gu=t=>t&&t.env.closestScrollable||null;function Jz(t){let e=q(null),n=yu(wu),o=Jg("droppable"),{registry:r,marshal:i}=n,s=Xg(t),a=Fe(()=>({id:t.droppableId,type:t.type,mode:t.mode}),[t.droppableId,t.mode,t.type]),l=q(a),c=Fe(()=>Vt((x,E)=>{e.current||j();let C={x,y:E};i.updateDroppableScroll(a.id,C)}),[a.id,i]),d=de(()=>{let x=e.current;return!x||!x.env.closestScrollable?Wt:Mg(x.env.closestScrollable)},[]),u=de(()=>{let x=d();c(x.x,x.y)},[d,c]),p=Fe(()=>la(u),[u]),h=de(()=>{let x=e.current,E=gu(x);if(x&&E||j(),x.scrollOptions.shouldPublishImmediately){u();return}p()},[p,u]),g=de((x,E)=>{e.current&&j();let C=s.current,k=C.getDroppableRef();k||j();let T=jz(k),w={ref:k,descriptor:a,env:T,scrollOptions:E};e.current=w;let S=Gz({ref:k,descriptor:a,env:T,windowScroll:x,direction:C.direction,isDropDisabled:C.isDropDisabled,isCombineEnabled:C.isCombineEnabled,shouldClipSubject:!C.ignoreContainerClipping}),N=T.closestScrollable;return N&&(N.setAttribute(w0.contextId,n.contextId),N.addEventListener("scroll",h,I0(w.scrollOptions))),S},[n.contextId,a,h,s]),m=de(()=>{let x=e.current,E=gu(x);return x&&E||j(),Mg(E)},[]),_=de(()=>{let x=e.current;x||j();let E=gu(x);e.current=null,E&&(p.cancel(),E.removeAttribute(w0.contextId),E.removeEventListener("scroll",h,I0(x.scrollOptions)))},[h,p]),b=de(x=>{let E=e.current;E||j();let C=gu(E);C||j(),C.scrollTop+=x.y,C.scrollLeft+=x.x},[]),y=Fe(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:m,dragStopped:_,scroll:b}),[_,g,m,b]),v=Fe(()=>({uniqueId:o,descriptor:a,callbacks:y}),[y,a,o]);Qn(()=>(l.current=v.descriptor,r.droppable.register(v),()=>{e.current&&_(),r.droppable.unregister(v)}),[y,a,_,v,i,r.droppable]),Qn(()=>{e.current&&i.updateDroppableIsEnabled(l.current.id,!t.isDropDisabled)},[t.isDropDisabled,i]),Qn(()=>{e.current&&i.updateDroppableIsCombineEnabled(l.current.id,t.isCombineEnabled)},[t.isCombineEnabled,i])}function Eg(){}var A0={width:0,height:0,margin:JF},Xz=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>t||n==="close"?A0:{height:e.client.borderBox.height,width:e.client.borderBox.width,margin:e.client.margin},Zz=({isAnimatingOpenOnMount:t,placeholder:e,animate:n})=>{let o=Xz({isAnimatingOpenOnMount:t,placeholder:e,animate:n});return{display:e.display,boxSizing:"border-box",width:o.width,height:o.height,marginTop:o.margin.top,marginRight:o.margin.right,marginBottom:o.margin.bottom,marginLeft:o.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Vl.placeholder:null}},Qz=t=>{let e=q(null),n=de(()=>{e.current&&(clearTimeout(e.current),e.current=null)},[]),{animate:o,onTransitionEnd:r,onClose:i,contextId:s}=t,[a,l]=L(t.animate==="open");P(()=>a?o!=="open"?(n(),l(!1),Eg):e.current?Eg:(e.current=setTimeout(()=>{e.current=null,l(!1)}),n):Eg,[o,a,n]);let c=de(u=>{u.propertyName==="height"&&(r(),o==="close"&&i())},[o,i,r]),d=Zz({isAnimatingOpenOnMount:a,animate:t.animate,placeholder:t.placeholder});return rt.createElement(t.placeholder.tagName,{style:d,"data-rfd-placeholder-context-id":s,onTransitionEnd:c,ref:t.innerRef})},eH=rt.memo(Qz);function wg(t){return typeof t=="boolean"}function Tg(t,e){e.forEach(n=>n(t))}var tH=[function({props:e}){e.droppableId||j(),typeof e.droppableId!="string"&&j()},function({props:e}){wg(e.isDropDisabled)||j(),wg(e.isCombineEnabled)||j(),wg(e.ignoreContainerClipping)||j()},function({getDroppableRef:e}){kT(e())}],nH=[function({props:e,getPlaceholderRef:n}){!e.placeholder||n()}],oH=[function({props:e}){e.renderClone||j()},function({getPlaceholderRef:e}){e()&&j()}];function rH(t){rc(()=>{Tg(t,tH),t.props.mode==="standard"&&Tg(t,nH),t.props.mode==="virtual"&&Tg(t,oH)})}var Lg=class extends rt.PureComponent{constructor(...e){super(...e),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(e,n){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!e.on,data:e.on,animate:"none"}}render(){if(!this.state.isVisible)return null;let e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)}},iH=t=>{let e=ht(wu);e||j();let{contextId:n,isMovementAllowed:o}=e,r=q(null),i=q(null),{children:s,droppableId:a,type:l,mode:c,direction:d,ignoreContainerClipping:u,isDropDisabled:p,isCombineEnabled:h,snapshot:g,useClone:m,updateViewportMaxScroll:_,getContainerForClone:b}=t,y=de(()=>r.current,[]),v=de((D=null)=>{r.current=D},[]),x=de(()=>i.current,[]),E=de((D=null)=>{i.current=D},[]);rH({props:t,getDroppableRef:y,getPlaceholderRef:x});let C=de(()=>{o()&&_({maxScroll:fT()})},[o,_]);Jz({droppableId:a,type:l,mode:c,direction:d,isDropDisabled:p,isCombineEnabled:h,ignoreContainerClipping:u,getDroppableRef:y});let k=Fe(()=>rt.createElement(Lg,{on:t.placeholder,shouldAnimate:t.shouldAnimatePlaceholder},({onClose:D,data:O,animate:A})=>rt.createElement(eH,{placeholder:O,onClose:D,innerRef:E,animate:A,contextId:n,onTransitionEnd:C})),[n,C,t.placeholder,t.shouldAnimatePlaceholder,E]),T=Fe(()=>({innerRef:v,placeholder:k,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,k,v]),w=m?m.dragging.draggableId:null,S=Fe(()=>({droppableId:a,type:l,isUsingCloneFor:w}),[a,w,l]);function N(){if(!m)return null;let{dragging:D,render:O}=m,A=rt.createElement(IT,{draggableId:D.draggableId,index:D.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(I,R)=>O(I,R,D));return rt.createPortal(A,b())}return rt.createElement(Qg.Provider,{value:S},s(T,g),N())};function sH(){return document.body||j(),document.body}var M0={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:sH},RT=t=>{let e={...t},n;for(n in M0)t[n]===void 0&&(e={...e,[n]:M0[n]});return e},Sg=(t,e)=>t===e.droppable.type,L0=(t,e)=>e.draggables[t.draggable.id],aH=()=>{let t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},e={...t,shouldAnimatePlaceholder:!1},n=Vt(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),o=Vt((i,s,a,l,c,d)=>{let u=c.descriptor.id;if(c.descriptor.droppableId===i){let g=d?{render:d,dragging:n(c.descriptor)}:null,m={isDraggingOver:a,draggingOverWith:a?u:null,draggingFromThisWith:u,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:g}}if(!s)return e;if(!l)return t;let h={isDraggingOver:a,draggingOverWith:u,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:h,useClone:null}});return(i,s)=>{let a=RT(s),l=a.droppableId,c=a.type,d=!a.isDropDisabled,u=a.renderClone;if(Zl(i)){let p=i.critical;if(!Sg(c,p))return e;let h=L0(p,i.dimensions),g=Zn(i.impact)===l;return o(l,d,g,g,h,u)}if(i.phase==="DROP_ANIMATING"){let p=i.completed;if(!Sg(c,p.critical))return e;let h=L0(p.critical,i.dimensions);return o(l,d,DT(p.result)===l,Zn(p.impact)===l,h,u)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){let p=i.completed;if(!Sg(c,p.critical))return e;let h=Zn(p.impact)===l,g=!!(p.impact.at&&p.impact.at.type==="COMBINE"),m=p.critical.droppable.id===l;return h?g?t:e:m?t:e}return e}},lH={updateViewportMaxScroll:l2},Nu=pg(aH,lH,(t,e,n)=>({...RT(n),...t,...e}),{context:qg,areStatePropsEqual:NT})(iH);ri();ke();ri();ke();function cH(){return new URLSearchParams(window.location.search).get("deeplink")||""}var PT=ft(null);function FT(t){let e=cH(),[n,o]=L(e),r={value:n,setValue:o};return P(()=>{o(e)},[e]),P(()=>{let i=s=>{if(cw(s.origin)&&Mw(s.data)){let a=s.data.scrollToDeeplink.deepKey,l=document.getElementById(a);if(l){o(a),tm(l,{behavior:"smooth",force:!0});let c=new URL(window.location.href);c.searchParams.set("deeplink",a),window.history.replaceState({},"",c.toString())}}};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i)}},[]),f(PT.Provider,{value:r,children:t.children})}function ic(){let t=ht(PT);if(!t)throw new Error("[useDeeplink()] DeeplinkContext not found, be sure to add <DeeplinkProvider>");return t}function dH(t){let e=t;for(;e&&e!==document.body;){let n=e.closest("details");if(n&&n.parentElement)n.open=!0,e=n.parentElement;else break}}function uH(t){let e=[],n=t;for(;n&&n!==document.body;){let o=n.closest(".DocEditor__ArrayField__item");if(!o)break;let r=o.querySelector(".DocEditor__ArrayField__item__header");if(r&&!e.includes(r))e.push(r),n=o.parentElement;else break}return e}function tm(t,e={behavior:"auto"}){setTimeout(()=>{let n=document.querySelector(".DocumentPage__side");if(!n||n.scrollTop>0&&!e.force)return;dH(t);let r=uH(t).reduce((s,a)=>s+a.offsetHeight,0),i=t.offsetTop-r;n.scroll({top:i,behavior:e.behavior})},e.force?0:300)}function BT(t){let e=new URL(window.location.href);return e.searchParams.set("deeplink",t),e.toString()}var pH={get:async()=>{try{let t=await fH();return t?JSON.parse(t):null}catch{return null}},set:t=>{navigator.clipboard&&navigator.clipboard.writeText&&navigator.clipboard.writeText(JSON.stringify(t,void 0,2)).catch(console.error)}};function nm(){return pH}async function fH(){try{if(navigator.clipboard&&navigator.clipboard.readText)return await navigator.clipboard.readText()}catch{}return null}function eo(t,e){if(!gH())return;let n=hH();if(!n)return;let o={highlightNode:{deepKey:t,options:e}};n.contentWindow?.postMessage(o,window.location.origin)}function hH(){return document.querySelector('iframe[title="iframe preview"]')}function gH(){let t=window.__ROOT_CTX.preview||{};return[!0,"to-preview"].includes(t.channel)}function $T(t,e){return t.replace(/\{(.+?)\}/g,(n,o)=>{let r=e(o);return r??n})}var Du=class extends Error{};function zT(t,e,n){let o=t.preview?.title;if(o)return ga(o,e,n)}function HT(t,e,n){let o=t.preview?.image;if(o)return ga(o,e,n)}function ga(t,e,n){if(!t)return;let o=Array.isArray(t)?t:[t],r=n?.index,i=s=>{if(r!==void 0){if(s==="_index"||s==="_index0")return String(r);if(s==="_index1")return String(r+1);if(s==="_index:02")return String(r).padStart(2,"0");if(s==="_index:03")return String(r).padStart(3,"0")}let a=Go(e,s);if(!a)throw new Du(s);if(Md(a)){let l=mH(a);if(l)return l}return String(a)};for(let s of o)try{return $T(s,i)}catch(a){if(a instanceof Du)continue;throw a}}function mH(t){let e=t?.blocks||[];for(let n of e)if(n.type==="paragraph"){let o=n.data?.text||"";o=o.replace(/<br\s*\/?>/gi,`
82
- `),o=o.replace(/<[^>]+>/g,"").replace(/&nbsp;/g," ");let r=o.split(/\r?\n/)[0].trim();if(r)return r}}function as(t,e,n={}){if(e==null)return!0;switch(t.type){case"string":case"select":case"date":case"datetime":return e==="";case"multiselect":return!Array.isArray(e)||e.length===0;case"number":case"boolean":return e==null;case"image":case"file":return!e||!e.src;case"reference":return!e||!e.id;case"references":return!Array.isArray(e)||e.length===0;case"richtext":return!Md(e);case"object":if(!Ln(e)||Object.keys(e).length===0)return!0;for(let o of t.fields||[])if(o.id&&!as(o,e[o.id],n))return!1;return!0;case"array":if(Array.isArray(e)){if(e.length===0)return!0;for(let o of e)if(!as(t.of,o,n))return!1;return!0}if(!Ln(e)||!Array.isArray(e._array)||e._array.length===0)return!0;for(let o of e._array)if(!as(t.of,e[o],n))return!1;return!0;case"oneof":{if(!Ln(e)||!e._type)return!0;let o,r=t.types||[];if(typeof r[0]=="string"?r.includes(e._type)&&(o=n[e._type]):o=r.find(i=>i.name===e._type),!o)return!0;for(let i of o.fields||[])if(i.id&&!as(i,e[i.id],n))return!1;return!0}default:return!1}}ke();function UT(t,e){let n=!1;return(...o)=>{n||(t(...o),n=!0,setTimeout(()=>{n=!1},e))}}var sc=class extends ho{constructor(n){super();this.interval=0;this.timeout=0;this.interval=n}start(){this.timeout=window.setTimeout(()=>{this.tick()},this.interval)}tick(){this.dispatch("tick"),this.start()}reset(){this.stop(),this.start()}stop(){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0)}};var _H=60*Zi.second,KT=5*Zi.minute,om=class extends ho{constructor(n){super();this.started=!1;this.timer=new sc(_H);this.idleTimer=new sc(KT);this.onUserInteraction=UT(()=>{this.idleTimer.reset()},5e3);this.id=n;let o=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db;this.docRef=kd(r,"Projects",o,"Viewers",n),this.timer.on("tick",()=>this.onTick()),this.idleTimer.on("tick",()=>this.onIdle()),window.addEventListener("mousemove",this.onUserInteraction),window.addEventListener("keypress",this.onUserInteraction)}async start(){this.started||(this.started=!0,this.dbUnsubscribe=Dd(this.docRef,n=>{let o=n.data();this.onData(o)}),this.onTick(),this.timer.start())}onData(n){let o=window.firebase.user,r=Sd.now(),i=Object.values(n).filter(s=>!(s.email===o.email||r.toMillis()-s.lastViewedAt.toMillis()>KT));this.dispatch("change",i)}async onTick(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}await NC(this.docRef,{[n.email]:{email:n.email,photoURL:n.photoURL,lastViewedAt:ea()}},{merge:!0})}async onIdle(){this.stop()}stop(){this.started&&(this.dbUnsubscribe&&this.dbUnsubscribe(),this.timer.stop(),this.idleTimer.stop(),this.onDisconnect(),this.started=!1)}async onDisconnect(){let n=window.firebase.user;if(!n.email){console.log("no user email:",n);return}let o=new kC(n.email,"disconnectedAt");await Nd(this.docRef,o,ea())}async dispose(){super.dispose(),this.stop(),this.timer.dispose(),this.idleTimer.dispose()}};function jT(t){let e=OC(t.id),[n,o]=L([]);if(P(()=>{let l=new om(e);l.on("change",d=>o(d)),l.start();let c=()=>{document.hidden||document.visibilityState!=="visible"?l.stop():l.started||l.start()};return document.addEventListener("visibilitychange",c),()=>{l.dispose(),document.removeEventListener("visibilitychange",c)}},[e]),n.length===0)return null;function r(l){return l.disconnectedAt?l.disconnectedAt>l.lastViewedAt:!1}let i=t.max||3,s=n.slice(0,i),a=n.length-i;return f("div",{className:"Viewers",children:[s.map(l=>f(JE,{email:l.email,size:30,inactive:r(l),className:"Viewers__avatar"},l.email)),a>0&&f(CC,{className:"Viewers__avatar",size:30,radius:"xl",children:["+",a]})]})}function VT(t){let n=t.field.checkboxLabel||"Enabled",[o,r]=Ot(t.deepKey,!1);return f("div",{className:"DocEditor__BooleanField",children:f(uo,{label:n,onChange:i=>{let s=i.currentTarget;r(s.checked)},checked:o,size:"xs"})})}ke();function WT(t){let[e,n]=Ot(t.deepKey),[o,r]=L(null),i=(s,a)=>{if(a&&!a.valid){r("Invalid date");return}if(s){let l=new Date(s);if(isNaN(l.getTime())){r("Invalid date");return}r(null),n(s)}else r(null),n(null)};return f("div",{className:"DocEditor__DateField",children:[f("input",{type:"date",value:e||"",onChange:s=>{let a=s.currentTarget;i(a.value,a.validity)}}),o&&f("div",{style:{color:"red",fontSize:"12px",marginTop:"4px"},children:o})]})}var bH={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},GT=(t,e,n)=>{let o,r=bH[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Ou(t){return(e={})=>{let n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var yH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},vH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},YT={date:Ou({formats:yH,defaultWidth:"full"}),time:Ou({formats:xH,defaultWidth:"full"}),dateTime:Ou({formats:vH,defaultWidth:"full"})};var CH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},qT=(t,e,n,o)=>CH[t];function ma(t){return(e,n)=>{let o=n?.context?String(n.context):"standalone",r;if(o==="formatting"&&t.formattingValues){let s=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):s;r=t.formattingValues[a]||t.formattingValues[s]}else{let s=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[s]}let i=t.argumentCallback?t.argumentCallback(e):e;return r[i]}}var EH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},wH={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},TH={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},SH={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},kH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},NH={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},DH=(t,e)=>{let n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},JT={ordinalNumber:DH,era:ma({values:EH,defaultWidth:"wide"}),quarter:ma({values:wH,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ma({values:TH,defaultWidth:"wide"}),day:ma({values:SH,defaultWidth:"wide"}),dayPeriod:ma({values:kH,defaultWidth:"wide",formattingValues:NH,defaultFormattingWidth:"wide"})};function _a(t){return(e,n={})=>{let o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],i=e.match(r);if(!i)return null;let s=i[0],a=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?IH(a,u=>u.test(s)):OH(a,u=>u.test(s)),c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;let d=e.slice(s.length);return{value:c,rest:d}}}function OH(t,e){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function IH(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function XT(t){return(e,n={})=>{let o=e.match(t.matchPattern);if(!o)return null;let r=o[0],i=e.match(t.parsePattern);if(!i)return null;let s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;let a=e.slice(r.length);return{value:s,rest:a}}}var AH=/^(\d+)(th|st|nd|rd)?/i,MH=/\d+/i,LH={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},RH={any:[/^b/i,/^(a|c)/i]},PH={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},FH={any:[/1/i,/2/i,/3/i,/4/i]},BH={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},$H={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zH={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},HH={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},UH={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},KH={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZT={ordinalNumber:XT({matchPattern:AH,parsePattern:MH,valueCallback:t=>parseInt(t,10)}),era:_a({matchPatterns:LH,defaultMatchWidth:"wide",parsePatterns:RH,defaultParseWidth:"any"}),quarter:_a({matchPatterns:PH,defaultMatchWidth:"wide",parsePatterns:FH,defaultParseWidth:"any",valueCallback:t=>t+1}),month:_a({matchPatterns:BH,defaultMatchWidth:"wide",parsePatterns:$H,defaultParseWidth:"any"}),day:_a({matchPatterns:zH,defaultMatchWidth:"wide",parsePatterns:HH,defaultParseWidth:"any"}),dayPeriod:_a({matchPatterns:UH,defaultMatchWidth:"any",parsePatterns:KH,defaultParseWidth:"any"})};var rm={code:"en-US",formatDistance:GT,formatLong:YT,formatRelative:qT,localize:JT,match:ZT,options:{weekStartsOn:0,firstWeekContainsDate:1}};var jH={};function Jo(){return jH}var VH=Math.pow(10,8)*24*60*60*1e3,eX=-VH,Iu=6048e5,QT=864e5;var WH=3600;var eS=WH*24,tX=eS*7,GH=eS*365.2425,YH=GH/12,nX=YH*3,im=Symbol.for("constructDateFrom");function Rn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&im in t?t[im](e):t instanceof Date?new t.constructor(e):new Date(e)}function yt(t,e){return Rn(e||t,t)}function sm(t){let e=yt(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function tS(t,...e){let n=Rn.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function am(t,e){let n=yt(t,e?.in);return n.setHours(0,0,0,0),n}function nS(t,e,n){let[o,r]=tS(n?.in,t,e),i=am(o),s=am(r),a=+i-sm(i),l=+s-sm(s);return Math.round((a-l)/QT)}function oS(t,e){let n=yt(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function rS(t,e){let n=yt(t,e?.in);return nS(n,oS(n))+1}function Er(t,e){let n=Jo(),o=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=yt(t,e?.in),i=r.getDay(),s=(i<o?7:0)+i-o;return r.setDate(r.getDate()-s),r.setHours(0,0,0,0),r}function ls(t,e){return Er(t,{...e,weekStartsOn:1})}function Au(t,e){let n=yt(t,e?.in),o=n.getFullYear(),r=Rn(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);let i=ls(r),s=Rn(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);let a=ls(s);return n.getTime()>=i.getTime()?o+1:n.getTime()>=a.getTime()?o:o-1}function iS(t,e){let n=Au(t,e),o=Rn(e?.in||t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),ls(o)}function sS(t,e){let n=yt(t,e?.in),o=+ls(n)-+iS(n);return Math.round(o/Iu)+1}function Mu(t,e){let n=yt(t,e?.in),o=n.getFullYear(),r=Jo(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=Rn(e?.in||t,0);s.setFullYear(o+1,0,i),s.setHours(0,0,0,0);let a=Er(s,e),l=Rn(e?.in||t,0);l.setFullYear(o,0,i),l.setHours(0,0,0,0);let c=Er(l,e);return+n>=+a?o+1:+n>=+c?o:o-1}function aS(t,e){let n=Jo(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=Mu(t,e),i=Rn(e?.in||t,0);return i.setFullYear(r,0,o),i.setHours(0,0,0,0),Er(i,e)}function lS(t,e){let n=yt(t,e?.in),o=+Er(n,e)-+aS(n,e);return Math.round(o/Iu)+1}function Ke(t,e){let n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}var wr={y(t,e){let n=t.getFullYear(),o=n>0?n:1-n;return Ke(e==="yy"?o%100:o,e.length)},M(t,e){let n=t.getMonth();return e==="M"?String(n+1):Ke(n+1,2)},d(t,e){return Ke(t.getDate(),e.length)},a(t,e){let n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Ke(t.getHours()%12||12,e.length)},H(t,e){return Ke(t.getHours(),e.length)},m(t,e){return Ke(t.getMinutes(),e.length)},s(t,e){return Ke(t.getSeconds(),e.length)},S(t,e){let n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return Ke(r,e.length)}};var ba={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},lm={G:function(t,e,n){let o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){let o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return wr.y(t,e)},Y:function(t,e,n,o){let r=Mu(t,o),i=r>0?r:1-r;if(e==="YY"){let s=i%100;return Ke(s,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Ke(i,e.length)},R:function(t,e){let n=Au(t);return Ke(n,e.length)},u:function(t,e){let n=t.getFullYear();return Ke(n,e.length)},Q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return Ke(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){let o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return Ke(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){let o=t.getMonth();switch(e){case"M":case"MM":return wr.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){let o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return Ke(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){let r=lS(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):Ke(r,e.length)},I:function(t,e,n){let o=sS(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):Ke(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):wr.d(t,e)},D:function(t,e,n){let o=rS(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):Ke(o,e.length)},E:function(t,e,n){let o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Ke(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){let r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Ke(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){let o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return Ke(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){let o=t.getHours(),r;switch(o===12?r=ba.noon:o===0?r=ba.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){let o=t.getHours(),r;switch(o>=17?r=ba.evening:o>=12?r=ba.afternoon:o>=4?r=ba.morning:r=ba.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return wr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):wr.H(t,e)},K:function(t,e,n){let o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):Ke(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):Ke(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):wr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):wr.s(t,e)},S:function(t,e){return wr.S(t,e)},X:function(t,e,n){let o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return dS(o);case"XXXX":case"XX":return cs(o);default:return cs(o,":")}},x:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"x":return dS(o);case"xxxx":case"xx":return cs(o);default:return cs(o,":")}},O:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+cS(o,":");default:return"GMT"+cs(o,":")}},z:function(t,e,n){let o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+cS(o,":");default:return"GMT"+cs(o,":")}},t:function(t,e,n){let o=Math.trunc(+t/1e3);return Ke(o,e.length)},T:function(t,e,n){return Ke(+t,e.length)}};function cS(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+Ke(i,2)}function dS(t,e){return t%60===0?(t>0?"-":"+")+Ke(Math.abs(t)/60,2):cs(t,e)}function cs(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Ke(Math.trunc(o/60),2),i=Ke(o%60,2);return n+r+e+i}var uS=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},pS=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},qH=(t,e)=>{let n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return uS(t,e);let i;switch(o){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",uS(o,e)).replace("{{time}}",pS(r,e))},fS={p:pS,P:qH};var JH=/^D+$/,XH=/^Y+$/,ZH=["D","DD","YY","YYYY"];function hS(t){return JH.test(t)}function gS(t){return XH.test(t)}function mS(t,e,n){let o=QH(t,e,n);if(console.warn(o),ZH.includes(t))throw new RangeError(o)}function QH(t,e,n){let o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function _S(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function bS(t){return!(!_S(t)&&typeof t!="number"||isNaN(+yt(t)))}var e4=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,t4=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,n4=/^'([^]*?)'?$/,o4=/''/g,r4=/[a-zA-Z]/;function yS(t,e,n){let o=Jo(),r=n?.locale??o.locale??rm,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,a=yt(t,n?.in);if(!bS(a))throw new RangeError("Invalid time value");let l=e.match(t4).map(d=>{let u=d[0];if(u==="p"||u==="P"){let p=fS[u];return p(d,r.formatLong)}return d}).join("").match(e4).map(d=>{if(d==="''")return{isToken:!1,value:"'"};let u=d[0];if(u==="'")return{isToken:!1,value:i4(d)};if(lm[u])return{isToken:!0,value:d};if(u.match(r4))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));let c={firstWeekContainsDate:i,weekStartsOn:s,locale:r};return l.map(d=>{if(!d.isToken)return d.value;let u=d.value;(!n?.useAdditionalWeekYearTokens&&gS(u)||!n?.useAdditionalDayOfYearTokens&&hS(u))&&mS(u,e,String(t));let p=lm[u[0]];return p(a,u,r.localize,c)}).join("")}function i4(t){let e=t.match(n4);return e?e[1].replace(o4,"'"):t}function xS(){return Object.assign({},Jo())}function cm(t,e,n){let o=xS(),r=l4(t,n.timeZone,n.locale??o.locale);return"formatToParts"in r?s4(r,e):a4(r,e)}function s4(t,e){let n=t.formatToParts(e);for(let o=n.length-1;o>=0;--o)if(n[o].type==="timeZoneName")return n[o].value}function a4(t,e){let n=t.format(e).replace(/\u200E/g,""),o=/ [\w-+ ]+$/.exec(n);return o?o[0].substr(1):""}function l4(t,e,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:e,timeZoneName:t})}function CS(t,e){let n=f4(e);return"formatToParts"in n?d4(n,t):u4(n,t)}var c4={year:0,month:1,day:2,hour:3,minute:4,second:5};function d4(t,e){try{let n=t.formatToParts(e),o=[];for(let r=0;r<n.length;r++){let i=c4[n[r].type];i!==void 0&&(o[i]=parseInt(n[r].value,10))}return o}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function u4(t,e){let n=t.format(e),o=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(o[3],10),parseInt(o[1],10),parseInt(o[2],10),parseInt(o[4],10),parseInt(o[5],10),parseInt(o[6],10)]}var dm={},vS=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),p4=vS==="06/25/2014, 00:00:00"||vS==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";function f4(t){return dm[t]||(dm[t]=p4?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),dm[t]}function ac(t,e,n,o,r,i,s){let a=new Date(0);return a.setUTCFullYear(t,e,n),a.setUTCHours(o,r,i,s),a}var ES=36e5,h4=6e4,um={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Tr(t,e,n){if(!t)return 0;let o=um.timezoneZ.exec(t);if(o)return 0;let r,i;if(o=um.timezoneHH.exec(t),o)return r=parseInt(o[1],10),wS(r)?-(r*ES):NaN;if(o=um.timezoneHHMM.exec(t),o){r=parseInt(o[2],10);let s=parseInt(o[3],10);return wS(r,s)?(i=Math.abs(r)*ES+s*h4,o[1]==="+"?-i:i):NaN}if(_4(t)){e=new Date(e||Date.now());let s=n?e:g4(e),a=pm(s,t);return-(n?a:m4(e,a,t))}return NaN}function g4(t){return ac(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function pm(t,e){let n=CS(t,e),o=ac(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=t.getTime(),i=r%1e3;return r-=i>=0?i:1e3+i,o-r}function m4(t,e,n){let r=t.getTime()-e,i=pm(new Date(r),n);if(e===i)return e;r-=i-e;let s=pm(new Date(r),n);return i===s?i:Math.max(i,s)}function wS(t,e){return-23<=t&&t<=23&&(e==null||0<=e&&e<=59)}var TS={};function _4(t){if(TS[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),TS[t]=!0,!0}catch{return!1}}var b4=60*1e3,kS={X:function(t,e,n){let o=fm(n.timeZone,t);if(o===0)return"Z";switch(e){case"X":return SS(o);case"XXXX":case"XX":return ya(o);default:return ya(o,":")}},x:function(t,e,n){let o=fm(n.timeZone,t);switch(e){case"x":return SS(o);case"xxxx":case"xx":return ya(o);default:return ya(o,":")}},O:function(t,e,n){let o=fm(n.timeZone,t);switch(e){case"O":case"OO":case"OOO":return"GMT"+y4(o,":");default:return"GMT"+ya(o,":")}},z:function(t,e,n){switch(e){case"z":case"zz":case"zzz":return cm("short",t,n);default:return cm("long",t,n)}}};function fm(t,e){let n=t?Tr(t,e,!0)/b4:e?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+t);return n}function Lu(t,e){let n=t<0?"-":"",o=Math.abs(t).toString();for(;o.length<e;)o="0"+o;return n+o}function ya(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Lu(Math.floor(o/60),2),i=Lu(Math.floor(o%60),2);return n+r+e+i}function SS(t,e){return t%60===0?(t>0?"-":"+")+Lu(Math.abs(t)/60,2):ya(t,e)}function y4(t,e=""){let n=t>0?"-":"+",o=Math.abs(t),r=Math.floor(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+Lu(i,2)}function hm(t){let e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+t-+e}var Ru=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;var gm=36e5,NS=6e4,x4=2,xn={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Ru};function pi(t,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(t===null)return new Date(NaN);let n=e.additionalDigits==null?x4:Number(e.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]")return new Date(t.getTime());if(typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]")return new Date(t);if(Object.prototype.toString.call(t)!=="[object String]")return new Date(NaN);let o=v4(t),{year:r,restDateString:i}=C4(o.date,n),s=E4(i,r);if(s===null||isNaN(s.getTime()))return new Date(NaN);if(s){let a=s.getTime(),l=0,c;if(o.time&&(l=w4(o.time),l===null||isNaN(l)))return new Date(NaN);if(o.timeZone||e.timeZone){if(c=Tr(o.timeZone||e.timeZone,new Date(a+l)),isNaN(c))return new Date(NaN)}else c=hm(new Date(a+l)),c=hm(new Date(a+l+c));return new Date(a+l+c)}else return new Date(NaN)}function v4(t){let e={},n=xn.dateTimePattern.exec(t),o;if(n?(e.date=n[1],o=n[3]):(n=xn.datePattern.exec(t),n?(e.date=n[1],o=n[2]):(e.date=null,o=t)),o){let r=xn.timeZone.exec(o);r?(e.time=o.replace(r[1],""),e.timeZone=r[1].trim()):e.time=o}return e}function C4(t,e){if(t){let n=xn.YYY[e],o=xn.YYYYY[e],r=xn.YYYY.exec(t)||o.exec(t);if(r){let i=r[1];return{year:parseInt(i,10),restDateString:t.slice(i.length)}}if(r=xn.YY.exec(t)||n.exec(t),r){let i=r[1];return{year:parseInt(i,10)*100,restDateString:t.slice(i.length)}}}return{year:null}}function E4(t,e){if(e===null)return null;let n,o,r;if(!t||!t.length)return n=new Date(0),n.setUTCFullYear(e),n;let i=xn.MM.exec(t);if(i)return n=new Date(0),o=parseInt(i[1],10)-1,OS(e,o)?(n.setUTCFullYear(e,o),n):new Date(NaN);if(i=xn.DDD.exec(t),i){n=new Date(0);let s=parseInt(i[1],10);return k4(e,s)?(n.setUTCFullYear(e,0,s),n):new Date(NaN)}if(i=xn.MMDD.exec(t),i){n=new Date(0),o=parseInt(i[1],10)-1;let s=parseInt(i[2],10);return OS(e,o,s)?(n.setUTCFullYear(e,o,s),n):new Date(NaN)}if(i=xn.Www.exec(t),i)return r=parseInt(i[1],10)-1,IS(r)?DS(e,r):new Date(NaN);if(i=xn.WwwD.exec(t),i){r=parseInt(i[1],10)-1;let s=parseInt(i[2],10)-1;return IS(r,s)?DS(e,r,s):new Date(NaN)}return null}function w4(t){let e,n,o=xn.HH.exec(t);if(o)return e=parseFloat(o[1].replace(",",".")),mm(e)?e%24*gm:NaN;if(o=xn.HHMM.exec(t),o)return e=parseInt(o[1],10),n=parseFloat(o[2].replace(",",".")),mm(e,n)?e%24*gm+n*NS:NaN;if(o=xn.HHMMSS.exec(t),o){e=parseInt(o[1],10),n=parseInt(o[2],10);let r=parseFloat(o[3].replace(",","."));return mm(e,n,r)?e%24*gm+n*NS+r*1e3:NaN}return null}function DS(t,e,n){e=e||0,n=n||0;let o=new Date(0);o.setUTCFullYear(t,0,4);let r=o.getUTCDay()||7,i=e*7+n+1-r;return o.setUTCDate(o.getUTCDate()+i),o}var T4=[31,28,31,30,31,30,31,31,30,31,30,31],S4=[31,29,31,30,31,30,31,31,30,31,30,31];function AS(t){return t%400===0||t%4===0&&t%100!==0}function OS(t,e,n){if(e<0||e>11)return!1;if(n!=null){if(n<1)return!1;let o=AS(t);if(o&&n>S4[e]||!o&&n>T4[e])return!1}return!0}function k4(t,e){if(e<1)return!1;let n=AS(t);return!(n&&e>366||!n&&e>365)}function IS(t,e){return!(t<0||t>52||e!=null&&(e<0||e>6))}function mm(t,e,n){return!(t<0||t>=25||e!=null&&(e<0||e>=60)||n!=null&&(n<0||n>=60))}var N4=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function _m(t,e,n={}){e=String(e);let o=e.match(N4);if(o){let r=pi(n.originalDate||t,n);e=o.reduce(function(i,s){if(s[0]==="'")return i;let a=i.indexOf(s),l=i[a-1]==="'",c=i.replace(s,"'"+kS[s[0]](r,s,n)+"'");return l?c.substring(0,a-1)+c.substring(a+1):c},e)}return yS(t,e,n)}function bm(t,e,n){t=pi(t,n);let o=Tr(e,t,!0),r=new Date(t.getTime()-o),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}function ym(t,e,n,o){return o={...o,timeZone:e,originalDate:t},_m(bm(t,e,{timeZone:o.timeZone}),n,o)}function xm(t,e,n){if(typeof t=="string"&&!t.match(Ru))return pi(t,{...n,timeZone:e});t=pi(t,n);let o=ac(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).getTime(),r=Tr(e,new Date(o));return new Date(o+r)}ke();function MS(t){let e=t.field,[n,o]=Ot(t.deepKey),r=`${D4(t.deepKey)}.timezone`,[i,s]=Ot(r),a=e.timezone||i||Intl.DateTimeFormat().resolvedOptions().timeZone,l=J(()=>{if(!n)return"";try{return ym(n.toDate(),a,"yyyy-MM-dd'T'HH:mm")}catch(h){return console.error("Error formatting date:",h),""}},[n,a]),[c,d]=L(null),u=(h,g)=>{if(g&&!g.valid){console.warn("Invalid date input"),d("Invalid datetime");return}if(h)try{let m=xm(h,a);if(isNaN(m.getTime())){console.warn("Invalid date:",h),d("Invalid datetime");return}d(null),o(Sd.fromDate(m))}catch(m){console.error("Error parsing date:",m),d("Invalid datetime")}else d(null),o(null)},p=h=>{s(h)};return f("div",{className:"DocEditor__DateTimeField",children:[f("div",{className:"DocEditor__DateTimeField__row",children:[f("input",{type:"datetime-local",value:l,onChange:h=>{let g=h.target;u(g.value,g.validity)},className:"DocEditor__DateTimeField__input"}),e.timezone?f("div",{className:"DocEditor__DateTimeField__timezone",children:["timezone: ",e.timezone]}):f(Mn,{className:"DocEditor__DateTimeField__timezoneSelect",value:a,onChange:h=>{h&&p(h)},data:Intl.supportedValuesOf("timeZone"),searchable:!0,size:"xs"})]}),c&&f("div",{className:"DocEditor__DateTimeField__error",children:c})]})}function D4(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}ri();si();si();ke();var O4=["drive.google.com","docs.google.com"];function Pu(t){try{let e=new URL(t);if(!O4.includes(e.hostname))return null;if(e.searchParams.has("id"))return e.searchParams.get("id");let n=e.pathname.split("/"),o=n.findIndex(r=>r==="d");if(o!==-1&&o<n.length-1)return n[o+1]}catch{return null}return null}async function LS(t,e){let n="https://www.googleapis.com/auth/drive.readonly";(!t.isLoggedIn()||!t.hasScope(n))&&await t.login({scopes:[n]});let o=window.gapi;if(!o||!o.client||!o.client.drive)throw new Error("Google Drive API not loaded");let r=o.auth.getToken()?.access_token;if(!r)throw new Error("No Google Drive access token found");let[i,s]=await Promise.all([o.client.drive.files.get({fileId:e,fields:"name,mimeType,size",supportsAllDrives:!0}),fetch(`https://www.googleapis.com/drive/v3/files/${e}?alt=media&supportsAllDrives=true`,{headers:{Authorization:`Bearer ${r}`}})]),a=i.result;if(!s.ok)throw new Error(`Failed to download file from Drive: ${s.statusText}`);let l=await s.blob();return new File([l],a.name,{type:a.mimeType})}ke();var I4=["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"],A4=["#25262b","#868e96","#fa5252","#e64980","#be4bdb","#7950f2","#4c6ef5","#228be6","#15aabf","#12b886","#40c057","#82c91e","#fab005","#fd7e14"];function RS(t){let[e,n]=L("simple"),[o,r]=L(!1),[i,s]=L(!1),[a,l]=L(null),[c,d]=L(""),[u,p]=L(t.initialWidth||1600),[h,g]=L(t.initialHeight||900),[m,_]=L("16:9"),y=!!(window.__ROOT_CTX?.experiments||{}).ai;async function v(){if(!c){ce({title:"Prompt required",message:"Please enter a prompt to generate an image.",color:"red"});return}r(!0);try{let k=await(await fetch("/cms/api/ai.generate_image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:c,aspectRatio:m})})).json();if(k.success&&k.image)l(k.image);else throw new Error(k.error||"Failed to generate image")}catch(C){console.error(C),ce({title:"Generation failed",message:C.message||"Unknown error",color:"red"})}finally{r(!1)}}function x(C){C.preventDefault();let k=new FormData(C.target),T=parseInt(k.get("width"),10),w=parseInt(k.get("height"),10),S=k.get("backgroundColor"),N=k.get("label")||`${T}x${w}`,D=[];if(D.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${T}" height="${w}" viewBox="0 0 ${T} ${w}"><rect width="${T}" height="${w}" fill="${S}" />`),N){let F=T*.5/(N.length*.6);D.push(`<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-size="${F}" fill="#fff">${N}</text>`)}D.push("</svg>");let O=D.join(""),I=new TextEncoder().encode(O),z={src:`data:image/svg+xml;base64,${btoa(String.fromCharCode(...I))}`,filename:"placeholder.svg",width:T,height:w,alt:""};t.onSubmit(z)}async function E(){if(a){s(!0);try{let k=await(await fetch(a)).blob(),T=new File([k],"generated-image.png",{type:"image/png"}),{uploadFileToGCS:w}=await import("./gcs-ECSDFCIU.js"),S=await w(T),[N,D]=m.split(":").map(Number),O=1600,A=Math.round(O*D/N),I={...S,width:O,height:A,alt:c};t.onSubmit(I)}catch(C){console.error(C),ce({title:"Save failed",message:C.message||"Failed to upload image",color:"red"})}finally{s(!1)}}}return f(po,{gap:"md",children:[y&&f(wd,{value:e,onChange:C=>n(C),data:[{label:"Simple",value:"simple"},{label:f(pn,{gap:5,children:[f(ko,{size:16}),f("span",{children:"Generate with AI"})]}),value:"ai"}],fullWidth:!0}),e==="simple"?f("form",{onSubmit:x,children:[f(po,{gap:"xs",children:[f(qn,{label:"Width",name:"width",type:"number",value:u,onChange:C=>p(parseInt(C.currentTarget.value,10)),"data-autofocus":!0}),f(qn,{label:"Height",name:"height",type:"number",value:h,onChange:C=>g(parseInt(C.currentTarget.value,10))}),f(qn,{name:"label",label:"Label",defaultValue:""}),f(EC,{name:"backgroundColor",label:"Background color",format:"hex",defaultValue:"#868e96",swatches:A4})]}),f(pn,{justify:"flex-end",mt:"md",children:f(X,{variant:"filled",type:"submit",children:"Create"})})]}):f(po,{gap:"xs",children:[f(Mn,{label:"Aspect Ratio",data:I4,value:m,onChange:C=>_(C)}),f(_n,{label:"Prompt",placeholder:"Describe the image you want to generate...",minRows:3,value:c,onChange:C=>d(C.currentTarget.value),"data-autofocus":!0,required:!0}),a&&f(Qs,{src:a,alt:"Generated preview",height:200,fit:"contain"}),f(pn,{justify:"flex-end",mt:"md",children:[f(X,{variant:"light",onClick:v,loading:o,disabled:i||!c,leftIcon:f(ko,{size:16}),children:o?"Generating...":"Preview"}),f(X,{variant:"filled",onClick:E,loading:i,disabled:!a||o,children:i?"Saving...":"Save"})]})]})]})}var M4=["image/gif","image/jpeg","image/png","image/svg+xml","image/webp"],PS=ft(null),L4=_C(()=>import("./ImageEditorDialog-GGS4VFEA.js").then(t=>({default:t.ImageEditorDialog})));function lc(){let t=ht(PS);if(!t)throw new Error("useFileField() should be called within a <FileFieldContext.Provider>");return t}function R4(t){let{field:e,value:n,setValue:o,loadingState:r,setLoadingState:i}=t,s=xC(),a=q(null),[l,c]=L(!1),[d,u]=L(!1),[p,h]=L(!1),g=aa(),m=bw(),_=t.allowEditing!==!1,[b,y]=L("hash"),[v,x]=L(null),[E,C]=L(!1),[k,T]=L(null),w=t.accept??e.exts??(t.variant==="image"?M4:[]),S=n?.alt||"",N=t.altDisabledByMetadata===!0,D=n?.altDisabled===!0,O=e.alt!==!1&&!N&&!D;async function A(oe,ee,xe){try{i("loading");let Be=xe?.namingMode||(e.preserveFilename?"clean":"hash"),cn=e.cacheControl||(Be==="clean"?"no-cache":void 0),$e=await ai(oe,{namingMode:Be,checkExists:xe?.checkExists??!1,cacheControl:cn});!$e.alt&&FS($e.filename)&&S&&($e.alt=S),ee&&($e.originalSrc=ee),o($e),i("complete"),x(null),T(null)}catch(Be){console.error("upload failed"),console.error(Be),i("error"),ce({title:"Upload failed",message:"Failed to upload: "+String(Be),color:"red",autoClose:!1})}}async function I(){i("loading");try{let oe=n?.gcsPath||n?.src;oe&&await RC(oe),o(null),i(null),ce({message:"File deleted from GCS",color:"green"})}catch(oe){console.error(oe),i("error"),ce({title:"Delete failed",message:String(oe),color:"red"})}finally{u(!1)}}function R(){if(!_&&n?.src){u(!0);return}o(null)}async function z(oe,ee){if(!oe)return;if(x(null),T(null),C(!1),typeof oe=="string"&&!ee?.as){let cn=Pu(oe);if(cn){try{if(!g.enabled){console.warn("Google API integration is not enabled for this project. Specify the `gapi` config in your root.config.ts to enable pasting from Google Drive URLs.");return}i("loading"),ce({message:"Downloading from Google Drive...",loading:!0,autoClose:!1,id:"gdrive-download"});let $e=await LS(g,cn);Ol("gdrive-download"),z($e)}catch($e){console.error($e),i("error"),Ol("gdrive-download"),ce({title:"Google Drive import failed",message:$e.message||"Failed to download",color:"red"})}return}}ee?.as==="svg"&&typeof oe=="string"&&(oe=new File([new Blob([oe],{type:"image/svg+xml"})],"untitled.svg",{type:"image/svg+xml"}));let xe=oe,Be=kh(xe.name);if(w.length>0&&!w.some(cn=>cn.endsWith(Be)||cn===`*/${Be}`||cn==="*/*"||cn===xe.type)){ce({title:"Invalid file type",message:`File type ${Be} is not allowed.`,color:"red",autoClose:!0});return}if(b==="clean"&&t.showNamingOptions){i("loading");let $e=`${window.__ROOT_CTX.rootConfig.projectId}/uploads/${xe.name}`;try{if(await PC($e)){x(xe),T(`https://storage.googleapis.com/${window.firebase.storage.app.options.storageBucket}/${$e}`),i(null);return}}catch(nn){console.warn("Failed to check file existence",nn)}}A(xe,void 0,{namingMode:b})}function W(){a.current?.focus()}function Z(){if(n?.src)if(Nh(n.src)){let oe=document.createElement("a");oe.href=FC(n.src),n.filename&&(oe.download=n.filename),document.body.appendChild(oe),oe.click(),document.body.removeChild(oe)}else window.open(n.src,"_blank")}function F(){let oe=document.createElement("input");oe.type="file",w.length>0&&(oe.accept=w.join(",")),oe.onchange=ee=>{let xe=ee.target;xe.files&&xe.files.length>0&&z(xe.files[0])},oe.click(),oe.remove()}function se(){c(!0)}function ye(){h(!0)}async function ut(){let oe=BC();if(n?.assetId)try{let ee=await zC(n.assetId);ee&&(oe=ee.parent||"")}catch(ee){console.warn("failed to resolve linked asset folder:",ee)}m.open({accept:w,initialFolder:oe,onSelect:ee=>{let xe=HC(ee);!xe.alt&&S&&(xe.alt=S),o(xe),i("complete")}})}function Rt(){if(!n?.assetId)return;let oe={...n};delete oe.assetId,o(oe)}function ot(oe){n?.src&&o({...n,alt:oe||""})}async function pt(){let oe=n;if(oe?.src){i("loading");try{let ee=await window.fetch("/cms/api/ai.generate_alt_text",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({imageUrl:oe.src})}),xe=await ee.json();if(!ee.ok||!xe.success)throw new Error(xe.error||"Failed to generate alt text");xe.altText&&ot(xe.altText)}catch(ee){ce({title:"Sorry, something went wrong.",message:ee.message||"Unknown error",color:"red",autoClose:!0})}finally{i("complete")}}}return f(PS.Provider,{value:{field:e,variant:t.variant,value:n,setValue:o,loadingState:r,removeFile:R,acceptedFileTypes:w,handleFile:z,focusDropZone:W,requestGenerateAltText:pt,requestFileUpload:F,requestFileDownload:Z,requestPlaceholderModalOpen:se,requestImageEditorOpen:ye,assetPickerEnabled:m.enabled,requestAssetPicker:ut,unlinkAsset:Rt,showAltText:O,altText:S,setAltText:ot,altDisabledByMetadata:N,setAltDisabledByMetadata:t.setAltDisabledByMetadata,allowEditing:_},children:[f(Xi,{size:"sm",opened:l,onClose:()=>c(!1),title:"Placeholder image",centered:!0,overlayColor:s.colorScheme==="dark"?s.colors.dark[9]:s.colors.gray[2],children:f(RS,{onSubmit:oe=>{o(oe),c(!1)}})}),f(Xi,{size:"sm",opened:d,onClose:()=>u(!1),title:"Delete file?",centered:!0,overlayColor:s.colorScheme==="dark"?s.colors.dark[9]:s.colors.gray[2],children:[f(un,{size:"sm",mb:"lg",children:"Are you sure you want to delete this file from GCS? This action cannot be undone."}),f(pn,{grow:!0,spacing:"xs",children:[f(X,{variant:"default",onClick:()=>u(!1),disabled:r==="loading",children:"Cancel"}),f(X,{color:"red",onClick:I,loading:r==="loading",children:"Delete"})]})]}),p&&n?.src&&f(vd,{fallback:null,children:f(L4,{opened:p,onClose:()=>h(!1),src:n.src,originalSrc:n.originalSrc,filename:n.filename,initialWidth:parseInt(n.width),initialHeight:parseInt(n.height),onSave:oe=>{A(oe,n.originalSrc||n.src),h(!1)}},n.src)}),v?f("div",{className:"FileField__overwriteWarning",children:[f("div",{className:"FileField__overwriteWarning__header",children:f(un,{size:"sm",color:"red",weight:700,children:"File already exists"})}),f(un,{size:"sm",children:["A file named ",f("strong",{children:v.name})," already exists."]}),k&&f(un,{size:"sm",className:"FileField__overwriteWarning__link",children:f("a",{href:k,target:"_blank",rel:"noopener noreferrer",children:["View existing file ",f(vr,{size:12})]})}),f("div",{className:"FileField__overwriteWarning__checkbox",children:f(uo,{label:"Confirm overwrite",checked:E,onChange:oe=>C(oe.currentTarget.checked)})}),f(pn,{grow:!0,spacing:"xs",className:"FileField__overwriteWarning__actions",children:[f(X,{variant:"default",onClick:()=>{x(null),T(null),C(!1)},disabled:r==="loading",children:"Cancel"}),f(X,{disabled:!E,onClick:()=>A(v,void 0,{namingMode:"clean"}),color:"red",loading:r==="loading",children:"Overwrite"})]})]}):f(Ne,{children:[f("div",{className:Ce("FileField",t.showNamingOptions&&"FileField--withOptions"),children:[f(vn.Dropzone,{ref:a}),n?.src?f(vn.Preview,{}):f(vn.InvisibleDropzone,{children:f(vn.Empty,{})})]}),t.showNamingOptions&&!n&&f("div",{className:"FileField__settings",style:{marginTop:8},children:f(Mn,{label:"File name options",size:"xs",itemComponent:P4,data:[{value:"hash",label:"Hash the file name",description:"The filename will be hashed so the file's original name won't be exposed."},{value:"hash-path",label:"Use a hashed path with the original file name",description:"Use the original file name, but put it inside a hashed directory."},{value:"clean",label:"Use the original file name only",description:"The file will be uploaded to the bucket as-is, without a hashed directory."}],value:b,onChange:oe=>y(oe||"hash"),disabled:r==="loading"||!!n})})]})]})}function vn(t){let e=t.field,[n,o]=Ot(t.deepKey),[r,i]=L(null),s=B4(t.deepKey),[a,l]=Ot(s),c=a?.alt===!1,d=u=>{let p={...a||{}};u?p.alt=!1:delete p.alt,l(Object.keys(p).length===0?null:p)};return f(R4,{field:e,value:n,setValue:o,loadingState:r,setLoadingState:i,variant:t.variant,allowEditing:t.allowEditing,altDisabledByMetadata:c,setAltDisabledByMetadata:t.variant==="image"&&e.alt!==!1?d:void 0})}vn.Preview=()=>{let t=lc(),[e,n]=L(!1),[o,r]=L(!1),i=window.__ROOT_CTX.experiments||{},s=!!t.value?.width&&!!t.value?.height&&Number(t.value.width)>0&&Number(t.value.height)>0,a=t.value?.filename||"",l=Ml(a),c=yr(a)||l&&s,[d,u]=L(!c),p=q(t.value?.src);if(t.value?.src!==p.current){p.current=t.value?.src;let h=t.value?.filename||"",g=yr(h)||Ml(h)&&s;!g&&!d?u(!0):g&&d&&u(!1)}return t.value?.src?f("div",{className:"FileField__Preview",children:[f("div",{className:"FileField__Preview__InfoButton",children:[c&&f(Oe,{label:"Toggle file info",position:"top",withArrow:!0,children:f(Me,{onClick:()=>u(h=>!h),size:"sm",variant:"outline",className:"FileField__Preview__InfoButton__Icon","aria-label":"Toggle file info",children:f(Rl,{size:16})})}),f(G,{classNames:{body:"FileField__Preview__Menu"},shadow:"sm",control:f(Me,{variant:"outline",size:"sm",radius:"sm",c:"black",className:"FileField__Preview__InfoButton__Icon",children:f(ia,{size:16})}),children:[t.allowEditing&&f(Ne,{children:[f(G.Label,{size:"sm",children:"REPLACE"}),f(G.Item,{icon:t.variant==="image"?f(Ph,{size:16}):f(Ll,{size:16}),onClick:()=>t.requestFileUpload(),children:["Upload ",t.variant==="image"?"image":"file"]}),t.assetPickerEnabled&&f(G.Item,{icon:f(SE,{size:16}),onClick:()=>t.requestAssetPicker(),children:"Select from asset library"}),BS(t.acceptedFileTypes)&&f(G.Item,{disabled:!t.value?.src,icon:f(Rh,{size:16}),onClick:()=>{t.requestPlaceholderModalOpen()},children:"Placeholder image"}),yr(t.value?.src)&&!t.value?.src?.endsWith(".svg")&&f(G.Item,{disabled:!t.value?.src,icon:f(dE,{size:16}),closeMenuOnClick:!0,onClick:()=>{t.requestImageEditorOpen()},children:"Edit image"}),f(_r,{})]}),f(G.Item,{disabled:t.value?.src?.startsWith("data:"),onClick:()=>{t?.requestFileDownload()},icon:f(pE,{size:16}),children:"Download file"}),f(G.Item,{closeOnItemClick:!1,icon:f(Kd,{size:16}),onClick:()=>{r(!1);let h=t.value?.src||"";Nh(h)&&(h=h.split("=")[0]+"=s0"),navigator.clipboard.writeText(h).then(()=>r(!0)).finally(()=>setTimeout(()=>{r(!1)},2e3))},children:o?"Copied!":"Copy URL"}),t.value?.assetId&&f(G.Item,{component:"a",href:`/cms/assets?asset=${t.value.assetId}`,target:"_blank",rel:"noreferrer",icon:f(vr,{size:16}),children:"View in asset library"}),t.allowEditing&&t.value?.assetId&&f(G.Item,{icon:f(UE,{size:16}),onClick:()=>t.unlinkAsset(),children:"Unlink from asset library"}),t.allowEditing&&yr(t.value?.src||"")&&t.value?.canvasBgColor&&f(G.Item,{icon:t.value?.canvasBgColor==="dark"?f(Hh,{size:16}):f($h,{size:16,style:{opacity:.25}}),closeOnItemClick:!1,onClick:()=>{let h=t.value?.canvasBgColor==="dark"?"light":"dark";t.value&&t.setValue({...t.value,canvasBgColor:h})},children:"Use dark canvas"}),t.allowEditing&&t.setAltDisabledByMetadata&&f(G.Item,{icon:t.altDisabledByMetadata?f(Hh,{size:16}):f($h,{size:16,style:{opacity:.25}}),closeOnItemClick:!1,onClick:()=>{t.setAltDisabledByMetadata?.(!t.altDisabledByMetadata)},children:"Disable alt text"}),f(_r,{}),f(G.Item,{color:"red",onClick:()=>{t?.removeFile()},icon:f(Jn,{size:16}),children:"Remove file"})]})]}),f("div",{className:Ce("FileField__Canvas",d&&"FileField__Canvas--infoOpened",e&&"dragging"),style:F4(t.value),onDragOver:h=>{h.preventDefault(),n(!0)},onDragLeave:h=>{h.preventDefault(),n(!1)},onDrop:h=>{h.preventDefault(),n(!1);let g=h.dataTransfer?.files[0];g&&t&&t.handleFile(g)},onPaste:h=>{h.preventDefault();let g=h.clipboardData?.files[0];if(g){t.handleFile(g);return}let m=h.clipboardData?.getData("text/plain");if(m){if(Pu(m)){t.handleFile(m);return}if($S(m)){t.handleFile(m,{as:"svg"});return}}},children:[f(Ed,{visible:t.loadingState==="loading"}),d?f("div",{className:"FileField__Canvas__Info",children:[f(Pl,{size:16,className:"FileField__Canvas__Info__Icon"}),f(SC,{className:"FileField__Canvas__Info__Table",verticalSpacing:"xs",fontSize:"xs",children:f("tbody",{children:[t.value?.filename&&f("tr",{children:[f("td",{children:f("b",{children:"Name"})}),f("td",{children:t.value.filename})]}),t.value?.assetId&&f("tr",{children:[f("td",{children:f("b",{children:"Asset"})}),f("td",{children:f("a",{href:`/cms/assets?asset=${t.value.assetId}`,target:"_blank",rel:"noreferrer",children:"Open in asset library"})})]}),t.value?.uploadedAt&&f("tr",{children:[f("td",{children:f("b",{children:"Uploaded"})}),f("td",{children:[new Date(parseInt(t.value.uploadedAt,10)).toLocaleString(),t.value.uploadedBy&&f(Ne,{children:[" by ",t.value.uploadedBy]})]})]}),!!(t.value?.width&&t.value?.height)&&f("tr",{children:[f("td",{children:f("b",{children:"Dimensions"})}),f("td",{children:[t.value.width,"x",t.value.height]})]}),f("tr",{children:[f("td",{children:f("b",{children:"URL"})}),f("td",{children:f(_n,{readOnly:!0,value:t.value?.src,size:"xs",radius:0,autosize:!0,maxRows:10})})]})]})})]}):f(Ne,{children:[!!(t.value?.width&&t.value?.height)&&f(vC,{radius:"sm",className:"FileField__Preview__Info",children:[t.value.width,"x",t.value.height]}),t.value?.assetId&&f("a",{className:"FileField__Preview__AssetLibraryBadge",href:`/cms/assets?asset=${t.value?.assetId}`,target:"_blank",children:"ASSET LIBRARY"}),yr(t.value?.src)&&f("img",{onClick:()=>{t?.focusDropZone()},onDblClick:()=>{t.allowEditing&&t?.requestFileUpload()},src:t.value.src,alt:t.value.alt||"Uploaded file preview",className:"FileField__Preview__Image"}),Ml(t.value?.src)&&f(Ne,{children:f("video",{className:"FileField__Preview__Image",controls:!0,muted:!0,preload:"metadata",children:f("source",{src:t.value.src,type:`video/${kh(t.value.src)}`})})})]}),t.allowEditing&&f("div",{className:"FileField__reupload",children:f(vn.UploadButton,{className:"FileField__reupload__button",compact:!0})})]}),t.allowEditing&&t.showAltText&&(t.altText||FS(t.value?.filename)||t.variant==="image")&&f("div",{className:"DocEditor__ImageField__imagePreview__Image__Alt",children:[f(_n,{radius:0,className:"DocEditor__ImageField__imagePreview__Image__Alt__Textarea",value:t.altText,placeholder:"Alt text",size:"xs",autosize:!0,disabled:t.loadingState==="loading",onChange:h=>{t?.setAltText(h.currentTarget.value)}}),i.ai&&!t.altText&&t.value?.src?.startsWith("http")&&f(Oe,{label:"Generate alt text with AI",position:"top",withArrow:!0,children:f(Me,{className:"DocEditor__ImageField__imagePreview__Image__Alt__AiButton",onClick:()=>{t.requestGenerateAltText()},disabled:t.loadingState==="loading",children:f(ko,{size:20,stroke:"1.75"})})})]})]}):null};vn.UploadButton=t=>{let e=lc(),n=e.loadingState==="loading",o=t.compact?14:16;return f(X,{color:"black",variant:"default",disabled:n,size:t.compact?"compact-xs":"compact-md",className:Ce("FileField__FileUploadButton",t.compact&&"FileField__FileUploadButton--compact"),onClick:()=>{e.requestFileUpload()},leftIcon:f(Ne,{children:n&&!t.compact?f(Ft,{size:o}):e?.variant==="image"?f(Ph,{size:o}):f(Ll,{size:o})}),children:n&&!t.compact?"Uploading...":e.value?.src?"Upload":"Paste, drop, or click to upload"})};vn.InvisibleDropzone=t=>{let[e,n]=L(!1),o=lc();return f("div",{className:Ce("FileField__InvisibleDropzone",e&&"dragging"),onDragOver:r=>{r.preventDefault(),r.stopPropagation(),n(!0)},onDragLeave:r=>{r.preventDefault(),r.stopPropagation(),n(!1)},onDrop:r=>{r.preventDefault(),r.stopPropagation(),n(!1);let i=r.dataTransfer?.files[0];i&&o.handleFile(i)},children:t.children})};vn.Empty=()=>{let t=lc(),e=J(()=>{if(t.acceptedFileTypes.length===0)return"";let n=t.acceptedFileTypes.filter(o=>o!=="*/*"&&o!=="*");return n.length===0?"":n.map(o=>o.split("/").pop().split("+")[0].replaceAll(".","")).sort().join(", ")},[t.acceptedFileTypes]);return f("div",{className:"FileField__Empty",children:[f("div",{className:"FileField__Empty__Label",children:[f(vn.UploadButton,{}),BS(t.acceptedFileTypes)&&f("div",{children:f(Oe,{label:"Create placeholder image",children:f(Me,{className:"FileField__Empty__Label__PlaceholderButton",onClick:()=>{t.requestPlaceholderModalOpen()},title:"Create placeholder image",children:f(Rh,{size:16})})})})]}),t.allowEditing&&t.assetPickerEnabled&&f("div",{className:"FileField__Empty__AssetLibrary",children:["or select from"," ",f("button",{type:"button",className:"FileField__Empty__AssetLibrary__link",onClick:()=>t.requestAssetPicker(),children:"asset library"})]}),e&&f("div",{children:f("div",{className:"FileField__Empty__AcceptTypes",children:["Allowed file types: ",e]})})]})};vn.Dropzone=Wo((t,e)=>{let[n,o]=L(!1),r=lc();return f("button",{ref:e,className:Ce("FileField__Dropzone",n&&"dragging"),onDblClick:()=>{r?.requestFileUpload()},onCopy:i=>{r.value?.src&&(i.preventDefault(),i.clipboardData?.setData("text/plain",r.value.src),i.clipboardData?.setData("application/json",JSON.stringify(r.value)))},onKeyDown:i=>{((i.metaKey||i.ctrlKey)&&i.key==="Backspace"||i.key==="Delete")&&(i.preventDefault(),r.value?.src&&r.removeFile())},onDragOver:i=>{i.preventDefault(),o(!0)},onDragLeave:i=>{i.preventDefault(),o(!1)},onDrop:i=>{i.preventDefault(),o(!1);let s=i.dataTransfer?.files[0];s&&r&&r.handleFile(s)},onPaste:i=>{if(i.preventDefault(),!r)return;let s=i.clipboardData?.getData("application/json");if(s)try{let c=JSON.parse(s);if(c&&c.src&&c.filename&&r){console.log("Parsed JSON file:",c),r.setValue(c);return}}catch(c){console.error("error parsing json",c)}let a=i.clipboardData?.files[0];if(a){r.handleFile(a);return}let l=i.clipboardData?.getData("text/plain");if(l){if(Pu(l)){r.handleFile(l);return}if($S(l)){r.handleFile(l,{as:"svg"});return}}},title:"Drop or paste to upload a file"})});var P4=Wo(t=>{let{label:e,description:n,...o}=t;return f("div",{className:"FileField__NamingModeItem",...o,children:[f(un,{size:"sm",weight:500,children:e}),f(un,{size:"xs",color:"dimmed",children:n})]})});function FS(t){return t?yr(t)||Ml(t):!1}function BS(t){return t.some(e=>e.startsWith("image/"))||t.length===0}function F4(t){let e={};if(t.width&&t.height){e["--canvas-aspect-ratio"]=`${t.width} / ${t.height}`,e["--canvas-asset-width"]=`${t.width}px`;let n=Math.min(t.height,280);n<80&&(n=80),e["--canvas-max-height"]=`${n}px`}return t.canvasBgColor==="dark"&&(e["--canvas-bg-color"]="#000"),e}function B4(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}function $S(t){return/^(?:\uFEFF)?\s*(?:<!--[\s\S]*?-->\s*)*(?:<\?xml[\s\S]*?\?>\s*)?(?:<!DOCTYPE\s+svg[\s\S]*?>\s*)?<svg\b[^>]*?(?:\/>|>[\s\S]*?<\/svg>)\s*$/.test(t)}function zS(t){return f(vn,{...t,variant:"image"})}ke();function HS(t){let e=t.field,[n,o]=Ot(t.deepKey,[]),r=J(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return f("div",{className:"DocEditor__MultiSelectField",children:f(wC,{data:r,size:"xs",radius:0,placeholder:e.placeholder,value:n,searchable:!0,creatable:e.creatable||!1,getCreateLabel:i=>`+ Add "${i}"`,onChange:i=>o(i),dropdownComponent:"div"})})}function US(t){let[e,n]=Ot(t.deepKey,0);return f(TC,{size:"xs",radius:0,value:e,onChange:o=>n(o),hideControls:!0})}ke();var KS="ReferenceFieldEditorModal";function Fu(){let t=Et(),e=it();return{open:n=>{t.openContextModal(KS,{...e,className:"ReferenceFieldEditorModalWrap",innerProps:n,title:`Edit ${n.docId}`,size:"xl",overflow:"inside",closeOnClickOutside:!1,closeOnEscape:!1})}}}function vm(t){let{id:e,context:n,innerProps:o}=t,r=o.docId;return f("div",{className:"ReferenceFieldEditorModal",children:f(Fw,{docId:r,autoSave:!1,flushOnStop:!1,children:[f(Ae,{className:"ReferenceFieldEditorModal__DocEditor",docId:o.docId,hideStatusBar:!0}),f(vm.Footer,{docId:r,onCancel:()=>n.closeModal(e)})]})})}vm.Footer=t=>{let e=on();return f("div",{className:"ReferenceFieldEditorModal__footer",children:[f("div",{className:"ReferenceFieldEditorModal__footer__start",children:f(X,{component:"a",variant:"default",size:"xs",rightIcon:f(ra,{size:16}),href:`/cms/content/${t.docId}`,target:"_blank",children:["Open ",t.docId]})}),f(X,{variant:"default",size:"xs",onClick:t.onCancel,children:"Cancel"}),f(X,{color:"dark",size:"xs",onClick:async()=>{await e.controller.flush(),t.onCancel()},children:"Save"})]})};vm.id=KS;function xa(t){let e=t.field,[n,o]=Ot(t.deepKey),r=n?.id||"";function i(c){o(c?Pd(c):null)}let s=ru(),a=Fu();function l(){let c=r?Pd(r).collection:e.initialCollection;s.open({collections:e.collections,initialCollection:c,onChange:d=>{i(d),s.close()}})}return f("div",{className:"ReferenceField",children:[r?f("div",{className:"ReferenceField__ref",children:[f(xa.Preview,{id:r}),f("div",{className:"ReferenceField__remove",children:[f(Oe,{label:"Quick edit",children:f(Me,{className:"ReferenceField__remove__icon",onClick:()=>a.open({docId:r}),children:f(Yd,{size:16})})}),f(Oe,{label:"Remove",children:f(Me,{className:"ReferenceField__remove__icon",onClick:()=>o(null),children:f(Jn,{size:16})})})]})]}):f("div",{className:"ReferenceField__none",children:"None selected"}),f(X,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}xa.Preview=t=>{let[e,n]=L(!0),[o,r]=L(null);async function i(){n(!0),await br(async()=>{let s=await Al(t.id);r(s)}),n(!1)}return P(()=>{i()},[t.id]),f("div",{className:"ReferenceField__Preview",children:e?f("div",{className:"ReferenceField__Preview__loading",children:f(Ft,{color:"gray",size:"sm"})}):o?f(xa.DocCard,{doc:o}):f("div",{className:"ReferenceField__Preview__notfound",children:["Doc not found: ",f("b",{children:t.id})," (was it deleted?). Select a new doc or remove using the trash icon to the right."]})})};xa.DocCard=t=>{let e=t.doc,n=e.id||e.sys?.id||"";if(!n)return f("div",{className:"ReferenceField__DocCard ReferenceField__DocCard--error",children:JSON.stringify(e)});let o=Pd(n).collection,r=e.fields||{},i=window.__ROOT_CTX.collections[o];if(!i)throw new Error(`could not find collection: ${o}`);let s=Go(r,i.preview?.title||"meta.title"),a=Go(r,i.preview?.image||"meta.image")||i.preview?.defaultImage;return f("a",{className:"ReferenceField__DocCard",href:`/cms/content/${n}`,target:"_blank",children:[f("div",{className:"ReferenceField__DocCard__image",children:f(Qs,{src:a?.src,width:80,height:60,withPlaceholder:!a?.src})}),f("div",{className:"ReferenceField__DocCard__content",children:[f("div",{className:"ReferenceField__DocCard__content__header",children:f("div",{className:"ReferenceField__DocCard__content__header__docId",children:n})}),f("div",{className:"ReferenceField__DocCard__content__title",children:s||"[UNTITLED]"})]})]})};ke();function jS(t){let e=t.field,[n,o]=L([]),r=on().controller;function i(d){if(d.length){let u=d.map(p=>{let[h,g]=p.split("/");return{id:p,collection:h,slug:g}});r.updateKey(t.deepKey,u)}else r.removeKey(t.deepKey);o(d)}qo(t.deepKey,d=>{Array.isArray(d)?o(d.map(u=>u.id)):o([])});let s=ru(),a=Fu();function l(){s.open({collections:e.collections,initialCollection:e.initialCollection,multiSelect:!0,selectedDocIds:n,onChangeMulti:(d,u)=>{o(p=>{let h=[...p];if(u)h.includes(d)||h.push(d);else{let g=h.indexOf(d);g>-1&&h.splice(g,1)}return i(h),h})}})}function c(d){let u=n.filter(p=>p!==d);i(u)}return f("div",{className:"ReferencesField",children:[n.length>0?f(Su,{onDragEnd:d=>{let{destination:u,source:p}=d;if(!u||u.index===p.index)return;let h=[...n],[g]=h.splice(p.index,1);h.splice(u.index,0,g),i(h)},children:f(Nu,{droppableId:"ReferencesField__droppable",direction:"vertical",children:d=>f("div",{ref:d.innerRef,...d.droppableProps,className:"ReferencesField__refs",children:[n.map((u,p)=>f(ku,{draggableId:u,index:p,children:(h,g)=>f("div",{ref:h.innerRef,...h.draggableProps,className:Ce("ReferencesField__card",g.isDragging&&"ReferencesField__card--dragging"),children:[f("div",{className:"ReferencesField__card__handle",...h.dragHandleProps,children:f(jd,{size:16,stroke:"1.5"})}),f(Bd,{className:"ReferencesField__card__preview",docId:u,variant:"compact",clickable:!0,statusBadges:!0}),f("div",{className:"ReferencesField__card__controls",children:[f(Oe,{label:"Quick edit",children:f(Me,{onClick:()=>a.open({docId:u}),children:f(Yd,{size:16})})}),f(Oe,{label:"Remove",children:f(Me,{className:"ReferencesField__card__controls__remove",onClick:()=>c(u),children:f(Jn,{size:16})})})]})]})},u)),d.placeholder]})})}):f("div",{className:"ReferencesField__none",children:"None selected"}),f(X,{color:"dark",size:"xs",onClick:()=>l(),children:e.buttonLabel||"Select"})]})}ke();(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var gc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function $4(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}function Cm(){}Object.assign(Cm,{default:Cm,register:Cm,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){let e=(this.document||this.ownerDocument).querySelectorAll(t),n=e.length;for(;--n>=0&&e.item(n)!==this;);return n>-1});Element.prototype.closest||(Element.prototype.closest=function(t){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(t){let e=document.createDocumentFragment();Array.isArray(t)||(t=[t]),t.forEach(n=>{let o=n instanceof Node;e.appendChild(o?n:document.createTextNode(n))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(t){t=arguments.length===0?!0:!!t;let e=this.parentNode,n=window.getComputedStyle(e,null),o=parseInt(n.getPropertyValue("border-top-width")),r=parseInt(n.getPropertyValue("border-left-width")),i=this.offsetTop-e.offsetTop<e.scrollTop,s=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,a=this.offsetLeft-e.offsetLeft<e.scrollLeft,l=this.offsetLeft-e.offsetLeft+this.clientWidth-r>e.scrollLeft+e.clientWidth,c=i&&!s;(i||s)&&t&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(a||l)&&t&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-r+this.clientWidth/2),(i||s||a||l)&&!t&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(t){let e=Date.now();return setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(t){clearTimeout(t)};var z4=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),""),rk=(t=>(t.VERBOSE="VERBOSE",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t))(rk||{}),Te={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},H4={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function Ec(t,e,n="log",o,r="color: inherit"){if(!("console"in window)||!window.console[n])return;let i=["info","log","warn","error"].includes(n),s=[];switch(Ec.logLevel){case"ERROR":if(n!=="error")return;break;case"WARN":if(!["error","warn"].includes(n))return;break;case"INFO":if(!i||t)return;break}o&&s.push(o);let a="Editor.js 2.31.0-rc.7";t&&(i?(s.unshift(`line-height: 1em;
83
- color: #006FEA;
84
- display: inline-block;
85
- font-size: 11px;
86
- line-height: 1em;
87
- background-color: #fff;
88
- padding: 4px 9px;
89
- border-radius: 30px;
90
- border: 1px solid rgba(56, 138, 229, 0.16);
91
- margin: 4px 5px 4px 0;`,r),e=`%c${a}%c ${e}`):e=`( ${a} )${e}`);try{i?o?console[n](`${e} %o`,...s):console[n](e,...s):console[n](e)}catch{}}Ec.logLevel="VERBOSE";function U4(t){Ec.logLevel=t}var Ge=Ec.bind(window,!1),xo=Ec.bind(window,!0);function us(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function gt(t){return us(t)==="function"||us(t)==="asyncfunction"}function sn(t){return us(t)==="object"}function Dr(t){return us(t)==="string"}function K4(t){return us(t)==="boolean"}function VS(t){return us(t)==="number"}function WS(t){return us(t)==="undefined"}function vo(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0}function ik(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}async function j4(t,e=()=>{},n=()=>{}){async function o(r,i,s){try{await r.function(r.data),await i(WS(r.data)?{}:r.data)}catch{s(WS(r.data)?{}:r.data)}}return t.reduce(async(r,i)=>(await r,o(i,e,n)),Promise.resolve())}function sk(t){return Array.prototype.slice.call(t)}function Vu(t,e){return function(){let n=this,o=arguments;window.setTimeout(()=>t.apply(n,o),e)}}function V4(t){return t.name.split(".").pop()}function W4(t){return/^[-\w]+\/([-+\w]+|\*)$/.test(t)}function GS(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=null,n||t.apply(i,r)},a=n&&!o;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function Dm(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s||(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s||(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}function G4(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e&&(t[e]=!0),t}function Wu(t){return t[0].toUpperCase()+t.slice(1)}function Om(t,...e){if(!e.length)return t;let n=e.shift();if(sn(t)&&sn(n))for(let o in n)sn(n[o])?(t[o]||Object.assign(t,{[o]:{}}),Om(t[o],n[o])):Object.assign(t,{[o]:n[o]});return Om(t,...e)}function N_(t){let e=G4();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi," + "),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function Y4(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function q4(){return z4(10)}function J4(t){window.open(t,"_blank")}function X4(t=""){return`${t}${Math.floor(Math.random()*1e8).toString(16)}`}function Im(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&xo(o,"warn")}function Sa(t,e,n){let o=n.value?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,...s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}var ak=650;function ka(){return window.matchMedia(`(max-width: ${ak}px)`).matches}var Am=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function Z4(t,e){let n=Array.isArray(t)||sn(t),o=Array.isArray(e)||sn(e);return n||o?JSON.stringify(t)===JSON.stringify(e):t===e}var H=class t{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,n=null,o={}){let r=document.createElement(e);if(Array.isArray(n)){let i=n.filter(s=>s!==void 0);r.classList.add(...i)}else n&&r.classList.add(n);for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i]);return r}static text(e){return document.createTextNode(e)}static append(e,n){Array.isArray(n)?n.forEach(o=>e.appendChild(o)):e.appendChild(n)}static prepend(e,n){Array.isArray(n)?(n=n.reverse(),n.forEach(o=>e.prepend(o))):e.prepend(n)}static swap(e,n){let o=document.createElement("div"),r=e.parentNode;r.insertBefore(o,e),r.insertBefore(e,n),r.insertBefore(n,o),r.removeChild(o)}static find(e=document,n){return e.querySelector(n)}static get(e){return document.getElementById(e)}static findAll(e=document,n){return e.querySelectorAll(n)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return sk(e.querySelectorAll(t.allInputsSelector)).reduce((n,o)=>t.isNativeInput(o)||t.containsOnlyInlineElements(o)?[...n,o]:[...n,...t.getDeepestBlockElements(o)],[])}static getDeepestNode(e,n=!1){let o=n?"lastChild":"firstChild",r=n?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let i=e[o];if(t.isSingleTag(i)&&!t.isNativeInput(i)&&!t.isLineBreakTag(i))if(i[r])i=i[r];else if(i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return this.getDeepestNode(i,n)}return e}static isElement(e){return VS(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return VS(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){let n=["INPUT","TEXTAREA"];return e&&e.tagName?n.includes(e.tagName):!1}static canSetCaret(e){let n=!0;if(t.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":n=!1;break}else n=t.isContentEditable(e);return n}static isNodeEmpty(e,n){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("\u200B",""),n&&(o=o.replace(new RegExp(n,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,n){let o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,n))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){let n=t.make("div");return n.innerHTML=e,n.childElementCount>0}static getContentLength(e){return t.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let n;Dr(e)?(n=document.createElement("div"),n.innerHTML=e):n=e;let o=r=>!t.blockElements.includes(r.tagName.toLowerCase())&&Array.from(r.children).every(o);return Array.from(n.children).every(o)}static getDeepestBlockElements(e){return t.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((n,o)=>[...n,...t.getDeepestBlockElements(o)],[])}static getHolder(e){return Dr(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){let n=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=n.top+r,s=n.left+o;return{top:i,left:s,bottom:i+n.height,right:s+n.width}}};function Q4(t){return!/[^\t\n\r ]/.test(t)}function e5(t){let e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2;return s+i+r+l+a}function lk(t){t.dataset.empty=H.isEmpty(t)?"true":"false"}var t5={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},n5={Text:"",Link:"",Bold:"",Italic:""},o5={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},r5={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},ck={ui:t5,toolNames:n5,tools:o5,blockTunes:r5},dk=class va{static ui(e,n){return va._t(e,n)}static t(e,n){return va._t(e,n)}static setDictionary(e){va.currentDictionary=e}static _t(e,n){let o=va.getNamespace(e);return!o||!o[n]?n:o[n]}static getNamespace(e){return e.split(".").reduce((n,o)=>!n||!Object.keys(n).length?{}:n[o],va.currentDictionary)}};dk.currentDictionary=ck;var En=dk,Gu=class extends Error{},ps=class{constructor(){this.subscribers={}}on(e,n){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(n)}once(e,n){e in this.subscribers||(this.subscribers[e]=[]);let o=r=>{let i=n(r),s=this.subscribers[e].indexOf(o);return s!==-1&&this.subscribers[e].splice(s,1),i};this.subscribers[e].push(o)}emit(e,n){vo(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,r)=>{let i=r(o);return i!==void 0?i:o},n)}off(e,n){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===n){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}};function Sr(t){Object.setPrototypeOf(this,{get id(){return t.id},get name(){return t.name},get config(){return t.config},get holder(){return t.holder},get isEmpty(){return t.isEmpty},get selected(){return t.selected},set stretched(e){t.stretched=e},get stretched(){return t.stretched},get focusable(){return t.focusable},call(e,n){return t.call(e,n)},save(){return t.save()},validate(e){return t.validate(e)},dispatchChange(){t.dispatchChange()},getActiveToolboxEntry(){return t.getActiveToolboxEntry()}})}var fs=class{constructor(){this.allListeners=[]}on(e,n,o,r=!1){let i=X4("l"),s={id:i,element:e,eventType:n,handler:o,options:r};if(!this.findOne(e,n,o))return this.allListeners.push(s),e.addEventListener(n,o,r),i}off(e,n,o,r){let i=this.findAll(e,n,o);i.forEach((s,a)=>{let l=this.allListeners.indexOf(i[a]);l>-1&&(this.allListeners.splice(l,1),s.element.removeEventListener(s.eventType,s.handler,s.options))})}offById(e){let n=this.findById(e);n&&n.element.removeEventListener(n.eventType,n.handler,n.options)}findOne(e,n,o){let r=this.findAll(e,n,o);return r.length>0?r[0]:null}findAll(e,n,o){let r,i=e?this.findByEventTarget(e):[];return e&&n&&o?r=i.filter(s=>s.eventType===n&&s.handler===o):e&&n?r=i.filter(s=>s.eventType===n):r=i,r}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(n=>{if(n.element===e)return n})}findByType(e){return this.allListeners.filter(n=>{if(n.eventType===e)return n})}findByHandler(e){return this.allListeners.filter(n=>{if(n.handler===e)return n})}findById(e){return this.allListeners.find(n=>n.id===e)}},Re=class t{constructor({config:e,eventsDispatcher:n}){if(this.nodes={},this.listeners=new fs,this.readOnlyMutableListeners={on:(o,r,i,s=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,r,i,s))},clearAll:()=>{for(let o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===t)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=n}set state(e){this.Editor=e}removeAllNodes(){for(let e in this.nodes){let n=this.nodes[e];n instanceof HTMLElement&&n.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},be=class t{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){let e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return n?H.isElement(n)?n:n.parentElement:null}static get anchorOffset(){let e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){let e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(t.get())}static isSelectionAtEditor(e){if(!e)return!1;let n=e.anchorNode||e.focusNode;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let n=e.startContainer;n&&n.nodeType===Node.TEXT_NODE&&(n=n.parentNode);let o=null;return n&&n instanceof Element&&(o=n.closest(`.${t.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!t.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,n,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,n=e.createRange(),o.x=n.boundingLeft,o.y=n.boundingTop,o.width=n.boundingWidth,o.height=n.boundingHeight,o;if(!window.getSelection)return Ge("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return Ge("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(n=e.getRangeAt(0).cloneRange(),n.getBoundingClientRect&&(o=n.getBoundingClientRect()),o.x===0&&o.y===0){let r=document.createElement("span");if(r.getBoundingClientRect){r.appendChild(document.createTextNode("\u200B")),n.insertNode(r),o=r.getBoundingClientRect();let i=r.parentNode;i.removeChild(r),i.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,n=0){let o=document.createRange(),r=window.getSelection();return H.isNativeInput(e)?H.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=n,e.getBoundingClientRect()):void 0:(o.setStart(e,n),o.setEnd(e,n),r.removeAllRanges(),r.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){let n=t.range;return n===null?!1:e.contains(n.startContainer)}static addFakeCursor(){let e=t.range;if(e===null)return;let n=H.make("span","codex-editor__fake-cursor");n.dataset.mutationFree="true",e.collapse(),e.insertNode(n)}static isFakeCursorInsideContainer(e){return H.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){let n=H.find(e,".codex-editor__fake-cursor");n&&n.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=t.range}restore(){if(!this.savedSelectionRange)return;let e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(e.focusNode),n.collapse(!1),e.removeAllRanges(),e.addRange(n)}findParentTag(e,n,o=10){let r=window.getSelection(),i=null;return!r||!r.anchorNode||!r.focusNode?null:([r.anchorNode,r.focusNode].forEach(s=>{let a=o;for(;a>0&&s.parentNode&&!(s.tagName===e&&(i=s,n&&s.classList&&!s.classList.contains(n)&&(i=null),i));)s=s.parentNode,a--}),i)}expandToTag(e){let n=window.getSelection();n.removeAllRanges();let o=document.createRange();o.selectNodeContents(e),n.addRange(o)}};function i5(t,e){let{type:n,target:o,addedNodes:r,removedNodes:i}=t;return t.type==="attributes"&&t.attributeName==="data-empty"?!1:!!(e.contains(o)||n==="childList"&&(Array.from(r).some(s=>s===e)||Array.from(i).some(s=>s===e)))}var Mm="redactor dom changed",uk="block changed",pk="fake cursor is about to be toggled",fk="fake cursor have been set",mc="editor mobile layout toggled";function Lm(t,e){if(!t.conversionConfig)return!1;let n=t.conversionConfig[e];return gt(n)||Dr(n)}function Yu(t,e){return Lm(t.tool,e)}function hk(t,e){return Object.entries(t).some(([n,o])=>e[n]&&Z4(e[n],o))}async function gk(t,e){let n=(await t.save()).data,o=e.find(r=>r.name===t.name);return o!==void 0&&!Lm(o,"export")?[]:e.reduce((r,i)=>{if(!Lm(i,"import")||i.toolbox===void 0)return r;let s=i.toolbox.filter(a=>{if(vo(a)||a.icon===void 0)return!1;if(a.data!==void 0){if(hk(a.data,n))return!1}else if(i.name===t.name)return!1;return!0});return r.push({...i,toolbox:s}),r},[])}function YS(t,e){return t.mergeable?t.name===e.name?!0:Yu(e,"export")&&Yu(t,"import"):!1}function s5(t,e){let n=e?.export;return gt(n)?n(t):Dr(n)?t[n]:(n!==void 0&&Ge("Conversion \xABexport\xBB property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function qS(t,e,n){let o=e?.import;return gt(o)?o(t,n):Dr(o)?{[o]:t}:(o!==void 0&&Ge("Conversion \xABimport\xBB property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var st=(t=>(t.Default="default",t.Separator="separator",t.Html="html",t))(st||{}),kr=(t=>(t.APPEND_CALLBACK="appendCallback",t.RENDERED="rendered",t.MOVED="moved",t.UPDATED="updated",t.REMOVED="removed",t.ON_PASTE="onPaste",t))(kr||{}),No=class t extends ps{constructor({id:e=q4(),data:n,tool:o,readOnly:r,tunesData:i},s){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(a=void 0)=>{let l=a===void 0,c=a instanceof InputEvent;!l&&!c&&this.detectToolRootChange(a);let d;l||c?d=!0:d=!(a.length>0&&a.every(u=>{let{addedNodes:p,removedNodes:h,target:g}=u;return[...Array.from(p),...Array.from(h),g].some(m=>(H.isElement(m)||(m=m.parentElement),m&&m.closest('[data-mutation-free="true"]')!==null))})),d&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=s||null,this.blockAPI=new Sr(this),this.tool=o,this.toolInstance=o.create(n,this.blockAPI,r),this.tunes=o.tunes,this.composeTunes(i),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;let e=H.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){let n=this.inputs.findIndex(o=>o===e||o.contains(e));n!==-1&&(this.inputIndex=n)}get firstInput(){return this.inputs[0]}get lastInput(){let e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!vo(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return gt(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){let e=H.isEmpty(this.pluginsContent,"/"),n=!this.hasMedia;return e&&n}get hasMedia(){let e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,o;this.holder.classList.toggle(t.CSS.selected,e);let r=e===!0&&be.isRangeInsideContainer(this.holder),i=e===!1&&be.isFakeCursorInsideContainer(this.holder);(r||i)&&((n=this.editorEventBus)==null||n.emit(pk,{state:e}),r?be.addFakeCursor():be.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(fk,{state:e}))}get selected(){return this.holder.classList.contains(t.CSS.selected)}set stretched(e){this.holder.classList.toggle(t.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(t.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(t.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,n){if(gt(this.toolInstance[e])){e==="appendCallback"&&Ge("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,n)}catch(o){Ge(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){let e=await this.toolInstance.save(this.pluginsContent),n=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([i,s])=>{if(gt(s.save))try{n[i]=s.save()}catch(a){Ge(`Tune ${s.constructor.name} save method throws an Error %o`,"warn",a)}});let o=window.performance.now(),r;return Promise.resolve(e).then(i=>(r=window.performance.now(),{id:this.id,tool:this.name,data:i,tunes:n,time:r-o})).catch(i=>{Ge(`Saving process for ${this.name} tool failed due to the ${i}`,"log","red")})}async validate(e){let n=!0;return this.toolInstance.validate instanceof Function&&(n=await this.toolInstance.validate(e)),n}getTunes(){let e=[],n=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return H.isElement(o)?e.push({type:st.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(r=>r.render()).forEach(r=>{H.isElement(r)?n.push({type:st.Html,element:r}):Array.isArray(r)?n.push(...r):n.push(r)}),{toolTunes:e,commonTunes:n}}updateCurrentInput(){this.currentInput=H.isNativeInput(document.activeElement)||!be.anchorNode?document.activeElement:be.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),gt(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){let e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);let n=await this.data,o=e;return o?.find(r=>hk(r.data,n))}async exportDataAsString(){let e=await this.data;return s5(e,this.tool.conversionConfig)}compose(){let e=H.make("div",t.CSS.wrapper),n=H.make("div",t.CSS.content),o=this.toolInstance.render();e.setAttribute("data-cy","block-wrapper"),e.dataset.id=this.id,this.toolRenderedElement=o,n.appendChild(this.toolRenderedElement);let r=n;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(i=>{if(gt(i.wrap))try{r=i.wrap(r)}catch(s){Ge(`Tune ${i.constructor.name} wrap method throws an Error %o`,"warn",s)}}),e.appendChild(r),e}composeTunes(e){Array.from(this.tunes.values()).forEach(n=>{(n.isInternal?this.defaultTunesInstances:this.tunesInstances).set(n.name,n.create(e[n.name],this.blockAPI))}),Object.entries(e).forEach(([n,o])=>{this.tunesInstances.has(n)||(this.unavailableTunesData[n]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),H.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),H.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=n=>{let{mutations:o}=n;o.some(r=>i5(r,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(Mm,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(Mm,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(n=>{if(Array.from(n.removedNodes).includes(this.toolRenderedElement)){let o=n.addedNodes[n.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(lk)}},Rm=class extends Re{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,n={},o={},r,i,s,a)=>{let l=this.Editor.BlockManager.insert({id:a,tool:e,data:n,index:r,needToFocus:i,replace:s});return new Sr(l)},this.composeBlockData=async e=>{let n=this.Editor.Tools.blockTools.get(e);return new No({tool:n,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,n,o)=>{let{BlockManager:r}=this.Editor,i=r.getBlockById(e);if(i===void 0)throw new Error(`Block with id "${e}" not found`);let s=await r.update(i,n,o);return new Sr(s)},this.convert=async(e,n,o)=>{var r,i;let{BlockManager:s,Tools:a}=this.Editor,l=s.getBlockById(e);if(!l)throw new Error(`Block with id "${e}" not found`);let c=a.blockTools.get(l.name),d=a.blockTools.get(n);if(!d)throw new Error(`Block Tool with type "${n}" not found`);let u=((r=c?.conversionConfig)==null?void 0:r.export)!==void 0,p=((i=d.conversionConfig)==null?void 0:i.import)!==void 0;if(u&&p){let h=await s.convert(l,n,o);return new Sr(h)}else{let h=[u?!1:Wu(l.name),p?!1:Wu(n)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${n}" is not possible. ${h} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,n=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(n);let o=e.map(({id:r,type:i,data:s})=>this.Editor.BlockManager.composeBlock({id:r,tool:i||this.config.defaultBlock,data:s}));return this.Editor.BlockManager.insertMany(o,n),o.map(r=>new Sr(r))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,n)=>this.swap(e,n),move:(e,n)=>this.move(e,n),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,n=!0)=>this.stretchBlock(e,n),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){let n=this.Editor.BlockManager.getBlockById(e);if(!n){xo("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(n)}getBlockByIndex(e){let n=this.Editor.BlockManager.getBlockByIndex(e);if(n===void 0){xo("There is no block at index `"+e+"`","warn");return}return new Sr(n)}getById(e){let n=this.Editor.BlockManager.getBlockById(e);return n===void 0?(xo("There is no block with id `"+e+"`","warn"),null):new Sr(n)}getBlockByElement(e){let n=this.Editor.BlockManager.getBlock(e);if(n===void 0){xo("There is no block corresponding to element `"+e+"`","warn");return}return new Sr(n)}swap(e,n){Ge("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,n)}move(e,n){this.Editor.BlockManager.move(e,n)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{let n=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(n)}catch(n){xo(n,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}renderFromHTML(e){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,n=!0){Im(!0,"blocks.stretchBlock()","BlockAPI");let o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=n)}insertNewBlock(){Ge("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}};function a5(t,e){return typeof t=="number"?e.BlockManager.getBlockByIndex(t):typeof t=="string"?e.BlockManager.getBlockById(t):e.BlockManager.getBlockById(t.id)}var Pm=class extends Re{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,n),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,n),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,n),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,n=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,n),!0):!1,this.setToBlock=(e,n=this.Editor.Caret.positions.DEFAULT,o=0)=>{let r=a5(e,this.Editor);return r===void 0?!1:(this.Editor.Caret.setToBlock(r,n,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}},Fm=class extends Re{get methods(){return{emit:(e,n)=>this.emit(e,n),off:(e,n)=>this.off(e,n),on:(e,n)=>this.on(e,n)}}on(e,n){this.eventsDispatcher.on(e,n)}emit(e,n){this.eventsDispatcher.emit(e,n)}off(e,n){this.eventsDispatcher.off(e,n)}},Bm=class t extends Re{static getNamespace(e,n){return n?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{xo("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,n){return Object.assign(this.methods,{t:o=>En.t(t.getNamespace(e,n),o)})}},$m=class extends Re{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,n){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,n)})}},zm=class extends Re{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}},Hm=class extends Re{get methods(){return{on:(e,n,o,r)=>this.on(e,n,o,r),off:(e,n,o,r)=>this.off(e,n,o,r),offById:e=>this.offById(e)}}on(e,n,o,r){return this.listeners.on(e,n,o,r)}off(e,n,o,r){this.listeners.off(e,n,o,r)}offById(e){this.listeners.offById(e)}},mk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="/",r(r.s=0)})([function(n,o,r){r(1),n.exports=(function(){var i=r(6),s="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=i.getWrapper(),document.body.appendChild(a)})();var c=null,d=l.time||8e3;switch(l.type){case"confirm":c=i.confirm(l);break;case"prompt":c=i.prompt(l);break;default:c=i.alert(l),window.setTimeout(function(){c.remove()},d)}a.appendChild(c),c.classList.add(s)}}}})()},function(n,o,r){var i=r(2);typeof i=="string"&&(i=[[n.i,i,""]]);var s={hmr:!0,transform:void 0,insertInto:void 0};r(4)(i,s),i.locals&&(n.exports=i.locals)},function(n,o,r){(n.exports=r(3)(!1)).push([n.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(n,o){n.exports=function(r){var i=[];return i.toString=function(){return this.map(function(s){var a=(function(l,c){var d=l[1]||"",u=l[3];if(!u)return d;if(c&&typeof btoa=="function"){var p=(g=u,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(g))))+" */"),h=u.sources.map(function(m){return"/*# sourceURL="+u.sourceRoot+m+" */"});return[d].concat(h).concat([p]).join(`
92
- `)}var g;return[d].join(`
93
- `)})(s,r);return s[2]?"@media "+s[2]+"{"+a+"}":a}).join("")},i.i=function(s,a){typeof s=="string"&&(s=[[null,s,""]]);for(var l={},c=0;c<this.length;c++){var d=this[c][0];typeof d=="number"&&(l[d]=!0)}for(c=0;c<s.length;c++){var u=s[c];typeof u[0]=="number"&&l[u[0]]||(a&&!u[2]?u[2]=a:a&&(u[2]="("+u[2]+") and ("+a+")"),i.push(u))}},i}},function(n,o,r){var i,s,a={},l=(i=function(){return window&&document&&document.all&&!window.atob},function(){return s===void 0&&(s=i.apply(this,arguments)),s}),c=(function(T){var w={};return function(S){if(typeof S=="function")return S();if(w[S]===void 0){var N=(function(D){return document.querySelector(D)}).call(this,S);if(window.HTMLIFrameElement&&N instanceof window.HTMLIFrameElement)try{N=N.contentDocument.head}catch{N=null}w[S]=N}return w[S]}})(),d=null,u=0,p=[],h=r(5);function g(T,w){for(var S=0;S<T.length;S++){var N=T[S],D=a[N.id];if(D){D.refs++;for(var O=0;O<D.parts.length;O++)D.parts[O](N.parts[O]);for(;O<N.parts.length;O++)D.parts.push(x(N.parts[O],w))}else{var A=[];for(O=0;O<N.parts.length;O++)A.push(x(N.parts[O],w));a[N.id]={id:N.id,refs:1,parts:A}}}}function m(T,w){for(var S=[],N={},D=0;D<T.length;D++){var O=T[D],A=w.base?O[0]+w.base:O[0],I={css:O[1],media:O[2],sourceMap:O[3]};N[A]?N[A].parts.push(I):S.push(N[A]={id:A,parts:[I]})}return S}function _(T,w){var S=c(T.insertInto);if(!S)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var N=p[p.length-1];if(T.insertAt==="top")N?N.nextSibling?S.insertBefore(w,N.nextSibling):S.appendChild(w):S.insertBefore(w,S.firstChild),p.push(w);else if(T.insertAt==="bottom")S.appendChild(w);else{if(typeof T.insertAt!="object"||!T.insertAt.before)throw new Error(`[Style Loader]
94
-
95
- Invalid value for parameter 'insertAt' ('options.insertAt') found.
96
- Must be 'top', 'bottom', or Object.
97
- (https://github.com/webpack-contrib/style-loader#insertat)
98
- `);var D=c(T.insertInto+" "+T.insertAt.before);S.insertBefore(w,D)}}function b(T){if(T.parentNode===null)return!1;T.parentNode.removeChild(T);var w=p.indexOf(T);w>=0&&p.splice(w,1)}function y(T){var w=document.createElement("style");return T.attrs.type===void 0&&(T.attrs.type="text/css"),v(w,T.attrs),_(T,w),w}function v(T,w){Object.keys(w).forEach(function(S){T.setAttribute(S,w[S])})}function x(T,w){var S,N,D,O;if(w.transform&&T.css){if(!(O=w.transform(T.css)))return function(){};T.css=O}if(w.singleton){var A=u++;S=d||(d=y(w)),N=k.bind(null,S,A,!1),D=k.bind(null,S,A,!0)}else T.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(S=(function(I){var R=document.createElement("link");return I.attrs.type===void 0&&(I.attrs.type="text/css"),I.attrs.rel="stylesheet",v(R,I.attrs),_(I,R),R})(w),N=(function(I,R,z){var W=z.css,Z=z.sourceMap,F=R.convertToAbsoluteUrls===void 0&&Z;(R.convertToAbsoluteUrls||F)&&(W=h(W)),Z&&(W+=`
99
- /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(Z))))+" */");var se=new Blob([W],{type:"text/css"}),ye=I.href;I.href=URL.createObjectURL(se),ye&&URL.revokeObjectURL(ye)}).bind(null,S,w),D=function(){b(S),S.href&&URL.revokeObjectURL(S.href)}):(S=y(w),N=(function(I,R){var z=R.css,W=R.media;if(W&&I.setAttribute("media",W),I.styleSheet)I.styleSheet.cssText=z;else{for(;I.firstChild;)I.removeChild(I.firstChild);I.appendChild(document.createTextNode(z))}}).bind(null,S),D=function(){b(S)});return N(T),function(I){if(I){if(I.css===T.css&&I.media===T.media&&I.sourceMap===T.sourceMap)return;N(T=I)}else D()}}n.exports=function(T,w){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(w=w||{}).attrs=typeof w.attrs=="object"?w.attrs:{},w.singleton||typeof w.singleton=="boolean"||(w.singleton=l()),w.insertInto||(w.insertInto="head"),w.insertAt||(w.insertAt="bottom");var S=m(T,w);return g(S,w),function(N){for(var D=[],O=0;O<S.length;O++){var A=S[O];(I=a[A.id]).refs--,D.push(I)}for(N&&g(m(N,w),w),O=0;O<D.length;O++){var I;if((I=D[O]).refs===0){for(var R=0;R<I.parts.length;R++)I.parts[R]();delete a[I.id]}}}};var E,C=(E=[],function(T,w){return E[T]=w,E.filter(Boolean).join(`
100
- `)});function k(T,w,S,N){var D=S?"":N.css;if(T.styleSheet)T.styleSheet.cssText=C(w,D);else{var O=document.createTextNode(D),A=T.childNodes;A[w]&&T.removeChild(A[w]),A.length?T.insertBefore(O,A[w]):T.appendChild(O)}}},function(n,o){n.exports=function(r){var i=typeof window<"u"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!r||typeof r!="string")return r;var s=i.protocol+"//"+i.host,a=s+i.pathname.replace(/\/[^\/]*$/,"/");return r.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var d,u=c.trim().replace(/^"(.*)"$/,function(p,h){return h}).replace(/^'(.*)'$/,function(p,h){return h});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(u)?l:(d=u.indexOf("//")===0?u:u.indexOf("/")===0?s+u:a+u.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(n,o,r){var i,s,a,l,c,d,u,p,h;n.exports=(i="cdx-notifies",s="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",d="cdx-notify__input",u="cdx-notify__button",p="cdx-notify__btns-wrapper",{alert:h=function(g){var m=document.createElement("DIV"),_=document.createElement("DIV"),b=g.message,y=g.style;return m.classList.add(s),y&&m.classList.add(s+"--"+y),m.innerHTML=b,_.classList.add(a),_.addEventListener("click",m.remove.bind(m)),m.appendChild(_),m},confirm:function(g){var m=h(g),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("button"),v=m.querySelector("."+a),x=g.cancelHandler,E=g.okHandler;return _.classList.add(p),b.innerHTML=g.okText||"Confirm",y.innerHTML=g.cancelText||"Cancel",b.classList.add(u),y.classList.add(u),b.classList.add(l),y.classList.add(c),x&&typeof x=="function"&&(y.addEventListener("click",x),v.addEventListener("click",x)),E&&typeof E=="function"&&b.addEventListener("click",E),b.addEventListener("click",m.remove.bind(m)),y.addEventListener("click",m.remove.bind(m)),_.appendChild(b),_.appendChild(y),m.appendChild(_),m},prompt:function(g){var m=h(g),_=document.createElement("div"),b=document.createElement("button"),y=document.createElement("input"),v=m.querySelector("."+a),x=g.cancelHandler,E=g.okHandler;return _.classList.add(p),b.innerHTML=g.okText||"Ok",b.classList.add(u),b.classList.add(l),y.classList.add(d),g.placeholder&&y.setAttribute("placeholder",g.placeholder),g.default&&(y.value=g.default),g.inputType&&(y.type=g.inputType),x&&typeof x=="function"&&v.addEventListener("click",x),E&&typeof E=="function"&&b.addEventListener("click",function(){E(y.value)}),b.addEventListener("click",m.remove.bind(m)),_.appendChild(y),_.appendChild(b),m.appendChild(_),m},getWrapper:function(){var g=document.createElement("DIV");return g.classList.add(i),g}})}])})})(mk);var l5=mk.exports,c5=cp(l5),Um=class{show(e){c5.show(e)}},Km=class extends Re{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.notifier=new Um}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}},jm=class extends Re{get methods(){let e=()=>this.isEnabled;return{toggle:n=>this.toggle(n),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}},_k={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(gc,function(){function n(u){var p=u.tags,h=Object.keys(p),g=h.map(function(m){return typeof p[m]}).every(function(m){return m==="object"||m==="boolean"||m==="function"});if(!g)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function r(u){return o.indexOf(u.nodeName)!==-1}var i=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(u){return i.indexOf(u.nodeName)!==-1}n.prototype.clean=function(u){let p=document.implementation.createHTMLDocument(),h=p.createElement("div");return h.innerHTML=u,this._sanitize(p,h),h.innerHTML},n.prototype._sanitize=function(u,p){var h=a(u,p),g=h.firstChild();if(g)do{if(g.nodeType===Node.TEXT_NODE)if(g.data.trim()===""&&(g.previousElementSibling&&r(g.previousElementSibling)||g.nextElementSibling&&r(g.nextElementSibling))){p.removeChild(g),this._sanitize(u,p);break}else continue;if(g.nodeType===Node.COMMENT_NODE){p.removeChild(g),this._sanitize(u,p);break}var m=s(g),_;m&&(_=Array.prototype.some.call(g.childNodes,r));var b=!!p.parentNode,y=r(p)&&r(g)&&b,v=g.nodeName.toLowerCase(),x=l(this.config,v,g),E=m&&_;if(E||c(g,x)||!this.config.keepNestedBlockElements&&y){if(!(g.nodeName==="SCRIPT"||g.nodeName==="STYLE"))for(;g.childNodes.length>0;)p.insertBefore(g.childNodes[0],g);p.removeChild(g),this._sanitize(u,p);break}for(var C=0;C<g.attributes.length;C+=1){var k=g.attributes[C];d(k,x,g)&&(g.removeAttribute(k.name),C=C-1)}this._sanitize(u,g)}while(g=h.nextSibling())};function a(u,p){return u.createTreeWalker(p,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,p,h){return typeof u.tags[p]=="function"?u.tags[p](h):u.tags[p]}function c(u,p){return typeof p>"u"?!0:typeof p=="boolean"?!p:!1}function d(u,p,h){var g=u.name.toLowerCase();return p===!0?!1:typeof p[g]=="function"?!p[g](u.value,h):typeof p[g]>"u"||p[g]===!1?!0:typeof p[g]=="string"?p[g]!==u.value:!1}return n})})(_k);var d5=_k.exports,u5=cp(d5);function D_(t,e){return t.map(n=>{let o=gt(e)?e(n.tool):e;return vo(o)||(n.data=O_(n.data,o)),n})}function Xo(t,e={}){let n={tags:e};return new u5(n).clean(t)}function O_(t,e){return Array.isArray(t)?p5(t,e):sn(t)?f5(t,e):Dr(t)?h5(t,e):t}function p5(t,e){return t.map(n=>O_(n,e))}function f5(t,e){let n={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;let r=t[o],i=g5(e[o])?e[o]:e;n[o]=O_(r,i)}return n}function h5(t,e){return sn(e)?Xo(t,e):e===!1?Xo(t,{}):t}function g5(t){return sn(t)||K4(t)||gt(t)}var Vm=class extends Re{get methods(){return{clean:(e,n)=>this.clean(e,n)}}clean(e,n){return Xo(e,n)}},Wm=class extends Re{get methods(){return{save:()=>this.save()}}save(){let e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(xo(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}},Gm=class extends Re{constructor(){super(...arguments),this.selectionUtils=new be}get methods(){return{findParentTag:(e,n)=>this.findParentTag(e,n),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,n){return this.selectionUtils.findParentTag(e,n)}expandToTag(e){this.selectionUtils.expandToTag(e)}},Ym=class extends Re{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}},qm=class extends Re{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}},Jm=class extends Re{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){xo("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){xo("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}},bk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){n.exports=r(1)},function(n,o,r){r.r(o),r.d(o,"default",function(){return i});class i{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);let d=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(d.hidingDelay&&(this.hidingDelay=d.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of \xABcontent\xBB passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),d.placement){case"top":this.placeTop(a,d);break;case"left":this.placeLeft(a,d);break;case"right":this.placeRight(a,d);break;default:this.placeBottom(a,d)}d&&d.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},d.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){let a="codex-tooltips-style";if(document.getElementById(a))return;let l=r(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",d,u)}placeTop(a,l){let c=a.getBoundingClientRect(),d=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,u=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",d,u)}placeLeft(a,l){let c=a.getBoundingClientRect(),d=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",d,u)}placeRight(a,l){let c=a.getBoundingClientRect(),d=c.right+this.offsetRight+l.marginRight,u=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",d,u)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){let d=document.createElement(a);Array.isArray(l)?d.classList.add(...l):l&&d.classList.add(l);for(let u in c)c.hasOwnProperty(u)&&(d[u]=c[u]);return d}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(n,o){n.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(bk);var m5=bk.exports,_5=cp(m5),Do=null;function I_(){Do||(Do=new _5)}function b5(t,e,n){I_(),Do?.show(t,e,n)}function qu(t=!1){I_(),Do?.hide(t)}function Ju(t,e,n){I_(),Do?.onHover(t,e,n)}function y5(){Do?.destroy(),Do=null}var Xm=class extends Re{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n})}get methods(){return{show:(e,n,o)=>this.show(e,n,o),hide:()=>this.hide(),onHover:(e,n,o)=>this.onHover(e,n,o)}}show(e,n,o){b5(e,n,o)}hide(){qu()}onHover(e,n,o){Ju(e,n,o)}},Zm=class extends Re{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}};function yk(t,e){let n={};return Object.entries(t).forEach(([o,r])=>{if(sn(r)){let i=e?`${e}.${o}`:o;Object.values(r).every(s=>Dr(s))?n[o]=i:n[o]=yk(r,i);return}n[o]=r}),n}var no=yk(ck);function x5(t,e){let n={};return Object.keys(t).forEach(o=>{let r=e[o];r!==void 0?n[r]=t[o]:n[o]=t[o]}),n}var xk=class pc{constructor(e,n){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=n}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(pc.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(pc.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let n=this.cursor;return n===-1?n=e===pc.directions.RIGHT?-1:0:this.items[n].classList.remove(this.focusedCssClass),e===pc.directions.RIGHT?n=(n+1)%this.items.length:n=(this.items.length+n-1)%this.items.length,H.canSetCaret(this.items[n])&&Vu(()=>be.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),n}};xk.directions={RIGHT:"right",LEFT:"left"};var cc=xk,wa=class t{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=n=>{if(this.isEventReadyForHandling(n))switch(t.usedKeys.includes(n.keyCode)&&n.preventDefault(),n.keyCode){case Te.TAB:this.handleTabPress(n);break;case Te.LEFT:case Te.UP:this.flipLeft();break;case Te.RIGHT:case Te.DOWN:this.flipRight();break;case Te.ENTER:this.handleEnterPress(n);break}},this.iterator=new cc(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||t.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[Te.TAB,Te.LEFT,Te.RIGHT,Te.ENTER,Te.UP,Te.DOWN]}activate(e,n){this.activated=!0,e&&this.iterator.setItems(e),n!==void 0&&this.iterator.setCursor(n),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(n=>n!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?cc.directions.LEFT:cc.directions.RIGHT){case cc.directions.RIGHT:this.flipRight();break;case cc.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),gt(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}},v5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',C5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',E5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',w5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',T5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',S5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',k5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',N5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',JS='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',D5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',O5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',vk='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',I5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',A5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',M5='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',L5="__",R5="--";function hi(t){return(e,n)=>[[t,e].filter(o=>!!o).join(L5),n].filter(o=>!!o).join(R5)}var dc=hi("ce-hint"),uc={root:dc(),alignedStart:dc(null,"align-left"),alignedCenter:dc(null,"align-center"),title:dc("title"),description:dc("description")},Qm=class{constructor(e){this.nodes={root:H.make("div",[uc.root,e.alignment==="center"?uc.alignedCenter:uc.alignedStart]),title:H.make("div",uc.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=H.make("div",uc.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}},_c=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){qu()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,n;this.params!==void 0&&"onActivate"in this.params&&((n=(e=this.params).onActivate)==null||n.call(e,this.params))}addHint(e,n){let o=new Qm(n);Ju(e,o.getElement(),{placement:n.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}},to=hi("ce-popover-item"),xt={container:to(),active:to(null,"active"),disabled:to(null,"disabled"),focused:to(null,"focused"),hidden:to(null,"hidden"),confirmationState:to(null,"confirmation"),noHover:to(null,"no-hover"),noFocus:to(null,"no-focus"),title:to("title"),secondaryTitle:to("secondary-title"),icon:to("icon"),iconTool:to("icon","tool"),iconChevronRight:to("icon","chevron-right"),wobbleAnimation:hi("wobble")()},Nr=class extends _c{constructor(e,n){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(xt.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(xt.noHover)},this.onErrorAnimationEnd=()=>{var o,r;(o=this.nodes.icon)==null||o.classList.remove(xt.wobbleAnimation),(r=this.nodes.icon)==null||r.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,n)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(xt.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var n;(n=this.nodes.root)==null||n.classList.toggle(xt.active,e)}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(xt.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,n){var o,r;let i=n?.wrapperTag||"div",s=H.make(i,xt.container,{type:i==="button"?"button":void 0});return e.name&&(s.dataset.itemName=e.name),this.nodes.icon=H.make("div",[xt.icon,xt.iconTool],{innerHTML:e.icon||k5}),s.appendChild(this.nodes.icon),e.title!==void 0&&s.appendChild(H.make("div",xt.title,{innerHTML:e.title||""})),e.secondaryLabel&&s.appendChild(H.make("div",xt.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&s.appendChild(H.make("div",[xt.icon,xt.iconChevronRight],{innerHTML:w5})),this.isActive&&s.classList.add(xt.active),e.isDisabled&&s.classList.add(xt.disabled),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(s,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"}),s}enableConfirmationMode(e){if(this.nodes.root===null)return;let n={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(n);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(xt.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;let e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(xt.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,n,o;(e=this.nodes.root)==null||e.classList.add(xt.noHover),(n=this.nodes.root)==null||n.classList.add(xt.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var n;if(!("confirmation"in e)||e.confirmation===void 0)try{(n=e.onActivate)==null||n.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,n,o;(e=this.nodes.icon)!=null&&e.classList.contains(xt.wobbleAnimation)||((n=this.nodes.icon)==null||n.classList.add(xt.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}},Em=hi("ce-popover-item-separator"),wm={container:Em(),line:Em("line"),hidden:Em(null,"hidden")},Xu=class extends _c{constructor(){super(),this.nodes={root:H.make("div",wm.container),line:H.make("div",wm.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(wm.hidden,e)}},Zo=(t=>(t.Closed="closed",t.ClosedOnActivate="closed-on-activate",t))(Zo||{}),Cn=hi("ce-popover"),Tt={popover:Cn(),popoverContainer:Cn("container"),popoverOpenTop:Cn(null,"open-top"),popoverOpenLeft:Cn(null,"open-left"),popoverOpened:Cn(null,"opened"),search:Cn("search"),nothingFoundMessage:Cn("nothing-found-message"),nothingFoundMessageDisplayed:Cn("nothing-found-message","displayed"),items:Cn("items"),overlay:Cn("overlay"),overlayHidden:Cn("overlay","hidden"),popoverNested:Cn(null,"nested"),getPopoverNestedClass:t=>Cn(null,`nested-level-${t.toString()}`),popoverInline:Cn(null,"inline"),popoverHeader:Cn("header")},Ea=(t=>(t.NestingLevel="--nesting-level",t.PopoverHeight="--popover-height",t.InlinePopoverWidth="--inline-popover-width",t.TriggerItemLeft="--trigger-item-left",t.TriggerItemTop="--trigger-item-top",t))(Ea||{}),XS=hi("ce-popover-item-html"),ZS={root:XS(),hidden:XS(null,"hidden")},hs=class extends _c{constructor(e,n){var o,r;super(e),this.nodes={root:H.make("div",ZS.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=n?.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((r=n?.hint)==null?void 0:r.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(ZS.hidden,e)}getControls(){let e=this.nodes.root.querySelectorAll(`button, ${H.allInputsSelector}`);return Array.from(e)}},Zu=class extends ps{constructor(e,n={}){super(),this.params=e,this.itemsRenderParams=n,this.listeners=new fs,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=H.make("div",[Tt.popoverContainer]),this.nodes.nothingFoundMessage=H.make("div",[Tt.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=H.make("div",[Tt.items]),this.items.forEach(o=>{let r=o.getElement();r!==null&&this.nodes.items.appendChild(r)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=H.make("div",[Tt.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof Nr)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(Tt.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(Tt.popoverOpened),this.nodes.popover.classList.remove(Tt.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Zo.Closed)}destroy(){var e;this.items.forEach(n=>n.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){let n=this.items.find(o=>o.name===e);this.handleItemClick(n)}buildItems(e){return e.map(n=>{switch(n.type){case st.Separator:return new Xu;case st.Html:return new hs(n,this.itemsRenderParams[st.Html]);default:return new Nr(n,this.itemsRenderParams[st.Default])}})}getTargetItem(e){return this.items.filter(n=>n instanceof Nr||n instanceof hs).find(n=>{let o=n.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(n=>n!==e).forEach(n=>n.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Zo.ClosedOnActivate))}}handleClick(e){let n=this.getTargetItem(e);n!==void 0&&this.handleItemClick(n)}toggleItemActivenessIfNeeded(e){if(e instanceof Nr&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){let n=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(n.length===1){e.toggleActive();return}n.forEach(o=>{o.toggleActive(o===e)})}}},Qu=(t=>(t.Search="search",t))(Qu||{}),Tm=hi("cdx-search-field"),Sm={wrapper:Tm(),icon:Tm("icon"),input:Tm("input")},e_=class extends ps{constructor({items:e,placeholder:n}){super(),this.listeners=new fs,this.items=e,this.wrapper=H.make("div",Sm.wrapper);let o=H.make("div",Sm.icon,{innerHTML:I5});this.input=H.make("input",Sm.input,{placeholder:n,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(Qu.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(Qu.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,o;let r=((n=e.title)==null?void 0:n.toLowerCase())||"",i=(o=this.searchQuery)==null?void 0:o.toLowerCase();return i!==void 0?r.includes(i):!1}},P5=Object.defineProperty,F5=Object.getOwnPropertyDescriptor,B5=(t,e,n,o)=>{for(var r=o>1?void 0:o?F5(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&P5(e,n,r),r},Ck=class Ek extends Zu{constructor(e,n){super(e,n),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{let o=this.itemsDefault.find(r=>r.isFocused);o?.onFocus()},this.onSearch=o=>{var r;let i=o.query==="",s=o.items.length===0;this.items.forEach(l=>{let c=!1;l instanceof Nr?c=!o.items.includes(l):(l instanceof Xu||l instanceof hs)&&(c=s||!i),l.toggleHidden(c)}),this.toggleNothingFoundMessage(s);let a=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(r=this.flipper)!=null&&r.isActivated&&(this.flipper.deactivate(),this.flipper.activate(a))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(Tt.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new wa({items:this.flippableElements,focusedItemClass:xt.focused,allowedKeys:[Te.TAB,Te.UP,Te.DOWN,Te.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(Ea.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(Tt.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(Tt.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){let n=this.getTargetItem(e);n!==void 0&&this.previouslyHoveredItem!==n&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=n,n.hasChildren&&this.showNestedPopoverForItem(n))}setTriggerItemPosition(e,n){let o=n.getElement(),r=(o?o.offsetTop:0)-this.scrollTop,i=this.offsetTop+r;e.style.setProperty(Ea.TriggerItemTop,i+"px")}destroyNestedPopoverIfExists(){var e,n;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Zo.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose())}showNestedPopoverForItem(e){var n;this.nestedPopover=new Ek({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Zo.ClosedOnActivate,this.hide);let o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(Ea.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popoverContainer.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.height,r=e.top+o,i=e.top-o,s=Math.min(window.innerHeight,n.bottom);return i<n.top||r<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;let e=this.nodes.popover.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),o=this.size.width,r=e.right+o,i=e.left-o,s=Math.min(window.innerWidth,n.right);return i<n.left||r<=s}get size(){var e;let n={height:0,width:0};if(this.nodes.popover===null)return n;let o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(Tt.popoverOpened),(e=o.querySelector("."+Tt.popoverNested))==null||e.remove(),document.body.appendChild(o);let r=o.querySelector("."+Tt.popoverContainer);return n.height=r.offsetHeight,n.width=r.offsetWidth,o.remove(),n}get flippableElements(){return this.items.map(e=>{if(e instanceof Nr)return e.getElement();if(e instanceof hs)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new e_({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Qu.Search,this.onSearch);let e=this.search.getElement();e.classList.add(Tt.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(Tt.nothingFoundMessageDisplayed,e)}};B5([Sa],Ck.prototype,"size",1);var A_=Ck,t_=class extends A_{constructor(e){let n=!ka();super({...e,class:Tt.popoverInline},{[st.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:n}},[st.Html]:{hint:{position:"top",alignment:"center",enabled:n}}}),this.items.forEach(o=>{!(o instanceof Nr)&&!(o instanceof hs)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(Ea.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,n){let o=n.getElement(),r=o?o.offsetLeft:0,i=this.offsetLeft+r;e.style.setProperty(Ea.TriggerItemLeft,i+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){let n=super.showNestedPopoverForItem(e);return n.getElement().classList.add(Tt.getPopoverNestedClass(n.nestingLevel)),n}handleItemClick(e){var n;e!==this.nestedPopoverTriggerItem&&((n=this.nestedPopoverTriggerItem)==null||n.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}},wk=class fc{constructor(){this.scrollPosition=null}lock(){Am?this.lockHard():document.body.classList.add(fc.CSS.scrollLocked)}unlock(){Am?this.unlockHard():document.body.classList.remove(fc.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(fc.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(fc.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};wk.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var $5=wk,km=hi("ce-popover-header"),Nm={root:km(),text:km("text"),backButton:km("back-button")},n_=class{constructor({text:e,onBackButtonClick:n}){this.listeners=new fs,this.text=e,this.onBackButtonClick=n,this.nodes={root:H.make("div",[Nm.root]),backButton:H.make("button",[Nm.backButton]),text:H.make("div",[Nm.text])},this.nodes.backButton.innerHTML=E5,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}},o_=class{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}},ep=class extends Zu{constructor(e){super(e,{[st.Default]:{hint:{enabled:!1}},[st.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new $5,this.history=new o_,this.isHidden=!0,this.nodes.overlay=H.make("div",[Tt.overlay,Tt.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(Tt.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(Tt.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,n){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),n!==void 0){this.header=new n_({text:n,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});let o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var r;return(r=o.getElement())==null?void 0:r.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var r;let i=o.getElement();i!==null&&((r=this.nodes.items)==null||r.appendChild(i))})}},r_=class extends Re{constructor(){super(...arguments),this.opened=!1,this.selection=new be,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,be.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Zo.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=H.make("div",[this.CSS.settings]),this.nodes.wrapper.setAttribute("data-cy","block-tunes"),this.eventsDispatcher.on(mc,this.close)}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(mc,this.close)}async open(e=this.Editor.BlockManager.currentBlock){var n;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();let{toolTunes:o,commonTunes:r}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);let i=ka()?ep:A_;this.popover=new i({searchable:!0,items:await this.getTunesItems(e,r,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:En.ui(no.ui.popover,"Nothing found"),search:En.ui(no.ui.popover,"Filter")}}),this.popover.on(Zo.Closed,this.onPopoverClose),(n=this.nodes.wrapper)==null||n.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,n,o){let r=[];o!==void 0&&o.length>0&&(r.push(...o),r.push({type:st.Separator}));let i=Array.from(this.Editor.Tools.blockTools.values()),s=(await gk(e,i)).reduce((a,l)=>(l.toolbox.forEach(c=>{a.push({icon:c.icon,title:En.t(no.toolNames,c.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{let{BlockManager:d,Caret:u,Toolbar:p}=this.Editor,h=await d.convert(e,l.name,c.data);p.close(),u.setToBlock(h,u.positions.END)}})}),a),[]);return s.length>0&&(r.push({icon:vk,name:"convert-to",title:En.ui(no.ui.popover,"Convert to"),children:{searchable:!0,items:s}}),r.push({type:st.Separator})),r.push(...n),r.map(a=>this.resolveTuneAliases(a))}resolveTuneAliases(e){if(e.type===st.Separator||e.type===st.Html)return e;let n=x5(e,{label:"title"});return e.confirmation&&(n.confirmation=this.resolveTuneAliases(e.confirmation)),n}},Tk={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)})([function(n,o,r){function i(l,c){for(var d=0;d<c.length;d++){var u=c[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(l,u.key,u)}}function s(l,c,d){return c&&i(l.prototype,c),d&&i(l,d),l}r.r(o);var a=(function(){function l(c){var d=this;(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(u){d.execute(u)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return s(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),s(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var d=0;d<c.length;d++){c[d]=c[d].toUpperCase();var u=!1;for(var p in l.supportedCommands)if(l.supportedCommands[p].includes(c[d])){u=this.commands[p]=!0;break}u||(this.keys[c[d]]=!0)}for(var h in l.supportedCommands)this.commands[h]||(this.commands[h]=!1)}},{key:"execute",value:function(c){var d,u={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},p=!0;for(d in this.commands)this.commands[d]!==u[d]&&(p=!1);var h,g=!0;for(h in this.keys)g=g&&c.keyCode===l.keyCodes[h];p&&g&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();o.default=a}]).default})})(Tk);var z5=Tk.exports,H5=cp(z5),i_=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);let n=new H5({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,n])}remove(e,n){let o=this.findShortcut(e,n);if(!o)return;o.remove();let r=this.registeredShortcuts.get(e);this.registeredShortcuts.set(e,r.filter(i=>i!==o))}findShortcut(e,n){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===n)}},Ta=new i_,U5=Object.defineProperty,K5=Object.getOwnPropertyDescriptor,Sk=(t,e,n,o)=>{for(var r=o>1?void 0:o?K5(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&U5(e,n,r),r},zu=(t=>(t.Opened="toolbox-opened",t.Closed="toolbox-closed",t.BlockAdded="toolbox-block-added",t))(zu||{}),M_=class kk extends ps{constructor({api:e,tools:n,i18nLabels:o}){super(),this.opened=!1,this.listeners=new fs,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=n,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:H.make("div",kk.CSS.toolbox)},this.initPopover(),this.nodes.toolbox.setAttribute("data-cy","toolbox"),this.api.events.on(mc,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Zo.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(mc,this.handleMobileLayoutToggle)}toolButtonActivated(e,n){this.insertNewBlock(e,n)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;let n=ka()?ep:A_;this.popover=new n({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Zo.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Zo.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){let e=[];return this.tools.forEach(n=>{n.toolbox&&e.push(n)}),e}get toolboxItemsToBeDisplayed(){let e=(n,o,r=!0)=>({icon:n.icon,title:En.t(no.toolNames,n.title||Wu(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,n.data)},secondaryLabel:o.shortcut&&r?N_(o.shortcut):""});return this.toolsToBeDisplayed.reduce((n,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((r,i)=>{n.push(e(r,o,i===0))}):o.toolbox!==void 0&&n.push(e(o.toolbox,o)),n),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&this.enableShortcutForTool(e.name,n)})}enableShortcutForTool(e,n){Ta.add({name:n,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();let r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r);if(i)try{let s=await this.api.blocks.convert(i.id,e);this.api.caret.setToBlock(s,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{let n=e.shortcut;n&&Ta.remove(this.api.ui.nodes.redactor,n)})}async insertNewBlock(e,n){let o=this.api.blocks.getCurrentBlockIndex(),r=this.api.blocks.getBlockByIndex(o);if(!r)return;let i=r.isEmpty?o:o+1,s;if(n){let l=await this.api.blocks.composeBlockData(e);s=Object.assign(l,n)}let a=this.api.blocks.insert(e,s,void 0,i,void 0,r.isEmpty);a.call(kr.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:a}),this.api.toolbar.close()}};Sk([Sa],M_.prototype,"toolsToBeDisplayed",1);Sk([Sa],M_.prototype,"toolboxItemsToBeDisplayed",1);var j5=M_,Nk="block hovered";async function V5(t,e){let n=navigator.keyboard;if(!n)return e;try{return(await n.getLayoutMap()).get(t)||e}catch(o){return console.error(o),e}}var s_=class extends Re{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var n;(n=this.toolboxInstance)==null||n.close()},open:()=>{if(this.toolboxInstance===null){Ge("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){Ge("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var n;return(n=this.toolboxInstance)==null?void 0:n.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){Ge("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;let n=e.holder,{isMobile:o}=this.Editor.UI,r,i=20,s=e.firstInput,a=n.getBoundingClientRect(),l=s!==void 0?s.getBoundingClientRect():null,c=l!==null?l.top-a.top:null,d=c!==null?c>i:void 0;if(o)r=n.offsetTop+n.offsetHeight;else if(s===void 0||d){let u=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);r=n.offsetTop+u}else{let u=e5(s),p=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);r=n.offsetTop+u-p+8+c}this.nodes.wrapper.style.top=`${Math.floor(r)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,n;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=H.make("div",this.CSS.toolbar),["content","actions"].forEach(i=>{this.nodes[i]=H.make("div",this.CSS[i])}),H.append(this.nodes.wrapper,this.nodes.content),H.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=H.make("div",this.CSS.plusButton,{innerHTML:O5}),H.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{qu(!0),this.plusButtonClicked()},!1);let e=H.make("div");e.appendChild(document.createTextNode(En.ui(no.ui.toolbar.toolbox,"Add"))),e.appendChild(H.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),Ju(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=H.make("span",this.CSS.settingsToggler,{innerHTML:D5}),H.append(this.nodes.actions,this.nodes.settingsToggler);let n=H.make("div"),o=H.text(En.ui(no.ui.blockTunes.toggler,"Click to tune")),r=await V5("Slash","/");n.appendChild(o),n.appendChild(H.make("div",this.CSS.plusButtonShortcut,{textContent:N_(`CMD + ${r}`)})),Ju(this.nodes.settingsToggler,n,{hidingDelay:400}),H.append(this.nodes.actions,this.makeToolbox()),H.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),H.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new j5({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:En.ui(no.ui.popover,"Filter"),nothingFound:En.ui(no.ui.popover,"Nothing found")}}),this.toolboxInstance.on(zu.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(zu.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(zu.BlockAdded,({block:e})=>{let{BlockManager:n,Caret:o}=this.Editor,r=n.getBlockById(e.id);r.inputs.length===0&&(r===n.lastBlock?(n.insertAtEnd(),o.setToBlock(n.lastBlock)):o.setToBlock(n.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var n;e.stopPropagation(),this.settingsTogglerClicked(),(n=this.toolboxInstance)!=null&&n.opened&&this.toolboxInstance.close(),qu(!0)},!0),ka()||this.eventsDispatcher.on(Nk,e=>{var n;this.Editor.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}},ds=(t=>(t[t.Block=0]="Block",t[t.Inline=1]="Inline",t[t.Tune=2]="Tune",t))(ds||{}),Hu=(t=>(t.Shortcut="shortcut",t.Toolbox="toolbox",t.EnabledInlineTools="inlineToolbar",t.EnabledBlockTunes="tunes",t.Config="config",t))(Hu||{}),Dk=(t=>(t.Shortcut="shortcut",t.SanitizeConfig="sanitize",t))(Dk||{}),Ca=(t=>(t.IsEnabledLineBreaks="enableLineBreaks",t.Toolbox="toolbox",t.ConversionConfig="conversionConfig",t.IsReadOnlySupported="isReadOnlySupported",t.PasteConfig="pasteConfig",t))(Ca||{}),tp=(t=>(t.IsInline="isInline",t.Title="title",t.IsReadOnlySupported="isReadOnlySupported",t))(tp||{}),a_=(t=>(t.IsTune="isTune",t))(a_||{}),bc=class{constructor({name:e,constructable:n,config:o,api:r,isDefault:i,isInternal:s=!1,defaultPlaceholder:a}){this.api=r,this.name=e,this.constructable=n,this.config=o,this.isDefault=i,this.isInternal=s,this.defaultPlaceholder=a}get settings(){let e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(gt(this.constructable.reset))return this.constructable.reset()}prepare(){if(gt(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){let e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===ds.Inline}isBlock(){return this.type===ds.Block}isTune(){return this.type===ds.Tune}},l_=class extends Re{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=ka()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,n;if(this.opened){for(let[o,r]of this.tools){let i=this.getToolShortcut(o.name);i!==void 0&&Ta.remove(this.Editor.UI.nodes.redactor,i),gt(r.clear)&&r.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(n=this.popover)==null||n.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=H.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.wrapper.setAttribute("data-cy","inline-toolbar"),H.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();let n=await this.getPopoverItems();this.popover=new t_({items:n,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:En.ui(no.ui.popover,"Nothing found"),search:En.ui(no.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){let n=be.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),r={x:n.x-o.x,y:n.y+n.height-o.top+this.toolbarVerticalMargin};r.x+e+o.x>this.Editor.UI.contentRect.right&&(r.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(r.x)+"px",this.nodes.wrapper.style.top=Math.floor(r.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){let e=["IMG","INPUT"],n=be.get(),o=be.text;if(!n||!n.anchorNode||n.isCollapsed||o.length<1)return!1;let r=H.isElement(n.anchorNode)?n.anchorNode:n.anchorNode.parentElement;if(r===null||n!==null&&e.includes(r.tagName))return!1;let i=this.Editor.BlockManager.getBlock(n.anchorNode);return!i||this.getTools().some(s=>i.tool.inlineTools.has(s.name))===!1?!1:r.closest("[contenteditable]")!==null}getTools(){let e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Editor.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{let n=e.create();this.tools.set(e,n)})}async getPopoverItems(){let e=[],n=0;for(let[o,r]of this.tools){let i=await r.render(),s=this.getToolShortcut(o.name);if(s!==void 0)try{this.enableShortcuts(o.name,s)}catch{}let a=s!==void 0?N_(s):void 0,l=En.t(no.toolNames,o.title||Wu(o.name));[i].flat().forEach(c=>{var d,u;let p={name:o.name,onActivate:()=>{this.toolClicked(r)},hint:{title:l,description:a}};if(H.isElement(c)){let h={...p,element:c,type:st.Html};if(gt(r.renderActions)){let g=r.renderActions();h.children={isOpen:(d=r.checkState)==null?void 0:d.call(r,be.get()),isFlippable:!1,items:[{type:st.Html,element:g}]}}else(u=r.checkState)==null||u.call(r,be.get());e.push(h)}else if(c.type===st.Html)e.push({...p,...c,type:st.Html});else if(c.type===st.Separator)e.push({type:st.Separator});else{let h={...p,...c,type:st.Default};"children"in h&&n!==0&&e.push({type:st.Separator}),e.push(h),"children"in h&&n<this.tools.size-1&&e.push({type:st.Separator})}}),n++}return e}getToolShortcut(e){let{Tools:n}=this.Editor,o=n.inlineTools.get(e),r=n.internal.inlineTools;return Array.from(r.keys()).includes(e)?this.inlineTools[e][Dk.Shortcut]:o?.shortcut}enableShortcuts(e,n){Ta.add({name:n,handler:o=>{var r;let{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),(r=this.popover)==null||r.activateItemByName(e))},on:document})}toolClicked(e){var n;let o=be.range;(n=e.surround)==null||n.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(n=>{var o;(o=n.checkState)==null||o.call(n,be.get())})}get inlineTools(){let e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([n,o])=>{e[n]=o.create()}),e}};function Ok(){let t=window.getSelection();if(t===null)return[null,0];let e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],n=e.textContent.length)),[e,n])}function Ik(t,e,n,o){let r=document.createRange();o==="left"?(r.setStart(t,0),r.setEnd(e,n)):(r.setStart(e,n),r.setEnd(t,t.childNodes.length));let i=r.cloneContents(),s=document.createElement("div");s.appendChild(i);let a=s.textContent||"";return Q4(a)}function Uu(t){let e=H.getDeepestNode(t);if(e===null||H.isEmpty(t))return!0;if(H.isNativeInput(e))return e.selectionEnd===0;if(H.isEmpty(t))return!0;let[n,o]=Ok();return n===null?!1:Ik(t,n,o,"left")}function Ku(t){let e=H.getDeepestNode(t,!0);if(e===null)return!0;if(H.isNativeInput(e))return e.selectionEnd===e.value.length;let[n,o]=Ok();return n===null?!1:Ik(t,n,o,"right")}var Ak={},L_={},dp={},gs={},R_={},P_={};Object.defineProperty(P_,"__esModule",{value:!0});P_.allInputsSelector=W5;function W5(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=P_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(R_);var ms={},F_={};Object.defineProperty(F_,"__esModule",{value:!0});F_.isNativeInput=G5;function G5(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=F_;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(ms);var Mk={},B_={};Object.defineProperty(B_,"__esModule",{value:!0});B_.append=Y5;function Y5(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=B_;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(Mk);var $_={},z_={};Object.defineProperty(z_,"__esModule",{value:!0});z_.blockElements=q5;function q5(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=z_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})($_);var Lk={},H_={};Object.defineProperty(H_,"__esModule",{value:!0});H_.calculateBaseline=J5;function J5(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||n*1.2,r=parseFloat(e.paddingTop),i=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(o-n)/2,c=s+i+r+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=H_;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(Lk);var Rk={},U_={},K_={},j_={};Object.defineProperty(j_,"__esModule",{value:!0});j_.isContentEditable=X5;function X5(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=j_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(K_);Object.defineProperty(U_,"__esModule",{value:!0});U_.canSetCaret=eU;var Z5=ms,Q5=K_;function eU(t){var e=!0;if((0,Z5.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,Q5.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=U_;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(Rk);var up={},V_={};function tU(t,e,n){let o=n.value!==void 0?"value":"get",r=n[o],i=`#${e}Cache`;if(n[o]=function(...s){return this[i]===void 0&&(this[i]=r.apply(this,s)),this[i]},o==="get"&&n.set){let s=n.set;n.set=function(a){delete t[i],s.apply(this,a)}}return n}function Pk(){let t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function W_(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function nU(t){return!W_(t)}var oU=()=>typeof window<"u"&&window.navigator!==null&&W_(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function rU(t){let e=Pk();return t=t.replace(/shift/gi,"\u21E7").replace(/backspace/gi,"\u232B").replace(/enter/gi,"\u23CE").replace(/up/gi,"\u2191").replace(/left/gi,"\u2192").replace(/down/gi,"\u2193").replace(/right/gi,"\u2190").replace(/escape/gi,"\u238B").replace(/insert/gi,"Ins").replace(/delete/gi,"\u2421").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"\u2318").replace(/alt/gi,"\u2325"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function iU(t){return t[0].toUpperCase()+t.slice(1)}function sU(t){let e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);let n=window.getSelection(),o=document.createRange();if(o.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function aU(t,e,n){let o;return(...r)=>{let i=this,s=()=>{o=void 0,n!==!0&&t.apply(i,r)},a=n===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(s,e),a&&t.apply(i,r)}}function fi(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function lU(t){return fi(t)==="boolean"}function Fk(t){return fi(t)==="function"||fi(t)==="asyncfunction"}function cU(t){return Fk(t)&&/^\s*class\s+/.test(t.toString())}function dU(t){return fi(t)==="number"}function ju(t){return fi(t)==="object"}function uU(t){return Promise.resolve(t)===t}function pU(t){return fi(t)==="string"}function fU(t){return fi(t)==="undefined"}function c_(t,...e){if(!e.length)return t;let n=e.shift();if(ju(t)&&ju(n))for(let o in n)ju(n[o])?(t[o]===void 0&&Object.assign(t,{[o]:{}}),c_(t[o],n[o])):Object.assign(t,{[o]:n[o]});return c_(t,...e)}function hU(t,e,n){let o=`\xAB${e}\xBB is deprecated and will be removed in the next major release. Please use the \xAB${n}\xBB instead.`;t&&console.warn(o)}function gU(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function mU(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}var _U={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},bU={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4},yU=class{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,n)=>{this.completed=this.completed.then(t).then(e).catch(n)})}};function xU(t,e,n=void 0){let o,r,i,s=null,a=0;n||(n={});let l=function(){a=n.leading===!1?0:Date.now(),s=null,i=t.apply(o,r),s===null&&(o=r=null)};return function(){let c=Date.now();!a&&n.leading===!1&&(a=c);let d=e-(c-a);return o=this,r=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),a=c,i=t.apply(o,r),s===null&&(o=r=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,d)),i}}var vU=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:yU,beautifyShortcut:rU,cacheable:tU,capitalize:iU,copyTextToClipboard:sU,debounce:aU,deepMerge:c_,deprecationAssert:hU,getUserOS:Pk,getValidUrl:gU,isBoolean:lU,isClass:cU,isEmpty:nU,isFunction:Fk,isIosDevice:oU,isNumber:dU,isObject:ju,isPrintableKey:mU,isPromise:uU,isString:pU,isUndefined:fU,keyCodes:_U,mouseButtons:bU,notEmpty:W_,throttle:xU,typeOf:fi},Symbol.toStringTag,{value:"Module"})),G_=$4(vU);Object.defineProperty(V_,"__esModule",{value:!0});V_.containsOnlyInlineElements=wU;var CU=G_,EU=$_;function wU(t){var e;(0,CU.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(o){return!(0,EU.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=V_;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(up);var Bk={},Y_={},pp={},q_={};Object.defineProperty(q_,"__esModule",{value:!0});q_.make=TU;function TU(t,e,n){var o;e===void 0&&(e=null),n===void 0&&(n={});var r=document.createElement(t);if(Array.isArray(e)){var i=e.filter(function(a){return a!==void 0});(o=r.classList).add.apply(o,i)}else e!==null&&r.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);return r}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=q_;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(pp);Object.defineProperty(Y_,"__esModule",{value:!0});Y_.fragmentToString=kU;var SU=pp;function kU(t){var e=(0,SU.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=Y_;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(Bk);var $k={},J_={};Object.defineProperty(J_,"__esModule",{value:!0});J_.getContentLength=DU;var NU=ms;function DU(t){var e,n;return(0,NU.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=J_;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})($k);var X_={},Z_={},QS=gc&&gc.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.getDeepestBlockElements=zk;var OU=up;function zk(t){return(0,OU.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return QS(QS([],e,!0),zk(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=Z_;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(X_);var Hk={},Q_={},fp={},eb={};Object.defineProperty(eb,"__esModule",{value:!0});eb.isLineBreakTag=IU;function IU(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=eb;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(fp);var hp={},tb={};Object.defineProperty(tb,"__esModule",{value:!0});tb.isSingleTag=AU;function AU(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=tb;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(hp);Object.defineProperty(Q_,"__esModule",{value:!0});Q_.getDeepestNode=Uk;var MU=ms,LU=fp,RU=hp;function Uk(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var r=t[n];if((0,RU.isSingleTag)(r)&&!(0,MU.isNativeInput)(r)&&!(0,LU.isLineBreakTag)(r))if(r[o])r=r[o];else if(r.parentNode!==null&&r.parentNode[o])r=r.parentNode[o];else return r.parentNode;return Uk(r,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=Q_;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(Hk);var Kk={},nb={},Bu=gc&&gc.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o<r;o++)(i||!(o in e))&&(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};Object.defineProperty(nb,"__esModule",{value:!0});nb.findAllInputs=zU;var PU=up,FU=X_,BU=R_,$U=ms;function zU(t){return Array.from(t.querySelectorAll((0,BU.allInputsSelector)())).reduce(function(e,n){return(0,$U.isNativeInput)(n)||(0,PU.containsOnlyInlineElements)(n)?Bu(Bu([],e,!0),[n],!1):Bu(Bu([],e,!0),(0,FU.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=nb;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(Kk);var jk={},ob={};Object.defineProperty(ob,"__esModule",{value:!0});ob.isCollapsedWhitespaces=HU;function HU(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=ob;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(jk);var rb={},ib={};Object.defineProperty(ib,"__esModule",{value:!0});ib.isElement=KU;var UU=G_;function KU(t){return(0,UU.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=ib;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(rb);var Vk={},sb={},ab={},lb={};Object.defineProperty(lb,"__esModule",{value:!0});lb.isLeaf=jU;function jU(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=lb;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(ab);var cb={},db={};Object.defineProperty(db,"__esModule",{value:!0});db.isNodeEmpty=qU;var VU=fp,WU=rb,GU=ms,YU=hp;function qU(t,e){var n="";return(0,YU.isSingleTag)(t)&&!(0,VU.isLineBreakTag)(t)?!1:((0,WU.isElement)(t)&&(0,GU.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("\u200B","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=db;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(cb);Object.defineProperty(sb,"__esModule",{value:!0});sb.isEmpty=ZU;var JU=ab,XU=cb;function ZU(t,e){t.normalize();for(var n=[t];n.length>0;){var o=n.shift();if(o){if(t=o,(0,JU.isLeaf)(t)&&!(0,XU.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=sb;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(Vk);var Wk={},ub={};Object.defineProperty(ub,"__esModule",{value:!0});ub.isFragment=e6;var QU=G_;function e6(t){return(0,QU.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=ub;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(Wk);var Gk={},pb={};Object.defineProperty(pb,"__esModule",{value:!0});pb.isHTMLString=n6;var t6=pp;function n6(t){var e=(0,t6.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=pb;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(Gk);var Yk={},fb={};Object.defineProperty(fb,"__esModule",{value:!0});fb.offset=o6;function o6(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,r=e.top+o,i=e.left+n;return{top:r,left:i,bottom:r+e.height,right:i+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=fb;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(Yk);var qk={},hb={};Object.defineProperty(hb,"__esModule",{value:!0});hb.prepend=r6;function r6(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=hb;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(qk);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=R_;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=ms;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var o=Mk;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return o.append}});var r=$_;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return r.blockElements}});var i=Lk;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return i.calculateBaseline}});var s=Rk;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=up;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=Bk;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=$k;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var d=X_;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return d.getDeepestBlockElements}});var u=Hk;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return u.getDeepestNode}});var p=Kk;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var h=jk;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return h.isCollapsedWhitespaces}});var g=K_;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return g.isContentEditable}});var m=rb;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return m.isElement}});var _=Vk;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var b=Wk;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return b.isFragment}});var y=Gk;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return y.isHTMLString}});var v=ab;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return v.isLeaf}});var x=cb;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return x.isNodeEmpty}});var E=fp;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return E.isLineBreakTag}});var C=hp;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return C.isSingleTag}});var k=pp;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return k.make}});var T=Yk;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return T.offset}});var w=qk;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return w.prepend}})})(gs);var gp={};Object.defineProperty(gp,"__esModule",{value:!0});gp.getContenteditableSlice=s6;var i6=gs;function s6(t,e,n,o,r){var i;r===void 0&&(r=!1);var s=document.createRange();if(o==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),r===!0){var a=s.extractContents();return(0,i6.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var d=(i=c.textContent)!==null&&i!==void 0?i:"";return d}Object.defineProperty(dp,"__esModule",{value:!0});dp.checkContenteditableSliceForEmptiness=c6;var a6=gs,l6=gp;function c6(t,e,n,o){var r=(0,l6.getContenteditableSlice)(t,e,n,o);return(0,a6.isCollapsedWhitespaces)(r)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=dp;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(L_);var Jk={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=gp;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(Jk);var Xk={},gb={};Object.defineProperty(gb,"__esModule",{value:!0});gb.focus=u6;var d6=gs;function u6(t,e){var n,o;if(e===void 0&&(e=!0),(0,d6.isNativeInput)(t)){t.focus();var r=e?0:t.value.length;t.setSelectionRange(r,r)}else{var i=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p){var h=document.createTextNode("");p.appendChild(h),i.setStart(h,0),i.setEnd(h,0)},l=function(p){return p!=null},c=t.childNodes,d=e?c[0]:c[c.length-1];if(l(d)){for(;l(d)&&d.nodeType!==Node.TEXT_NODE;)d=e?d.firstChild:d.lastChild;if(l(d)&&d.nodeType===Node.TEXT_NODE){var u=(o=(n=d.textContent)===null||n===void 0?void 0:n.length)!==null&&o!==void 0?o:0,r=e?0:u;i.setStart(d,r),i.setEnd(d,r)}else a(t)}else a(t);s.removeAllRanges(),s.addRange(i)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=gb;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(Xk);var mb={},mp={};Object.defineProperty(mp,"__esModule",{value:!0});mp.getCaretNodeAndOffset=p6;function p6(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=mp;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(mb);var Zk={},_p={};Object.defineProperty(_p,"__esModule",{value:!0});_p.getRange=f6;function f6(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=_p;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(Zk);var Qk={},_b={};Object.defineProperty(_b,"__esModule",{value:!0});_b.isCaretAtEndOfInput=m6;var ek=gs,h6=mb,g6=L_;function m6(t){var e=(0,ek.getDeepestNode)(t,!0);if(e===null)return!0;if((0,ek.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,h6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,g6.checkContenteditableSliceForEmptiness)(t,o,r,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=_b;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(Qk);var eN={},bb={};Object.defineProperty(bb,"__esModule",{value:!0});bb.isCaretAtStartOfInput=y6;var $u=gs,_6=mp,b6=dp;function y6(t){var e=(0,$u.getDeepestNode)(t);if(e===null||(0,$u.isEmpty)(t))return!0;if((0,$u.isNativeInput)(e))return e.selectionEnd===0;if((0,$u.isEmpty)(t))return!0;var n=(0,_6.getCaretNodeAndOffset)(),o=n[0],r=n[1];return o===null?!1:(0,b6.checkContenteditableSliceForEmptiness)(t,o,r,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=bb;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(eN);var tN={},yb={};Object.defineProperty(yb,"__esModule",{value:!0});yb.save=C6;var x6=gs,v6=_p;function C6(){var t=(0,v6.getRange)(),e=(0,x6.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=yb;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(tN);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=L_;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=Jk;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var o=Xk;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return o.focus}});var r=mb;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return r.getCaretNodeAndOffset}});var i=Zk;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return i.getRange}});var s=Qk;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=eN;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=tN;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(Ak);var d_=class extends Re{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case Te.BACKSPACE:this.backspace(e);break;case Te.DELETE:this.delete(e);break;case Te.ENTER:this.enter(e);break;case Te.DOWN:case Te.RIGHT:this.arrowRightAndDown(e);break;case Te.UP:case Te.LEFT:this.arrowLeftAndUp(e);break;case Te.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&ik(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!0}dragLeave(e){let n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!1}handleCommandC(e){let{BlockSelection:n}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e)}handleCommandX(e){let{BlockSelection:n,BlockManager:o,Caret:r}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e).then(()=>{let i=o.removeSelectedBlocks(),s=o.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),n.clearSelection(e)})}tabPressed(e){let{InlineToolbar:n,Caret:o}=this.Editor;n.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){this.Editor.BlockManager.currentBlock.isEmpty&&(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){let{BlockManager:n,UI:o}=this.Editor,r=n.currentBlock;if(r===void 0||r.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!Am)return;let i=r;r.currentInput!==void 0&&Uu(r.currentInput)&&!r.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):r.currentInput&&Ku(r.currentInput)?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),e.preventDefault()}backspace(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,previousBlock:i}=n;if(!(r===void 0||!be.isCollapsed||!r.currentInput||!Uu(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.firstInput){o.navigatePrevious();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r);let s=n.currentBlock;o.setToBlock(s,o.positions.END);return}YS(i,r)?this.mergeBlocks(i,r):o.setToBlock(i,o.positions.END)}}}delete(e){let{BlockManager:n,Caret:o}=this.Editor,{currentBlock:r,nextBlock:i}=n;if(!(!be.isCollapsed||!Ku(r.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),r.currentInput!==r.lastInput){o.navigateNext();return}if(i!==null){if(i.isEmpty){n.removeBlock(i);return}if(r.isEmpty){n.removeBlock(r),o.setToBlock(i,o.positions.START);return}YS(r,i)?this.mergeBlocks(r,i):o.setToBlock(i,o.positions.START)}}}mergeBlocks(e,n){let{BlockManager:o,Toolbar:r}=this.Editor;e.lastInput!==void 0&&(Ak.focus(e.lastInput,!1),o.mergeBlocks(e,n).then(()=>{r.close()}))}arrowRightAndDown(e){let n=wa.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Te.TAB);if(this.Editor.UI.someToolbarOpened&&n)return;this.Editor.Toolbar.close();let{currentBlock:o}=this.Editor.BlockManager,r=(o?.currentInput!==void 0?Ku(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Te.DOWN&&r){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===Te.DOWN||e.keyCode===Te.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}Vu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(wa.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===Te.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();let{currentBlock:n}=this.Editor.BlockManager,o=(n?.currentInput!==void 0?Uu(n.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===Te.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===Te.UP||e.keyCode===Te.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}Vu(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){let n=e.keyCode===Te.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===Te.ENTER&&this.Editor.BlockSettings.opened,r=e.keyCode===Te.ENTER&&this.Editor.InlineToolbar.opened,i=e.keyCode===Te.TAB;return!(e.shiftKey||i||n||o||r)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}},hc=class{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return sk(this.workingArea.children)}static set(e,n,o){return isNaN(Number(n))?(Reflect.set(e,n,o),!0):(e.insert(+n,o),!0)}static get(e,n){return isNaN(Number(n))?Reflect.get(e,n):e.get(+n)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,n){let o=this.blocks[n];H.swap(this.blocks[e].holder,o.holder),this.blocks[n]=this.blocks[e],this.blocks[e]=o}move(e,n){let o=this.blocks.splice(n,1)[0],r=e-1,i=Math.max(0,r),s=this.blocks[i];e>0?this.insertToDOM(o,"afterend",s):this.insertToDOM(o,"beforebegin",s),this.blocks.splice(e,0,o);let a=this.composeBlockEvent("move",{fromIndex:n,toIndex:e});o.call(kr.MOVED,a)}insert(e,n,o=!1){if(!this.length){this.push(n);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(kr.REMOVED));let r=o?1:0;if(this.blocks.splice(e,r,n),e>0){let i=this.blocks[e-1];this.insertToDOM(n,"afterend",i)}else{let i=this.blocks[e+1];i?this.insertToDOM(n,"beforebegin",i):this.insertToDOM(n)}}replace(e,n){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(n.holder),this.blocks[e]=n}insertMany(e,n){let o=new DocumentFragment;for(let r of e)o.appendChild(r.holder);if(this.length>0){if(n>0){let r=Math.min(n-1,this.length-1);this.blocks[r].holder.after(o)}else n===0&&this.workingArea.prepend(o);this.blocks.splice(n,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(r=>r.call(kr.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(kr.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(kr.REMOVED)),this.blocks.length=0}insertAfter(e,n){let o=this.blocks.indexOf(e);this.insert(o+1,n)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,n,o){n?o.holder.insertAdjacentElement(n,e.holder):this.workingArea.appendChild(e.holder),e.call(kr.RENDERED)}composeBlockEvent(e,n){return new CustomEvent(e,{detail:n})}},tk="block-removed",nk="block-added",E6="block-moved",ok="block-changed",u_=class{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,o)=>{this.completed=this.completed.then(e).then(n).catch(o)})}},p_=class extends Re{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){let e=new hc(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:hc.set,get:hc.get}),this.listeners.on(document,"copy",n=>this.Editor.BlockEvents.handleCommandC(n))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:n={},id:o=void 0,tunes:r={}}){let i=this.Editor.ReadOnly.isEnabled,s=this.Editor.Tools.blockTools.get(e),a=new No({id:o,data:n,tool:s,api:this.Editor.API,readOnly:i,tunesData:r},this.eventsDispatcher);return i||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:n=this.config.defaultBlock,data:o={},index:r,needToFocus:i=!0,replace:s=!1,tunes:a={}}={}){let l=r;l===void 0&&(l=this.currentBlockIndex+(s?0:1));let c=this.composeBlock({id:e,tool:n,data:o,tunes:a});return s&&this.blockDidMutated(tk,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,s),this.blockDidMutated(nk,c,{index:l}),i?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,n=0){this._blocks.insertMany(e,n)}async update(e,n,o){if(!n&&!o)return e;let r=await e.data,i=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},r,n??{}),tunes:o??e.tunes}),s=this.getBlockIndex(e);return this._blocks.replace(s,i),this.blockDidMutated(ok,i,{index:s}),i}replace(e,n,o){let r=this.getBlockIndex(e);return this.insert({tool:n,data:o,index:r,replace:!0})}paste(e,n,o=!1){let r=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{r.call(kr.ON_PASTE,n)})}catch(i){Ge(`${e}: onPaste callback call is failed`,"error",i)}return r}insertDefaultBlockAtIndex(e,n=!1){let o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(nk,o,{index:e}),n?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,n){let o;if(e.name===n.name&&e.mergeable){let r=await n.data;if(vo(r)){console.error("Could not merge Block. Failed to extract original Block data.");return}let[i]=D_([r],e.tool.sanitizeConfig);o=i}else if(e.mergeable&&Yu(n,"export")&&Yu(e,"import")){let r=await n.exportDataAsString(),i=Xo(r,e.tool.sanitizeConfig);o=qS(i,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(n),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,n=!0){return new Promise(o=>{let r=this._blocks.indexOf(e);if(!this.validateIndex(r))throw new Error("Can't find a Block to remove");e.destroy(),this._blocks.remove(r),this.blockDidMutated(tk,e,{index:r}),this.currentBlockIndex>=r&&this.currentBlockIndex--,this.blocks.length?r===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),n&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let n=this.blocks.length-1;n>=0;n--)this.blocks[n].selected&&(this.removeBlock(this.blocks[n]),e=n);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){let e=this.Editor.Caret.extractFragmentFromCaretPosition(),n=H.make("div");n.appendChild(e);let o={text:H.isEmpty(n)?"":n.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(n=>n.id===e)}getBlock(e){H.isElement(e)||(e=e.parentNode);let n=this._blocks.nodes,o=e.closest(`.${No.CSS.wrapper}`),r=n.indexOf(o);if(r>=0)return this._blocks[r]}setCurrentBlockByChildNode(e){H.isElement(e)||(e=e.parentNode);let n=e.closest(`.${No.CSS.wrapper}`);if(!n)return;let o=n.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(n),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;H.isElement(e)||(e=e.parentNode);let n=e.closest(`.${No.CSS.wrapper}`);return this.blocks.find(o=>o.holder===n)}swap(e,n){this._blocks.swap(e,n),this.currentBlockIndex=n}move(e,n=this.currentBlockIndex){if(isNaN(e)||isNaN(n)){Ge("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(n)){Ge("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,n),this.currentBlockIndex=e,this.blockDidMutated(E6,this.currentBlock,{fromIndex:n,toIndex:e})}async convert(e,n,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");let r=this.Editor.Tools.blockTools.get(n);if(!r)throw new Error(`Could not convert Block. Tool \xAB${n}\xBB not found.`);let i=await e.exportDataAsString(),s=Xo(i,r.sanitizeConfig),a=qS(s,r.conversionConfig,r.settings);return o&&(a=Object.assign(a,o)),this.replace(e,r.name,a)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){let n=new u_;this.blocks.forEach(o=>{n.add(async()=>{await this.removeBlock(o,!1)})}),await n.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){let{BlockEvents:n}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{n.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{n.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{n.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{n.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(ok,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,n,o){let r=new CustomEvent(e,{detail:{target:new Sr(n),...o}});return this.eventsDispatcher.emit(uk,{event:r}),n}},f_=class extends Re{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){let{BlockManager:e}=this.Editor;return e.blocks.every(n=>n.selected===!0)}set allBlocksSelected(e){let{BlockManager:n}=this.Editor;n.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){let{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(n=>n.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new be,Ta.add({name:"CMD+A",handler:e=>{let{BlockManager:n,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}n.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){be.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){let{BlockManager:n}=this.Editor,o;isNaN(e)?o=n.currentBlock:o=n.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,n=!1){let{BlockManager:o,Caret:r,RectangleSelection:i}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;let s=e&&e instanceof KeyboardEvent,a=s&&ik(e.keyCode);if(this.anyBlockSelected&&s&&a&&!be.isSelectionExists){let l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),r.setToBlock(o.currentBlock),Vu(()=>{let c=e.key;r.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||i.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}n&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();let n=H.make("div");this.selectedBlocks.forEach(i=>{let s=Xo(i.holder.innerHTML,this.sanitizerConfig),a=H.make("p");a.innerHTML=s,n.appendChild(a)});let o=Array.from(n.childNodes).map(i=>i.textContent).join(`
101
-
102
- `),r=n.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",r),Promise.all(this.selectedBlocks.map(i=>i.save())).then(i=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(i))}catch{}})}selectBlockByIndex(e){let{BlockManager:n}=this.Editor,o=n.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),be.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){Ta.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),H.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}let n=this.Editor.BlockManager.getBlock(e.target),o=n.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(n),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),be.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}},h_=class t extends Re{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,n=this.positions.DEFAULT,o=0){var r;let{BlockManager:i,BlockSelection:s}=this.Editor;if(s.clearSelection(),!e.focusable){(r=window.getSelection())==null||r.removeAllRanges(),s.selectBlock(e),i.currentBlock=e;return}let a;switch(n){case this.positions.START:a=e.firstInput;break;case this.positions.END:a=e.lastInput;break;default:a=e.currentInput}if(!a)return;let l=H.getDeepestNode(a,n===this.positions.END),c=H.getContentLength(l);switch(!0){case n===this.positions.START:o=0;break;case n===this.positions.END:case o>c:o=c;break}this.set(l,o),i.setCurrentBlockByChildNode(e.holder),i.currentBlock.currentInput=a}setToInput(e,n=this.positions.DEFAULT,o=0){let{currentBlock:r}=this.Editor.BlockManager,i=H.getDeepestNode(e);switch(n){case this.positions.START:this.set(i,0);break;case this.positions.END:this.set(i,H.getContentLength(i));break;default:o&&this.set(i,o)}r.currentInput=e}set(e,n=0){let{top:o,bottom:r}=be.setCursor(e,n),{innerHeight:i}=window;o<0?window.scrollBy(0,o-30):r>i&&window.scrollBy(0,r-i+30)}setToTheLastBlock(){let e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{let n=this.Editor.BlockManager.insertAtEnd();this.setToBlock(n)}}extractFragmentFromCaretPosition(){let e=be.get();if(e.rangeCount){let n=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(n.deleteContents(),o)if(H.isNativeInput(o)){let r=o,i=document.createDocumentFragment(),s=r.value.substring(0,r.selectionStart),a=r.value.substring(r.selectionStart);return i.textContent=a,r.value=s,i}else{let r=n.cloneRange();return r.selectNodeContents(o),r.setStart(n.endContainer,n.endOffset),r.extractContents()}}}navigateNext(e=!1){let{BlockManager:n}=this.Editor,{currentBlock:o,nextBlock:r}=n;if(o===void 0)return!1;let{nextInput:i,currentInput:s}=o,a=s!==void 0?Ku(s):void 0,l=r,c=e||a||!o.focusable;if(i&&c)return this.setToInput(i,this.positions.START),!0;if(l===null){if(o.tool.isDefault||!c)return!1;l=n.insertAtEnd()}return c?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){let{currentBlock:n,previousBlock:o}=this.Editor.BlockManager;if(!n)return!1;let{previousInput:r,currentInput:i}=n,s=i!==void 0?Uu(i):void 0,a=e||s||!n.focusable;return r&&a?(this.setToInput(r,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){let n=document.createElement("span");n.classList.add(t.CSS.shadowCaret),e.insertAdjacentElement("beforeend",n)}restoreCaret(e){let n=e.querySelector(`.${t.CSS.shadowCaret}`);if(!n)return;new be().expandToTag(n);let o=document.createRange();o.selectNode(n),o.extractContents()}insertContentAtCaretPosition(e){let n=document.createDocumentFragment(),o=document.createElement("div"),r=be.get(),i=be.range;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>n.appendChild(c)),n.childNodes.length===0&&n.appendChild(new Text);let s=n.lastChild;i.deleteContents(),i.insertNode(n);let a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),r.removeAllRanges(),r.addRange(a)}},g_=class extends Re{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{let{BlockManager:n,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;let r=n.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,i=n.getBlockByChildNode(e.target);if(!(!r||!i)&&i!==r){if(r===this.firstSelectedBlock){be.get().removeAllRanges(),r.selected=!0,i.selected=!0,o.clearCache();return}if(i===this.firstSelectedBlock){r.selected=!1,i.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(r,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==H4.LEFT)return;let{BlockManager:n}=this.Editor;this.firstSelectedBlock=n.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){let{BlockManager:n,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),be.get().removeAllRanges());let r=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=n.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=i,this.Editor.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}))}clear(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor,i=n.blocks.indexOf(this.firstSelectedBlock),s=n.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&i>-1&&s>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case Te.DOWN:case Te.RIGHT:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END);break;case Te.UP:case Te.LEFT:r.setToBlock(n.blocks[Math.min(i,s)],r.positions.START);break;default:r.setToBlock(n.blocks[Math.max(i,s)],r.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){let{UI:n}=this.Editor;be.isCollapsed||this.Editor.BlockSelection.clearSelection(e),n.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,n){let{BlockManager:o,BlockSelection:r}=this.Editor,i=o.blocks.indexOf(e),s=o.blocks.indexOf(n),a=e.selected!==n.selected;for(let l=Math.min(i,s);l<=Math.max(i,s);l++){let c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:n)&&(o.blocks[l].selected=!o.blocks[l].selected,r.clearCache())}}},m_=class extends Re{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){let{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async n=>{await this.processDrop(n)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",n=>{this.processDragOver(n)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){let{BlockManager:n,Paste:o,Caret:r}=this.Editor;e.preventDefault(),n.blocks.forEach(s=>{s.dropTarget=!1}),be.isAtEditor&&!be.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;let i=n.setCurrentBlockByChildNode(e.target);if(i)this.Editor.Caret.setToBlock(i,r.positions.END);else{let s=n.setCurrentBlockByChildNode(n.lastBlock.holder);this.Editor.Caret.setToBlock(s,r.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){be.isAtEditor&&!be.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}},w6=180,T6=400,__=class extends Re{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=T6,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(uk,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(pk,()=>{this.disable()}),this.eventsDispatcher.on(fk,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!gt(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let n;this.batchingOnChangeQueue.size===1?n=this.batchingOnChangeQueue.values().next().value:n=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,n),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(Mm,{mutations:e})}},nN=class oN extends Re{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{let n=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!gt(n.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(n){Ge(`Paste handling for \xAB${e.name}\xBB Tool hasn't been set up because of the error`,"warn",n)}},this.handlePasteEvent=async e=>{let{BlockManager:n,Toolbar:o}=this.Editor,r=n.setCurrentBlockByChildNode(e.target);!r||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||r&&this.exceptionList.includes(r.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,n=!1){let{Tools:o}=this.Editor,r=e.types;if((r.includes?r.includes("Files"):r.contains("Files"))&&!vo(this.toolsFiles)){await this.processFiles(e.files);return}let i=e.getData(this.MIME_TYPE),s=e.getData("text/plain"),a=e.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}n&&s.trim()&&a.trim()&&(a="<p>"+(a.trim()?a:s)+"</p>");let l=Object.keys(this.toolsTags).reduce((u,p)=>(u[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},u),{}),c=Object.assign({},l,o.getAllInlineToolsSanitizeConfig(),{br:{}}),d=Xo(a,c);!d.trim()||d.trim()===s||!H.isHTMLString(d)?await this.processText(s):await this.processText(d,!0)}async processText(e,n=!1){let{Caret:o,BlockManager:r}=this.Editor,i=n?this.processHTML(e):this.processPlain(e);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}let s=r.currentBlock&&r.currentBlock.tool.isDefault&&r.currentBlock.isEmpty;i.map(async(a,l)=>this.insertBlock(a,l===0&&s)),r.currentBlock&&o.setToBlock(r.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){let e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return Dr(e)?[e]:sn(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;let n=e.pasteConfig.tags||[],o=[];n.forEach(r=>{let i=this.collectTagNames(r);o.push(...i),i.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){Ge(`Paste handler for \xAB${e.name}\xBB Tool on \xAB${s}\xBB tag is skipped because it is already used by \xAB${this.toolsTags[s].tool.name}\xBB Tool.`,"warn");return}let a=sn(r)?r[s]:null;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(r=>r.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;let{files:n={}}=e.pasteConfig,{extensions:o,mimeTypes:r}=n;!o&&!r||(o&&!Array.isArray(o)&&(Ge(`\xABextensions\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),o=[]),r&&!Array.isArray(r)&&(Ge(`\xABmimeTypes\xBB property of the onDrop config for \xAB${e.name}\xBB Tool should be an array`),r=[]),r&&(r=r.filter(i=>W4(i)?!0:(Ge(`MIME type value \xAB${i}\xBB for the \xAB${e.name}\xBB Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:r||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||vo(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([n,o])=>{o instanceof RegExp||Ge(`Pattern ${o} for \xAB${e.name}\xBB Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:n,pattern:o,tool:e})})}isNativeBehaviour(e){return H.isNativeInput(e)}async processFiles(e){let{BlockManager:n}=this.Editor,o;o=await Promise.all(Array.from(e).map(i=>this.processFile(i))),o=o.filter(i=>!!i);let r=n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty;o.forEach((i,s)=>{n.paste(i.type,i.event,s===0&&r)})}async processFile(e){let n=V4(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:s,extensions:a}])=>{let[l,c]=e.type.split("/"),d=a.find(p=>p.toLowerCase()===n.toLowerCase()),u=s.find(p=>{let[h,g]=p.split("/");return h===l&&(g===c||g==="*")});return!!d||!!u});if(!o)return;let[r]=o;return{event:this.composePasteEvent("file",{file:e}),type:r}}processHTML(e){let{Tools:n}=this.Editor,o=H.make("DIV");return o.innerHTML=e,this.getNodes(o).map(r=>{let i,s=n.defaultTool,a=!1;switch(r.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=H.make("div"),i.appendChild(r);break;case Node.ELEMENT_NODE:i=r,a=!0,this.toolsTags[i.tagName]&&(s=this.toolsTags[i.tagName].tool);break}let{tags:l}=s.pasteConfig||{tags:[]},c=l.reduce((p,h)=>(this.collectTagNames(h).forEach(g=>{let m=sn(h)?h[g]:null;p[g.toLowerCase()]=m||{}}),p),{}),d=Object.assign({},c,s.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){let p=Xo(i.outerHTML,d);i=H.make("div",void 0,{innerHTML:p}).firstChild}else i.innerHTML=Xo(i.innerHTML,d);let u=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:a,tool:s.name,event:u}}).filter(r=>{let i=H.isEmpty(r.content),s=H.isSingleTag(r.content);return!i||s})}processPlain(e){let{defaultBlock:n}=this.config;if(!e)return[];let o=n;return e.split(/\r?\n/).filter(r=>r.trim()).map(r=>{let i=H.make("div");i.textContent=r;let s=this.composePasteEvent("tag",{data:i});return{content:i,tool:o,isBlock:!1,event:s}})}async processSingleBlock(e){let{Caret:n,BlockManager:o}=this.Editor,{currentBlock:r}=o;if(!r||e.tool!==r.name||!H.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,r?.tool.isDefault&&r.isEmpty);return}n.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){let{BlockManager:n,Caret:o}=this.Editor,{content:r}=e;if(n.currentBlock&&n.currentBlock.tool.isDefault&&r.textContent.length<oN.PATTERN_PROCESSING_MAX_LENGTH){let i=await this.processPattern(r.textContent);if(i){let s=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty,a=n.paste(i.tool,i.event,s);o.setToBlock(a,o.positions.END);return}}if(n.currentBlock&&n.currentBlock.currentInput){let i=n.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,Xo(r.innerHTML,i))}else this.insertBlock(e)}async processPattern(e){let n=this.toolsPatterns.find(o=>{let r=o.pattern.exec(e);return r?e===r.shift():!1});return n?{event:this.composePasteEvent("pattern",{key:n.key,data:e}),tool:n.tool.name}:void 0}insertBlock(e,n=!1){let{BlockManager:o,Caret:r}=this.Editor,{currentBlock:i}=o,s;if(n&&i&&i.isEmpty){s=o.paste(e.tool,e.event,!0),r.setToBlock(s,r.positions.END);return}s=o.paste(e.tool,e.event),r.setToBlock(s,r.positions.END)}insertEditorJSData(e){let{BlockManager:n,Caret:o,Tools:r}=this.Editor;D_(e,i=>r.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:s},a)=>{let l=!1;a===0&&(l=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);let c=n.insert({tool:i,data:s,replace:l});o.setToBlock(c,o.positions.END)})}processElementNode(e,n,o){let r=Object.keys(this.toolsTags),i=e,{tool:s}=this.toolsTags[i.tagName]||{},a=this.tagsByTool[s?.name]||[],l=r.includes(i.tagName),c=H.blockElements.includes(i.tagName.toLowerCase()),d=Array.from(i.children).some(({tagName:p})=>r.includes(p)&&!a.includes(p)),u=Array.from(i.children).some(({tagName:p})=>H.blockElements.includes(p.toLowerCase()));if(!c&&!l&&!d)return o.appendChild(i),[...n,o];if(l&&!d||c&&!u&&!d)return[...n,o,i]}getNodes(e){let n=Array.from(e.childNodes),o,r=(i,s)=>{if(H.isEmpty(s)&&!H.isSingleTag(s))return i;let a=i[i.length-1],l=new DocumentFragment;switch(a&&H.isFragment(a)&&(l=i.pop()),s.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(s,i,l),o)return o;break;case Node.TEXT_NODE:return l.appendChild(s),[...i,l];default:return[...i,l]}return[...i,...Array.from(s.childNodes).reduce(r,[])]};return n.reduce(r,[])}composePasteEvent(e,n){return new CustomEvent(e,{detail:n})}};nN.PATTERN_PROCESSING_MAX_LENGTH=450;var S6=nN,b_=class extends Re{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){let{Tools:e}=this.Editor,{blockTools:n}=e,o=[];Array.from(n.entries()).forEach(([r,i])=>{i.isReadOnlySupported||o.push(r)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,n=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();let o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(let i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(n)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();let r=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(r.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new Gu(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}},y_=class t extends Re{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,n){let o=document.elementFromPoint(e-window.pageXOffset,n-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);let r=[`.${No.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],i=o.closest("."+this.Editor.UI.CSS.editorWrapper),s=r.some(a=>!!o.closest(a));!i||s||(this.mousedown=!0,this.startX=e,this.startY=n)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){let{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1),this.listeners.on(document.body,"mousemove",Dm(n=>{this.processMouseMove(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",Dm(n=>{this.processScroll(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(H.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){let{UI:e}=this.Editor,n=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=H.make("div",t.CSS.overlay,{}),r=H.make("div",t.CSS.overlayContainer,{}),i=H.make("div",t.CSS.rect,{});return r.appendChild(i),o.appendChild(r),n.appendChild(o),this.overlayRectangle=i,{container:n,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;let n=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-n,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);let{rightPos:n,leftPos:o,index:r}=this.genInfoForMouseSelection(),i=this.startX>n&&this.mouseX>n,s=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(i||s),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),r!==void 0&&(this.trySelectNextBlock(r),this.inverseSelection(),be.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){let e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(n);if(!this.rectCrossesBlocks&&e)for(let n of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(n)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){let e=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,n),r=this.Editor.BlockManager.getBlockByChildNode(o),i;r!==void 0&&(i=this.Editor.BlockManager.blocks.findIndex(d=>d.holder===r.holder));let s=this.Editor.BlockManager.lastBlock.holder.querySelector("."+No.CSS.content),a=Number.parseInt(window.getComputedStyle(s).width,10)/2,l=e-a,c=e+a;return{index:i,leftPos:l,rightPos:c}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){let n=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,r=1,i=-1,s=0;if(n)return;let a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0,l=s;o>1&&(l=a?r:i);let c=e>this.stackOfSelected[o-1]&&l===r,d=e<this.stackOfSelected[o-1]&&l===i,u=!(c||d||l===s);if(!u&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let g=this.stackOfSelected[o-1]+1||e;for(g;g<=e;g++)this.addBlockInSelection(g);return}if(!u&&e<this.stackOfSelected[o-1]){for(let g=this.stackOfSelected[o-1]-1;g>=e;g--)this.addBlockInSelection(g);return}if(!u)return;let p=o-1,h;for(e>this.stackOfSelected[o-1]?h=()=>e>this.stackOfSelected[p]:h=()=>e<this.stackOfSelected[p];h();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[p]),this.stackOfSelected.pop(),p--}},x_=class extends Re{async render(e){return new Promise(n=>{let{Tools:o,BlockManager:r}=this.Editor;if(e.length===0)r.insert();else{let i=e.map(({type:s,data:a,tunes:l,id:c})=>{o.available.has(s)===!1&&(xo(`Tool \xAB${s}\xBB is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(s,a,c),s=o.stubTool);let d;try{d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}catch(u){Ge(`Block \xAB${s}\xBB skipped because of plugins error`,"error",{data:a,error:u}),a=this.composeStubDataForTool(s,a,c),s=o.stubTool,d=r.composeBlock({id:c,tool:s,data:a,tunes:l})}return d});r.insertMany(i)}window.requestIdleCallback(()=>{n()},{timeout:2e3})})}composeStubDataForTool(e,n,o){let{Tools:r}=this.Editor,i=e;if(r.unavailable.has(e)){let s=r.unavailable.get(e).toolbox;s!==void 0&&s[0].title!==void 0&&(i=s[0].title)}return{savedData:{id:o,type:e,data:n},title:i}}},v_=class extends Re{async save(){let{BlockManager:e,Tools:n}=this.Editor,o=e.blocks,r=[];try{o.forEach(a=>{r.push(this.getSavedData(a))});let i=await Promise.all(r),s=await D_(i,a=>n.blockTools.get(a).sanitizeConfig);return this.makeOutput(s)}catch(i){xo("Saving failed due to the Error %o","error",i)}}async getSavedData(e){let n=await e.save(),o=n&&await e.validate(n.data);return{...n,isValid:o}}makeOutput(e){let n=[];return e.forEach(({id:o,tool:r,data:i,tunes:s,isValid:a})=>{if(!a){Ge(`Block \xAB${r}\xBB skipped because saved data is invalid`);return}if(r===this.Editor.Tools.stubTool){n.push(i);return}let l={id:o,type:r,data:i,...!vo(s)&&{tunes:s}};n.push(l)}),{time:+new Date,blocks:n,version:"2.31.0-rc.7"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var k6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function N6(t){let e=document.createElement("div");e.innerHTML=t.trim();let n=document.createDocumentFragment();return n.append(...Array.from(e.childNodes)),n}var C_=class t{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=n.placeholder?n.placeholder:t.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=n.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;let{textContent:n}=this._element;n===""&&(this._element.innerHTML="")}drawView(){let e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;let n=N6(e.text);this._element.appendChild(n),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){let n={text:e.detail.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:k6,title:"Text"}}},yc=class{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:v5,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}};yc.isInline=!0;yc.title="Bold";var xc=class{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=N5,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){let e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}};xc.isInline=!0;xc.title="Italic";var vc=class{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new be}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=JS,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());let n=this.selection.findParentTag("A");if(n){this.selection.expandToTag(n),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close();return}}this.toggleActions()}checkState(){let e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=A5,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();let n=e.getAttribute("href");this.nodes.input.value=n!=="null"?n:"",this.selection.save()}else this.nodes.button.innerHTML=JS,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){let n=new be;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let n=this.nodes.input.value||"";if(!n.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(n)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Ge("Incorrect Link pasted","warn",n);return}n=this.prepareLink(n),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(n),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;let n=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",r=/^\/\/[^/\s]/.test(e);return!n&&!o&&!r&&(e="http://"+e),e}insertLink(e){let n=this.selection.findParentTag("A");n&&this.selection.expandToTag(n),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}};vc.isInline=!0;vc.title="Link";var np=class{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){let e=be.get(),n=this.blocksAPI.getBlockByElement(e.anchorNode);if(n===void 0)return[];let o=this.toolsAPI.getBlockTools(),r=await gk(n,o);if(r.length===0)return[];let i=r.reduce((c,d)=>{var u;return(u=d.toolbox)==null||u.forEach(p=>{c.push({icon:p.icon,title:En.t(no.toolNames,p.title),name:d.name,closeOnActivate:!0,onActivate:async()=>{let h=await this.blocksAPI.convert(n.id,d.name,p.data);this.caretAPI.setToBlock(h,"end")}})}),c},[]),s=await n.getActiveToolboxEntry(),a=s!==void 0?s.icon:vk,l=!ka();return{icon:a,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:i,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};np.isInline=!0;var op=class{constructor({data:e,api:n}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=n,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){let e=H.make("div",this.CSS.wrapper),n=M5,o=H.make("div",this.CSS.info),r=H.make("div",this.CSS.title,{textContent:this.title}),i=H.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=n,o.appendChild(r),o.appendChild(i),e.appendChild(o),e}};op.isReadOnlySupported=!0;var E_=class extends bc{constructor(){super(...arguments),this.type=ds.Inline}get title(){return this.constructable[tp.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[tp.IsReadOnlySupported]??!1}},w_=class extends bc{constructor(){super(...arguments),this.type=ds.Tune}create(e,n){return new this.constructable({api:this.api,config:this.settings,block:n,data:e})}},yo=class t extends Map{get blockTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isBlock());return new t(e)}get inlineTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInline());return new t(e)}get blockTunes(){let e=Array.from(this.entries()).filter(([,n])=>n.isTune());return new t(e)}get internalTools(){let e=Array.from(this.entries()).filter(([,n])=>n.isInternal);return new t(e)}get externalTools(){let e=Array.from(this.entries()).filter(([,n])=>!n.isInternal);return new t(e)}},D6=Object.defineProperty,O6=Object.getOwnPropertyDescriptor,rN=(t,e,n,o)=>{for(var r=o>1?void 0:o?O6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&D6(e,n,r),r},Cc=class extends bc{constructor(){super(...arguments),this.type=ds.Block,this.inlineTools=new yo,this.tunes=new yo}create(e,n,o){return new this.constructable({data:e,block:n,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Ca.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[Ca.IsEnabledLineBreaks]}get toolbox(){let e=this.constructable[Ca.Toolbox],n=this.config[Hu.Toolbox];if(!vo(e)&&n!==!1)return n?Array.isArray(e)?Array.isArray(n)?n.map((o,r)=>{let i=e[r];return i?{...i,...o}:o}):[n]:Array.isArray(n)?n:[{...e,...n}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[Ca.ConversionConfig]}get enabledInlineTools(){return this.config[Hu.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[Hu.EnabledBlockTunes]}get pasteConfig(){return this.constructable[Ca.PasteConfig]??{}}get sanitizeConfig(){let e=super.sanitizeConfig,n=this.baseSanitizeConfig;if(vo(e))return n;let o={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=e[r];sn(i)?o[r]=Object.assign({},n,i):o[r]=i}return o}get baseSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),Array.from(this.tunes.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),e}};rN([Sa],Cc.prototype,"sanitizeConfig",1);rN([Sa],Cc.prototype,"baseSanitizeConfig",1);var T_=class{constructor(e,n,o){this.api=o,this.config=e,this.editorConfig=n}get(e){let{class:n,isInternal:o=!1,...r}=this.config[e],i=this.getConstructor(n),s=n[a_.IsTune];return new i({name:e,constructable:n,config:r,api:this.api.getMethodsForTool(e,s),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[tp.IsInline]:return E_;case e[a_.IsTune]:return w_;default:return Cc}}},rp=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:C5,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e+1);if(!n)throw new Error("Unable to move Block down since it is already the last");let o=n.holder,r=o.getBoundingClientRect(),i=Math.abs(window.innerHeight-o.offsetHeight);r.top<window.innerHeight&&(i=window.scrollY+o.offsetHeight),window.scrollTo(0,i),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}};rp.isTune=!0;var ip=class{constructor({api:e}){this.api=e}render(){return{icon:S5,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};ip.isTune=!0;var sp=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:T5,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){let e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!n||!o)throw new Error("Unable to move Block up since it is already the first");let r=n.holder,i=o.holder,s=r.getBoundingClientRect(),a=i.getBoundingClientRect(),l;a.top>0?l=Math.abs(s.top)-Math.abs(a.top):l=Math.abs(s.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}};sp.isTune=!0;var I6=Object.defineProperty,A6=Object.getOwnPropertyDescriptor,M6=(t,e,n,o)=>{for(var r=o>1?void 0:o?A6(e,n):e,i=t.length-1,s;i>=0;i--)(s=t[i])&&(r=(o?s(e,n,r):s(r))||r);return o&&r&&I6(e,n,r),r},ap=class extends Re{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new yo,this.toolsUnavailable=new yo}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=Om({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");let e=this.prepareConfig();this.factory=new T_(e,this.config,this.Editor.API);let n=this.getListOfPrepareFunctions(e);if(n.length===0)return Promise.resolve();await j4(n,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){let e={};return Array.from(this.inlineTools.values()).forEach(n=>{Object.assign(e,n.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{gt(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:np,isInternal:!0},link:{class:vc,isInternal:!0},bold:{class:yc,isInternal:!0},italic:{class:xc,isInternal:!0},paragraph:{class:C_,inlineToolbar:!0,isInternal:!0},stub:{class:op,isInternal:!0},moveUp:{class:sp,isInternal:!0},delete:{class:ip,isInternal:!0},moveDown:{class:rp,isInternal:!0}}}toolPrepareMethodSuccess(e){let n=this.factory.get(e.toolName);if(n.isInline()){let o=["render"].filter(r=>!n.create()[r]);if(o.length){Ge(`Incorrect Inline Tool: ${n.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(n.name,n);return}}this.toolsAvailable.set(n.name,n)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){let n=[];return Object.entries(e).forEach(([o,r])=>{n.push({function:gt(r.class.prepare)?r.class.prepare:()=>{},data:{toolName:o,config:r.config}})}),n}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new yo(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(n=>[n,this.inlineTools.get(n)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new yo(["convertTo",...e.enabledInlineTools].map(n=>[n,this.inlineTools.get(n)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){let n=new yo(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new yo([...n,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){let n=new yo(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new yo([...n,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(let e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;let n=this.config.tools[e];if(!gt(n)&&!gt(n.class))throw Error(`Tool \xAB${e}\xBB must be a constructor function or an object with function in the \xABclass\xBB property`)}}prepareConfig(){let e={};for(let n in this.config.tools)sn(this.config.tools[n])?e[n]=this.config.tools[n]:e[n]={class:this.config.tools[n]};return e}};M6([Sa],ap.prototype,"getAllInlineToolsSanitizeConfig",1);var L6=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
103
- `,S_=class extends Re{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=GS(()=>{this.windowResize()},200),this.selectionChangeDebounced=GS(()=>{this.selectionChanged()},w6),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;let e=this.nodes.wrapper.querySelector(`.${No.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){let{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;return!!(n.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof wa).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){let{Toolbar:e,BlockSettings:n,InlineToolbar:o}=this.Editor;n.close(),o.close(),e.toolbox.close()}setIsMobile(){let e=window.innerWidth<ak;e!==this.isMobile&&this.eventsDispatcher.emit(mc,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=H.getHolder(this.config.holder),this.nodes.wrapper=H.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=H.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){let e="editor-js-styles";if(H.get(e))return;let n=H.make("style",null,{id:e,textContent:L6.toString()});this.config.style&&!vo(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),H.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",Dm(n=>{let o=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(Nk,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case Te.ENTER:this.enterPressed(e);break;case Te.BACKSPACE:case Te.DELETE:this.backspacePressed(e);break;case Te.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){let{currentBlock:n}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),r=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||n&&r||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){let{BlockManager:n,BlockSelection:o,Caret:r}=this.Editor;if(o.anyBlockSelected&&!be.isSelectionExists){let i=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(i,!0);r.setToBlock(s,r.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){let{BlockManager:n,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;let r=n.currentBlockIndex>=0;if(o.anyBlockSelected&&!be.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&r&&e.target.tagName==="BODY"){let i=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,o;if(!e.isTrusted)return;let r=e.target;this.nodes.holder.contains(r)||be.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());let i=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(r),s=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(r),a=i||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();let l=this.Editor.BlockManager.getBlockByChildNode(r);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){let o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,r=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(o,r)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!be.isCollapsed)return;let n=e.target,o=e.metaKey||e.ctrlKey;if(H.isAnchor(n)&&o){e.stopImmediatePropagation(),e.stopPropagation();let r=n.getAttribute("href"),i=Y4(r);J4(i);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){let n=this.Editor.BlockManager.getBlockByIndex(-1),o=H.offset(n.holder).bottom,r=e.pageY,{BlockSelection:i}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!i.anyBlockSelected&&o<r){e.stopImmediatePropagation(),e.stopPropagation();let{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){let{CrossBlockSelection:e,BlockSelection:n}=this.Editor,o=be.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&be.get().removeAllRanges(),!o){be.range||this.Editor.InlineToolbar.close();return}let r=o.closest(`.${No.CSS.content}`);(r===null||r.closest(`.${be.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){let o=n.target;lk(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}},R6={BlocksAPI:Rm,CaretAPI:Pm,EventsAPI:Fm,I18nAPI:Bm,API:$m,InlineToolbarAPI:zm,ListenersAPI:Hm,NotifierAPI:Km,ReadOnlyAPI:jm,SanitizerAPI:Vm,SaverAPI:Wm,SelectionAPI:Gm,ToolsAPI:Ym,StylesAPI:qm,ToolbarAPI:Jm,TooltipAPI:Xm,UiAPI:Zm,BlockSettings:r_,Toolbar:s_,InlineToolbar:l_,BlockEvents:d_,BlockManager:p_,BlockSelection:f_,Caret:h_,CrossBlockSelection:g_,DragNDrop:m_,ModificationsObserver:__,Paste:S6,ReadOnly:b_,RectangleSelection:y_,Renderer:x_,Saver:v_,Tools:ap,UI:S_},k_=class{constructor(e){this.moduleInstances={},this.eventsDispatcher=new ps;let n,o;this.isReady=new Promise((r,i)=>{n=r,o=i}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();let{BlockManager:r,Caret:i,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&i.setToBlock(r.blocks[0],i.positions.START),n()}).catch(r=>{Ge(`Editor.js is not ready because of ${r}`,"error"),o(r)})}set configuration(e){var n,o;sn(e)?this.config={...e}:this.config={holder:e},Im(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=rk.VERBOSE),U4(this.config.logLevel),Im(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;let r={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(vo(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[r]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&En.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){let{holderId:e,holder:n}=this.config;if(e&&n)throw Error("\xABholderId\xBB and \xABholder\xBB param can't assign at the same time.");if(Dr(n)&&!H.get(n))throw Error(`element with ID \xAB${n}\xBB is missing. Pass correct holder's ID.`);if(n&&sn(n)&&!H.isElement(n))throw Error("\xABholder\xBB value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(o){if(o instanceof Gu)throw new Error(o.message);Ge(`Module ${n} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(R6).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){Ge("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(let e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){let n={};for(let o in this.moduleInstances)o!==e&&(n[o]=this.moduleInstances[o]);return n}};var lp=class{static get version(){return"2.31.0-rc.7"}constructor(e){let n=()=>{};sn(e)&&gt(e.onReady)&&(n=e.onReady);let o=new k_(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),n()})}exportAPI(e){let n=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(r=>{gt(r.destroy)&&r.destroy(),r.listeners.removeAll()}),y5(),e=null;for(let r in this)Object.prototype.hasOwnProperty.call(this,r)&&delete this[r];Object.setPrototypeOf(this,null)};n.forEach(r=>{this[r]=e[r]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([r,i])=>{Object.entries(i).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[r][s]})})}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var P6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',F6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',B6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',$6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',z6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',H6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',U6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';var bp=class{constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){let n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){let n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){let e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){let e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(\u0E07'\u0300-'\u0301)\u0E07 Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){let e=[{number:1,tag:"H1",svg:P6},{number:2,tag:"H2",svg:F6},{number:3,tag:"H3",svg:B6},{number:4,tag:"H4",svg:$6},{number:5,tag:"H5",svg:z6},{number:6,tag:"H6",svg:H6}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){let n=e.detail;if("data"in n){let o=n.data,r=this.defaultLevel.number;switch(o.tagName){case"H1":r=1;break;case"H2":r=2;break;case"H3":r=3;break;case"H4":r=4;break;case"H5":r=5;break;case"H6":r=6;break}this._settings.levels&&(r=this._settings.levels.reduce((i,s)=>Math.abs(s-r)<Math.abs(i-r)?s:i)),this.data={level:r,text:o.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:U6,title:"Heading"}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:block}.image-tool__image-preloader{width:50px;height:50px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;animation:image-preloader-spin 2s infinite linear;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important;content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:flex;align-items:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading .image-tool__image{min-height:200px;display:flex;border:1px solid var(--border-color);background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@keyframes image-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var K6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',j6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',iN='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>',V6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',W6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function Na(t,e=null,n={}){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e!==null&&o.classList.add(e);for(let r in n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o}var yp=(t=>(t.Empty="empty",t.Uploading="uploading",t.Filled="filled",t))(yp||{}),vb=class{constructor({api:e,config:n,onSelectFile:o,readOnly:r}){this.api=e,this.config=n,this.onSelectFile=o,this.readOnly=r,this.nodes={wrapper:Na("div",[this.CSS.baseClass,this.CSS.wrapper]),imageContainer:Na("div",[this.CSS.imageContainer]),fileButton:this.createFileButton(),imageEl:void 0,imagePreloader:Na("div",this.CSS.imagePreloader),caption:Na("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly})},this.nodes.caption.dataset.placeholder=this.config.captionPlaceholder,this.nodes.imageContainer.appendChild(this.nodes.imagePreloader),this.nodes.wrapper.appendChild(this.nodes.imageContainer),this.nodes.wrapper.appendChild(this.nodes.caption),this.nodes.wrapper.appendChild(this.nodes.fileButton)}applyTune(e,n){this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${e}`,n)}render(){return this.toggleStatus("empty"),this.nodes.wrapper}showPreloader(e){this.nodes.imagePreloader.style.backgroundImage=`url(${e})`,this.toggleStatus("uploading")}hidePreloader(){this.nodes.imagePreloader.style.backgroundImage="",this.toggleStatus("empty")}fillImage(e){let n=/\.mp4$/.test(e)?"VIDEO":"IMG",o={src:e},r="load";n==="VIDEO"&&(o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsinline=!0,r="loadeddata"),this.nodes.imageEl=Na(n,this.CSS.imageEl,o),this.nodes.imageEl.addEventListener(r,()=>{this.toggleStatus("filled"),this.nodes.imagePreloader!==void 0&&(this.nodes.imagePreloader.style.backgroundImage="")}),this.nodes.imageContainer.appendChild(this.nodes.imageEl)}fillCaption(e){this.nodes.caption!==void 0&&(this.nodes.caption.innerHTML=e)}toggleStatus(e){for(let n in yp)if(Object.prototype.hasOwnProperty.call(yp,n)){let o=yp[n];this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${o}`,o===e)}}get CSS(){return{baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,button:this.api.styles.button,wrapper:"image-tool",imageContainer:"image-tool__image",imagePreloader:"image-tool__image-preloader",imageEl:"image-tool__image-picture",caption:"image-tool__caption"}}createFileButton(){let e=Na("div",[this.CSS.button]);return e.innerHTML=this.config.buttonContent??`${iN} ${this.api.i18n.t("Select an Image")}`,e.addEventListener("click",()=>{this.onSelectFile()}),e}};function G6(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sN={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(window,function(){return(function(n){var o={};function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{enumerable:!0,get:a})},r.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},r.t=function(i,s){if(1&s&&(i=r(i)),8&s||4&s&&typeof i=="object"&&i&&i.__esModule)return i;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:i}),2&s&&typeof i!="string")for(var l in i)r.d(a,l,(function(c){return i[c]}).bind(null,l));return a},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=3)})([function(n,o){var r;r=(function(){return this})();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}n.exports=r},function(n,o,r){(function(i){var s=r(2),a=setTimeout;function l(){}function c(_){if(!(this instanceof c))throw new TypeError("Promises must be constructed via new");if(typeof _!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],m(_,this)}function d(_,b){for(;_._state===3;)_=_._value;_._state!==0?(_._handled=!0,c._immediateFn(function(){var y=_._state===1?b.onFulfilled:b.onRejected;if(y!==null){var v;try{v=y(_._value)}catch(x){return void p(b.promise,x)}u(b.promise,v)}else(_._state===1?u:p)(b.promise,_._value)})):_._deferreds.push(b)}function u(_,b){try{if(b===_)throw new TypeError("A promise cannot be resolved with itself.");if(b&&(typeof b=="object"||typeof b=="function")){var y=b.then;if(b instanceof c)return _._state=3,_._value=b,void h(_);if(typeof y=="function")return void m((v=y,x=b,function(){v.apply(x,arguments)}),_)}_._state=1,_._value=b,h(_)}catch(E){p(_,E)}var v,x}function p(_,b){_._state=2,_._value=b,h(_)}function h(_){_._state===2&&_._deferreds.length===0&&c._immediateFn(function(){_._handled||c._unhandledRejectionFn(_._value)});for(var b=0,y=_._deferreds.length;b<y;b++)d(_,_._deferreds[b]);_._deferreds=null}function g(_,b,y){this.onFulfilled=typeof _=="function"?_:null,this.onRejected=typeof b=="function"?b:null,this.promise=y}function m(_,b){var y=!1;try{_(function(v){y||(y=!0,u(b,v))},function(v){y||(y=!0,p(b,v))})}catch(v){if(y)return;y=!0,p(b,v)}}c.prototype.catch=function(_){return this.then(null,_)},c.prototype.then=function(_,b){var y=new this.constructor(l);return d(this,new g(_,b,y)),y},c.prototype.finally=s.a,c.all=function(_){return new c(function(b,y){if(!_||_.length===void 0)throw new TypeError("Promise.all accepts an array");var v=Array.prototype.slice.call(_);if(v.length===0)return b([]);var x=v.length;function E(k,T){try{if(T&&(typeof T=="object"||typeof T=="function")){var w=T.then;if(typeof w=="function")return void w.call(T,function(S){E(k,S)},y)}v[k]=T,--x==0&&b(v)}catch(S){y(S)}}for(var C=0;C<v.length;C++)E(C,v[C])})},c.resolve=function(_){return _&&typeof _=="object"&&_.constructor===c?_:new c(function(b){b(_)})},c.reject=function(_){return new c(function(b,y){y(_)})},c.race=function(_){return new c(function(b,y){for(var v=0,x=_.length;v<x;v++)_[v].then(b,y)})},c._immediateFn=typeof i=="function"&&function(_){i(_)}||function(_){a(_,0)},c._unhandledRejectionFn=function(_){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",_)},o.a=c}).call(this,r(5).setImmediate)},function(n,o,r){o.a=function(i){var s=this.constructor;return this.then(function(a){return s.resolve(i()).then(function(){return a})},function(a){return s.resolve(i()).then(function(){return s.reject(a)})})}},function(n,o,r){function i(m){return(i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _})(m)}r(4);var s,a,l,c,d,u,p,h=r(8),g=(a=function(m){return new Promise(function(_,b){m=c(m),(m=d(m)).beforeSend&&m.beforeSend();var y=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");y.open(m.method,m.url),y.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(m.headers).forEach(function(x){var E=m.headers[x];y.setRequestHeader(x,E)});var v=m.ratio;y.upload.addEventListener("progress",function(x){var E=Math.round(x.loaded/x.total*100),C=Math.ceil(E*v/100);m.progress(Math.min(C,100))},!1),y.addEventListener("progress",function(x){var E=Math.round(x.loaded/x.total*100),C=Math.ceil(E*(100-v)/100)+v;m.progress(Math.min(C,100))},!1),y.onreadystatechange=function(){if(y.readyState===4){var x=y.response;try{x=JSON.parse(x)}catch{}var E=h.parseHeaders(y.getAllResponseHeaders()),C={body:x,code:y.status,headers:E};p(y.status)?_(C):b(C)}},y.send(m.data)})},l=function(m){return m.method="POST",a(m)},c=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(m.url&&typeof m.url!="string")throw new Error("Url must be a string");if(m.url=m.url||"",m.method&&typeof m.method!="string")throw new Error("`method` must be a string or null");if(m.method=m.method?m.method.toUpperCase():"GET",m.headers&&i(m.headers)!=="object")throw new Error("`headers` must be an object or null");if(m.headers=m.headers||{},m.type&&(typeof m.type!="string"||!Object.values(s).includes(m.type)))throw new Error("`type` must be taken from module's \xABcontentType\xBB library");if(m.progress&&typeof m.progress!="function")throw new Error("`progress` must be a function or null");if(m.progress=m.progress||function(_){},m.beforeSend=m.beforeSend||function(_){},m.ratio&&typeof m.ratio!="number")throw new Error("`ratio` must be a number");if(m.ratio<0||m.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(m.ratio=m.ratio||90,m.accept&&typeof m.accept!="string")throw new Error("`accept` must be a string with a list of allowed mime-types");if(m.accept=m.accept||"*/*",m.multiple&&typeof m.multiple!="boolean")throw new Error("`multiple` must be a true or false");if(m.multiple=m.multiple||!1,m.fieldName&&typeof m.fieldName!="string")throw new Error("`fieldName` must be a string");return m.fieldName=m.fieldName||"files",m},d=function(m){switch(m.method){case"GET":var _=u(m.data,s.URLENCODED);delete m.data,m.url=/\?/.test(m.url)?m.url+"&"+_:m.url+"?"+_;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var b=(function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).type||s.JSON})(m);(h.isFormData(m.data)||h.isFormElement(m.data))&&(b=s.FORM),m.data=u(m.data,b),b!==g.contentType.FORM&&(m.headers["content-type"]=b)}return m},u=function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case s.URLENCODED:return h.urlEncode(m);case s.JSON:return h.jsonEncode(m);case s.FORM:return h.formEncode(m);default:return m}},p=function(m){return m>=200&&m<300},{contentType:s={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:a,get:function(m){return m.method="GET",a(m)},post:l,transport:function(m){return m=c(m),h.selectFiles(m).then(function(_){for(var b=new FormData,y=0;y<_.length;y++)b.append(m.fieldName,_[y],_[y].name);h.isObject(m.data)&&Object.keys(m.data).forEach(function(x){var E=m.data[x];b.append(x,E)});var v=m.beforeSend;return m.beforeSend=function(){return v(_)},m.data=b,l(m)})},selectFiles:function(m){return delete(m=c(m)).beforeSend,h.selectFiles(m)}});n.exports=g},function(n,o,r){r.r(o);var i=r(1);window.Promise=window.Promise||i.a},function(n,o,r){(function(i){var s=i!==void 0&&i||typeof self<"u"&&self||window,a=Function.prototype.apply;function l(c,d){this._id=c,this._clearFn=d}o.setTimeout=function(){return new l(a.call(setTimeout,s,arguments),clearTimeout)},o.setInterval=function(){return new l(a.call(setInterval,s,arguments),clearInterval)},o.clearTimeout=o.clearInterval=function(c){c&&c.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(s,this._id)},o.enroll=function(c,d){clearTimeout(c._idleTimeoutId),c._idleTimeout=d},o.unenroll=function(c){clearTimeout(c._idleTimeoutId),c._idleTimeout=-1},o._unrefActive=o.active=function(c){clearTimeout(c._idleTimeoutId);var d=c._idleTimeout;d>=0&&(c._idleTimeoutId=setTimeout(function(){c._onTimeout&&c._onTimeout()},d))},r(6),o.setImmediate=typeof self<"u"&&self.setImmediate||i!==void 0&&i.setImmediate||this&&this.setImmediate,o.clearImmediate=typeof self<"u"&&self.clearImmediate||i!==void 0&&i.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(n,o,r){(function(i,s){(function(a,l){if(!a.setImmediate){var c,d,u,p,h,g=1,m={},_=!1,b=a.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(a);y=y&&y.setTimeout?y:a,{}.toString.call(a.process)==="[object process]"?c=function(E){s.nextTick(function(){x(E)})}:(function(){if(a.postMessage&&!a.importScripts){var E=!0,C=a.onmessage;return a.onmessage=function(){E=!1},a.postMessage("","*"),a.onmessage=C,E}})()?(p="setImmediate$"+Math.random()+"$",h=function(E){E.source===a&&typeof E.data=="string"&&E.data.indexOf(p)===0&&x(+E.data.slice(p.length))},a.addEventListener?a.addEventListener("message",h,!1):a.attachEvent("onmessage",h),c=function(E){a.postMessage(p+E,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(E){x(E.data)},c=function(E){u.port2.postMessage(E)}):b&&"onreadystatechange"in b.createElement("script")?(d=b.documentElement,c=function(E){var C=b.createElement("script");C.onreadystatechange=function(){x(E),C.onreadystatechange=null,d.removeChild(C),C=null},d.appendChild(C)}):c=function(E){setTimeout(x,0,E)},y.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var C=new Array(arguments.length-1),k=0;k<C.length;k++)C[k]=arguments[k+1];var T={callback:E,args:C};return m[g]=T,c(g),g++},y.clearImmediate=v}function v(E){delete m[E]}function x(E){if(_)setTimeout(x,0,E);else{var C=m[E];if(C){_=!0;try{(function(k){var T=k.callback,w=k.args;switch(w.length){case 0:T();break;case 1:T(w[0]);break;case 2:T(w[0],w[1]);break;case 3:T(w[0],w[1],w[2]);break;default:T.apply(l,w)}})(C)}finally{v(E),_=!1}}}}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,r(0),r(7))},function(n,o){var r,i,s=n.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function c(y){if(r===setTimeout)return setTimeout(y,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(y,0);try{return r(y,0)}catch{try{return r.call(null,y,0)}catch{return r.call(this,y,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:a}catch{r=a}try{i=typeof clearTimeout=="function"?clearTimeout:l}catch{i=l}})();var d,u=[],p=!1,h=-1;function g(){p&&d&&(p=!1,d.length?u=d.concat(u):h=-1,u.length&&m())}function m(){if(!p){var y=c(g);p=!0;for(var v=u.length;v;){for(d=u,u=[];++h<v;)d&&d[h].run();h=-1,v=u.length}d=null,p=!1,(function(x){if(i===clearTimeout)return clearTimeout(x);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(x);try{i(x)}catch{try{return i.call(null,x)}catch{return i.call(this,x)}}})(y)}}function _(y,v){this.fun=y,this.array=v}function b(){}s.nextTick=function(y){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];u.push(new _(y,v)),u.length!==1||p||c(m)},_.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=b,s.addListener=b,s.once=b,s.off=b,s.removeListener=b,s.removeAllListeners=b,s.emit=b,s.prependListener=b,s.prependOnceListener=b,s.listeners=function(y){return[]},s.binding=function(y){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(y){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(n,o,r){function i(a,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}var s=r(9);n.exports=(function(){function a(){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,a)}var l,c,d;return l=a,d=[{key:"urlEncode",value:function(u){return s(u)}},{key:"jsonEncode",value:function(u){return JSON.stringify(u)}},{key:"formEncode",value:function(u){if(this.isFormData(u))return u;if(this.isFormElement(u))return new FormData(u);if(this.isObject(u)){var p=new FormData;return Object.keys(u).forEach(function(h){var g=u[h];p.append(h,g)}),p}throw new Error("`data` must be an instance of Object, FormData or <FORM> HTMLElement")}},{key:"isObject",value:function(u){return Object.prototype.toString.call(u)==="[object Object]"}},{key:"isFormData",value:function(u){return u instanceof FormData}},{key:"isFormElement",value:function(u){return u instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(p,h){var g=document.createElement("INPUT");g.type="file",u.multiple&&g.setAttribute("multiple","multiple"),u.accept&&g.setAttribute("accept",u.accept),g.style.display="none",document.body.appendChild(g),g.addEventListener("change",function(m){var _=m.target.files;p(_),document.body.removeChild(g)},!1),g.click()})}},{key:"parseHeaders",value:function(u){var p=u.trim().split(/[\r\n]+/),h={};return p.forEach(function(g){var m=g.split(": "),_=m.shift(),b=m.join(": ");_&&(h[_]=b)}),h}}],(c=null)&&i(l.prototype,c),d&&i(l,d),a})()},function(n,o){var r=function(s){return encodeURIComponent(s).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},i=function(s,a,l,c){return a=a||null,l=l||"&",c=c||null,s?(function(d){for(var u=new Array,p=0;p<d.length;p++)d[p]&&u.push(d[p]);return u})(Object.keys(s).map(function(d){var u,p,h=d;if(c&&(h=c+"["+h+"]"),typeof s[d]=="object"&&s[d]!==null)u=i(s[d],null,l,h);else{a&&(p=h,h=!isNaN(parseFloat(p))&&isFinite(p)?a+Number(h):h);var g=s[d];g=(g=(g=(g=g===!0?"1":g)===!1?"0":g)===0?"0":g)||"",u=r(h)+"="+r(g)}return u})).join(l).replace(/[!'()*]/g,""):""};n.exports=i}])})})(sN);var Y6=sN.exports,Da=G6(Y6);function xb(t){return t!==void 0&&typeof t.then=="function"}var Cb=class{constructor({config:e,onUpload:n,onError:o}){this.config=e,this.onUpload=n,this.onError=o}uploadSelectedFile({onPreview:e}){let n=function(r){let i=new FileReader;i.readAsDataURL(r),i.onload=s=>{e(s.target.result)}},o;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function"){let r=this.config.uploader.uploadByFile;o=Da.selectFiles({accept:this.config.types??"image/*"}).then(i=>{n(i[0]);let s=r(i[0]);return xb(s)||console.warn("Custom uploader method uploadByFile should return a Promise"),s})}else o=Da.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types??"image/*",headers:this.config.additionalRequestHeaders,beforeSend:r=>{n(r[0])},fieldName:this.config.field??"image"}).then(r=>r.body);o.then(r=>{this.onUpload(r)}).catch(r=>{this.onError(r)})}uploadByUrl(e){let n;this.config.uploader&&typeof this.config.uploader.uploadByUrl=="function"?(n=this.config.uploader.uploadByUrl(e),xb(n)||console.warn("Custom uploader method uploadByUrl should return a Promise")):n=Da.post({url:this.config.endpoints.byUrl,data:Object.assign({url:e},this.config.additionalRequestData),type:Da.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(o=>o.body),n.then(o=>{this.onUpload(o)}).catch(o=>{this.onError(o)})}uploadByFile(e,{onPreview:n}){let o=new FileReader;o.readAsDataURL(e),o.onload=i=>{n(i.target.result)};let r;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function")r=this.config.uploader.uploadByFile(e),xb(r)||console.warn("Custom uploader method uploadByFile should return a Promise");else{let i=new FormData;i.append(this.config.field??"image",e),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEach(([s,a])=>{i.append(s,a)}),r=Da.post({url:this.config.endpoints.byFile,data:i,type:Da.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(s=>s.body)}r.then(i=>{this.onUpload(i)}).catch(i=>{this.onError(i)})}};var xp=class t{constructor({data:e,config:n,api:o,readOnly:r,block:i}){this.isCaptionEnabled=null,this.api=o,this.block=i,this.config={endpoints:n.endpoints,additionalRequestData:n.additionalRequestData,additionalRequestHeaders:n.additionalRequestHeaders,field:n.field,types:n.types,captionPlaceholder:this.api.i18n.t(n.captionPlaceholder??"Caption"),buttonContent:n.buttonContent,uploader:n.uploader,actions:n.actions,features:n.features||{}},this.uploader=new Cb({config:this.config,onUpload:s=>this.onUpload(s),onError:s=>this.uploadingFailed(s)}),this.ui=new vb({api:o,config:this.config,onSelectFile:()=>{this.uploader.uploadSelectedFile({onPreview:s=>{this.ui.showPreloader(s)}})},readOnly:r}),this._data={caption:"",withBorder:!1,withBackground:!1,stretched:!1,file:{url:""}},this.data=e}static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:iN,title:"Image"}}static get tunes(){return[{name:"withBorder",icon:j6,title:"With border",toggle:!0},{name:"stretched",icon:V6,title:"Stretch image",toggle:!0},{name:"withBackground",icon:K6,title:"With background",toggle:!0}]}render(){var e,n,o;return(((e=this.config.features)==null?void 0:e.caption)===!0||((n=this.config.features)==null?void 0:n.caption)===void 0||((o=this.config.features)==null?void 0:o.caption)==="optional"&&this.data.caption)&&(this.isCaptionEnabled=!0),this.ui.render()}validate(e){return!!e.file.url}save(){let e=this.ui.nodes.caption;return this._data.caption=e.innerHTML,this.data}renderSettings(){var e;let n=t.tunes.concat(this.config.actions||[]),o={border:"withBorder",background:"withBackground",stretch:"stretched",caption:"caption"};((e=this.config.features)==null?void 0:e.caption)==="optional"&&n.push({name:"caption",icon:W6,title:"With caption",toggle:!0});let r=n.filter(s=>{var a,l;let c=Object.keys(o).find(d=>o[d]===s.name);return c==="caption"?((a=this.config.features)==null?void 0:a.caption)!==!1:c==null||((l=this.config.features)==null?void 0:l[c])!==!1}),i=s=>{let a=this.data[s.name];return s.name==="caption"&&(a=this.isCaptionEnabled??a),a};return r.map(s=>({icon:s.icon,label:this.api.i18n.t(s.title),name:s.name,toggle:s.toggle,isActive:i(s),onActivate:()=>{if(typeof s.action=="function"){s.action(s.name);return}let a=!i(s);s.name==="caption"&&(this.isCaptionEnabled=!(this.isCaptionEnabled??!1),a=this.isCaptionEnabled),this.tuneToggled(s.name,a)}}))}appendCallback(){this.ui.nodes.fileButton.click()}static get pasteConfig(){return{tags:[{img:{src:!0}}],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i},files:{mimeTypes:["image/*"]}}}async onPaste(e){switch(e.type){case"tag":{let n=e.detail.data;if(/^blob:/.test(n.src)){let o=await(await fetch(n.src)).blob();this.uploadFile(o);break}this.uploadUrl(n.src);break}case"pattern":{let n=e.detail.data;this.uploadUrl(n);break}case"file":{let n=e.detail.file;this.uploadFile(n);break}}}set data(e){this.image=e.file,this._data.caption=e.caption||"",this.ui.fillCaption(this._data.caption),t.tunes.forEach(({name:n})=>{let o=typeof e[n]<"u"?e[n]===!0||e[n]==="true":!1;this.setTune(n,o)}),e.caption&&this.setTune("caption",!0)}get data(){return this._data}set image(e){this._data.file=e||{url:""},e&&e.url&&this.ui.fillImage(e.url)}onUpload(e){e.success&&e.file?this.image=e.file:this.uploadingFailed("incorrect response: "+JSON.stringify(e))}uploadingFailed(e){console.log("Image Tool: uploading failed because of",e),this.api.notifier.show({message:this.api.i18n.t("Couldn\u2019t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}tuneToggled(e,n){e==="caption"?(this.ui.applyTune(e,n),n==!1&&(this._data.caption="",this.ui.fillCaption(""))):this.setTune(e,n)}setTune(e,n){this._data[e]=n,this.ui.applyTune(e,n),e==="stretched"&&Promise.resolve().then(()=>{this.block.stretched=n}).catch(o=>{console.error(o)})}uploadFile(e){this.uploader.uploadByFile(e,{onPreview:n=>{this.ui.showPreloader(n)}})}uploadUrl(e){this.ui.showPreloader(e),this.uploader.uploadByUrl(e)}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-nested-list{margin:0;padding:0;outline:none;counter-reset:item;list-style:none}.cdx-nested-list__item{line-height:1.6em;display:flex;margin:2px 0}.cdx-nested-list__item [contenteditable]{outline:none}.cdx-nested-list__item-body{flex-grow:2}.cdx-nested-list__item-content,.cdx-nested-list__item-children{flex-basis:100%}.cdx-nested-list__item-content{word-break:break-word;white-space:pre-wrap}.cdx-nested-list__item:before{counter-increment:item;margin-right:5px;white-space:nowrap}.cdx-nested-list--ordered>.cdx-nested-list__item:before{content:counters(item,".") ". "}.cdx-nested-list--unordered>.cdx-nested-list__item:before{content:"\u2022"}.cdx-nested-list__settings{display:flex}.cdx-nested-list__settings .cdx-settings-button{width:50%}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();function Or(t){return t.nodeType===Node.ELEMENT_NODE}function Oa(t,e=null,n){let o=document.createElement(t);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(let r in n)o[r]=n[r];return o}function aN(t){let e=Oa("div");return e.appendChild(t),e.innerHTML}function cN(t){let e;return t.nodeType!==Node.ELEMENT_NODE?e=t.textContent:(e=t.innerHTML,e=e.replaceAll("<br>","")),e?.trim().length===0}var gi=class t{constructor(){this.savedFakeCaret=void 0}save(){let e=t.range,n=Oa("span");n.hidden=!0,e&&(e.insertNode(n),this.savedFakeCaret=n)}restore(){if(!this.savedFakeCaret)return;let e=window.getSelection();if(!e)return;let n=new Range;n.setStartAfter(this.savedFakeCaret),n.setEndAfter(this.savedFakeCaret),e.removeAllRanges(),e.addRange(n),setTimeout(()=>{var o;(o=this.savedFakeCaret)==null||o.remove()},150)}static get range(){let e=window.getSelection();return e&&e.rangeCount?e.getRangeAt(0):null}static extractFragmentFromCaretPositionTillTheEnd(){let e=window.getSelection();if(!e||!e.rangeCount)return;let n=e.getRangeAt(0),o=n.startContainer;if(o.nodeType!==Node.ELEMENT_NODE){if(!o.parentNode)return;o=o.parentNode}if(!Or(o))return;let r=o.closest("[contenteditable]");if(!r)return;n.deleteContents();let i=n.cloneRange();return i.selectNodeContents(r),i.setStart(n.endContainer,n.endOffset),i.extractContents()}static focus(e,n=!0){let o=document.createRange(),r=window.getSelection();r&&(o.selectNodeContents(e),o.collapse(n),r.removeAllRanges(),r.addRange(o))}static isAtStart(){let e=window.getSelection();if(!e||e.focusOffset>0)return!1;let n=e.focusNode;return!n||!Or(n)?!1:t.getHigherLevelSiblings(n,"left").every(o=>cN(o))}static getHigherLevelSiblings(e,n="left"){let o=e,r=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;let i=n==="left"?"previousSibling":"nextSibling";for(;o[i];)o=o[i],r.push(o);return r}},q6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',lN='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',wc=class t{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:lN,title:"List"}}constructor({data:e,config:n,api:o,readOnly:r}){var i;this.nodes={wrapper:null},this.api=o,this.readOnly=r,this.config=n,this.defaultListStyle=((i=this.config)==null?void 0:i.defaultStyle)==="ordered"?"ordered":"unordered";let s={style:this.defaultListStyle,items:[]};this.data=e&&Object.keys(e).length?e:s,this.caret=new gi}render(){return this.nodes.wrapper=this.makeListWrapper(this.data.style,[this.CSS.baseBlock]),this.data.items.length?this.appendItems(this.data.items,this.nodes.wrapper):this.appendItems([{content:"",items:[]}],this.nodes.wrapper),this.readOnly||this.nodes.wrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),this.nodes.wrapper}renderSettings(){return[{name:"unordered",label:this.api.i18n.t("Unordered"),icon:q6},{name:"ordered",label:this.api.i18n.t("Ordered"),icon:lN}].map(e=>({name:e.name,icon:e.icon,label:e.label,isActive:this.data.style===e.name,closeOnActivate:!0,onActivate:()=>{this.listStyle=e.name}}))}static get pasteConfig(){return{tags:["OL","UL","LI"]}}onPaste(e){let n=e.detail.data;this.data=this.pasteHandler(n);let o=this.nodes.wrapper;o&&o.parentNode&&o.parentNode.replaceChild(this.render(),o)}pasteHandler(e){let{tagName:n}=e,o="unordered",r;switch(n){case"OL":o="ordered",r="ol";break;case"UL":case"LI":o="unordered",r="ul"}let i={style:o,items:[]},s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{var c;let d=l.querySelector(`:scope > ${r}`),u=d?s(d):[];return{content:((c=l?.firstChild)==null?void 0:c.textContent)||"",items:u}});return i.items=s(e),i}appendItems(e,n){e.forEach(o=>{let r=this.createItem(o.content,o.items);n.appendChild(r)})}createItem(e,n=[]){let o=Oa("li",this.CSS.item),r=Oa("div",this.CSS.itemBody),i=Oa("div",this.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),o.appendChild(r),n&&n.length>0&&this.addChildrenList(o,n),o}save(){let e=n=>Array.from(n.querySelectorAll(`:scope > .${this.CSS.item}`)).map(o=>{let r=o.querySelector(`.${this.CSS.itemChildren}`),i=this.getItemContent(o),s=r?e(r):[];return{content:i,items:s}});return{style:this.data.style,items:this.nodes.wrapper?e(this.nodes.wrapper):[]}}addChildrenList(e,n){let o=e.querySelector(`.${this.CSS.itemBody}`),r=this.makeListWrapper(void 0,[this.CSS.itemChildren]);this.appendItems(n,r),o&&o.appendChild(r)}makeListWrapper(e=this.listStyle,n=[]){let o=e==="ordered"?"ol":"ul",r=e==="ordered"?this.CSS.wrapperOrdered:this.CSS.wrapperUnordered;return n.push(r),Oa(o,[this.CSS.wrapper,...n])}get CSS(){return{baseBlock:this.api.styles.block,wrapper:"cdx-nested-list",wrapperOrdered:"cdx-nested-list--ordered",wrapperUnordered:"cdx-nested-list--unordered",item:"cdx-nested-list__item",itemBody:"cdx-nested-list__item-body",itemContent:"cdx-nested-list__item-content",itemChildren:"cdx-nested-list__item-children",settingsWrapper:"cdx-nested-list__settings",settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){if(!this.nodes||!this.nodes.wrapper)return;let n=Array.from(this.nodes.wrapper.querySelectorAll(`.${this.CSS.wrapper}`));n.push(this.nodes.wrapper),n.forEach(o=>{o.classList.toggle(this.CSS.wrapperUnordered,e==="unordered"),o.classList.toggle(this.CSS.wrapperOrdered,e==="ordered")}),this.data.style=e}get currentItem(){let e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(Or(n)||(n=n.parentNode),!n)||!Or(n)?null:n.closest(`.${this.CSS.item}`)}enterPressed(e){let n=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing)return;let o=n?this.getItemContent(n).trim().length===0:!0,r=n?.parentNode===this.nodes.wrapper,i=n?.nextElementSibling===null;if(r&&i&&o){this.getOutOfList();return}else if(i&&o){this.unshiftItem();return}let s=gi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=aN(s),l=n?.querySelector(`.${this.CSS.itemChildren}`),c=this.createItem(a,void 0);l&&Array.from(l.querySelectorAll(`.${this.CSS.item}`)).length>0?l.prepend(c):n?.after(c),this.focusItem(c)}unshiftItem(){let e=this.currentItem;if(!e||!e.parentNode||!Or(e.parentNode))return;let n=e.parentNode.closest(`.${this.CSS.item}`);if(!n)return;this.caret.save(),n.after(e),this.caret.restore();let o=n.querySelector(`.${this.CSS.itemChildren}`);o&&o.children.length===0&&o.remove()}getItemContent(e){let n=e.querySelector(`.${this.CSS.itemContent}`);return!n||cN(n)?"":n.innerHTML}focusItem(e,n=!0){let o=e.querySelector(`.${this.CSS.itemContent}`);o&&gi.focus(o,n)}getOutOfList(){var e;(e=this.currentItem)==null||e.remove(),this.api.blocks.insert(),this.api.caret.setToBlock(this.api.blocks.getCurrentBlockIndex())}backspace(e){if(!gi.isAtStart())return;e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!n.parentNode||!Or(n.parentNode))return;let r=n.parentNode.closest(`.${this.CSS.item}`);if(!o&&!r||o&&!Or(o))return;e.stopPropagation();let i;if(o){let d=o.querySelectorAll(`.${this.CSS.item}`);i=Array.from(d).pop()||o}else i=r;let s=gi.extractFragmentFromCaretPositionTillTheEnd();if(!s)return;let a=aN(s);if(!i)return;let l=i.querySelector(`.${this.CSS.itemContent}`);if(!l)return;gi.focus(l,!1),this.caret.save(),l.insertAdjacentHTML("beforeend",a);let c=n.querySelectorAll(`.${this.CSS.itemChildren} > .${this.CSS.item}`);c=Array.from(c),c=c.filter(d=>!d.parentNode||!Or(d.parentNode)?!1:d.parentNode.closest(`.${this.CSS.item}`)===n),c.reverse().forEach(d=>{o?i.after(d):n.after(d)}),n.remove(),this.caret.restore()}addTab(e){e.stopPropagation(),e.preventDefault();let n=this.currentItem;if(!n)return;let o=n.previousSibling;if(!o||!Or(o)||!o)return;let r=o.querySelector(`.${this.CSS.itemChildren}`);if(this.caret.save(),r)r.appendChild(n);else{let i=this.makeListWrapper(void 0,[this.CSS.itemChildren]),s=o.querySelector(`.${this.CSS.itemBody}`);i.appendChild(n),s?.appendChild(i)}this.caret.restore()}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.unshiftItem()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${t.joinRecursive(n)}`).join("")}static get conversionConfig(){return{export:e=>t.joinRecursive(e),import:e=>({items:[{content:e,items:[]}],style:"unordered"})}}};(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-rawtool__textarea{min-height:200px;resize:vertical;border-radius:8px;border:0;background-color:#1e2128;font-family:Menlo,Monaco,Consolas,Courier New,monospace;font-size:12px;line-height:1.6;letter-spacing:-.2px;color:#a1a7b6;overscroll-behavior:contain}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var J6='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.6954 5C17.912 5 18.8468 6.07716 18.6755 7.28165L17.426 16.0659C17.3183 16.8229 16.7885 17.4522 16.061 17.6873L12.6151 18.8012C12.2152 18.9304 11.7848 18.9304 11.3849 18.8012L7.93898 17.6873C7.21148 17.4522 6.6817 16.8229 6.57403 16.0659L5.32454 7.28165C5.15322 6.07716 6.088 5 7.30461 5H16.6954Z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 8.4H9L9.42857 11.7939H14.5714L14.3571 13.2788L14.1429 14.7636L12 15.4L9.85714 14.7636L9.77143 14.3394"/></svg>';var vp=class t{static get isReadOnlySupported(){return!0}static get displayInToolbox(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return{icon:J6,title:"Raw HTML"}}constructor({data:e,config:n,api:o,readOnly:r}){this.api=o,this.readOnly=r,this.placeholder=o.i18n.t(n.placeholder||t.DEFAULT_PLACEHOLDER),this.CSS={baseClass:this.api.styles.block,input:this.api.styles.input,wrapper:"ce-rawtool",textarea:"ce-rawtool__textarea"},this.data={html:e.html||""},this.textarea=null,this.resizeDebounce=null}render(){let e=document.createElement("div"),n=100;return this.textarea=document.createElement("textarea"),e.classList.add(this.CSS.baseClass,this.CSS.wrapper),this.textarea.classList.add(this.CSS.textarea,this.CSS.input),this.textarea.textContent=this.data.html,this.textarea.placeholder=this.placeholder,this.readOnly?this.textarea.disabled=!0:this.textarea.addEventListener("input",()=>{this.onInput()}),e.appendChild(this.textarea),setTimeout(()=>{this.resize()},n),e}save(e){return{html:e.querySelector("textarea").value}}static get DEFAULT_PLACEHOLDER(){return"Enter HTML code"}static get sanitize(){return{html:!0}}onInput(){this.resizeDebounce&&clearTimeout(this.resizeDebounce),this.resizeDebounce=setTimeout(()=>{this.resize()},200)}resize(){this.textarea.style.height="auto",this.textarea.style.height=this.textarea.scrollHeight+"px"}};ke();var Eb=class t{static get CSS(){return""}static get shortcut(){return"CMD+SHIFT+X"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("S",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("S");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("S",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"/></svg>'}static get sanitize(){return{s:{}}}},dN=Eb;var wb=class t{static get CSS(){return""}static get shortcut(){return"CMD+."}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("SUP",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("SUP");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("SUP",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" style="stroke: none !important" /><path d="M5 7l8 10m-8 0l8 -10" /><path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2" /></svg>'}static get sanitize(){return{sup:{}}}},uN=wb;var Tb=class t{static get CSS(){return""}static get shortcut(){return"CMD+U"}constructor(e){this.api=e.api,this.button=document.createElement("button"),this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}static get isInline(){return!0}render(){return this.button?(this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button):null}surround(e){if(!e)return;let n=this.api.selection.findParentTag("U",t.CSS);n?this.unwrap(n):this.wrap(e)}wrap(e){let n=document.createElement("U");n.appendChild(e.extractContents()),e.insertNode(n),this.api.selection.expandToTag(n)}unwrap(e){this.api.selection.expandToTag(e);let n=window.getSelection(),o=n.getRangeAt(0),r=o.extractContents();e.parentNode.removeChild(e),o.insertNode(r),n.removeAllRanges(),n.addRange(o)}checkState(){let e=this.api.selection.findParentTag("U",t.CSS);this.button.classList.toggle(this.iconClasses.active,!!e)}get toolboxIcon(){return'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 7.5V11.5C9 12.2956 9.31607 13.0587 9.87868 13.6213C10.4413 14.1839 11.2044 14.5 12 14.5C12.7956 14.5 13.5587 14.1839 14.1213 13.6213C14.6839 13.0587 15 12.2956 15 11.5V7.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.71429 18H16.2857" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}static get sanitize(){return{u:{}}}},pN=Tb;function fN(t){let e=q(null),[n,o]=L(null),[r,i]=L({blocks:[{type:"paragraph",data:{}}],time:0,version:""}),s=t.placeholder||"Start typing...";return P(()=>{if(!n)return;let a=t.value;if(r?.time!==a?.time){let l=r?.time||0;(a?.time||0)>l&&X6(a)&&((a?.blocks||[]).length>0?n.render(a):n.render({...a,blocks:[{type:"paragraph",data:{text:""}}]}),i(a))}},[n,t.value]),P(()=>{let a=e.current,l=lp,c=new l({holder:a,placeholder:s,inlineToolbar:["bold","italic","underline","strikethrough","superscript","link"],tools:{heading:{class:bp,config:{placeholder:"Enter a header",levels:[2,3,4,5],defaultLevel:2}},strikethrough:{class:dN},superscript:{class:uN},underline:{class:pN},image:{class:xp,config:{uploader:Z6(),captionPlaceholder:"Alt text"}},unorderedList:{class:wc,inlineToolbar:!0,config:{defaultStyle:"unordered"},toolbox:{name:"unorderedList",title:"Bulleted List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>'}},orderedList:{class:wc,inlineToolbar:!0,config:{defaultStyle:"ordered"},toolbox:{name:"orderedList",title:"Numbered List",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>'}},html:{class:vp,toolbox:{name:"HTML"}}},onReady:()=>{o(c)},onChange:()=>{c.save().then(d=>{i(d),t.onChange&&t.onChange(d)}).catch(d=>{console.error("richtext error: ",d)})}});return()=>{c&&typeof c.destroy=="function"&&c.destroy()}},[]),f("div",{ref:e,className:Ce(t.className,"EditorJSEditor")})}function X6(t){return Ln(t)&&Array.isArray(t.blocks)&&t.blocks.length>0}function Z6(){return{uploadByFile:async t=>{try{let e=await ai(t),n=e.src;return Q6(n)&&(n=`${n}=s0-e365`),console.log(e),{success:1,file:{...e,url:n}}}catch(e){return console.error(e),{success:0,error:e}}},uploadByUrl:async t=>({success:0,error:"upload by url not currently supported"})}}function Q6(t){return t.startsWith("https://lh3.googleusercontent.com/")}var Zy={};ze(Zy,{$addUpdateTag:()=>wD,$applyNodeReplacement:()=>Yc,$caretFromPoint:()=>Ti,$caretRangeFromSelection:()=>uy,$cloneWithProperties:()=>ID,$comparePointCaretNext:()=>qy,$copyNode:()=>Ky,$create:()=>O3,$createLineBreakNode:()=>$a,$createNodeSelection:()=>Ny,$createParagraphNode:()=>Br,$createPoint:()=>Mo,$createRangeSelection:()=>tD,$createRangeSelectionFromDom:()=>e3,$createTabNode:()=>Qp,$createTextNode:()=>Gt,$extendCaretToRange:()=>Gy,$getAdjacentChildCaret:()=>Ya,$getAdjacentNode:()=>CD,$getAdjacentSiblingOrParentSiblingCaret:()=>B3,$getCaretInDirection:()=>Si,$getCaretRange:()=>wi,$getCaretRangeInDirection:()=>Xy,$getCharacterOffsets:()=>oy,$getChildCaret:()=>Hr,$getChildCaretAtIndex:()=>$D,$getChildCaretOrSelf:()=>LD,$getCollapsedCaretRange:()=>RD,$getCommonAncestor:()=>Ac,$getCommonAncestorResultBranchOrder:()=>Jy,$getEditor:()=>jy,$getNearestNodeFromDOMNode:()=>rf,$getNearestRootOrShadowRoot:()=>SD,$getNodeByKey:()=>$t,$getNodeByKeyOrThrow:()=>kD,$getPreviousSelection:()=>Ns,$getRoot:()=>Bn,$getSelection:()=>He,$getSiblingCaret:()=>Zt,$getState:()=>Lp,$getStateChange:()=>NK,$getTextContent:()=>o3,$getTextNodeOffset:()=>ks,$getTextPointCaret:()=>Ei,$getTextPointCaretSlice:()=>cy,$getWritableNodeState:()=>yy,$hasAncestor:()=>Yp,$hasUpdateTag:()=>w3,$insertNodes:()=>n3,$isBlockElementNode:()=>QK,$isChildCaret:()=>Ao,$isDecoratorNode:()=>Ze,$isElementNode:()=>K,$isExtendableTextPointCaret:()=>BD,$isInlineElementOrDecoratorNode:()=>T3,$isLeafNode:()=>v3,$isLineBreakNode:()=>ys,$isNodeCaret:()=>M3,$isNodeSelection:()=>ef,$isParagraphNode:()=>p3,$isRangeSelection:()=>fe,$isRootNode:()=>Pn,$isRootOrShadowRoot:()=>Lo,$isSiblingCaret:()=>Ss,$isTabNode:()=>ky,$isTextNode:()=>ne,$isTextPointCaret:()=>$r,$isTextPointCaretSlice:()=>F3,$isTokenOrSegmented:()=>Lr,$isTokenOrTab:()=>bi,$nodesOfType:()=>E3,$normalizeCaret:()=>Oo,$normalizeSelection__EXPERIMENTAL:()=>Rp,$onUpdate:()=>TD,$parseSerializedNode:()=>s3,$removeTextFromCaretRange:()=>FD,$rewindSiblingCaret:()=>Za,$selectAll:()=>C3,$setCompositionKey:()=>qt,$setPointFromCaret:()=>qa,$setSelection:()=>$n,$setSelectionFromCaretRange:()=>PD,$setState:()=>DK,$splitAtPointCaretNext:()=>H3,$splitNode:()=>S3,$updateRangeSelectionFromCaretRange:()=>Mc,ArtificialNode__DO_NOT_USE:()=>Vp,BLUR_COMMAND:()=>z1,CAN_REDO_COMMAND:()=>HK,CAN_UNDO_COMMAND:()=>UK,CLEAR_EDITOR_COMMAND:()=>$K,CLEAR_HISTORY_COMMAND:()=>zK,CLICK_COMMAND:()=>C1,COLLABORATION_TAG:()=>lD,COMMAND_PRIORITY_CRITICAL:()=>_3,COMMAND_PRIORITY_EDITOR:()=>f3,COMMAND_PRIORITY_HIGH:()=>m3,COMMAND_PRIORITY_LOW:()=>h3,COMMAND_PRIORITY_NORMAL:()=>g3,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ma,COPY_COMMAND:()=>wy,CUT_COMMAND:()=>Ty,DELETE_CHARACTER_COMMAND:()=>zc,DELETE_LINE_COMMAND:()=>Uc,DELETE_WORD_COMMAND:()=>Hc,DRAGEND_COMMAND:()=>B1,DRAGOVER_COMMAND:()=>F1,DRAGSTART_COMMAND:()=>P1,DROP_COMMAND:()=>R1,DecoratorNode:()=>Kc,ElementNode:()=>Ci,FOCUS_COMMAND:()=>$1,FORMAT_ELEMENT_COMMAND:()=>BK,FORMAT_TEXT_COMMAND:()=>mi,HISTORIC_TAG:()=>a3,HISTORY_MERGE_TAG:()=>Op,HISTORY_PUSH_TAG:()=>l3,INDENT_CONTENT_COMMAND:()=>PK,INSERT_LINE_BREAK_COMMAND:()=>Nc,INSERT_PARAGRAPH_COMMAND:()=>Yb,INSERT_TAB_COMMAND:()=>RK,INTERNAL_$isBlock:()=>Fr,IS_ALL_FORMATTING:()=>a1,IS_BOLD:()=>cK,IS_CODE:()=>uK,IS_HIGHLIGHT:()=>Jp,IS_ITALIC:()=>dK,IS_STRIKETHROUGH:()=>Rc,IS_SUBSCRIPT:()=>pK,IS_SUPERSCRIPT:()=>fK,IS_UNDERLINE:()=>Pc,KEY_ARROW_DOWN_COMMAND:()=>D1,KEY_ARROW_LEFT_COMMAND:()=>S1,KEY_ARROW_RIGHT_COMMAND:()=>w1,KEY_ARROW_UP_COMMAND:()=>N1,KEY_BACKSPACE_COMMAND:()=>I1,KEY_DELETE_COMMAND:()=>M1,KEY_DOWN_COMMAND:()=>E1,KEY_ENTER_COMMAND:()=>$p,KEY_ESCAPE_COMMAND:()=>A1,KEY_MODIFIER_COMMAND:()=>H1,KEY_SPACE_COMMAND:()=>O1,KEY_TAB_COMMAND:()=>L1,LineBreakNode:()=>Ba,MOVE_TO_END:()=>T1,MOVE_TO_START:()=>k1,NODE_STATE_KEY:()=>vK,OUTDENT_CONTENT_COMMAND:()=>FK,PASTE_COMMAND:()=>vy,PASTE_TAG:()=>c3,ParagraphNode:()=>Ua,REDO_COMMAND:()=>Ey,REMOVE_TEXT_COMMAND:()=>qb,RootNode:()=>Ha,SELECTION_CHANGE_COMMAND:()=>xy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>LK,SELECT_ALL_COMMAND:()=>Jb,SKIP_COLLAB_TAG:()=>d3,SKIP_DOM_SELECTION_TAG:()=>dD,SKIP_SCROLL_INTO_VIEW_TAG:()=>cD,TEXT_TYPE_TO_FORMAT:()=>fn,TabNode:()=>za,TextNode:()=>Es,UNDO_COMMAND:()=>Cy,buildImportMap:()=>VK,createCommand:()=>we,createEditor:()=>b3,createSharedNodeState:()=>h1,createState:()=>kK,flipDirection:()=>ki,getDOMOwnerDocument:()=>Hy,getDOMSelection:()=>nr,getDOMSelectionFromTarget:()=>ND,getDOMTextNode:()=>Ts,getEditorPropertyFromDOMNode:()=>Wc,getNearestEditorFromDOMNode:()=>Py,getRegisteredNode:()=>Ly,getRegisteredNodeOrThrow:()=>My,isBlockDomNode:()=>ay,isCurrentlyReadOnlyMode:()=>Ja,isDOMDocumentNode:()=>fD,isDOMNode:()=>Xa,isDOMTextNode:()=>or,isDOMUnmanaged:()=>MD,isDocumentFragment:()=>DD,isExactShortcutMatch:()=>Ye,isHTMLAnchorElement:()=>k3,isHTMLElement:()=>Sn,isInlineDomNode:()=>OD,isLexicalEditor:()=>nf,isModifierMatch:()=>vD,isSelectionCapturedInDecoratorInput:()=>Ry,isSelectionWithinEditor:()=>Vc,makeStepwiseIterator:()=>Yy,removeFromParent:()=>yi,resetRandomKey:()=>y3,setDOMUnmanaged:()=>D3,setNodeIndentFromDOM:()=>AD});function V(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ro=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,eK=Ro&&"documentMode"in document?document.documentMode:null,tr=Ro&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xs=Ro&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ip=!(!Ro||!("InputEvent"in window)||eK)&&"getTargetRanges"in new window.InputEvent("input"),Lc=Ro&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Pa=Ro&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,tK=Ro&&/Android/.test(navigator.userAgent),i1=Ro&&/^(?=.*Chrome).*/i.test(navigator.userAgent),hN=Ro&&tK&&i1,Ap=Ro&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!i1;function Mp(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var nK=1,oK=3,rK=9,iK=11,vs=0,s1=1,Fa=2,sK=0,aK=1,lK=2,cK=1,dK=2,Rc=4,Pc=8,uK=16,pK=32,fK=64,Jp=128,a1=1792|(112|(3|Rc|Pc)|Jp),py=1,fy=2,hy=3,gy=4,my=5,_y=6,Xp=Lc||Pa||Ap?"\xA0":"\u200B",zr=`
104
-
105
- `,hK=xs?"\xA0":Xp,l1="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",c1="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",gK=new RegExp("^[^"+c1+"]*["+l1+"]"),mK=new RegExp("^[^"+l1+"]*["+c1+"]"),fn={bold:1,capitalize:1024,code:16,highlight:Jp,italic:2,lowercase:256,strikethrough:Rc,subscript:32,superscript:64,underline:Pc,uppercase:512},_K={directionless:1,unmergeable:2},gN={center:fy,end:_y,justify:gy,left:py,right:hy,start:my},bK={[fy]:"center",[_y]:"end",[gy]:"justify",[py]:"left",[hy]:"right",[my]:"start"},yK={normal:0,segmented:2,token:1},xK={[sK]:"normal",[lK]:"segmented",[aK]:"token"},vK="$",mN="$config";function d1(t,e,n,o,r,i){let s=t.getFirstChild();for(;s!==null;){let a=s.__key;s.__parent===e&&(K(s)&&d1(s,a,n,o,r,i),n.has(a)||i.delete(a),r.push(a)),s=s.getNextSibling()}}var CK=100,$b=!1,by=0;function EK(t){by=t.timeStamp}function Sb(t,e,n){let o=t.nodeName==="BR",r=e.__lexicalLineBreak;return r&&(t===r||o&&t.previousSibling===r)||o&&of(t,n)!==void 0}function wK(t,e,n){let o=nr(Co(n)),r=null,i=null;o!==null&&o.anchorNode===t&&(r=o.anchorOffset,i=o.focusOffset);let s=t.nodeValue;s!==null&&$y(e,s,r,i,!1)}function TK(t,e,n){if(fe(t)){let o=t.anchor.getNode();if(o.is(n)&&t.format!==o.getFormat())return!1}return or(e)&&n.isAttached()}function SK(t,e,n,o){for(let r=t;r&&!MD(r);r=Gc(r)){let i=of(r,e);if(i!==void 0){let s=$t(i,n);if(s)return Ze(s)||!Sn(r)?void 0:[r,s]}else if(r===o)return[o,_D(n)]}}function u1(t,e,n){$b=!0;let o=performance.now()-by>CK;try{oo(t,(()=>{let r=He()||(function(p){return p.getEditorState().read((()=>{let h=He();return h!==null?h.clone():null}))})(t),i=new Map,s=t.getRootElement(),a=t._editorState,l=t._blockCursorElement,c=!1,d="";for(let p=0;p<e.length;p++){let h=e[p],g=h.type,m=h.target,_=SK(m,t,a,s);if(!_)continue;let[b,y]=_;if(g==="characterData")o&&ne(y)&&or(m)&&TK(r,m,y)&&wK(m,y,t);else if(g==="childList"){c=!0;let v=h.addedNodes;for(let C=0;C<v.length;C++){let k=v[C],T=gD(k),w=k.parentNode;if(w!=null&&k!==l&&T===null&&!Sb(k,w,t)){if(xs){let S=(Sn(k)?k.innerText:null)||k.nodeValue;S&&(d+=S)}w.removeChild(k)}}let x=h.removedNodes,E=x.length;if(E>0){let C=0;for(let k=0;k<E;k++){let T=x[k];(Sb(T,m,t)||l===T)&&(m.appendChild(T),C++)}E!==C&&i.set(b,y)}}}if(i.size>0)for(let[p,h]of i)h.reconcileObservedMutation(p,t);let u=n.takeRecords();if(u.length>0){for(let p=0;p<u.length;p++){let h=u[p],g=h.addedNodes,m=h.target;for(let _=0;_<g.length;_++){let b=g[_],y=b.parentNode;y==null||b.nodeName!=="BR"||Sb(b,m,t)||y.removeChild(b)}}n.takeRecords()}r!==null&&(c&&$n(r),xs&&ED(t)&&r.insertRawText(d))}))}finally{$b=!1}}function p1(t){let e=t._observer;e!==null&&u1(t,e.takeRecords(),e)}function f1(t){(function(e){by===0&&Co(e).addEventListener("textInput",EK,!0)})(t),t._observer=new MutationObserver(((e,n)=>{u1(t,e,n)}))}var zb=class{constructor(e,n){this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||OK).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function kK(t,e){return new zb(t,e)}function Lp(t,e,n="latest"){let o=(n==="latest"?t.getLatest():t).__state;return o?o.getValue(e):e.defaultValue}function NK(t,e,n){let o=Lp(t,n,"direct"),r=Lp(e,n,"direct");return n.isEqual(o,r)?null:[o,r]}function DK(t,e,n){let o;if(Yt(),typeof n=="function"){let i=t.getLatest(),s=Lp(i,e);if(o=n(s),e.isEqual(s,o))return i}else o=n;let r=t.getWritable();return yy(r).updateFromKnown(e,o),r}function h1(t){let e=new Map,n=new Set;for(let o=typeof t=="function"?t:t.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=Vy(o);if(r&&r.stateConfigs)for(let i of r.stateConfigs){let s;"stateConfig"in i?(s=i.stateConfig,i.flat&&n.add(s.key)):s=i,e.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:e}}var Hb=class t{constructor(e,n,o=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,c,d){let u=d.size;if(c)for(let p in c){let h=l.get(p);h&&d.has(h)||u++}return u})(s,o,r);this.size=a}getValue(e){let n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let o=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let r=this.unknownState[e.key];r!==void 0&&(o=e.parse(r)),this.updateFromKnown(e,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete e[o.key]:e[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in e&&(n[o]=e[o],delete e[o]);return _N(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new t(e,n,(function(i,s,a){let l;if(a)for(let[c,d]of Object.entries(a)){let u=i.get(c);u?s.has(u)||s.set(u,u.parse(d)):(l=l||{},l[c]=d)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(e,n){let o=e.key;this.sharedNodeState.sharedConfigMap.set(o,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&o in i||(i&&(delete i[o],this.unknownState=_N(i)),this.size++),r.set(e,n)}updateFromUnknown(e,n){let o=this.sharedNodeState.sharedConfigMap.get(e);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(let[o,r]of Object.entries(e))this.updateFromUnknown(o,r)}};function yy(t){let e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new Hb(e,g1(e));return e.__state=n,n}function g1(t){return t.__state?t.__state.sharedNodeState:My(jy(),t.getType()).sharedNodeState}function _N(t){if(t)for(let e in t)return t}function OK(t){return t}function bN(t,e,n){for(let[o,r]of e.knownState){if(t.has(o.key))continue;t.add(o.key);let i=n?n.getValue(o):o.defaultValue;if(i!==r&&!o.isEqual(i,r))return!0}return!1}function yN(t,e,n){let{unknownState:o}=e,r=n?n.unknownState:void 0;if(o){for(let[i,s]of Object.entries(o))if(!t.has(i)&&(t.add(i),s!==(r?r[i]:void 0)))return!0}return!1}function xN(t,e){let n=t.__state;return n&&n.node===t?n.getWritable(e):n}function vN(t,e){let n=t.__mode,o=t.__format,r=t.__style,i=e.__mode,s=e.__format,a=e.__style,l=t.__state,c=e.__state;return(n===null||n===i)&&(o===null||o===s)&&(r===null||r===a)&&(t.__state===null||l===c||(function(d,u){if(d===u)return!0;if(d&&u&&d.size!==u.size)return!1;let p=new Set;return!(d&&bN(p,d,u)||u&&bN(p,u,d)||d&&yN(p,d,u)||u&&yN(p,u,d))})(l,c))}function CN(t,e){let n=t.mergeWithSibling(e),o=at()._normalizedNodes;return o.add(t.__key),o.add(e.__key),n}function EN(t){let e,n,o=t;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(e=o.getPreviousSibling())!==null&&ne(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(vN(e,o)){o=CN(e,o);break}break}e.remove()}for(;(n=o.getNextSibling())!==null&&ne(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(vN(o,n)){o=CN(o,n);break}break}n.remove()}}else o.remove()}function Rp(t){return wN(t.anchor),wN(t.focus),t}function wN(t){for(;t.type==="element";){let e=t.getNode(),n=t.offset,o,r;if(n===e.getChildrenSize()?(o=e.getChildAtIndex(n-1),r=!0):(o=e.getChildAtIndex(n),r=!1),ne(o)){t.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!K(o))break;t.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var xi,Tn,Fc,Zp,Ub,Kb,Cs,Io,jb,Bc,Bt="",wn="",Qo=null,er="",Rr="",m1=!1,$c=!1,kp=null;function Pp(t,e){let n=Cs.get(t);if(e!==null){let o=Gb(t);o.parentNode===e&&e.removeChild(o)}if(Io.has(t)||Tn._keyToDOMMap.delete(t),K(n)){let o=Bp(n,Cs);Vb(o,0,o.length-1,null)}n!==void 0&&zy(Bc,Fc,Zp,n,"destroyed")}function Vb(t,e,n,o){let r=e;for(;r<=n;++r){let i=t[r];i!==void 0&&Pp(i,o)}}function _s(t,e){t.setProperty("text-align",e)}var IK="40px";function _1(t,e){let n=xi.theme.indent;if(typeof n=="string"){let r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}let o=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||IK;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function b1(t,e){let n=t.style;e===0?_s(n,""):e===py?_s(n,"left"):e===fy?_s(n,"center"):e===hy?_s(n,"right"):e===gy?_s(n,"justify"):e===my?_s(n,"start"):e===_y&&_s(n,"end")}function Fp(t,e){let n=Io.get(t);n===void 0&&V(60);let o=n.createDOM(xi,Tn);if((function(r,i,s){let a=s._keyToDOMMap;(function(l,c,d){let u=`__lexicalKey_${c._key}`;l[u]=d})(i,s,r),a.set(r,i)})(t,o,Tn),ne(n)?o.setAttribute("data-lexical-text","true"):Ze(n)&&o.setAttribute("data-lexical-decorator","true"),K(n)){let r=n.__indent,i=n.__size;if(r!==0&&_1(o,r),i!==0){let a=i-1;(function(l,c,d,u){let p=wn;wn="",Wb(l,d,0,c,d.getDOMSlot(u)),x1(d,u),wn=p})(Bp(n,Io),a,n,o)}let s=n.__format;s!==0&&b1(o,s),n.isInline()||y1(null,n,o),sf(n)&&(Bt+=zr,Rr+=zr)}else{let r=n.getTextContent();if(Ze(n)){let i=n.decorate(Tn,xi);i!==null&&v1(t,i),o.contentEditable="false"}else ne(n)&&(n.isDirectionless()||(wn+=r));Bt+=r,Rr+=r}return e!==null&&e.insertChild(o),zy(Bc,Fc,Zp,n,"created"),o}function Wb(t,e,n,o,r){let i=Bt;Bt="";let s=n;for(;s<=o;++s){Fp(t[s],r);let a=Io.get(t[s]);a!==null&&ne(a)&&(Qo===null&&(Qo=a.getFormat()),er===""&&(er=a.getStyle()))}sf(e)&&(Bt+=zr),r.element.__lexicalTextContent=Bt,Bt=i+Bt}function TN(t,e){if(t){let n=t.__last;if(n){let o=e.get(n);if(o)return ys(o)?"line-break":Ze(o)&&o.isInline()?"decorator":null}return"empty"}return null}function y1(t,e,n){let o=TN(t,Cs),r=TN(e,Io);o!==r&&e.getDOMSlot(n).setManagedLineBreak(r)}function x1(t,e){let n=e.__lexicalDirTextContent||"",o=e.__lexicalDir||"";if(n!==wn||o!==kp){let r=wn==="",i=r?kp:(function(s){return gK.test(s)?"rtl":mK.test(s)?"ltr":null})(wn);if(i!==o){let s=e.classList,a=xi.theme,l=o!==null?a[o]:void 0,c=i!==null?a[i]:void 0;if(l!==void 0){if(typeof l=="string"){let d=Mp(l);l=a[o]=d}s.remove(...l)}if(i===null||r&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){let d=Mp(c);c=a[i]=d}c!==void 0&&s.add(...c)}e.dir=i}$c||(t.getWritable().__dir=i)}kp=i,e.__lexicalDirTextContent=wn,e.__lexicalDir=i}}function AK(t,e,n){let o=wn;var r;wn="",Qo=null,er="",(function(i,s,a){let l=Bt,c=i.__size,d=s.__size;Bt="";let u=a.element;if(c===1&&d===1){let p=i.__first,h=s.__first;if(p===h)kc(p,u);else{let m=Gb(p),_=Fp(h,null);try{u.replaceChild(_,m)}catch(b){if(typeof b=="object"&&b!=null){let y=`${b.toString()} Parent: ${u.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${p}}.`;throw new Error(y)}throw b}Pp(p,null)}let g=Io.get(h);ne(g)&&(Qo===null&&(Qo=g.getFormat()),er===""&&(er=g.getStyle()))}else{let p=Bp(i,Cs),h=Bp(s,Io);if(p.length!==c&&V(227),h.length!==d&&V(228),c===0)d!==0&&Wb(h,s,0,d-1,a);else if(d===0){if(c!==0){let g=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;Vb(p,0,c-1,g?null:u),g&&(u.textContent="")}}else(function(g,m,_,b,y,v){let x=b-1,E=y-1,C,k,T=v.getFirstChild(),w=0,S=0;for(;w<=x&&S<=E;){let O=m[w],A=_[S];if(O===A)T=kb(kc(A,v.element)),w++,S++;else{C===void 0&&(C=new Set(m)),k===void 0&&(k=new Set(_));let R=k.has(O),z=C.has(A);if(R)if(z){let W=ja(Tn,A);W===T?T=kb(kc(A,v.element)):(v.withBefore(T).insertChild(W),kc(A,v.element)),w++,S++}else Fp(A,v.withBefore(T)),S++;else T=kb(Gb(O)),Pp(O,v.element),w++}let I=Io.get(A);I!==null&&ne(I)&&(Qo===null&&(Qo=I.getFormat()),er===""&&(er=I.getStyle()))}let N=w>x,D=S>E;if(N&&!D){let O=_[E+1],A=O===void 0?null:Tn.getElementByKey(O);Wb(_,g,S,E,v.withBefore(A))}else D&&!N&&Vb(m,w,x,v.element)})(s,p,h,c,d,a)}sf(s)&&(Bt+=zr),u.__lexicalTextContent=Bt,Bt=l+Bt})(t,e,e.getDOMSlot(n)),x1(e,n),r=e,Qo==null||Qo===r.__textFormat||$c||r.setTextFormat(Qo),(function(i){er===""||er===i.__textStyle||$c||i.setTextStyle(er)})(e),wn=o}function Bp(t,e){let n=[],o=t.__first;for(;o!==null;){let r=e.get(o);r===void 0&&V(101),n.push(o),o=r.__next}return n}function kc(t,e){let n=Cs.get(t),o=Io.get(t);n!==void 0&&o!==void 0||V(61);let r=m1||Kb.has(t)||Ub.has(t),i=ja(Tn,t);if(n===o&&!r){if(K(n)){let s=i.__lexicalTextContent;s!==void 0&&(Bt+=s,Rr+=s);let a=i.__lexicalDirTextContent;a!==void 0&&(wn+=a)}else{let s=n.getTextContent();ne(n)&&!n.isDirectionless()&&(wn+=s),Rr+=s,Bt+=s}return i}if(n!==o&&r&&zy(Bc,Fc,Zp,o,"updated"),o.updateDOM(n,i,xi)){let s=Fp(t,null);return e===null&&V(62),e.replaceChild(s,i),Pp(t,null),s}if(K(n)&&K(o)){let s=o.__indent;s!==n.__indent&&_1(i,s);let a=o.__format;a!==n.__format&&b1(i,a),r&&(AK(n,o,i),Pn(o)||o.isInline()||y1(n,o,i)),sf(o)&&(Bt+=zr,Rr+=zr)}else{let s=o.getTextContent();if(Ze(o)){let a=o.decorate(Tn,xi);a!==null&&v1(t,a)}else ne(o)&&!o.isDirectionless()&&(wn+=s);Bt+=s,Rr+=s}if(!$c&&Pn(o)&&o.__cachedText!==Rr){let s=o.getWritable();s.__cachedText=Rr,o=s}return i}function v1(t,e){let n=Tn._pendingDecorators,o=Tn._decorators;if(n===null){if(o[t]===e)return;n=mD(Tn)}n[t]=e}function kb(t){let e=t.nextSibling;return e!==null&&e===Tn._blockCursorElement&&(e=e.nextSibling),e}function MK(t,e,n,o,r,i){Bt="",Rr="",wn="",m1=o===Fa,kp=null,Tn=n,xi=n._config,Fc=n._nodes,Zp=Tn._listeners.mutation,Ub=r,Kb=i,Cs=t._nodeMap,Io=e._nodeMap,$c=e._readOnly,jb=new Map(n._keyToDOMMap);let s=new Map;return Bc=s,kc("root",null),Tn=void 0,Fc=void 0,Ub=void 0,Kb=void 0,Cs=void 0,Io=void 0,xi=void 0,jb=void 0,Bc=void 0,s}function Gb(t){let e=jb.get(t);return e===void 0&&V(75,t),e}function we(t){return{type:t}}var xy=we("SELECTION_CHANGE_COMMAND"),LK=we("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),C1=we("CLICK_COMMAND"),zc=we("DELETE_CHARACTER_COMMAND"),Nc=we("INSERT_LINE_BREAK_COMMAND"),Yb=we("INSERT_PARAGRAPH_COMMAND"),Ma=we("CONTROLLED_TEXT_INSERTION_COMMAND"),vy=we("PASTE_COMMAND"),qb=we("REMOVE_TEXT_COMMAND"),Hc=we("DELETE_WORD_COMMAND"),Uc=we("DELETE_LINE_COMMAND"),mi=we("FORMAT_TEXT_COMMAND"),Cy=we("UNDO_COMMAND"),Ey=we("REDO_COMMAND"),E1=we("KEYDOWN_COMMAND"),w1=we("KEY_ARROW_RIGHT_COMMAND"),T1=we("MOVE_TO_END"),S1=we("KEY_ARROW_LEFT_COMMAND"),k1=we("MOVE_TO_START"),N1=we("KEY_ARROW_UP_COMMAND"),D1=we("KEY_ARROW_DOWN_COMMAND"),$p=we("KEY_ENTER_COMMAND"),O1=we("KEY_SPACE_COMMAND"),I1=we("KEY_BACKSPACE_COMMAND"),A1=we("KEY_ESCAPE_COMMAND"),M1=we("KEY_DELETE_COMMAND"),L1=we("KEY_TAB_COMMAND"),RK=we("INSERT_TAB_COMMAND"),PK=we("INDENT_CONTENT_COMMAND"),FK=we("OUTDENT_CONTENT_COMMAND"),R1=we("DROP_COMMAND"),BK=we("FORMAT_ELEMENT_COMMAND"),P1=we("DRAGSTART_COMMAND"),F1=we("DRAGOVER_COMMAND"),B1=we("DRAGEND_COMMAND"),wy=we("COPY_COMMAND"),Ty=we("CUT_COMMAND"),Jb=we("SELECT_ALL_COMMAND"),$K=we("CLEAR_EDITOR_COMMAND"),zK=we("CLEAR_HISTORY_COMMAND"),HK=we("CAN_REDO_COMMAND"),UK=we("CAN_UNDO_COMMAND"),$1=we("FOCUS_COMMAND"),z1=we("BLUR_COMMAND"),H1=we("KEY_MODIFIER_COMMAND"),Ir=Object.freeze({}),Xb=30,Zb=[["keydown",function(t,e){if(Dc=t.timeStamp,U1=t.key,!e.isComposing()&&!Q(e,E1,t)&&t.key!=null){if(Nb&&QN(t))return oo(e,(()=>{Cp(e,Db)})),Nb=!1,void(Db="");if((function(n){return Ye(n,"ArrowRight",{shiftKey:"any"})})(t))Q(e,w1,t);else if((function(n){return Ye(n,"ArrowRight",Mr)})(t))Q(e,T1,t);else if((function(n){return Ye(n,"ArrowLeft",{shiftKey:"any"})})(t))Q(e,S1,t);else if((function(n){return Ye(n,"ArrowLeft",Mr)})(t))Q(e,k1,t);else if((function(n){return Ye(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(t))Q(e,N1,t);else if((function(n){return Ye(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(t))Q(e,D1,t);else if((function(n){return Ye(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(t))Oc=!0,Q(e,$p,t);else if((function(n){return n.key===" "})(t))Q(e,O1,t);else if((function(n){return tr&&Ye(n,"o",{ctrlKey:!0})})(t))t.preventDefault(),Oc=!0,Q(e,Nc,!0);else if((function(n){return Ye(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(t))Oc=!1,Q(e,$p,t);else if((function(n){return Ye(n,"Backspace",{shiftKey:"any"})||tr&&Ye(n,"h",{ctrlKey:!0})})(t))QN(t)?Q(e,I1,t):(t.preventDefault(),Q(e,zc,!0));else if((function(n){return n.key==="Escape"})(t))Q(e,A1,t);else if((function(n){return Ye(n,"Delete",{})||tr&&Ye(n,"d",{ctrlKey:!0})})(t))(function(n){return n.key==="Delete"})(t)?Q(e,M1,t):(t.preventDefault(),Q(e,zc,!1));else if((function(n){return Ye(n,"Backspace",ZN)})(t))t.preventDefault(),Q(e,Hc,!0);else if((function(n){return Ye(n,"Delete",ZN)})(t))t.preventDefault(),Q(e,Hc,!1);else if((function(n){return tr&&Ye(n,"Backspace",{metaKey:!0})})(t))t.preventDefault(),Q(e,Uc,!0);else if((function(n){return tr&&(Ye(n,"Delete",{metaKey:!0})||Ye(n,"k",{ctrlKey:!0}))})(t))t.preventDefault(),Q(e,Uc,!1);else if((function(n){return Ye(n,"b",Mr)})(t))t.preventDefault(),Q(e,mi,"bold");else if((function(n){return Ye(n,"u",Mr)})(t))t.preventDefault(),Q(e,mi,"underline");else if((function(n){return Ye(n,"i",Mr)})(t))t.preventDefault(),Q(e,mi,"italic");else if((function(n){return Ye(n,"Tab",{shiftKey:"any"})})(t))Q(e,L1,t);else if((function(n){return Ye(n,"z",Mr)})(t))t.preventDefault(),Q(e,Cy,void 0);else if((function(n){return tr?Ye(n,"z",{metaKey:!0,shiftKey:!0}):Ye(n,"y",{ctrlKey:!0})||Ye(n,"z",{ctrlKey:!0,shiftKey:!0})})(t))t.preventDefault(),Q(e,Ey,void 0);else{let n=e._editorState._selection;n===null||fe(n)?e1(t)&&(t.preventDefault(),Q(e,Jb,t)):(function(o){return Ye(o,"c",Mr)})(t)?(t.preventDefault(),Q(e,wy,t)):(function(o){return Ye(o,"x",Mr)})(t)?(t.preventDefault(),Q(e,Ty,t)):e1(t)&&(t.preventDefault(),Q(e,Jb,t))}(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(t)&&Q(e,H1,t)}}],["pointerdown",function(t,e){let n=t.target,o=t.pointerType;Xa(n)&&o!=="touch"&&o!=="pen"&&t.button===0&&oo(e,(()=>{qN(n)||(ey=!0)}))}],["compositionstart",function(t,e){oo(e,(()=>{let n=He();if(fe(n)&&!e.isComposing()){let o=n.anchor,r=n.anchor.getNode();qt(o.key),(t.timeStamp<Dc+Xb||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||ne(r)&&r.getStyle()!==n.style)&&Q(e,Ma,hK)}}))}],["compositionend",function(t,e){xs?Tc=!0:Pa||!Lc&&!Ap?oo(e,(()=>{Cp(e,t.data)})):(Nb=!0,Db=t.data)}],["input",function(t,e){t.stopPropagation(),oo(e,(()=>{if(Sn(t.target)&&qN(t.target))return;let n=He(),o=t.data,r=G1(t);if(o!=null&&fe(n)&&V1(n,r,o,t.timeStamp,!1)){Tc&&(Cp(e,o),Tc=!1);let i=n.anchor.getNode(),s=nr(Co(e));if(s===null)return;let a=n.isBackward(),l=a?n.anchor.offset:n.focus.offset,c=a?n.focus.offset:n.anchor.offset;Ip&&!n.isCollapsed()&&ne(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,l)+o+i.getTextContent().slice(l+c)===xD(s.anchorNode)||Q(e,Ma,o);let d=o.length;xs&&d>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(n.anchor.offset-=d),Lc||Pa||Ap||!e.isComposing()||(Dc=0,qt(null))}else By(!1,e,o!==null?o:void 0),Tc&&(Cp(e,o||void 0),Tc=!1);(function(){Yt();let i=at();p1(i)})()}),{event:t}),Ia=null}],["click",function(t,e){oo(e,(()=>{let n=He(),o=nr(Co(e)),r=Ns();if(o){if(fe(n)){let i=n.anchor,s=i.getNode();if(i.type==="element"&&i.offset===0&&n.isCollapsed()&&!Pn(s)&&Bn().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(t.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let a=(function(l,c){let d=l;for(;d!==Bn()&&d!=null;){if(c(d))return d;d=d.getParent()}return null})(s,(l=>K(l)&&!l.isInline()));K(a)&&a.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=o.anchorNode;(Sn(i)||or(i))&&$n(tf(r,o,e,t))}}Q(e,C1,t)}))}],["cut",Ir],["copy",Ir],["dragstart",Ir],["dragover",Ir],["dragend",Ir],["paste",Ir],["focus",Ir],["blur",Ir],["drop",Ir]];Ip&&Zb.push(["beforeinput",(t,e)=>(function(n,o){let r=n.inputType,i=G1(n);r==="deleteCompositionText"||xs&&ED(o)||r!=="insertCompositionText"&&oo(o,(()=>{let s=He();if(r==="deleteContentBackward"){if(s===null){let h=Ns();if(!fe(h))return;$n(h.clone())}if(fe(s)){let h=s.anchor.key===s.focus.key;if(a=n.timeStamp,U1==="MediaLast"&&a<Dc+Xb&&o.isComposing()&&h){if(qt(null),Dc=0,setTimeout((()=>{oo(o,(()=>{qt(null)}))}),Xb),fe(s)){let g=s.anchor.getNode();g.markDirty(),ne(g)||V(142),W1(s,g)}}else{qt(null),n.preventDefault();let g=s.anchor.getNode(),m=g.getTextContent(),_=g.canInsertTextAfter(),b=s.anchor.offset===0&&s.focus.offset===m.length,y=hN&&h&&!b&&_;if(y&&s.isCollapsed()&&(y=!Ze(CD(s.anchor,!0))),!y){Q(o,zc,!0);let v=He();hN&&fe(v)&&v.isCollapsed()&&(bs=v,setTimeout((()=>bs=null)))}}return}}var a;if(!fe(s))return;let l=n.data;Ia!==null&&By(!1,o,Ia),s.dirty&&Ia===null||!s.isCollapsed()||Pn(s.anchor.getNode())||i===null||s.applyDOMRange(i),Ia=null;let c=s.anchor,d=s.focus,u=c.getNode(),p=d.getNode();if(r!=="insertText"&&r!=="insertTranspose")switch(n.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Q(o,Ma,n);break;case"insertFromComposition":qt(null),Q(o,Ma,n);break;case"insertLineBreak":qt(null),Q(o,Nc,!1);break;case"insertParagraph":qt(null),Oc&&!Pa?(Oc=!1,Q(o,Nc,!1)):Q(o,Yb,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Q(o,vy,n);break;case"deleteByComposition":(function(h,g){return h!==g||K(h)||K(g)||!bi(h)||!bi(g)})(u,p)&&Q(o,qb,n);break;case"deleteByDrag":case"deleteByCut":Q(o,qb,n);break;case"deleteContent":Q(o,zc,!1);break;case"deleteWordBackward":Q(o,Hc,!0);break;case"deleteWordForward":Q(o,Hc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Q(o,Uc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Q(o,Uc,!1);break;case"formatStrikeThrough":Q(o,mi,"strikethrough");break;case"formatBold":Q(o,mi,"bold");break;case"formatItalic":Q(o,mi,"italic");break;case"formatUnderline":Q(o,mi,"underline");break;case"historyUndo":Q(o,Cy,void 0);break;case"historyRedo":Q(o,Ey,void 0)}else{if(l===`
106
- `)n.preventDefault(),Q(o,Nc,!1);else if(l===zr)n.preventDefault(),Q(o,Yb,void 0);else if(l==null&&n.dataTransfer){let h=n.dataTransfer.getData("text/plain");n.preventDefault(),s.insertRawText(h)}else l!=null&&V1(s,i,l,n.timeStamp,!0)?(n.preventDefault(),Q(o,Ma,l)):Ia=l;K1=n.timeStamp}}))})(t,e)]);var Dc=0,U1=null,K1=0,Ia=null,zp=new WeakMap,Qb=!1,ey=!1,Oc=!1,Tc=!1,Nb=!1,Db="",bs=null,j1=[0,"",0,"root",0];function V1(t,e,n,o,r){let i=t.anchor,s=t.focus,a=i.getNode(),l=at(),c=nr(Co(l)),d=c!==null?c.anchorNode:null,u=i.key,p=l.getElementByKey(u),h=n.length;return u!==s.key||!ne(a)||(!r&&(!Ip||K1<o+50)||a.isDirty()&&h<2||bD(n))&&i.offset!==s.offset&&!a.isComposing()||Lr(a)||a.isDirty()&&h>1||(r||!Ip)&&p!==null&&!a.isComposing()&&d!==Ts(p)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||a.getFormat()!==t.format||a.getStyle()!==t.style||(function(g,m){if(m.isSegmented())return!0;if(!g.isCollapsed())return!1;let _=g.anchor.offset,b=m.getParentOrThrow(),y=bi(m);return _===0?!m.canInsertTextBefore()||!b.canInsertTextBefore()&&!m.isComposing()||y||(function(v){let x=v.getPreviousSibling();return(ne(x)||K(x)&&x.isInline())&&!x.canInsertTextAfter()})(m):_===m.getTextContentSize()&&(!m.canInsertTextAfter()||!b.canInsertTextAfter()&&!m.isComposing()||y)})(t,a)}function SN(t,e){return or(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function kN(t,e,n){let{anchorNode:o,anchorOffset:r,focusNode:i,focusOffset:s}=t;Qb&&(Qb=!1,SN(o,r)&&SN(i,s)&&!bs)||oo(e,(()=>{if(!n)return void $n(null);if(!Vc(e,o,i))return;let a=He();if(bs&&fe(a)&&a.isCollapsed()){let l=a.anchor,c=bs.anchor;(l.key===c.key&&l.offset===c.offset+1||l.offset===1&&c.getNode().is(l.getNode().getPreviousSibling()))&&(a=bs.clone(),$n(a))}if(bs=null,fe(a)){let l=a.anchor,c=l.getNode();if(a.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(a.dirty=!0);let d=Co(e).event,u=d?d.timeStamp:performance.now(),[p,h,g,m,_]=j1,b=Bn(),y=e.isComposing()===!1&&b.getTextContent()==="";if(u<_+200&&l.offset===g&&l.key===m)Np(a,p,h);else if(l.type==="text")ne(c)||V(141),W1(a,c);else if(l.type==="element"&&!y){K(c)||V(259);let v=l.getNode();v.isEmpty()?(function(x,E){let C=E.getTextFormat(),k=E.getTextStyle();Np(x,C,k)})(a,v):Np(a,0,"")}}else{let d=l.key,u=a.focus.key,p=a.getNodes(),h=p.length,g=a.isBackward(),m=g?s:r,_=g?r:s,b=g?u:d,y=g?d:u,v=a1,x=!1;for(let E=0;E<h;E++){let C=p[E],k=C.getTextContentSize();if(ne(C)&&k!==0&&!(E===0&&C.__key===b&&m===k||E===h-1&&C.__key===y&&_===0)&&(x=!0,v&=C.getFormat(),v===0))break}a.format=x?v:0}}Q(e,xy,void 0)}))}function Np(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=!0)}function W1(t,e){Np(t,e.getFormat(),e.getStyle())}function G1(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function Cp(t,e){let n=t._compositionKey;if(qt(null),n!==null&&e!=null){if(e===""){let o=$t(n),r=Ts(t.getElementByKey(n));return void(r!==null&&r.nodeValue!==null&&ne(o)&&$y(o,r.nodeValue,null,null,!0))}if(e[e.length-1]===`
107
- `){let o=He();if(fe(o)){let r=o.focus;return o.anchor.set(r.key,r.offset,r.type),void Q(t,$p,null)}}}By(!0,t,e)}function Y1(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var La=new Map;function q1(t){let e=ND(t.target);if(e===null)return;let n=Py(e.anchorNode);if(n===null)return;ey&&(ey=!1,oo(n,(()=>{let l=Ns(),c=e.anchorNode;(Sn(c)||or(c))&&$n(tf(l,e,n,t))})));let o=Fy(n),r=o[o.length-1],i=r._key,s=La.get(i),a=s||r;a!==n&&kN(e,a,!1),kN(e,n,!0),n!==r?La.set(i,n):s&&La.delete(i)}function NN(t){t._lexicalHandled=!0}function DN(t){return t._lexicalHandled===!0}var KK=()=>{};function jK(t){let e=t.ownerDocument,n=zp.get(e);if(n===void 0)return void KK();let o=n-1;o>=0||V(164),zp.set(e,o),o===0&&e.removeEventListener("selectionchange",q1);let r=Wc(t);nf(r)?((function(s){if(s._parentEditor!==null){let a=Fy(s),l=a[a.length-1]._key;La.get(l)===s&&La.delete(l)}else La.delete(s._key)})(r),t.__lexicalEditor=null):r&&V(198);let i=Y1(t);for(let s=0;s<i.length;s++)i[s]();t.__lexicalEventHandles=[]}function ty(t,e,n){Yt();let o=t.__key,r=t.getParent();if(r===null)return;let i=(function(a){let l=He();if(!fe(l)||!K(a))return l;let{anchor:c,focus:d}=l,u=c.getNode(),p=d.getNode();return Yp(u,a)&&c.set(a.__key,0,"element"),Yp(p,a)&&d.set(a.__key,0,"element"),l})(t),s=!1;if(fe(i)&&e){let a=i.anchor,l=i.focus;a.key===o&&(Kp(a,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0),l.key===o&&(Kp(l,t,r,t.getPreviousSibling(),t.getNextSibling()),s=!0)}else ef(i)&&e&&t.isSelected()&&t.selectPrevious();if(fe(i)&&e&&!s){let a=t.getIndexWithinParent();yi(t),Up(i,r,a,-1)}else yi(t);n||Lo(r)||r.canBeEmpty()||!r.isEmpty()||ty(r,e),e&&i&&Pn(r)&&r.isEmpty()&&r.selectEnd()}function VK(t){return t}var vi=class{static getType(){let{ownNodeType:e}=Vy(this);return e===void 0&&V(64,this.name),e}static clone(e){V(65,this.name)}$config(){return{}}config(e,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:e}),{[e]:n}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),hD(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let n=$t(e);if(n===null)break;e=n.__parent}return!1}isSelected(e){let n=e||He();if(n==null)return!1;let o=n.getNodes().some((r=>r.__key===this.__key));if(ne(this))return o;if(fe(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Ze(this)&&this.isInline()&&r){let i=n.isBackward()?n.focus:n.anchor;if(r.is(i.getNode())&&i.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:$t(e)}getParentOrThrow(){let e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let n=e.getParent();if(Lo(n))return K(e)||e===this&&Ze(e)||V(194),e;e=n}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){let e=[],n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){let e=[],n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:$t(e)}getPreviousSiblings(){let e=[],n=this.getParent();if(n===null)return e;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:$t(e)}getNextSiblings(){let e=[],n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){let n=K(this)?this:this.getParent(),o=K(e)?e:e.getParent(),r=n&&o?Ac(n,o):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let n=Ac(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Jy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&V(279),!1)))}isParentOf(e){let n=Ac(this,e);return n!==null&&n.type==="ancestor"}getNodesBetween(e){let n=this.isBefore(e),o=[],r=new Set,i=this;for(;i!==null;){let s=i.__key;if(r.has(s)||(r.add(s),o.push(i)),i===e)break;let a=K(i)?n?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}let l=n?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||o.push(c),c===e)break;let d=null,u=c;do{if(u===null&&V(68),d=n?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;d!==null||r.has(u.__key)||o.push(u)}while(d===null);i=d}return n||o.reverse(),o}isDirty(){let e=at()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=$t(this.__key);return e===null&&V(113),e}getWritable(){Yt();let e=Ur(),n=at(),o=e._nodeMap,r=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,a=He();if(a!==null&&a.setCachedNodes(null),s.has(r))return Gp(i),i;let l=ID(i);return s.add(r),Gp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){V(70)}updateDOM(e,n,o){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){V(18,this.name)}updateFromJSON(e){return(function(n,o){let r=n.getWritable(),i=o.$,s=i;for(let a of g1(r).flatKeys)a in o&&(s!==void 0&&s!==i||(s={...i}),s[a]=o[a]);return(r.__state||s)&&yy(n).updateFromJSON(s),r})(this,e)}static transform(){return null}remove(e){ty(this,!0,e)}replace(e,n){Yt();let o=He();o!==null&&(o=o.clone()),Rb(this,e);let r=this.getLatest(),i=this.__key,s=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),c=l.__size;yi(a);let d=r.getPreviousSibling(),u=r.getNextSibling(),p=r.__prev,h=r.__next,g=r.__parent;if(ty(r,!1,!0),d===null?l.__first=s:d.getWritable().__next=s,a.__prev=p,u===null?l.__last=s:u.getWritable().__prev=s,a.__next=h,a.__parent=g,l.__size=c,n&&(K(this)&&K(a)||V(139),this.getChildren().forEach((m=>{a.append(m)}))),fe(o)){$n(o);let m=o.anchor,_=o.focus;m.key===i&&MN(m,a),_.key===i&&MN(_,a)}return _i()===i&&qt(s),a}insertAfter(e,n=!0){Yt(),Rb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=He(),a=!1,l=!1;if(i!==null){let h=e.getIndexWithinParent();if(yi(r),fe(s)){let g=i.__key,m=s.anchor,_=s.focus;a=m.type==="element"&&m.key===g&&m.offset===h+1,l=_.type==="element"&&_.key===g&&_.offset===h+1}}let c=this.getNextSibling(),d=this.getParentOrThrow().getWritable(),u=r.__key,p=o.__next;if(c===null?d.__last=u:c.getWritable().__prev=u,d.__size++,o.__next=u,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&fe(s)){let h=this.getIndexWithinParent();Up(s,d,h+1);let g=d.__key;a&&s.anchor.set(g,h+2,"element"),l&&s.focus.set(g,h+2,"element")}return e}insertBefore(e,n=!0){Yt(),Rb(this,e);let o=this.getWritable(),r=e.getWritable(),i=r.__key;yi(r);let s=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=o.__prev,c=this.getIndexWithinParent();s===null?a.__first=i:s.getWritable().__next=i,a.__size++,o.__prev=i,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let d=He();return n&&fe(d)&&Up(d,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return Br()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){Yt();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(K(o))return o.select();if(!ne(o)){let i=o.getIndexWithinParent()+1;return r.select(i,i)}return o.select(e,n)}selectNext(e,n){Yt();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(K(o))return o.select(0,0);if(!ne(o)){let i=o.getIndexWithinParent();return r.select(i,i)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}},Ba=class t extends vi{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
108
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(n){let o=n.parentElement;if(o!==null&&ay(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Ep(r)){let i=o.lastChild;if(i===n||i.previousSibling===n&&Ep(i))return!0}}return!1})(e)||(function(n){let o=n.parentElement;if(o!==null&&ay(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Ep(r))return!1;let i=o.lastChild;if(i===n||i.previousSibling===n&&Ep(i))return!0}return!1})(e)?null:{conversion:WK,priority:0}}}static importJSON(e){return $a().updateFromJSON(e)}};function WK(t){return{node:$a()}}function $a(){return Yc(new Ba)}function ys(t){return t instanceof Ba}function Ep(t){return or(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Ob(t,e){return 16&e?"code":e&Jp?"mark":32&e?"sub":64&e?"sup":null}function Ib(t,e){return 1&e?"strong":2&e?"em":"span"}function J1(t,e,n,o,r){let i=o.classList,s=Ra(r,"base");s!==void 0&&i.add(...s),s=Ra(r,"underlineStrikethrough");let a=!1,l=e&Pc&&e&Rc;s!==void 0&&(n&Pc&&n&Rc?(a=!0,l||i.add(...s)):l&&i.remove(...s));for(let c in fn){let d=fn[c];if(s=Ra(r,c),s!==void 0)if(n&d){if(a&&(c==="underline"||c==="strikethrough")){e&d&&i.remove(...s);continue}e&d&&(!l||c!=="underline")&&c!=="strikethrough"||i.add(...s)}else e&d&&i.remove(...s)}}function X1(t,e,n){let o=e.firstChild,r=n.isComposing(),i=t+(r?Xp:"");if(o==null)e.textContent=i;else{let s=o.nodeValue;if(s!==i)if(r||xs){let[a,l,c]=(function(d,u){let p=d.length,h=u.length,g=0,m=0;for(;g<p&&g<h&&d[g]===u[g];)g++;for(;m+g<p&&m+g<h&&d[p-m-1]===u[h-m-1];)m++;return[g,p-g-m,u.slice(g,h-m)]})(s,i);l!==0&&o.deleteData(a,l),o.insertData(a,c)}else o.nodeValue=i}}function ON(t,e,n,o,r,i){X1(r,t,e);let s=i.theme.text;s!==void 0&&J1(0,0,o,t,s)}function wp(t,e){let n=document.createElement(e);return n.appendChild(t),n}var Es=class t extends vi{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",n){super(n),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return xK[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===_i()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let n=fn[e];return!!(this.getFormat()&n)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,n){return Wp(this.getLatest().__format,e,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,n){let o=this.__format,r=Ob(0,o),i=Ib(0,o),s=r===null?i:r,a=document.createElement(s),l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(i),a.appendChild(l)),ON(l,this,0,o,this.__text,e);let c=this.__style;return c!==""&&(a.style.cssText=c),a}updateDOM(e,n,o){let r=this.__text,i=e.__format,s=this.__format,a=Ob(0,i),l=Ob(0,s),c=Ib(0,i),d=Ib(0,s);if((a===null?c:a)!==(l===null?d:l))return!0;if(a===l&&c!==d){let m=n.firstChild;m==null&&V(48);let _=document.createElement(d);return ON(_,this,0,s,r,o),n.replaceChild(_,m),!1}let u=n;l!==null&&a!==null&&(u=n.firstChild,u==null&&V(49)),X1(r,u,this);let p=o.theme.text;p!==void 0&&i!==s&&J1(0,i,s,u,p);let h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:JK,priority:0}),b:()=>({conversion:YK,priority:0}),code:()=>({conversion:Ar,priority:0}),em:()=>({conversion:Ar,priority:0}),i:()=>({conversion:Ar,priority:0}),mark:()=>({conversion:Ar,priority:0}),s:()=>({conversion:Ar,priority:0}),span:()=>({conversion:GK,priority:0}),strong:()=>({conversion:Ar,priority:0}),sub:()=>({conversion:Ar,priority:0}),sup:()=>({conversion:Ar,priority:0}),u:()=>({conversion:Ar,priority:0})}}static importJSON(e){return Gt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Sn(n)||V(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=wp(n,"b")),this.hasFormat("italic")&&(n=wp(n,"i")),this.hasFormat("strikethrough")&&(n=wp(n,"s")),this.hasFormat("underline")&&(n=wp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,n){}setFormat(e){let n=this.getWritable();return n.__format=typeof e=="string"?fn[e]:e,n}setDetail(e){let n=this.getWritable();return n.__detail=typeof e=="string"?_K[e]:e,n}setStyle(e){let n=this.getWritable();return n.__style=e,n}toggleFormat(e){let n=Wp(this.getFormat(),e,null);return this.setFormat(n)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let n=yK[e];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(e){if(this.__text===e)return this;let n=this.getWritable();return n.__text=e,n}select(e,n){Yt();let o=e,r=n,i=He(),s=this.getTextContent(),a=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!fe(i))return eD(a,o,a,r,"text","text");{let l=_i();l!==i.anchor.key&&l!==i.focus.key||qt(a),i.setTextNodeRange(this,o,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,n,o,r){let i=this.getWritable(),s=i.__text,a=o.length,l=e;l<0&&(l=a+l,l<0&&(l=0));let c=He();if(r&&fe(c)){let u=e+a;c.setTextNodeRange(i,u,i,u)}let d=s.slice(0,l)+o+s.slice(l+n);return i.__text=d,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Yt();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,i=_i(),s=o.length;e.sort(((T,w)=>T-w)),e.push(s);let a=[],l=e.length;for(let T=0,w=0;T<s&&w<=l;w++){let S=e[w];S>T&&(a.push(o.slice(T,S)),T=S)}let c=a.length;if(c===1)return[n];let d=a[0],u=n.getParent(),p,h=n.getFormat(),g=n.getStyle(),m=n.__detail,_=!1,b=null,y=null,v=He();if(fe(v)){let[T,w]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];T.type==="text"&&T.key===r&&(b=T),w.type==="text"&&w.key===r&&(y=w)}n.isSegmented()?(p=Gt(d),p.__format=h,p.__style=g,p.__detail=m,p.__state=xN(n,p),_=!0):p=n.setTextContent(d);let x=[p];for(let T=1;T<c;T++){let w=Gt(a[T]);w.__format=h,w.__style=g,w.__detail=m,w.__state=xN(n,w);let S=w.__key;i===r&&qt(S),x.push(w)}let E=b?b.offset:null,C=y?y.offset:null,k=0;for(let T of x){if(!b&&!y)break;let w=k+T.getTextContentSize();if(b!==null&&E!==null&&E<=w&&E>=k&&(b.set(T.getKey(),E-k,"text"),E<w&&(b=null)),y!==null&&C!==null&&C<=w&&C>=k){y.set(T.getKey(),C-k,"text");break}k=w}if(u!==null){(function(S){let N=S.getPreviousSibling(),D=S.getNextSibling();N!==null&&Gp(N),D!==null&&Gp(D)})(this);let T=u.getWritable(),w=this.getIndexWithinParent();_?(T.splice(w,0,x),this.remove()):T.splice(w,1,x),fe(v)&&Up(v,u,w,c-1)}return x}mergeWithSibling(e){let n=e===this.getPreviousSibling();n||e===this.getNextSibling()||V(50);let o=this.__key,r=e.__key,i=this.__text,s=i.length;_i()===r&&qt(o);let a=He();if(fe(a)){let u=a.anchor,p=a.focus;u!==null&&u.key===r&&zN(u,n,o,e,s),p!==null&&p.key===r&&zN(p,n,o,e,s)}let l=e.__text,c=n?l+i:i+l;this.setTextContent(c);let d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function GK(t){return{forChild:Sy(t.style),node:null}}function YK(t){let e=t,n=e.style.fontWeight==="normal";return{forChild:Sy(e.style,n?void 0:"bold"),node:null}}var IN=new WeakMap;function qK(t){if(!Sn(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function JK(t){let e=t;t.parentElement===null&&V(129);let n=e.textContent||"";if((function(o){let r,i=o.parentNode,s=[o];for(;i!==null&&(r=IN.get(i))===void 0&&!qK(i);)s.push(i),i=i.parentNode;let a=r===void 0?i:r;for(let l=0;l<s.length;l++)IN.set(s[l],a);return a})(e)!==null){let o=n.split(/(\r?\n|\t)/),r=[],i=o.length;for(let s=0;s<i;s++){let a=o[s];a===`
109
- `||a===`\r
110
- `?r.push($a()):a===" "?r.push(Qp()):a!==""&&r.push(Gt(a))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=e,r=!0;for(;o!==null&&(o=AN(o,!1))!==null;){let i=o.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=e,r=!0;for(;o!==null&&(o=AN(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Gt(n)}}function AN(t,e){let n=t;for(;;){let o;for(;(o=e?n.nextSibling:n.previousSibling)===null;){let i=n.parentElement;if(i===null)return null;n=i}if(n=o,Sn(n)){let i=n.style.display;if(i===""&&!OD(n)||i!==""&&!i.startsWith("inline"))return null}let r=n;for(;(r=e?n.firstChild:n.lastChild)!==null;)n=r;if(or(n))return n;if(n.nodeName==="BR")return null}}var XK={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ar(t){let e=XK[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Sy(t.style,e),node:null}}function Gt(t=""){return Yc(new Es(t))}function ne(t){return t instanceof Es}function Sy(t,e){let n=t.fontWeight,o=t.textDecoration.split(" "),r=n==="700"||n==="bold",i=o.includes("line-through"),s=t.fontStyle==="italic",a=o.includes("underline"),l=t.verticalAlign;return c=>(ne(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),a&&!c.hasFormat("underline")&&c.toggleFormat("underline"),l!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),l!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}var za=class t extends Es{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let n=super.createDOM(e),o=Ra(e.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(e){return Qp().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&V(126),super.setTextContent(" ")}spliceText(e,n,o,r){return o===""&&n===0||o===" "&&n===1||V(286),this}setDetail(e){return e!==2&&V(127),this}setMode(e){return e!=="normal"&&V(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Qp(){return Yc(new za)}function ky(t){return t instanceof za}var ny=class{constructor(e,n,o){this._selection=null,this.key=e,this.offset=n,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:qy(Oo(Ti(this,"next")),Oo(Ti(e,"next")))<0}getNode(){let e=$t(this.key);return e===null&&V(20),e}set(e,n,o,r){let i=this._selection,s=this.key;r&&this.key===e&&this.offset===n&&this.type===o||(this.key=e,this.offset=n,this.type=o,Ja()||(_i()===s&&qt(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Mo(t,e,n){return new ny(t,e,n)}function Ab(t,e){let n=e.__key,o=t.offset,r="element";if(ne(e)){r="text";let i=e.getTextContentSize();o>i&&(o=i)}else if(!K(e)){let i=e.getNextSibling();if(ne(i))n=i.__key,o=0,r="text";else{let s=e.getParent();s&&(n=s.__key,o=e.getIndexWithinParent()+1)}}t.set(n,o,r)}function MN(t,e){if(K(e)){let n=e.getLastDescendant();K(n)||ne(n)?Ab(t,n):Ab(t,e)}else Ab(t,e)}var Hp=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!ef(e))return!1;let n=this._nodes,o=e._nodes;return n.size===o.size&&Array.from(n).every((r=>o.has(r)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let n=this.getNodes(),o=n.length,r=n[o-1],i;if(ne(r))i=r.select();else{let s=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=this._nodes,o=[];for(let r of n){let i=$t(r);i!==null&&o.push(i)}return Ja()||(this._cachedNodes=o),o}getTextContent(){let e=this.getNodes(),n="";for(let o=0;o<e.length;o++)n+=e[o].getTextContent();return n}deleteNodes(){let e=this.getNodes();if((He()||Ns())===this&&e[0]){let n=Zt(e[0],"next");PD(wi(n,n))}for(let n of e)n.remove()}};function fe(t){return t instanceof ws}var ws=class t{constructor(e,n,o,r){this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!fe(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let n=(function(o){let r=[],[i,s]=o.getTextSlices();i&&r.push(i.caret.origin);let a=new Set,l=new Set;for(let c of o)if(Ao(c)){let{origin:d}=c;r.length===0?a.add(d):(l.add(d),r.push(d))}else{let{origin:d}=c;K(d)&&l.has(d)||r.push(d)}if(s&&r.push(s.caret.origin),Ss(o.focus)&&K(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let c=Hr(o.focus.origin,"previous");Ao(c)&&a.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=Ya(c))a.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!K(c)||l.has(c)||c.isEmpty()||a.has(c))break;r.pop()}if(r.length===0&&o.isCollapsed()){let c=Oo(o.anchor),d=Oo(o.anchor.getFlipped()),u=h=>$r(h)?h.origin:h.getNodeAtCaret(),p=u(c)||u(d)||(o.anchor.getNodeAtCaret()?c.origin:d.origin);r.push(p)}return r})(Xy(uy(this),"next"));return Ja()||(this._cachedNodes=n),n}setTextNodeRange(e,n,o,r){this.anchor.set(e.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let n=e[0],o=e[e.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[a,l]=oy(this),c="",d=!0;for(let u=0;u<e.length;u++){let p=e[u];if(K(p)&&!p.isInline())d||(c+=`
111
- `),d=!p.isEmpty();else if(d=!1,ne(p)){let h=p.getTextContent();p===n?p===o?r.type==="element"&&i.type==="element"&&i.offset!==r.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=s?h.slice(a):h.slice(l):p===o&&(h=s?h.slice(0,l):h.slice(0,a)),c+=h}else!Ze(p)&&!ys(p)||p===o&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(e){let n=at(),o=n.getEditorState()._selection,r=Q1(e.startContainer,e.startOffset,e.endContainer,e.endOffset,n,o);if(r===null)return;let[i,s]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),Rp(this)}clone(){let e=this.anchor,n=this.focus;return new t(Mo(e.key,e.offset,e.type),Mo(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Wp(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let n=fn[e];return!!(this.format&n)}insertRawText(e){let n=e.split(/(\r?\n|\t)/),o=[],r=n.length;for(let i=0;i<r;i++){let s=n[i];s===`
112
- `||s===`\r
113
- `?o.push($a()):s===" "?o.push(Qp()):o.push(Gt(s))}this.insertNodes(o)}insertText(e){let n=this.anchor,o=this.focus,r=this.format,i=this.style,s=n,a=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,a=n),s.type==="element"&&(function(_,b,y,v){let x=_.getNode(),E=x.getChildAtIndex(_.offset),C=Gt(),k=Pn(x)?Br().append(C):C;C.setFormat(y),C.setStyle(v),E===null?x.append(k):E.insertBefore(k),_.is(b)&&b.set(C.__key,0,"text"),_.set(C.__key,0,"text")})(s,a,r,i),a.type==="element"&&qa(a,Oo(Ti(a,"next")));let l=s.offset,c=a.offset,d=this.getNodes(),u=d.length,p=d[0];ne(p)||V(26);let h=p.getTextContent().length,g=p.getParentOrThrow(),m=d[u-1];if(u===1&&a.type==="element"&&(c=h,a.set(s.key,c,"text")),this.isCollapsed()&&l===h&&(Lr(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let _=p.getNextSibling();if(ne(_)&&_.canInsertTextBefore()&&!Lr(_)||(_=Gt(),_.setFormat(r),_.setStyle(i),g.canInsertTextAfter()?p.insertAfter(_):g.insertAfter(_)),_.select(0,0),p=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(Lr(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let _=p.getPreviousSibling();if(ne(_)&&!Lr(_)||(_=Gt(),_.setFormat(r),g.canInsertTextBefore()?p.insertBefore(_):g.insertBefore(_)),_.select(),p=_,e!=="")return void this.insertText(e)}else if(p.isSegmented()&&l!==h){let _=Gt(p.getTextContent());_.setFormat(r),p.replace(_),p=_}else if(!this.isCollapsed()&&e!==""){let _=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||K(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Z1(this.anchor,this.focus,null),void this.insertText(e)}if(u===1){if(bi(p)){let v=Gt(e);return v.select(),void p.replace(v)}let _=p.getFormat(),b=p.getStyle();if(l!==c||_===r&&b===i){if(ky(p)){let v=Gt(e);return v.setFormat(r),v.setStyle(i),v.select(),void p.replace(v)}}else{if(p.getTextContent()!==""){let v=Gt(e);if(v.setFormat(r),v.setStyle(i),v.select(),l===0)p.insertBefore(v,!1);else{let[x]=p.splitText(l);x.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}p.setFormat(r),p.setStyle(i)}let y=c-l;p=p.spliceText(l,y,e,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(p.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=b))}else{let _=new Set([...p.getParentKeys(),...m.getParentKeys()]),b=K(p)?p:p.getParentOrThrow(),y=K(m)?m:m.getParentOrThrow(),v=m;if(!b.is(y)&&y.isInline())do v=y,y=y.getParentOrThrow();while(y.isInline());if(a.type==="text"&&(c!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<c)if(ne(m)&&!bi(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let T=Gt(m.getTextContent());m.replace(T),m=T}Pn(a.getNode())||a.type!=="text"||(m=m.spliceText(0,c,"")),_.add(m.__key)}else{let T=m.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?m.remove():T.remove()}else _.add(m.__key);let x=y.getChildren(),E=new Set(d),C=b.is(y),k=b.isInline()&&p.getNextSibling()===null?b:p;for(let T=x.length-1;T>=0;T--){let w=x[T];if(w.is(p)||K(w)&&w.isParentOf(p))break;w.isAttached()&&(!E.has(w)||w.is(v)?C||k.insertAfter(w,!1):w.remove())}if(!C){let T=y,w=null;for(;T!==null;){let S=T.getChildren(),N=S.length;(N===0||S[N-1].is(w))&&(_.delete(T.__key),w=T),T=T.getParent()}}if(bi(p))if(l===h)p.select();else{let T=Gt(e);T.select(),p.replace(T)}else p=p.spliceText(l,h-l,e,!0),p.getTextContent()===""?p.remove():p.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let T=1;T<u;T++){let w=d[T],S=w.__key;_.has(S)||w.remove()}}}removeText(){let e=He()===this;Mc(this,FD(uy(this))),e&&He()!==this&&$n(this)}formatText(e,n=null){if(this.isCollapsed())return this.toggleFormat(e),void qt(null);let o=this.getNodes(),r=[];for(let x of o)ne(x)&&r.push(x);let i=x=>{o.forEach((E=>{if(K(E)){let C=E.getFormatFlags(e,x);E.setTextFormat(C)}}))},s=r.length;if(s===0)return this.toggleFormat(e),qt(null),void i(n);let a=this.anchor,l=this.focus,c=this.isBackward(),d=c?l:a,u=c?a:l,p=0,h=r[0],g=d.type==="element"?0:d.offset;if(d.type==="text"&&g===h.getTextContentSize()&&(p=1,h=r[1],g=0),h==null)return;let m=h.getFormatFlags(e,n);i(m);let _=s-1,b=r[_],y=u.type==="text"?u.offset:b.getTextContentSize();if(h.is(b)){if(g===y)return;if(Lr(h)||g===0&&y===h.getTextContentSize())h.setFormat(m);else{let x=h.splitText(g,y),E=g===0?x[0]:x[1];E.setFormat(m),d.type==="text"&&d.set(E.__key,0,"text"),u.type==="text"&&u.set(E.__key,y-g,"text")}return void(this.format=m)}g===0||Lr(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);let v=b.getFormatFlags(e,m);y>0&&(y===b.getTextContentSize()||Lr(b)||([b]=b.splitText(y)),b.setFormat(v));for(let x=p+1;x<_;x++){let E=r[x],C=E.getFormatFlags(e,v);E.setFormat(C)}d.type==="text"&&d.set(h.__key,g,"text"),u.type==="text"&&u.set(b.__key,y,"text"),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=He();return fe(g)||V(134),g.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Fb(n,Fr),r=e[e.length-1];if(K(o)&&"__language"in o){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let g=Mb(this);o.splice(g,0,e),r.selectEnd()}return}if(!e.some((g=>(K(g)||Ze(g))&&!g.isInline()))){K(o)||V(211,n.constructor.name,n.getType());let g=Mb(this);return o.splice(g,0,e),void r.selectEnd()}let i=(function(g){let m=Br(),_=null;for(let b=0;b<g.length;b++){let y=g[b],v=ys(y);if(v||Ze(y)&&y.isInline()||K(y)&&y.isInline()||ne(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),v))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m})(e),s=i.getLastDescendant(),a=i.getChildren(),l=!K(o)||!o.isEmpty()?this.insertParagraph():null,c=a[a.length-1],d=a[0];var u;K(u=d)&&Fr(u)&&!u.isEmpty()&&K(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(K(o)||V(211,n.constructor.name,n.getType()),o.append(...d.getChildren()),d=a[1]),d&&(o===null&&V(212,n.constructor.name,n.getType()),(function(g,m,_){let b=m.getParentOrThrow().getLastChild(),y=m,v=[m];for(;y!==b;)y.getNextSibling()||V(140),y=y.getNextSibling(),v.push(y);let x=g;for(let E of v)x=x.insertAfter(E)})(o,d));let p=Fb(s,Fr);l&&K(p)&&(l.canMergeWhenEmpty()||Fr(c))&&(p.append(...l.getChildren()),l.remove()),K(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let h=K(o)?o.getLastChild():null;ys(h)&&p!==o&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Br();return Bn().splice(this.anchor.offset,0,[s]),s.select(),s}let e=Mb(this),n=Fb(this.anchor.getNode(),Fr);K(n)||V(213);let o=n.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],i=n.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let n=$a();if(this.insertNodes([n]),e){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let e=this.getNodes(),n=e.length,o=n-1,r=this.anchor,i=this.focus,s=e[0],a=e[o],[l,c]=oy(this);if(n===0)return[];if(n===1){if(ne(s)&&!this.isCollapsed()){let u=l>c?c:l,p=l>c?l:c,h=s.splitText(u,p),g=u===0?h[0]:h[1];return g!=null?[g]:[]}return[s]}let d=r.isBefore(i);if(ne(s)){let u=d?l:c;u===s.getTextContentSize()?e.shift():u!==0&&([,s]=s.splitText(u),e[0]=s)}if(ne(a)){let u=a.getTextContent().length,p=d?c:l;p===0?e.pop():p!==u&&([a]=a.splitText(p),e[o]=a)}return e}modify(e,n,o){if(HN(this,e,n,o))return;let r=e==="move",i=at(),s=nr(Co(i));if(!s)return;let a=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(l===null||a===null||!K(c)||c.isInline()||c.canBeEmpty()||sy(a,i,l),this.dirty){let d=ja(i,this.anchor.key),u=ja(i,this.focus.key);this.anchor.type==="text"&&(d=Ts(d)),this.focus.type==="text"&&(u=Ts(u)),d&&u&&nD(s,d,this.anchor.offset,u,this.focus.offset)}if((function(d,u,p,h){d.modify(u,p,h)})(s,e,n?"backward":"forward",o),s.rangeCount>0){let d=s.getRangeAt(0),u=this.anchor.getNode(),p=Pn(u)?u:SD(u);if(this.applyDOMRange(d),this.dirty=!0,!r){let h=this.getNodes(),g=[],m=!1;for(let _=0;_<h.length;_++){let b=h[_];Yp(b,p)?g.push(b):m=!0}if(m&&g.length>0)if(n){let _=g[0];K(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{let _=g[g.length-1];K(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}s.anchorNode===d.startContainer&&s.anchorOffset===d.startOffset||(function(_){let b=_.focus,y=_.anchor,v=y.key,x=y.offset,E=y.type;y.set(b.key,b.offset,b.type,!0),b.set(v,x,E,!0)})(this)}}o==="lineboundary"&&HN(this,e,n,o,"decorators")}forwardDeletion(e,n,o){if(!o&&(e.type==="element"&&K(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){let r=n.getParent(),i=n.getNextSibling()||(r===null?null:r.getNextSibling());if(K(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,e))return;let i=Gy(Ti(o,e?"previous":"next"));if(i.getTextSlices().every((a=>a===null||a.distance===0))){let a={type:"initial"};for(let l of i.iterNodeCarets("shadowRoot"))if(Ao(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(a.type==="merge-block")break;if(K(i.anchor.origin)&&i.anchor.origin.isEmpty()){let c=Oo(l);Mc(this,wi(c,c)),i.anchor.origin.remove()}return}a.type!=="merge-next-block"&&a.type!=="merge-block"||(a={block:a.block,caret:l,type:"merge-block"})}}else{if(a.type==="merge-block")break;if(Ss(l)){if(K(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(i.anchor.origin))break}else a={block:l.origin,type:"merge-next-block"};continue}if(Ze(l.origin)){if(!l.origin.isIsolated())if(a.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&K(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let c=Ny();c.add(l.origin.getKey()),$n(c)}else l.origin.remove();return}break}}if(a.type==="merge-block"){let{caret:l,block:c}=a;return Mc(this,wi(!l.origin.isEmpty()&&c.isEmpty()?Za(Zt(c,l.direction)):i.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&RN(this,o.getNode()))return}else{let a=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,a!==null&&a.isSegmented()){let l=s.offset,c=a.getTextContentSize();if(a.is(r)||e&&l!==c||!e&&l!==0)return void PN(a,e,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,c=r.getTextContentSize();if(r.is(a)||e&&l!==0||!e&&l!==c)return void PN(r,e,l)}(function(l,c){let d=l.anchor,u=l.focus,p=d.getNode(),h=u.getNode();if(p===h&&d.type==="text"&&u.type==="text"){let g=d.offset,m=u.offset,_=g<m,b=_?g:m,y=_?m:g,v=y-1;b!==v&&(function(x){return!(bD(x)||ZK(x))})(p.getTextContent().slice(b,y))&&(c?u.set(u.key,v,u.type):d.set(d.key,v,d.type))}})(this,e)}}if(this.removeText(),e&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Pn(o.getParent())&&o.getPreviousSibling()===null&&RN(this,o)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function ef(t){return t instanceof Hp}function LN(t){let e=t.offset;if(t.type==="text")return e;let n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function oy(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[n,o]=e;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[LN(n),LN(o)]}function RN(t,e){for(let n=e;n;n=n.getParent()){if(K(n)){if(n.collapseAtStart(t))return!0;if(Lo(n))break}if(n.getPreviousSibling())break}return!1}var ZK=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function PN(t,e,n){let o=t,r=o.getTextContent().split(/(?=\s)/g),i=r.length,s=0,a=0;for(let c=0;c<i;c++){let d=c===i-1;if(a=s,s+=r[c].length,e&&s===n||s>n||d){r.splice(c,1),d&&(a=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(a,a))}function FN(t,e,n,o){let r,i=e;if(Sn(t)){let s=!1,a=t.childNodes,l=a.length,c=o._blockCursorElement;i===l&&(s=!0,i=l-1);let d=a[i],u=!1;if(d===c)d=a[i+1],u=!0;else if(c!==null){let p=c.parentNode;t===p&&e>Array.prototype.indexOf.call(p.children,c)&&i--}if(r=Aa(d),ne(r))i=XN(r,s);else{let p=Aa(t);if(p===null)return null;if(K(p)){let h=o.getElementByKey(p.getKey());h===null&&V(214),[p,i]=p.getDOMSlot(h).resolveChildIndex(p,h,t,e),K(p)||V(215),s&&i>=p.getChildrenSize()&&(i=Math.max(0,p.getChildrenSize()-1));let m=p.getChildAtIndex(i);if(K(m)&&(function(_,b,y){let v=_.getParent();return y===null||v===null||!v.canBeEmpty()||v!==y.getNode()})(m,0,n)){let _=s?m.getLastDescendant():m.getFirstDescendant();_===null?p=m:(m=_,p=K(m)?m:m.getParentOrThrow()),i=0}ne(m)?(r=m,p=null,i=XN(m,s)):m!==p&&s&&!u&&(K(p)||V(216),i=Math.min(p.getChildrenSize(),i+1))}else{let h=p.getIndexWithinParent();i=e===0&&Ze(p)&&Aa(t)===p?h:h+1,p=p.getParentOrThrow()}if(K(p))return Mo(p.__key,i,"element")}}else r=Aa(t);return ne(r)?Mo(r.__key,i,"text"):null}function BN(t,e,n){let o=t.offset,r=t.getNode();if(o===0){let i=r.getPreviousSibling(),s=r.getParent();if(e){if((n||!e)&&i===null&&K(s)&&s.isInline()){let a=s.getPreviousSibling();ne(a)&&t.set(a.__key,a.getTextContent().length,"text")}}else K(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):ne(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(o===r.getTextContent().length){let i=r.getNextSibling(),s=r.getParent();if(e&&K(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&K(s)&&s.isInline()&&!s.canInsertTextAfter()){let a=s.getNextSibling();ne(a)&&t.set(a.__key,0,"text")}}}function Z1(t,e,n){if(t.type==="text"&&e.type==="text"){let o=t.isBefore(e),r=t.is(e);BN(t,o,r),BN(e,!o,r),r&&e.set(t.key,t.offset,t.type);let i=at();if(i.isComposing()&&i._compositionKey!==t.key&&fe(n)){let s=n.anchor,a=n.focus;t.set(s.key,s.offset,s.type,!0),e.set(a.key,a.offset,a.type,!0)}}}function Q1(t,e,n,o,r,i){if(t===null||n===null||!Vc(r,t,n))return null;let s=FN(t,e,fe(i)?i.anchor:null,r);if(s===null)return null;let a=FN(n,o,fe(i)?i.focus:null,r);if(a===null)return null;if(s.type==="element"&&a.type==="element"){let l=Aa(t),c=Aa(n);if(Ze(l)&&Ze(c))return null}return Z1(s,a,i),[s,a]}function QK(t){return K(t)&&!t.isInline()}function eD(t,e,n,o,r,i){let s=Ur(),a=new ws(Mo(t,e,r),Mo(n,o,i),0,"");return a.dirty=!0,s._selection=a,a}function tD(){let t=Mo("root",0,"element"),e=Mo("root",0,"element");return new ws(t,e,0,"")}function Ny(){return new Hp(new Set)}function e3(t,e){return tf(null,t,e,null)}function tf(t,e,n,o){let r=n._window;if(r===null)return null;let i=o||r.event,s=i?i.type:void 0,a=s==="selectionchange",l=!$b&&(a||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0),c,d,u,p;if(fe(t)&&!l)return t.clone();if(e===null)return null;if(c=e.anchorNode,d=e.focusNode,u=e.anchorOffset,p=e.focusOffset,a&&fe(t)&&!Vc(n,c,d))return t.clone();let h=Q1(c,u,d,p,n,t);if(h===null)return null;let[g,m]=h;return new ws(g,m,fe(t)?t.format:0,fe(t)?t.style:"")}function He(){return Ur()._selection}function Ns(){return at()._editorState._selection}function Up(t,e,n,o=1){let r=t.anchor,i=t.focus,s=r.getNode(),a=i.getNode();if(!e.is(s)&&!e.is(a))return;let l=e.__key;if(t.isCollapsed()){let c=r.offset;if(n<=c&&o>0||n<c&&o<0){let d=Math.max(0,c+o);r.set(l,d,"element"),i.set(l,d,"element"),$N(t)}}else{let c=t.isBackward(),d=c?i:r,u=d.getNode(),p=c?r:i,h=p.getNode();if(e.is(u)){let g=d.offset;(n<=g&&o>0||n<g&&o<0)&&d.set(l,Math.max(0,g+o),"element")}if(e.is(h)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}$N(t)}function $N(t){let e=t.anchor,n=e.offset,o=t.focus,r=o.offset,i=e.getNode(),s=o.getNode();if(t.isCollapsed()){if(!K(i))return;let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(ne(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text"),o.set(c.__key,d,"text")}}else{if(K(i)){let a=i.getChildrenSize(),l=n>=a,c=l?i.getChildAtIndex(a-1):i.getChildAtIndex(n);if(ne(c)){let d=0;l&&(d=c.getTextContentSize()),e.set(c.__key,d,"text")}}if(K(s)){let a=s.getChildrenSize(),l=r>=a,c=l?s.getChildAtIndex(a-1):s.getChildAtIndex(r);if(ne(c)){let d=0;l&&(d=c.getTextContentSize()),o.set(c.__key,d,"text")}}}}function Kp(t,e,n,o,r){let i=null,s=0,a=null;o!==null?(i=o.__key,ne(o)?(s=o.getTextContentSize(),a="text"):K(o)&&(s=o.getChildrenSize(),a="element")):r!==null&&(i=r.__key,ne(r)?a="text":K(r)&&(a="element")),i!==null&&a!==null?t.set(i,s,a):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function zN(t,e,n,o,r){t.type==="text"?t.set(n,t.offset+(e?0:r),"text"):t.offset>o.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function nD(t,e,n,o,r){try{t.setBaseAndExtent(e,n,o,r)}catch{}}function t3(t,e,n,o,r,i,s){let a=o.anchorNode,l=o.focusNode,c=o.anchorOffset,d=o.focusOffset,u=document.activeElement;if(r.has(lD)&&u!==i||u!==null&&Ry(u))return;if(!fe(e))return void(t!==null&&Vc(n,a,l)&&o.removeAllRanges());let p=e.anchor,h=e.focus,g=p.key,m=h.key,_=ja(n,g),b=ja(n,m),y=p.offset,v=h.offset,x=e.format,E=e.style,C=e.isCollapsed(),k=_,T=b,w=!1;if(p.type==="text"){k=Ts(_);let I=p.getNode();w=I.getFormat()!==x||I.getStyle()!==E}else fe(t)&&t.anchor.type==="text"&&(w=!0);var S,N,D,O,A;if(h.type==="text"&&(T=Ts(b)),k!==null&&T!==null&&(C&&(t===null||w||fe(t)&&(t.format!==x||t.style!==E))&&(S=x,N=E,D=y,O=g,A=performance.now(),j1=[S,N,D,O,A]),c!==y||d!==v||a!==k||l!==T||o.type==="Range"&&C||(u!==null&&i.contains(u)||i.focus({preventScroll:!0}),p.type==="element"))){if(nD(o,k,y,T,v),!r.has(cD)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let I=fe(e)&&e.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(I!==null){let R;if(I instanceof Text){let z=document.createRange();z.selectNode(I),R=z.getBoundingClientRect()}else R=I.getBoundingClientRect();(function(z,W,Z){let F=Hy(Z),se=Uy(F);if(F===null||se===null)return;let{top:ye,bottom:ut}=W,Rt=0,ot=0,pt=Z;for(;pt!==null;){let oe=pt===F.body;if(oe)Rt=0,ot=Co(z).innerHeight;else{let xe=pt.getBoundingClientRect();Rt=xe.top,ot=xe.bottom}let ee=0;if(ye<Rt?ee=-(Rt-ye):ut>ot&&(ee=ut-ot),ee!==0)if(oe)se.scrollBy(0,ee);else{let xe=pt.scrollTop;pt.scrollTop+=ee;let Be=pt.scrollTop-xe;ye-=Be,ut-=Be}if(oe)break;pt=Gc(pt)}})(n,R,i)}}Qb=!0}}function n3(t){let e=He()||Ns();e===null&&(e=Bn().selectEnd()),e.insertNodes(t)}function o3(){let t=He();return t===null?"":t.getTextContent()}function Mb(t){let e=t;t.isCollapsed()||e.removeText();let n=He();fe(n)&&(e=n),fe(e)||V(161);let o=e.anchor,r=o.getNode(),i=o.offset;for(;!Fr(r);){let s=r;if([r,i]=r3(r,i),s.is(r))break}return i}function r3(t,e){let n=t.getParent();if(!n){let r=Br();return Bn().append(r),r.select(),[Bn(),0]}if(ne(t)){let r=t.splitText(e);if(r.length===0)return[n,t.getIndexWithinParent()];let i=e===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!K(t)||e===0)return[n,t.getIndexWithinParent()];let o=t.getChildAtIndex(e);if(o){let r=new ws(Mo(t.__key,e,"element"),Mo(t.__key,e,"element"),0,""),i=t.insertNewAfter(r);i&&i.append(o,...o.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function HN(t,e,n,o,r="decorators-and-blocks"){if(e==="move"&&o==="character"&&!t.isCollapsed()){let[d,u]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return u.set(d.key,d.offset,d.type),!0}let i=Ti(t.focus,n?"previous":"next"),s=o==="lineboundary",a=e==="move",l=i,c=r==="decorators-and-blocks";if(!BD(l)){for(let d of l){c=!1;let{origin:u}=d;if(!Ze(u)||u.isIsolated()||(l=d,!s||!u.isInline()))break}if(c)for(let d of Gy(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(Ao(d))d.origin.isInline()||(l=d);else{if(K(d.origin))continue;Ze(d.origin)&&!d.origin.isInline()&&(l=d)}break}}if(l===i)return!1;if(a&&!s&&Ze(l.origin)&&l.origin.isKeyboardSelectable()){let d=Ny();return d.add(l.origin.getKey()),$n(d),!0}return l=Oo(l),a&&qa(t.anchor,l),qa(t.focus,l),c||!s}var Jt=null,Xt=null,Fn=!1,Lb=!1,Dp=0,UN={characterData:!0,childList:!0,subtree:!0};function Ja(){return Fn||Jt!==null&&Jt._readOnly}function Yt(){Fn&&V(13)}function oD(){Dp>99&&V(14)}function Ur(){return Jt===null&&V(195,rD()),Jt}function at(){return Xt===null&&V(196,rD()),Xt}function rD(){let t=0,e=new Set,n=Ka.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let i=Wc(r);if(nf(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let o=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function i3(){return Xt}function KN(t,e,n){let o=e.__type,r=My(t,o),i=n.get(o);i===void 0&&(i=Array.from(r.transforms),n.set(o,i));let s=i.length;for(let a=0;a<s&&(i[a](e),e.isAttached());a++);}function jN(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function iD(t,e){if(!e)return;let n=t._updateTags,o=e;Array.isArray(e)||(o=[e]);for(let r of o)n.add(r)}function s3(t){return Dy(t,at()._nodes)}function Dy(t,e){let n=t.type,o=e.get(n);o===void 0&&V(17,n);let r=o.klass;t.type!==r.getType()&&V(18,r.name);let i=r.importJSON(t),s=t.children;if(K(i)&&Array.isArray(s))for(let a=0;a<s.length;a++){let l=Dy(s[a],e);i.append(l)}return i}function VN(t,e,n){let o=Jt,r=Fn,i=Xt;Jt=e,Fn=!0,Xt=t;try{return n()}finally{Jt=o,Fn=r,Xt=i}}function Pr(t,e){let n=t._pendingEditorState,o=t._rootElement,r=t._headless||o===null;if(n===null)return;let i=t._editorState,s=i._selection,a=n._selection,l=t._dirtyType!==vs,c=Jt,d=Fn,u=Xt,p=t._updating,h=t._observer,g=null;if(t._pendingEditorState=null,t._editorState=n,!r&&l&&h!==null){Xt=t,Jt=n,Fn=!1,t._updating=!0;try{let C=t._dirtyType,k=t._dirtyElements,T=t._dirtyLeaves;h.disconnect(),g=MK(i,n,t,C,k,T)}catch(C){if(C instanceof Error&&t._onError(C),Lb)throw C;return uD(t,null,o,n),f1(t),t._dirtyType=Fa,Lb=!0,Pr(t,i),void(Lb=!1)}finally{h.observe(o,UN),t._updating=p,Jt=c,Fn=d,Xt=u}}n._readOnly||(n._readOnly=!0);let m=t._dirtyLeaves,_=t._dirtyElements,b=t._normalizedNodes,y=t._updateTags,v=t._deferred;l&&(t._dirtyType=vs,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),(function(C,k){let T=C._decorators,w=C._pendingDecorators||T,S=k._nodeMap,N;for(N in w)S.has(N)||(w===T&&(w=mD(C)),delete w[N])})(t,n);let x=r?null:nr(Co(t));if(t._editable&&x!==null&&(l||a===null||a.dirty)&&o!==null&&!y.has(dD)){Xt=t,Jt=n;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){let C=t._blockCursorElement;C!==null&&sy(C,t,o),t3(s,a,t,x,y,o)}(function(C,k,T){let w=C._blockCursorElement;if(fe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&k.contains(document.activeElement)){let S=T.anchor,N=S.getNode(),D=S.offset,O=!1,A=null;if(D===N.getChildrenSize())Pb(N.getChildAtIndex(D-1))&&(O=!0);else{let I=N.getChildAtIndex(D);if(I!==null&&Pb(I)){let R=I.getPreviousSibling();(R===null||Pb(R))&&(O=!0,A=C.getElementByKey(I.__key))}}if(O){let I=C.getElementByKey(N.__key);return w===null&&(C._blockCursorElement=w=(function(R){let z=R.theme,W=document.createElement("div");W.contentEditable="false",W.setAttribute("data-lexical-cursor","true");let Z=z.blockCursor;if(Z!==void 0){if(typeof Z=="string"){let F=Mp(Z);Z=z.blockCursor=F}Z!==void 0&&W.classList.add(...Z)}return W})(C._config)),k.style.caretColor="transparent",void(A===null?I.appendChild(w):I.insertBefore(w,A))}}w!==null&&sy(w,C,k)})(t,o,a)}finally{h!==null&&h.observe(o,UN),Xt=u,Jt=c}}g!==null&&(function(C,k,T,w,S){let N=Array.from(C._listeners.mutation),D=N.length;for(let O=0;O<D;O++){let[A,I]=N[O];for(let R of I){let z=k.get(R);z!==void 0&&A(z,{dirtyLeaves:w,prevEditorState:S,updateTags:T})}}})(t,g,y,m,i),fe(a)||a===null||s!==null&&s.is(a)||t.dispatchCommand(xy,void 0);let E=t._pendingDecorators;E!==null&&(t._decorators=E,t._pendingDecorators=null,Ic("decorator",t,!0,E)),(function(C,k,T){let w=JN(k),S=JN(T);w!==S&&Ic("textcontent",C,!0,S)})(t,e||i,n),Ic("update",t,!0,{dirtyElements:_,dirtyLeaves:m,editorState:n,mutatedNodes:g,normalizedNodes:b,prevEditorState:e||i,tags:y}),(function(C,k){if(C._deferred=[],k.length!==0){let T=C._updating;C._updating=!0;try{for(let w=0;w<k.length;w++)k[w]()}finally{C._updating=T}}})(t,v),(function(C){let k=C._updates;if(k.length!==0){let T=k.shift();if(T){let[w,S]=T;Oy(C,w,S)}}})(t)}function Ic(t,e,n,...o){let r=e._updating;e._updating=n;try{let i=Array.from(e._listeners[t]);for(let s=0;s<i.length;s++)i[s].apply(null,o)}finally{e._updating=r}}function WN(t,e){let n=t._updates,o=e||!1;for(;n.length!==0;){let r=n.shift();if(r){let[i,s]=r,a;if(s!==void 0){if(a=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete){let l=t._pendingEditorState;l===null&&V(191),l._flushSync=!0}a&&t._deferred.push(a),iD(t,s.tag)}i()}}return o}function Oy(t,e,n){let o=t._updateTags,r,i=!1,s=!1;n!==void 0&&(r=n.onUpdate,iD(t,n.tag),i=n.skipTransforms||!1,s=n.discrete||!1),r&&t._deferred.push(r);let a=t._editorState,l=t._pendingEditorState,c=!1;(l===null||l._readOnly)&&(l=t._pendingEditorState=sD(l||a),c=!0),l._flushSync=s;let d=Jt,u=Fn,p=Xt,h=t._updating;Jt=l,Fn=!1,t._updating=!0,Xt=t;let g=t._headless||t.getRootElement()===null;Ay(null);try{c&&(g?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=(function(y,v){let x=y.getEditorState()._selection,E=nr(Co(y));return fe(x)||x==null?tf(x,E,y,v):x.clone()})(t,n&&n.event||null));let _=t._compositionKey;e(),i=WN(t,i),(function(y,v){let x=v.getEditorState()._selection,E=y._selection;if(fe(E)){let C=E.anchor,k=E.focus,T;if(C.type==="text"&&(T=C.getNode(),T.selectionTransform(x,E)),k.type==="text"){let w=k.getNode();T!==w&&w.selectionTransform(x,E)}}})(l,t),t._dirtyType!==vs&&(i?(function(y,v){let x=v._dirtyLeaves,E=y._nodeMap;for(let C of x){let k=E.get(C);ne(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&EN(k)}})(l,t):(function(y,v){let x=v._dirtyLeaves,E=v._dirtyElements,C=y._nodeMap,k=_i(),T=new Map,w=x,S=w.size,N=E,D=N.size;for(;S>0||D>0;){if(S>0){v._dirtyLeaves=new Set;for(let O of w){let A=C.get(O);ne(A)&&A.isAttached()&&A.isSimpleText()&&!A.isUnmergeable()&&EN(A),A!==void 0&&jN(A,k)&&KN(v,A,T),x.add(O)}if(w=v._dirtyLeaves,S=w.size,S>0){Dp++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map,N.delete("root")&&N.set("root",!0);for(let O of N){let A=O[0],I=O[1];if(E.set(A,I),!I)continue;let R=C.get(A);R!==void 0&&jN(R,k)&&KN(v,R,T)}w=v._dirtyLeaves,S=w.size,N=v._dirtyElements,D=N.size,Dp++}v._dirtyLeaves=x,v._dirtyElements=E})(l,t),WN(t),(function(y,v,x,E){let C=y._nodeMap,k=v._nodeMap,T=[];for(let[w]of E){let S=k.get(w);S!==void 0&&(S.isAttached()||(K(S)&&d1(S,w,C,k,T,E),C.has(w)||E.delete(w),T.push(w)))}for(let w of T)k.delete(w);for(let w of x){let S=k.get(w);S===void 0||S.isAttached()||(C.has(w)||x.delete(w),k.delete(w))}})(a,l,t._dirtyLeaves,t._dirtyElements)),_!==t._compositionKey&&(l._flushSync=!0);let b=l._selection;if(fe(b)){let y=l._nodeMap,v=b.anchor.key,x=b.focus.key;y.get(v)!==void 0&&y.get(x)!==void 0||V(19)}else ef(b)&&b._nodes.size===0&&(l._selection=null)}catch(_){return _ instanceof Error&&t._onError(_),t._pendingEditorState=a,t._dirtyType=Fa,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void Pr(t)}finally{Jt=d,Fn=u,Xt=p,t._updating=h,Dp=0}t._dirtyType!==vs||t._deferred.length>0||(function(_,b){let y=b.getEditorState()._selection,v=_._selection;if(v!==null){if(v.dirty||!v.is(y))return!0}else if(y!==null)return!0;return!1})(l,t)?l._flushSync?(l._flushSync=!1,Pr(t)):c&&x3((()=>{Pr(t)})):(l._flushSync=!1,c&&(o.clear(),t._deferred=[],t._pendingEditorState=null))}function oo(t,e,n){Xt===t&&n===void 0?e():Oy(t,e,n)}var ry=class t{constructor(e,n,o){this.element=e,this.before=n||null,this.after=o||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&V(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&V(224),this.element.replaceChild(e,n),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let n=e==="decorator"&&(Pa||Lc);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let n=this.element,o=e.nodeName==="IMG"?e.nextSibling:null;o&&n.removeChild(o),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,i=document.createElement("br");if(o.insertBefore(i,r),e){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,i),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let n=this.after;n!==null;n=n.previousSibling)e++;return e}resolveChildIndex(e,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,r))]}let i=GN(n,o);i.push(r);let s=GN(n,this.element),a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){let c=i[l],d=s[l];if(c===void 0||c<d)break;if(c>d){a+=1;break}}return[e.getParentOrThrow(),a]}};function GN(t,e){let n=[],o=e;for(;o!==t&&o!==null;o=o.parentNode){let r=0;for(let i=o.previousSibling;i!==null;i=i.previousSibling)r++;n.push(r)}return o!==t&&V(225),n.reverse()}var Ci=class extends vi{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return bK[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getChildrenKeys(){let e=[],n=this.getFirstChild();for(;n!==null;)e.push(n.__key),n=n.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=at()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(e)}getAllTextNodes(){let e=[],n=this.getFirstChild();for(;n!==null;){if(ne(n)&&e.push(n),K(n)){let o=n.getAllTextNodes();e.push(...o)}n=n.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;K(e);){let n=e.getFirstChild();if(n===null)break;e=n}return e}getLastDescendant(){let e=this.getLastChild();for(;K(e);){let n=e.getLastChild();if(n===null)break;e=n}return e}getDescendantByIndex(e){let n=this.getChildren(),o=n.length;if(e>=o){let i=n[o-1];return K(i)&&i.getLastDescendant()||i||null}let r=n[e];return K(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:$t(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:$t(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){let n=this.getChildrenSize(),o,r;if(e<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContent(),K(i)&&r!==o-1&&!i.isInline()&&(e+=zr)}return e}getTextContentSize(){let e=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let i=n[r];e+=i.getTextContentSize(),K(i)&&r!==o-1&&!i.isInline()&&(e+=zr.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let n=gN[e];return!!(this.getFormat()&n)}return!1}hasTextFormat(e){let n=fn[e];return!!(this.getTextFormat()&n)}getFormatFlags(e,n){return Wp(this.getLatest().__textFormat,e,n)}getTextStyle(){return this.getLatest().__textStyle}select(e,n){Yt();let o=He(),r=e,i=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&n===0){let l=this.getFirstChild();if(ne(l)||K(l))return l.select(0,0)}else if(!(e!==void 0&&e!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(ne(l)||K(l))return l.select()}}r===void 0&&(r=s),i===void 0&&(i=s);let a=this.__key;return fe(o)?(o.anchor.set(a,r,"element"),o.focus.set(a,i,"element"),o.dirty=!0,o):eD(a,r,a,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach((n=>n.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let n=this.getWritable();return n.__dir=e,n}setFormat(e){return this.getWritable().__format=e!==""?gN[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let n=this.getWritable();return n.__textFormat=e,n}setTextStyle(e){let n=this.getWritable();return n.__textStyle=e,n}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,o){let r=o.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||V(226,String(e),String(n),String(i));let a=s.__key,l=[],c=[],d=this.getChildAtIndex(e+n),u=null,p=i-n+r;if(e!==0)if(e===i)u=this.getLastChild();else{let g=this.getChildAtIndex(e);g!==null&&(u=g.getPreviousSibling())}if(n>0){let g=u===null?this.getFirstChild():u.getNextSibling();for(let m=0;m<n;m++){g===null&&V(100);let _=g.getNextSibling(),b=g.__key;yi(g.getWritable()),c.push(b),g=_}}let h=u;for(let g=0;g<r;g++){let m=o[g];h!==null&&m.is(h)&&(u=h=h.getPreviousSibling());let _=m.getWritable();_.__parent===a&&p--,yi(_);let b=m.__key;if(h===null)s.__first=b,_.__prev=null;else{let y=h.getWritable();y.__next=b,_.__prev=y.__key}m.__key===a&&V(76),_.__parent=a,l.push(b),h=m}if(e+n===i)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else if(d!==null){let g=d.getWritable();if(h!==null){let m=h.getWritable();g.__prev=h.__key,m.__next=d.__key}else g.__prev=null}if(s.__size=p,c.length){let g=He();if(fe(g)){let m=new Set(c),_=new Set(l),{anchor:b,focus:y}=g;YN(b,m,_)&&Kp(b,b.getNode(),this,u,d),YN(y,m,_)&&Kp(y,y.getNode(),this,u,d),p!==0||this.canBeEmpty()||Lo(this)||this.remove()}}return s}getDOMSlot(e){return new ry(e)}exportDOM(e){let{element:n}=super.exportDOM(e);if(Sn(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n!==0&&(e.textFormat=n),o!==""&&(e.textStyle=o),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,n){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,n){let o=this.getDOMSlot(e),r=o.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let s=n.getElementByKey(i.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function K(t){return t instanceof Ci}function YN(t,e,n){let o=t.getNode();for(;o;){let r=o.__key;if(e.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Kc=class extends vi{decorate(e,n){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Ze(t){return t instanceof Kc}var Ha=class t extends Ci{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){let e=this.__cachedText;return!Ja()&&at()._dirtyType!==vs||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,n){return!1}splice(e,n,o){for(let r of o)K(r)||Ze(r)||V(282);return super.splice(e,n,o)}static importJSON(e){return Bn().updateFromJSON(e)}collapseAtStart(){return!0}};function Pn(t){return t instanceof Ha}function sD(t){return new jp(new Map(t._nodeMap))}function Iy(){return new jp(new Map([["root",new Ha]]))}function aD(t){let e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&V(130,n.name),K(t)){let o=e.children;Array.isArray(o)||V(59,n.name);let r=t.getChildren();for(let i=0;i<r.length;i++){let s=aD(r[i]);o.push(s)}}return e}var jp=class t{constructor(e,n){this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return VN(n&&n.editor||null,this,e)}clone(e){let n=new t(this._nodeMap,e===void 0?this._selection:e);return n._readOnly=!0,n}toJSON(){return VN(null,this,(()=>({root:aD(Bn())})))}},a3="historic",l3="history-push",Op="history-merge",c3="paste",lD="collaboration",d3="skip-collab",cD="skip-scroll-into-view",dD="skip-dom-selection",Vp=class extends Ci{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},Ua=class t extends Ci{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("p"),o=Ra(e.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(e,n,o){return!1}static importDOM(){return{p:e=>({conversion:u3,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(Sn(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(e){return Br().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,n){let o=Br();o.setTextFormat(e.format),o.setTextStyle(e.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let e=this.getChildren();if(e.length===0||ne(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function u3(t){let e=Br();return t.style&&(e.setFormat(t.style.textAlign),AD(t,e)),{node:e}}function Br(){return Yc(new Ua)}function p3(t){return t instanceof Ua}var f3=0,h3=1,g3=2,m3=3,_3=4;function uD(t,e,n,o){let r=t._keyToDOMMap;r.clear(),t._editorState=Iy(),t._pendingEditorState=o,t._compositionKey=null,t._dirtyType=vs,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function b3(t){let e=t||{},n=i3(),o=e.theme||{},r=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=Iy(),a=e.namespace||(r!==null?r._config.namespace:yD()),l=e.editorState,c=[Ha,Es,Ba,za,Ua,Vp,...e.nodes||[]],{onError:d,html:u}=e,p=e.editable===void 0||e.editable,h;if(t===void 0&&n!==null)h=n._nodes;else{h=new Map;for(let m=0;m<c.length;m++){let _=c[m],b=null,y=null;if(typeof _!="function"){let k=_;_=k.replace,b=k.with,y=k.withKlass||null}let{ownNodeConfig:v}=Vy(_),x=_.getType(),E=_.transform(),C=new Set;v&&v.$transform&&C.add(v.$transform),E!==null&&C.add(E),h.set(x,{exportDOM:u&&u.export?u.export.get(_):void 0,klass:_,replace:b,replaceWithKlass:y,sharedNodeState:h1(c[m]),transforms:C})}}let g=new Ka(s,r,h,{disableEvents:i,namespace:a,theme:o},d||console.error,(function(m,_){let b=new Map,y=new Set,v=x=>{Object.keys(x).forEach((E=>{let C=b.get(E);C===void 0&&(C=[],b.set(E,C)),C.push(x[E])}))};return m.forEach((x=>{let E=x.klass.importDOM;if(E==null||y.has(E))return;y.add(E);let C=E.call(x.klass);C!==null&&v(C)})),_&&v(_),b})(h,u?u.import:void 0),p,t);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=Fa),g}var Ka=class{constructor(e,n,o,r,i,s,a,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=vs,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=yD(),this._onError=i,this._htmlConversions=s,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let n=this._listeners.update;return n.add(e),()=>{n.delete(e)}}registerEditableListener(e){let n=this._listeners.editable;return n.add(e),()=>{n.delete(e)}}registerDecoratorListener(e){let n=this._listeners.decorator;return n.add(e),()=>{n.delete(e)}}registerTextContentListener(e){let n=this._listeners.textcontent;return n.add(e),()=>{n.delete(e)}}registerRootListener(e){let n=this._listeners.root;return e(this._rootElement,null),n.add(e),()=>{e(null,this._rootElement),n.delete(e)}}registerCommand(e,n,o){o===void 0&&V(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&V(36,String(e));let s=i[o];return s.add(n),()=>{s.delete(n),i.every((a=>a.size===0))&&r.delete(e)}}registerMutationListener(e,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(r);let a=o&&o.skipInitialization;return a!==void 0&&a||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&i.delete(n)}}getRegisteredNode(e){let n=this._nodes.get(e.getType());return n===void 0&&V(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){let o=this._editorState,r=ly(o).get(n.getType());if(!r)return;let i=new Map;for(let s of r.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){let o=this.getRegisteredNode(e);return o.transforms.add(n),o}registerNodeTransform(e,n){let o=this.registerNodeTransformToKlass(e,n),r=[o],i=o.replaceWithKlass;if(i!=null){let s=this.registerNodeTransformToKlass(i,n);r.push(s)}return(function(s,a){let l=ly(s.getEditorState()),c=[];for(let d of a){let u=l.get(d);u&&c.push(u)}c.length!==0&&s.update((()=>{for(let d of c)for(let u of d.keys()){let p=$t(u);p&&p.markDirty()}}),s._pendingEditorState===null?{tag:Op}:void 0)})(this,r.map((s=>s.klass.getType()))),()=>{r.forEach((s=>s.transforms.delete(n)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return Q(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let n=this._rootElement;if(e!==n){let o=Ra(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,uD(this,n,e,r),n!==null&&(this._config.disableEvents||jK(n),o!=null&&n.classList.remove(...o)),e!==null){let i=Uy(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Fa,f1(this),this._updateTags.add(Op),Pr(this),this._config.disableEvents||(function(a,l){let c=a.ownerDocument,d=zp.get(c);(d===void 0||d<1)&&c.addEventListener("selectionchange",q1),zp.set(c,(d||0)+1),a.__lexicalEditor=l;let u=Y1(a);for(let p=0;p<Zb.length;p++){let[h,g]=Zb[p],m=typeof g=="function"?_=>{DN(_)||(NN(_),(l.isEditable()||h==="click")&&g(_,l))}:_=>{if(DN(_))return;NN(_);let b=l.isEditable();switch(h){case"cut":return b&&Q(l,Ty,_);case"copy":return Q(l,wy,_);case"paste":return b&&Q(l,vy,_);case"dragstart":return b&&Q(l,P1,_);case"dragover":return b&&Q(l,F1,_);case"dragend":return b&&Q(l,B1,_);case"focus":return b&&Q(l,$1,_);case"blur":return b&&Q(l,z1,_);case"drop":return b&&Q(l,R1,_)}};a.addEventListener(h,m),u.push((()=>{a.removeEventListener(h,m)}))}})(e,this),o!=null&&e.classList.add(...o)}else this._window=null,this._updateTags.add(Op),Pr(this);Ic("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&V(38);let o=e;o._readOnly&&(o=sD(e),o._selection=e._selection?e._selection.clone():null),p1(this);let r=this._pendingEditorState,i=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Pr(this)),this._pendingEditorState=o,this._dirtyType=Fa,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),this._updating||Pr(this)}parseEditorState(e,n){return(function(o,r,i){let s=Iy(),a=Jt,l=Fn,c=Xt,d=r._dirtyElements,u=r._dirtyLeaves,p=r._cloneNotNeeded,h=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Jt=s,Fn=!1,Xt=r,Ay(null);try{let g=r._nodes;Dy(o.root,g),i&&i(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=d,r._dirtyLeaves=u,r._cloneNotNeeded=p,r._dirtyType=h,Jt=a,Fn=l,Xt=c}return s})(typeof e=="string"?JSON.parse(e):e,this,n)}read(e){return Pr(this),this.getEditorState().read(e,{editor:this})}update(e,n){(function(o,r,i){o._updating?o._updates.push([r,i]):Oy(o,r,i)})(this,e,n)}focus(e,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),oo(this,(()=>{let r=He(),i=Bn();r!==null?r.dirty||$n(r.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),wD("focus"),TD((()=>{o.removeAttribute("autocapitalize"),e&&e()}))})),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let n=nr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ic("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};Ka.version="0.33.1+prod.esm";var iy=null;function Ay(t){iy=t}var pD=1;function y3(){pD=1}function My(t,e){let n=Ly(t,e);return n===void 0&&V(30,e),n}function Ly(t,e){return t._nodes.get(e)}var x3=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function qN(t){return Ze(rf(t))}function Ry(t){let e=document.activeElement;if(!Sn(e))return!1;let n=e.nodeName;return Ze(rf(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&Wc(e)==null)}function Vc(t,e,n){let o=t.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(n)&&e!==null&&!Ry(e)&&Py(e)===t}catch{return!1}}function nf(t){return t instanceof Ka}function Py(t){let e=t;for(;e!=null;){let n=Wc(e);if(nf(n))return n;e=Gc(e)}return null}function Wc(t){return t?t.__lexicalEditor:null}function bi(t){return ky(t)||t.isToken()}function Lr(t){return bi(t)||t.isSegmented()}function or(t){return Xa(t)&&t.nodeType===oK}function fD(t){return Xa(t)&&t.nodeType===rK}function Ts(t){let e=t;for(;e!=null;){if(or(e))return e;e=e.firstChild}return null}function Wp(t,e,n){let o=fn[e];if(n!==null&&(t&o)==(n&o))return t;let r=t^o;return e==="subscript"?r&=~fn.superscript:e==="superscript"?r&=~fn.subscript:e==="lowercase"?(r&=~fn.uppercase,r&=~fn.capitalize):e==="uppercase"?(r&=~fn.lowercase,r&=~fn.capitalize):e==="capitalize"&&(r&=~fn.lowercase,r&=~fn.uppercase),r}function v3(t){return ne(t)||ys(t)||Ze(t)}function hD(t,e){let n=(function(){let s=iy;return iy=null,s})();if((e=e||n&&n.__key)!=null)return void(t.__key=e);Yt(),oD();let o=at(),r=Ur(),i=""+pD++;r._nodeMap.set(i,t),K(t)?o._dirtyElements.set(i,!0):o._dirtyLeaves.add(i),o._cloneNotNeeded.add(i),o._dirtyType=s1,t.__key=i}function yi(t){let e=t.getParent();if(e!==null){let n=t.getWritable(),o=e.getWritable(),r=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,a=r!==null?r.__key:null,l=r!==null?r.getWritable():null,c=i!==null?i.getWritable():null;r===null&&(o.__first=s),i===null&&(o.__last=a),l!==null&&(l.__next=s),c!==null&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Gp(t){oD();let e=t.getLatest(),n=e.__parent,o=Ur(),r=at(),i=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,c,d){let u=l;for(;u!==null;){if(d.has(u))return;let p=c.get(u);if(p===void 0)break;d.set(u,!1),u=p.__parent}})(n,i,s);let a=e.__key;r._dirtyType=s1,K(t)?s.set(a,!0):r._dirtyLeaves.add(a)}function qt(t){Yt();let e=at(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){let o=$t(n);o!==null&&o.getWritable()}if(t!==null){let o=$t(t);o!==null&&o.getWritable()}}}function _i(){return Ja()?null:at()._compositionKey}function $t(t,e){let n=(e||Ur())._nodeMap.get(t);return n===void 0?null:n}function gD(t,e){let n=of(t,at());return n!==void 0?$t(n,e):null}function of(t,e){return t[`__lexicalKey_${e._key}`]}function rf(t,e){let n=t;for(;n!=null;){let o=gD(n,e);if(o!==null)return o;n=Gc(n)}return null}function mD(t){let e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function JN(t){return t.read((()=>Bn().getTextContent()))}function Bn(){return _D(Ur())}function _D(t){return t._nodeMap.get("root")}function $n(t){Yt();let e=Ur();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function Aa(t){let e=at(),n=(function(o,r){let i=o;for(;i!=null;){let s=of(i,r);if(s!==void 0)return s;i=Gc(i)}return null})(t,e);return n===null?t===e.getRootElement()?$t("root"):null:$t(n)}function XN(t,e){return e?t.getTextContentSize():0}function bD(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Fy(t){let e=[],n=t;for(;n!==null;)e.push(n),n=n._parentEditor;return e}function yD(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function xD(t){return or(t)?t.nodeValue:null}function By(t,e,n){let o=nr(Co(e));if(o===null)return;let r=o.anchorNode,{anchorOffset:i,focusOffset:s}=o;if(r!==null){let a=xD(r),l=rf(r);if(a!==null&&ne(l)){if(a===Xp&&n){let c=n.length;a=n,i=c,s=c}a!==null&&$y(l,a,i,s,t)}}}function $y(t,e,n,o,r){let i=t;if(i.isAttached()&&(r||!i.isDirty())){let s=i.isComposing(),a=e;(s||r)&&e[e.length-1]===Xp&&(a=e.slice(0,-1));let l=i.getTextContent();if(r||a!==l){if(a===""){if(qt(null),Lc||Pa||Ap)i.remove();else{let m=at();setTimeout((()=>{m.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}let c=i.getParent(),d=Ns(),u=i.getTextContentSize(),p=_i(),h=i.getKey();if(i.isToken()||p!==null&&h===p&&!s||fe(d)&&(c!==null&&!c.canInsertTextBefore()&&d.anchor.offset===0||d.anchor.key===t.__key&&d.anchor.offset===0&&!i.canInsertTextBefore()&&!s||d.focus.key===t.__key&&d.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();let g=He();if(!fe(g)||n===null||o===null)return void i.setTextContent(a);if(g.setTextNodeRange(i,n,i,o),i.isSegmented()){let m=Gt(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Tp(t,e,n){let o=e[n]||!1;return o==="any"||o===t[n]}function vD(t,e){return Tp(t,e,"altKey")&&Tp(t,e,"ctrlKey")&&Tp(t,e,"shiftKey")&&Tp(t,e,"metaKey")}function Ye(t,e,n){return vD(t,n)&&t.key.toLowerCase()===e.toLowerCase()}var Mr={ctrlKey:!tr,metaKey:tr},ZN={altKey:tr,ctrlKey:!tr};function QN(t){return t.key==="Backspace"}function e1(t){return Ye(t,"a",Mr)}function C3(t){let e=Bn();if(fe(t)){let n=t.anchor,o=t.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Rp(t),t}{let n=e.select(0,e.getChildrenSize());return $n(Rp(n)),n}}function Ra(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let n=t.__lexicalClassNameCache,o=n[e];if(o!==void 0)return o;let r=t[e];if(typeof r=="string"){let i=Mp(r);return n[e]=i,i}return r}function zy(t,e,n,o,r){if(n.size===0)return;let i=o.__type,s=o.__key,a=e.get(i);a===void 0&&V(33,i);let l=a.klass,c=t.get(l);c===void 0&&(c=new Map,t.set(l,c));let d=c.get(s),u=d==="destroyed"&&r==="created";(d===void 0||u)&&c.set(s,u?"updated":r)}function E3(t){let e=t.getType(),n=Ur();if(n._readOnly){let i=ly(n).get(e);return i?Array.from(i.values()):[]}let o=n._nodeMap,r=[];for(let[,i]of o)i instanceof t&&i.__type===e&&i.isAttached()&&r.push(i);return r}function t1(t,e,n){let o=t.getParent(),r=n,i=t;return o!==null&&(e&&n===0?(r=i.getIndexWithinParent(),i=o):e||n!==i.getChildrenSize()||(r=i.getIndexWithinParent()+1,i=o)),i.getChildAtIndex(e?r-1:r)}function CD(t,e){let n=t.offset;if(t.type==="element")return t1(t.getNode(),e,n);{let o=t.getNode();if(e&&n===0||!e&&n===o.getTextContentSize()){let r=e?o.getPreviousSibling():o.getNextSibling();return r===null?t1(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function ED(t){let e=Co(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Q(t,e,n){return(function(o,r,i){let s=Fy(o);for(let a=4;a>=0;a--)for(let l=0;l<s.length;l++){let c=s[l],d=c._commands.get(r);if(d!==void 0){let u=d[a];if(u!==void 0){let p=Array.from(u),h=p.length,g=!1;if(oo(c,(()=>{for(let m=0;m<h;m++)if(p[m](i,o))return void(g=!0)})),g)return g}}}return!1})(t,e,n)}function sf(t){return!Pn(t)&&!t.isLastChild()&&!t.isInline()}function ja(t,e){let n=t._keyToDOMMap.get(e);return n===void 0&&V(75,e),n}function Gc(t){let e=t.assignedSlot||t.parentElement;return DD(e)?e.host:e}function Hy(t){return fD(t)?t:Sn(t)?t.ownerDocument:null}function w3(t){return at()._updateTags.has(t)}function wD(t){Yt(),at()._updateTags.add(t)}function TD(t){Yt(),at()._deferred.push(t)}function Yp(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function Uy(t){let e=Hy(t);return e?e.defaultView:null}function Co(t){let e=t._window;return e===null&&V(78),e}function T3(t){return K(t)&&t.isInline()||Ze(t)&&t.isInline()}function SD(t){let e=t.getParentOrThrow();for(;e!==null;){if(Lo(e))return e;e=e.getParentOrThrow()}return e}function Lo(t){return Pn(t)||K(t)&&t.isShadowRoot()}function Ky(t){let e=t.constructor.clone(t);return hD(e,null),e.afterCloneFrom(t),e}function Yc(t){let e=at(),n=t.getType(),o=Ly(e,n);o===void 0&&V(200,t.constructor.name,n);let{replace:r,replaceWithKlass:i}=o;if(r!==null){let s=r(t),a=s.constructor;return i!==null?s instanceof i||V(201,i.name,i.getType(),a.name,a.getType(),t.constructor.name,n):s instanceof t.constructor&&a!==t.constructor||V(202,a.name,a.getType(),t.constructor.name,n),s.__key===t.__key&&V(203,t.constructor.name,n,a.name,a.getType()),s}return t}function Rb(t,e){!Pn(t.getParent())||K(e)||Ze(e)||V(99)}function kD(t){let e=$t(t);return e===null&&V(63,t),e}function Pb(t){return(Ze(t)||K(t)&&!t.canBeEmpty())&&!t.isInline()}function sy(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;let o=t.parentElement;o!==null&&o.removeChild(t)}function nr(t){return Ro?(t||window).getSelection():null}function ND(t){let e=Uy(t);return e?e.getSelection():null}function S3(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),Lo(t)&&V(102);let o=s=>{let a=s.getParentOrThrow(),l=Lo(a),c=s!==n||l?Ky(s):s;if(l)return K(s)&&K(c)||V(133),s.insertAfter(c),[s,c,c];{let[d,u,p]=o(a),h=s.getNextSiblings();return p.append(c,...h),[d,u,c]}},[r,i]=o(n);return[r,i]}function k3(t){return Sn(t)&&t.tagName==="A"}function Sn(t){return Xa(t)&&t.nodeType===nK}function Xa(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function DD(t){return Xa(t)&&t.nodeType===iK}function OD(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function ay(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function Fr(t){if(Ze(t)&&!t.isInline())return!0;if(!K(t)||Lo(t))return!1;let e=t.getFirstChild(),n=e===null||ys(e)||ne(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function Fb(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}function jy(){return at()}var n1=new WeakMap,N3=new Map;function ly(t){if(!t._readOnly&&t.isEmpty())return N3;t._readOnly||V(192);let e=n1.get(t);return e||(e=(function(n){let o=new Map;for(let[r,i]of n._nodeMap){let s=i.__type,a=o.get(s);a||(a=new Map,o.set(s,a)),a.set(r,i)}return o})(t),n1.set(t,e)),e}function ID(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function AD(t,e){let n=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(n/40);e.setIndent(o)}function D3(t){t.__lexicalUnmanaged=!0}function MD(t){return t.__lexicalUnmanaged===!0}function Sc(t,e){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(t,e)&&t[e]!==vi[e]}function Vy(t){let e=mN in t.prototype?t.prototype[mN]():void 0,n=(function(s){return s===Kc||s===Ci||s===vi})(t),o=!n&&Sc(t,"getType")?t.getType():void 0,r,i=o;if(e)if(o)r=e[o];else for(let[s,a]of Object.entries(e))i=s,r=a;if(!n&&i&&(Sc(t,"getType")||(t.getType=()=>i),Sc(t,"clone")||(t.clone=s=>(Ay(s),new t)),Sc(t,"importJSON")||(t.importJSON=r&&r.$importJSON||(s=>new t().updateFromJSON(s))),!Sc(t,"importDOM")&&r)){let{importDOM:s}=r;s&&(t.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:i}}function O3(t){let e=jy();return Yt(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var I3={next:"previous",previous:"next"},Va=class{constructor(e){this.origin=e}[Symbol.iterator](){return Yy({hasNext:Ss,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Zt(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Zt(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){let o=this.getNodeAtCaret();return e.is(this.origin)||e.is(o)||(o===null?this.insert(e):o.replace(e,n)),this}splice(e,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),i=this,s=this.getParentAtCaret(),a=new Map;for(let l=i.getAdjacentCaret();l!==null&&a.size<e;l=l.getAdjacentCaret()){let c=l.origin.getWritable();a.set(c.getKey(),c)}for(let l of r){if(a.size>0){let c=i.getNodeAtCaret();if(c){if(a.delete(c.getKey()),a.delete(l.getKey()),!(c.is(l)||i.origin.is(l))){let d=l.getParent();d&&d.is(s)&&l.remove(),c.replace(l)}}else c===null&&V(263,Array.from(a).join(" "))}else i.insert(l);i=Zt(l,this.direction)}for(let l of a.values())l.remove();return this}},jc=class t extends Va{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Hr(e,this.direction)}getParentCaret(e="root"){return Zt(Wy(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ki(this.direction);return Zt(this.getNodeAtCaret(),e)||Hr(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},A3={root:Pn,shadowRoot:Lo};function ki(t){return I3[t]}function Wy(t,e="root"){return A3[e](t)?null:t}var Wa=class t extends Va{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Zt(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return K(this.origin)?Hr(this.origin,this.direction):null}getParentCaret(e="root"){return Zt(Wy(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ki(this.direction);return Zt(this.getNodeAtCaret(),e)||Hr(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof t||e instanceof Ga)&&this.direction===e.direction&&this.origin.is(e.origin)}},Ga=class t extends Va{type="text";constructor(e,n){super(e),this.offset=n}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Ei(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Zt(Wy(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Ei(this.origin,ki(this.direction),this.offset)}isSamePointCaret(e){return e instanceof t&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Wa||e instanceof t)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Zt(this.origin,this.direction)}};function $r(t){return t instanceof Ga}function M3(t){return t instanceof Va}function Ss(t){return t instanceof Wa}function Ao(t){return t instanceof jc}var L3={next:class extends Ga{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Ga{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},R3={next:class extends Wa{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Wa{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},P3={next:class extends jc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends jc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Zt(t,e){return t?new R3[e](t):null}function Ei(t,e,n){return t?new L3[e](t,ks(t,n)):null}function ks(t,e){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&((function(r,...i){let s=new URL("https://lexical.dev/docs/error"),a=new URLSearchParams;a.append("code",r);for(let l of i)a.append("v",l);s.search=a.toString(),console.warn(`Minified Lexical warning #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function cy(t,e){return new qp(t,e)}function Hr(t,e){return K(t)?new P3[e](t):null}function LD(t){return t&&t.getChildCaret()||t}function Ya(t){return t&&LD(t.getAdjacentCaret())}var dy=class t{type="node-caret-range";constructor(e,n,o){this.anchor=e,this.focus=n,this.direction=o}getLatest(){let e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new t(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=r=>{let i=this[r].getLatest();return $r(i)?(function(s,a){let{direction:l,origin:c}=s,d=ks(c,a==="focus"?ki(l):l);return cy(s,d-s.offset)})(i,r):null},n=e("anchor"),o=e("focus");if(n&&o){let{caret:r}=n,{caret:i}=o;if(r.isSameNodeCaret(i))return[cy(r,i.offset-r.offset),null]}return[n,o]}iterNodeCarets(e="root"){let n=$r(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=$r(o),i=s=>s.isSameNodeCaret(o)?null:Ya(s)||s.getParentCaret(e);return Yy({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},qp=class{type="slice";constructor(e,n){this.caret=e,this.distance=n}getSliceIndices(){let{distance:e,caret:{offset:n}}=this,o=n+e;return o<n?[o,n]:[n,o]}getTextContent(){let[e,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:n}}=this,[o,r]=this.getSliceIndices(),i=e.getTextContent();return Ei(e.setTextContent(i.slice(0,o)+i.slice(r)),n,o)}};function F3(t){return t instanceof qp}function Gy(t){return wi(t,Zt(Bn(),t.direction))}function RD(t){return wi(t,t)}function wi(t,e){return t.direction!==e.direction&&V(265),new dy(t,e,t.direction)}function Yy(t){let{initial:e,hasNext:n,step:o,map:r}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!n(i))return{done:!0,value:void 0};let s={done:!1,value:r(i)};return i=o(i),s}}}function qy(t,e){let n=Ac(t.origin,e.origin);switch(n===null&&V(275,t.origin.getKey(),e.origin.getKey()),n.type){case"same":{let o=t.type==="text",r=e.type==="text";return o&&r?(function(i,s){return Math.sign(i-s)})(t.offset,e.offset):t.type===e.type?0:o?-1:r?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return Jy(n)}}function Jy(t){let{a:e,b:n}=t,o=e.__key,r=n.__key,i=e,s=n;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===r)return-1;if(s.__key===o)return 1}return i===null?1:-1}function Sp(t,e){return e.is(t)}function o1(t){return K(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Ac(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let n=new Map;for(let[o,r]=o1(t);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=o1(e);o;r=o,o=o.getParent()){let i=n.get(o);if(i!==void 0)return i===null?(Sp(t,o)||V(276),{commonAncestor:o,type:"ancestor"}):r===null?(Sp(e,o)||V(277),{commonAncestor:o,type:"descendant"}):((K(i)||Sp(t,i))&&(K(r)||Sp(e,r))&&o.is(i.getParent())&&o.is(r.getParent())||V(278),{a:i,b:r,commonAncestor:o,type:"branch"})}return null}function Ti(t,e){let{type:n,key:o,offset:r}=t,i=kD(t.key);return n==="text"?(ne(i)||V(266,i.getType(),o),Ei(i,e,r)):(K(i)||V(267,i.getType(),o),$D(i,t.offset,e))}function qa(t,e){let{origin:n,direction:o}=e,r=o==="next";$r(e)?t.set(n.getKey(),e.offset,"text"):Ss(e)?ne(n)?t.set(n.getKey(),ks(n,o),"text"):t.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Ao(e)&&K(n)||V(268),t.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function PD(t){let e=He(),n=fe(e)?e:tD();return Mc(n,t),$n(n),n}function Mc(t,e){qa(t.anchor,e.anchor),qa(t.focus,e.focus)}function uy(t){let{anchor:e,focus:n}=t,o=Ti(e,"next"),r=Ti(n,"next"),i=qy(o,r)<=0?"next":"previous";return wi(Si(o,i),Si(r,i))}function Za(t){let{direction:e,origin:n}=t,o=Zt(n,ki(e)).getNodeAtCaret();return o?Zt(o,e):Hr(n.getParentOrThrow(),e)}function r1(t,e="root"){let n=[t];for(let o=Ao(t)?t.getParentCaret(e):t.getSiblingCaret();o!==null;o=o.getParentCaret(e))n.push(Za(o));return n}function Bb(t){return!!t&&t.origin.isAttached()}function FD(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let n="root",o="next",r=e,i=Xy(t,o),s=r1(i.anchor,n),a=r1(i.focus.getFlipped(),n),l=new Set,c=[];for(let g of i.iterNodeCarets(n))if(Ao(g))l.add(g.origin.getKey());else if(Ss(g)){let{origin:m}=g;K(m)&&!l.has(m.getKey())||c.push(m)}for(let g of c)g.remove();for(let g of i.getTextSlices()){if(!g)continue;let{origin:m}=g.caret,_=m.getTextContentSize(),b=Za(Zt(m,o)),y=m.getMode();if(Math.abs(g.distance)===_&&r==="removeEmptySlices"||y==="token"&&g.distance!==0)b.remove();else if(g.distance!==0){r="removeEmptySlices";let v=g.removeTextSlice(),x=g.caret.origin;if(y==="segmented"){let E=v.origin,C=Gt(E.getTextContent()).setStyle(E.getStyle()).setFormat(E.getFormat());b.replaceOrInsert(C),v=Ei(C,o,v.offset)}x.is(s[0].origin)&&(s[0]=v),x.is(a[0].origin)&&(a[0]=v.getFlipped())}}let d,u;for(let g of s)if(Bb(g)){d=Oo(g);break}for(let g of a)if(Bb(g)){u=Oo(g);break}let p=(function(g,m,_){if(!g||!m)return null;let b=g.getParentAtCaret(),y=m.getParentAtCaret();if(!b||!y)return null;let v=b.getParents().reverse();v.push(b);let x=y.getParents().reverse();x.push(y);let E=Math.min(v.length,x.length),C;for(C=0;C<E&&v[C]===x[C];C++);let k=(S,N)=>{let D;for(let O=C;O<S.length;O++){let A=S[O];if(Lo(A))return;!D&&N(A)&&(D=A)}return D},T=k(v,Fr),w=T&&k(x,(S=>_.has(S.getKey())&&Fr(S)));return T&&w?[T,w]:null})(d,u,l);if(p){let[g,m]=p;Hr(g,"previous").splice(0,m.getChildren()),m.remove()}let h=[d,u,...s,...a].find(Bb);if(h)return RD(Si(Oo(h),t.direction));V(269,JSON.stringify(s.map((g=>g.origin.__key))))}function Oo(t){let e=(function(r){let i=r;for(;Ao(i);){let s=Ya(i);if(!Ao(s))break;i=s}return i})(t.getLatest()),{direction:n}=e;if(ne(e.origin))return $r(e)?e:Ei(e.origin,n,n);let o=e.getAdjacentCaret();return Ss(o)&&ne(o.origin)?Ei(o.origin,n,ki(n)):e}function BD(t){return $r(t)&&t.offset!==ks(t.origin,t.direction)}function Si(t,e){return t.direction===e?t:t.getFlipped()}function Xy(t,e){return t.direction===e?t:wi(Si(t.focus,e),Si(t.anchor,e))}function $D(t,e,n){let o=Hr(t,"next");for(let r=0;r<e;r++){let i=o.getAdjacentCaret();if(i===null)break;o=i}return Si(o,n)}function B3(t,e="root"){let n=0,o=t,r=Ya(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=Ya(o)}return r&&[r,n]}function $3(t){let{origin:e,offset:n,direction:o}=t;if(n===ks(e,o))return t.getSiblingCaret();if(n===ks(e,ki(o)))return Za(t.getSiblingCaret());let[r]=e.splitText(n);return ne(r)||V(281),Si(Zt(r,"next"),o)}function z3(t,e){return!0}function H3(t,{$copyElementNode:e=Ky,$splitTextPointCaretNext:n=$3,rootMode:o="shadowRoot",$shouldSplit:r=z3}={}){if($r(t))return n(t);let i=t.getParentCaret(o);if(i){let{origin:s}=i;if(Ao(t)&&(!s.canBeEmpty()||!r(s,"first")))return Za(i);let a=(function(l){let c=[];for(let d=l.getAdjacentCaret();d;d=d.getAdjacentCaret())c.push(d.origin);return c})(t);(a.length>0||s.canBeEmpty()&&r(s,"last"))&&i.insert(e(s).splice(0,0,a))}return i}var M=Zy,Fte=M.$addUpdateTag,It=M.$applyNodeReplacement,Ni=M.$caretFromPoint,zD=M.$caretRangeFromSelection,Di=M.$cloneWithProperties,Bte=M.$comparePointCaretNext,$te=M.$copyNode,zte=M.$create,Po=M.$createLineBreakNode,HD=M.$createNodeSelection,me=M.$createParagraphNode,rr=M.$createPoint,ir=M.$createRangeSelection,UD=M.$createRangeSelectionFromDom,Fo=M.$createTabNode,St=M.$createTextNode,qc=M.$extendCaretToRange,Ds=M.$getAdjacentChildCaret,Qy=M.$getAdjacentNode,Hte=M.$getAdjacentSiblingOrParentSiblingCaret,ex=M.$getCaretInDirection,af=M.$getCaretRange,KD=M.$getCaretRangeInDirection,jD=M.$getCharacterOffsets,ro=M.$getChildCaret,Ute=M.$getChildCaretAtIndex,tx=M.$getChildCaretOrSelf,VD=M.$getCollapsedCaretRange,Kte=M.$getCommonAncestor,jte=M.$getCommonAncestorResultBranchOrder,Os=M.$getEditor,an=M.$getNearestNodeFromDOMNode,Vte=M.$getNearestRootOrShadowRoot,At=M.$getNodeByKey,Wte=M.$getNodeByKeyOrThrow,Kr=M.$getPreviousSelection,nt=M.$getRoot,$=M.$getSelection,kn=M.$getSiblingCaret,WD=M.$getState,Gte=M.$getStateChange,Yte=M.$getTextContent,qte=M.$getTextNodeOffset,GD=M.$getTextPointCaret,Jte=M.$getTextPointCaretSlice,Xte=M.$getWritableNodeState,YD=M.$hasAncestor,Zte=M.$hasUpdateTag,Bo=M.$insertNodes,Qa=M.$isBlockElementNode,Oi=M.$isChildCaret,zn=M.$isDecoratorNode,Y=M.$isElementNode,lf=M.$isExtendableTextPointCaret,qD=M.$isInlineElementOrDecoratorNode,Jc=M.$isLeafNode,Qe=M.$isLineBreakNode,Qte=M.$isNodeCaret,mt=M.$isNodeSelection,Qt=M.$isParagraphNode,B=M.$isRangeSelection,sr=M.$isRootNode,zt=M.$isRootOrShadowRoot,cf=M.$isSiblingCaret,Hn=M.$isTabNode,te=M.$isTextNode,df=M.$isTextPointCaret,ene=M.$isTextPointCaretSlice,nx=M.$isTokenOrSegmented,tne=M.$isTokenOrTab,nne=M.$nodesOfType,ar=M.$normalizeCaret,jr=M.$normalizeSelection__EXPERIMENTAL,one=M.$onUpdate,JD=M.$parseSerializedNode,rne=M.$removeTextFromCaretRange,XD=M.$rewindSiblingCaret,uf=M.$selectAll,ine=M.$setCompositionKey,Ii=M.$setPointFromCaret,vt=M.$setSelection,pf=M.$setSelectionFromCaretRange,ZD=M.$setState,QD=M.$splitAtPointCaretNext,eO=M.$splitNode,sne=M.$updateRangeSelectionFromCaretRange,ox=M.ArtificialNode__DO_NOT_USE,ane=M.BLUR_COMMAND,Is=M.CAN_REDO_COMMAND,As=M.CAN_UNDO_COMMAND,tO=M.CLEAR_EDITOR_COMMAND,nO=M.CLEAR_HISTORY_COMMAND,lr=M.CLICK_COMMAND,oO=M.COLLABORATION_TAG,kt=M.COMMAND_PRIORITY_CRITICAL,Se=M.COMMAND_PRIORITY_EDITOR,Ai=M.COMMAND_PRIORITY_HIGH,Pe=M.COMMAND_PRIORITY_LOW,ff=M.COMMAND_PRIORITY_NORMAL,hf=M.CONTROLLED_TEXT_INSERTION_COMMAND,gf=M.COPY_COMMAND,mf=M.CUT_COMMAND,el=M.DELETE_CHARACTER_COMMAND,Xc=M.DELETE_LINE_COMMAND,_f=M.DELETE_WORD_COMMAND,lne=M.DRAGEND_COMMAND,rO=M.DRAGOVER_COMMAND,iO=M.DRAGSTART_COMMAND,sO=M.DROP_COMMAND,tl=M.DecoratorNode,Ht=M.ElementNode,aO=M.FOCUS_COMMAND,bf=M.FORMAT_ELEMENT_COMMAND,lt=M.FORMAT_TEXT_COMMAND,nl=M.HISTORIC_TAG,ol=M.HISTORY_MERGE_TAG,lO=M.HISTORY_PUSH_TAG,Un=M.INDENT_CONTENT_COMMAND,rx=M.INSERT_LINE_BREAK_COMMAND,Mi=M.INSERT_PARAGRAPH_COMMAND,Ms=M.INSERT_TAB_COMMAND,Zc=M.INTERNAL_$isBlock,cne=M.IS_ALL_FORMATTING,dne=M.IS_BOLD,une=M.IS_CODE,pne=M.IS_HIGHLIGHT,fne=M.IS_ITALIC,hne=M.IS_STRIKETHROUGH,gne=M.IS_SUBSCRIPT,mne=M.IS_SUPERSCRIPT,_ne=M.IS_UNDERLINE,Vr=M.KEY_ARROW_DOWN_COMMAND,rl=M.KEY_ARROW_LEFT_COMMAND,yf=M.KEY_ARROW_RIGHT_COMMAND,$o=M.KEY_ARROW_UP_COMMAND,xf=M.KEY_BACKSPACE_COMMAND,vf=M.KEY_DELETE_COMMAND,cO=M.KEY_DOWN_COMMAND,dO=M.KEY_ENTER_COMMAND,Li=M.KEY_ESCAPE_COMMAND,bne=M.KEY_MODIFIER_COMMAND,Cf=M.KEY_SPACE_COMMAND,Ri=M.KEY_TAB_COMMAND,yne=M.LineBreakNode,ix=M.MOVE_TO_END,Ef=M.MOVE_TO_START,xne=M.NODE_STATE_KEY,Eo=M.OUTDENT_CONTENT_COMMAND,Pi=M.PASTE_COMMAND,uO=M.PASTE_TAG,vne=M.ParagraphNode,pO=M.REDO_COMMAND,fO=M.REMOVE_TEXT_COMMAND,hO=M.RootNode,hn=M.SELECTION_CHANGE_COMMAND,Qc=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,gO=M.SELECT_ALL_COMMAND,Cne=M.SKIP_COLLAB_TAG,Ene=M.SKIP_DOM_SELECTION_TAG,wne=M.SKIP_SCROLL_INTO_VIEW_TAG,mO=M.TEXT_TYPE_TO_FORMAT,Tne=M.TabNode,Ut=M.TextNode,_O=M.UNDO_COMMAND,sx=M.buildImportMap,Kn=M.createCommand,bO=M.createEditor,Sne=M.createSharedNodeState,kne=M.createState,Nne=M.flipDirection,Dne=M.getDOMOwnerDocument,io=M.getDOMSelection,One=M.getDOMSelectionFromTarget,yO=M.getDOMTextNode,Ine=M.getEditorPropertyFromDOMNode,xO=M.getNearestEditorFromDOMNode,vO=M.getRegisteredNode,Ane=M.getRegisteredNodeOrThrow,CO=M.isBlockDomNode,EO=M.isCurrentlyReadOnlyMode,Mne=M.isDOMDocumentNode,Fi=M.isDOMNode,Lne=M.isDOMTextNode,Rne=M.isDOMUnmanaged,ax=M.isDocumentFragment,Pne=M.isExactShortcutMatch,wO=M.isHTMLAnchorElement,Ls=M.isHTMLElement,ed=M.isInlineDomNode,Fne=M.isLexicalEditor,jn=M.isModifierMatch,TO=M.isSelectionCapturedInDecoratorInput,SO=M.isSelectionWithinEditor,lx=M.makeStepwiseIterator,Bne=M.removeFromParent,$ne=M.resetRandomKey,kO=M.setDOMUnmanaged,cx=M.setNodeIndentFromDOM;var hx={};ze(hx,{$addNodeStyle:()=>W3,$cloneWithProperties:()=>Di,$copyBlockFormatIndent:()=>PO,$ensureForwardRangeSelection:()=>RO,$forEachSelectedTextNode:()=>LO,$getSelectionStyleValueForProperty:()=>ej,$isAtNodeEnd:()=>V3,$isParentElementRTL:()=>$O,$moveCaretSelection:()=>BO,$moveCharacter:()=>Z3,$patchStyleText:()=>G3,$selectAll:()=>uf,$setBlocksType:()=>Y3,$shouldOverrideDefaultCharacterSelection:()=>X3,$sliceSelectedTextNodeContent:()=>j3,$trimTextContentFromAnchor:()=>MO,$wrapNodes:()=>J3,createDOMRange:()=>U3,createRectsFromDOMRange:()=>K3,getCSSFromStyleObject:()=>AO,getStyleObjectFromCSS:()=>Tf,trimTextContentFromAnchor:()=>tj});function fx(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var wf=new Map;function NO(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function DO(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function U3(t,e,n,o,r){let i=e.getKey(),s=o.getKey(),a=document.createRange(),l=t.getElementByKey(i),c=t.getElementByKey(s),d=n,u=r;if(te(e)&&(l=NO(l)),te(o)&&(c=NO(c)),e===void 0||o===void 0||l===null||c===null)return null;l.nodeName==="BR"&&([l,d]=DO(l)),c.nodeName==="BR"&&([c,u]=DO(c));let p=l.firstChild;l===c&&p!=null&&p.nodeName==="BR"&&d===0&&u===0&&(u=1);try{a.setStart(l,d),a.setEnd(c,u)}catch{return null}return!a.collapsed||d===u&&i===s||(a.setStart(c,u),a.setEnd(l,d)),a}function K3(t,e){let n=t.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),i=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(e.getClientRects()),a,l=s.length;s.sort(((c,d)=>{let u=c.top-d.top;return Math.abs(u)<=3?c.left-d.left:u}));for(let c=0;c<l;c++){let d=s[c],u=a&&a.top<=d.top&&a.top+a.height>d.top&&a.left+a.width>d.left,p=d.width+i===o.width;u||p?(s.splice(c--,1),l--):a=d}return s}function IO(t){let e={};if(!t)return e;let n=t.split(";");for(let o of n)if(o!==""){let[r,i]=o.split(/:([^]+)/);r&&i&&(e[r.trim()]=i.trim())}return e}function Tf(t){let e=wf.get(t);return e===void 0&&(e=IO(t),wf.set(t,e)),e}function AO(t){let e="";for(let n in t)n&&(e+=`${n}: ${t[n]};`);return e}function j3(t,e){let n=t.getStartEndPoints();if(e.isSelected(t)&&!nx(e)&&n!==null){let[o,r]=n,i=t.isBackward(),s=o.getNode(),a=r.getNode(),l=e.is(s),c=e.is(a);if(l||c){let[d,u]=jD(t),p=s.is(a),h=e.is(i?a:s),g=e.is(i?s:a),m,_=0;p?(_=d>u?u:d,m=d>u?d:u):h?(_=i?u:d,m=void 0):g&&(_=0,m=i?d:u),e.__text=e.__text.slice(_,m)}}return e}function V3(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return Y(e)||fx(177),t.offset===e.getChildrenSize()}function MO(t,e,n){let o=e.getNode(),r=n;if(Y(o)){let i=o.getDescendantByIndex(e.offset);i!==null&&(o=i)}for(;r>0&&o!==null;){if(Y(o)){let c=o.getLastDescendant();c!==null&&(o=c)}let i=o.getPreviousSibling(),s=0;if(i===null){let c=o.getParentOrThrow(),d=c.getPreviousSibling();for(;d===null;){if(c=c.getParent(),c===null){i=null;break}d=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,i=d)}let a=o.getTextContent();a===""&&Y(o)&&!o.isInline()&&(a=`
114
-
115
- `);let l=a.length;if(!te(o)||r>=l){let c=o.getParent();o.remove(),c==null||c.getChildrenSize()!==0||sr(c)||c.remove(),r-=l+s,o=i}else{let c=o.getKey(),d=t.getEditorState().read((()=>{let h=At(c);return te(h)&&h.isSimpleText()?h.getTextContent():null})),u=l-r,p=a.slice(0,u);if(d!==null&&d!==a){let h=Kr(),g=o;if(o.isSimpleText())o.setTextContent(d);else{let m=St(d);o.replace(m),g=m}if(B(h)&&h.isCollapsed()){let m=h.anchor.offset;g.select(m,m)}}else if(o.isSimpleText()){let h=e.key===c,g=e.offset;g<r&&(g=l);let m=h?g-r:0,_=h?g:u;if(h&&m===0){let[b]=o.splitText(m,_);b.remove()}else{let[,b]=o.splitText(m,_);b.remove()}}else{let h=St(p);o.replace(h)}r=0}}}function W3(t){let e=t.getStyle(),n=IO(e);wf.set(e,n)}function dx(t,e){(B(t)?t.isCollapsed():te(t)||Y(t))||fx(280);let n=Tf(B(t)?t.style:te(t)?t.getStyle():t.getTextStyle()),o=Object.entries(e).reduce(((i,[s,a])=>(typeof a=="function"?i[s]=a(n[s],t):a===null?delete i[s]:i[s]=a,i)),{...n}),r=AO(o);B(t)||te(t)?t.setStyle(r):t.setTextStyle(r),wf.set(r,o)}function G3(t,e){if(B(t)&&t.isCollapsed()){dx(t,e);let n=t.anchor.getNode();Y(n)&&n.isEmpty()&&dx(n,e)}LO((n=>{dx(n,e)}))}function LO(t){let e=$();if(!e)return;let n=new Map;if(B(e))for(let i of zD(e).getTextSlices())i&&n.set(i.caret.origin.getKey(),i.getSliceIndices());let o=e.getNodes();for(let i of o){if(!te(i)||!i.canHaveFormat())continue;let[s,a]=(r=i,n.get(r.getKey())||[0,r.getTextContentSize()]);a!==s&&(nx(i)||s===0&&a===i.getTextContentSize()?t(i):t(i.splitText(s,a)[s===0?0:1]))}var r;B(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&RO(e)}function RO(t){if(t.isBackward()){let{anchor:e,focus:n}=t,{key:o,offset:r,type:i}=e;e.set(n.key,n.offset,n.type),n.set(o,r,i)}}function PO(t,e){let n=t.getFormatType(),o=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),o!==e.getIndent()&&e.setIndent(o)}function Y3(t,e,n=PO){if(t===null)return;let o=t.getStartEndPoints(),r=new Map,i=null;if(o){let[s,a]=o;i=ir(),i.anchor.set(s.key,s.offset,s.type),i.focus.set(a.key,a.offset,a.type);let l=px(s.getNode(),Zc),c=px(a.getNode(),Zc);Y(l)&&r.set(l.getKey(),l),Y(c)&&r.set(c.getKey(),c)}for(let s of t.getNodes())if(Y(s)&&Zc(s))r.set(s.getKey(),s);else if(o===null){let a=px(s,Zc);Y(a)&&r.set(a.getKey(),a)}for(let[s,a]of r){let l=e();n(a,l),a.replace(l,!0),i&&(s===i.anchor.key&&i.anchor.set(l.getKey(),i.anchor.offset,i.anchor.type),s===i.focus.key&&i.focus.set(l.getKey(),i.focus.offset,i.focus.type))}i&&t.is($())&&vt(i)}function OO(t){return t.getNode().isAttached()}function q3(t){let e=t;for(;e!==null&&!zt(e);){let n=e.getLatest(),o=e.getParent();n.getChildrenSize()===0&&e.remove(!0),e=o}}function J3(t,e,n=null){let o=t.getStartEndPoints(),r=o?o[0]:null,i=t.getNodes(),s=i.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),d=c.getChildren(),u=e();return u.setFormat(c.getFormatType()),u.setIndent(c.getIndent()),d.forEach((p=>u.append(p))),n&&(u=n.append(u)),void c.replace(u)}let a=null,l=[];for(let c=0;c<s;c++){let d=i[c];zt(d)?(ux(t,l,l.length,e,n),l=[],a=d):a===null||a!==null&&YD(d,a)?l.push(d):(ux(t,l,l.length,e,n),l=[d])}ux(t,l,l.length,e,n)}function ux(t,e,n,o,r=null){if(e.length===0)return;let i=e[0],s=new Map,a=[],l=Y(i)?i:i.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let c=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,c=!0;break}if(l=l.getParentOrThrow(),zt(l))break}let d=new Set;for(let g=0;g<n;g++){let m=e[g];Y(m)&&m.getChildrenSize()===0&&d.add(m.getKey())}let u=new Set;for(let g=0;g<n;g++){let m=e[g],_=m.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Jc(m)&&!u.has(m.getKey())){let b=_.getKey();if(s.get(b)===void 0){let y=o();y.setFormat(_.getFormatType()),y.setIndent(_.getIndent()),a.push(y),s.set(b,y),_.getChildren().forEach((v=>{y.append(v),u.add(v.getKey()),Y(v)&&v.getChildrenKeys().forEach((x=>u.add(x)))})),q3(_)}}else if(d.has(m.getKey())){Y(m)||fx(179);let b=o();b.setFormat(m.getFormatType()),b.setIndent(m.getIndent()),a.push(b),m.remove(!0)}}if(r!==null)for(let g=0;g<a.length;g++){let m=a[g];r.append(m)}let p=null;if(zt(l))if(c)if(r!==null)l.insertAfter(r);else for(let g=a.length-1;g>=0;g--){let m=a[g];l.insertAfter(m)}else{let g=l.getFirstChild();if(Y(g)&&(l=g),g===null)if(r)l.append(r);else for(let m=0;m<a.length;m++){let _=a[m];l.append(_),p=_}else if(r!==null)g.insertBefore(r);else for(let m=0;m<a.length;m++){let _=a[m];g.insertBefore(_),p=_}}else if(r)l.insertAfter(r);else for(let g=a.length-1;g>=0;g--){let m=a[g];l.insertAfter(m),p=m}let h=Kr();B(h)&&OO(h.anchor)&&OO(h.focus)?vt(h.clone()):p!==null?p.selectEnd():t.dirty=!0}function FO(t){let e=t.anchor.getNode(),n=sr(e)?e:e.getParentOrThrow(),o=Os().getElementByKey(n.getKey());if(o===null)return!1;let r=o.ownerDocument.defaultView;return r===null?!1:r.getComputedStyle(o).writingMode==="vertical-rl"}function X3(t,e){let n=FO(t)?!e:e,o=Ni(t.focus,n?"previous":"next");if(lf(o))return!1;for(let r of qc(o)){if(Oi(r))return!r.origin.isInline();if(!Y(r.origin)){if(zn(r.origin))return!0;break}}return!1}function BO(t,e,n,o){t.modify(e?"extend":"move",n,o)}function $O(t){let e=t.anchor.getNode();return(sr(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Z3(t,e,n){let o=$O(t),r;r=FO(t)||o?!n:n,BO(t,e,r,"character")}function Q3(t,e,n){let o=Tf(t.getStyle());return o!==null&&o[e]||n}function ej(t,e,n=""){let o=null,r=t.getNodes(),i=t.anchor,s=t.focus,a=t.isBackward(),l=a?s.offset:i.offset,c=a?s.getNode():i.getNode();if(B(t)&&t.isCollapsed()&&t.style!==""){let d=Tf(t.style);if(d!==null&&e in d)return d[e]}for(let d=0;d<r.length;d++){let u=r[d];if((d===0||l!==0||!u.is(c))&&te(u)){let p=Q3(u,e,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}function px(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var tj=MO;var Ct=hx,zO=Ct.$addNodeStyle,Kne=Ct.$cloneWithProperties,jne=Ct.$copyBlockFormatIndent,Vne=Ct.$ensureForwardRangeSelection,Wne=Ct.$forEachSelectedTextNode,Gne=Ct.$getSelectionStyleValueForProperty,gx=Ct.$isAtNodeEnd,HO=Ct.$isParentElementRTL,Yne=Ct.$moveCaretSelection,mx=Ct.$moveCharacter,qne=Ct.$patchStyleText,Jne=Ct.$selectAll,Sf=Ct.$setBlocksType,_x=Ct.$shouldOverrideDefaultCharacterSelection,kf=Ct.$sliceSelectedTextNodeContent,Xne=Ct.$trimTextContentFromAnchor,Zne=Ct.$wrapNodes,Qne=Ct.createDOMRange,UO=Ct.createRectsFromDOMRange,eoe=Ct.getCSSFromStyleObject,bx=Ct.getStyleObjectFromCSS,toe=Ct.trimTextContentFromAnchor;var Cx={};ze(Cx,{$descendantsMatching:()=>zj,$dfs:()=>Ej,$dfsIterator:()=>XO,$filter:()=>Rj,$findMatchingParent:()=>tI,$firstToLastIterator:()=>Hj,$getAdjacentCaret:()=>wj,$getAdjacentSiblingOrParentSiblingCaret:()=>td,$getDepth:()=>QO,$getNearestBlockElementAncestorOrThrow:()=>Dj,$getNearestNodeOfType:()=>Nj,$getNextRightPreorderNode:()=>kj,$getNextSiblingOrParentSibling:()=>Sj,$insertFirst:()=>Pj,$insertNodeToNearestRoot:()=>Aj,$insertNodeToNearestRootAtCaret:()=>nI,$isEditorIsNestedEditor:()=>Bj,$lastToFirstIterator:()=>vx,$restoreEditorState:()=>Ij,$reverseDfs:()=>Tj,$reverseDfsIterator:()=>eI,$splitNode:()=>eO,$unwrapAndFilterDescendants:()=>$j,$unwrapNode:()=>Uj,$wrapNodeInElement:()=>Mj,CAN_USE_BEFORE_INPUT:()=>pj,CAN_USE_DOM:()=>YO,IS_ANDROID:()=>fj,IS_ANDROID_CHROME:()=>hj,IS_APPLE:()=>gj,IS_APPLE_WEBKIT:()=>mj,IS_CHROME:()=>_j,IS_FIREFOX:()=>qO,IS_IOS:()=>bj,IS_SAFARI:()=>yj,addClassNamesToElement:()=>xj,calculateZoomLevel:()=>Fj,isBlockDomNode:()=>CO,isHTMLAnchorElement:()=>wO,isHTMLElement:()=>Ls,isInlineDomNode:()=>ed,isMimeType:()=>JO,makeStateWrapper:()=>Kj,markSelection:()=>GO,mediaFileReader:()=>Cj,mergeRegister:()=>VO,objectKlassEquals:()=>Lj,positionNodeOnRange:()=>WO,registerNestedElementResolver:()=>Oj,removeClassNamesFromElement:()=>vj,selectionAlwaysOnDisplay:()=>uj});function Df(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var zo=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,nj=zo&&"documentMode"in document?document.documentMode:null,oj=zo&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),rj=zo&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ij=!(!zo||!("InputEvent"in window)||nj)&&"getTargetRanges"in new window.InputEvent("input"),sj=zo&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),aj=zo&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,KO=zo&&/Android/.test(navigator.userAgent),xx=zo&&/^(?=.*Chrome).*/i.test(navigator.userAgent),lj=zo&&KO&&xx,cj=zo&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xx;function jO(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}function VO(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function cr(t){return`${t}px`}var dj={attributes:!0,characterData:!0,childList:!0,subtree:!0};function WO(t,e,n){let o=null,r=null,i=null,s=[],a=document.createElement("div");function l(){o===null&&Df(182),r===null&&Df(183);let{left:u,top:p}=r.getBoundingClientRect(),h=UO(t,e);var g,m;a.isConnected||(m=a,(g=r).insertBefore(m,g.firstChild));let _=!1;for(let b=0;b<h.length;b++){let y=h[b],v=s[b]||document.createElement("div"),x=v.style;x.position!=="absolute"&&(x.position="absolute",_=!0);let E=cr(y.left-u);x.left!==E&&(x.left=E,_=!0);let C=cr(y.top-p);x.top!==C&&(v.style.top=C,_=!0);let k=cr(y.width);x.width!==k&&(v.style.width=k,_=!0);let T=cr(y.height);x.height!==T&&(v.style.height=T,_=!0),v.parentNode!==a&&(a.append(v),_=!0),s[b]=v}for(;s.length>h.length;)s.pop();_&&n(s)}function c(){r=null,o=null,i!==null&&i.disconnect(),i=null,a.remove();for(let u of s)u.remove();s=[]}a.style.position="relative";let d=t.registerRootListener((function u(){let p=t.getRootElement();if(p===null)return c();let h=p.parentElement;if(!Ls(h))return c();c(),o=p,r=h,i=new MutationObserver((g=>{let m=t.getRootElement(),_=m&&m.parentElement;if(m!==o||_!==r)return u();for(let b of g)if(!a.contains(b.target))return l()})),i.observe(h,dj),l()}));return()=>{d(),c()}}function Nf(t,e,n){if(t.type!=="text"&&Y(e)){let o=e.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+t.offset]}return[yO(n)||n,t.offset]}function GO(t,e){let n=null,o=null,r=null,i=null,s=null,a=null,l=()=>{};function c(d){d.read((()=>{let u=$();if(!B(u))return n=null,r=null,i=null,a=null,l(),void(l=()=>{});let{anchor:p,focus:h}=u,g=p.getNode(),m=g.getKey(),_=p.offset,b=h.getNode(),y=b.getKey(),v=h.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),C=n===null||x!==o||_!==r||m!==n.getKey(),k=i===null||E!==s||v!==a||y!==i.getKey();if((C||k)&&x!==null&&E!==null){let T=(function(w,S,N,D,O,A,I){let R=(w._window?w._window.document:document).createRange();return A.isBefore(N)?(R.setStart(...Nf(O,A,I)),R.setEnd(...Nf(S,N,D))):(R.setStart(...Nf(S,N,D)),R.setEnd(...Nf(O,A,I))),R})(t,p,g,x,h,b,E);l(),l=WO(t,T,(w=>{if(e===void 0)for(let S of w){let N=S.style;N.background!=="Highlight"&&(N.background="Highlight"),N.color!=="HighlightText"&&(N.color="HighlightText"),N.marginTop!==cr(-1.5)&&(N.marginTop=cr(-1.5)),N.paddingTop!==cr(4)&&(N.paddingTop=cr(4)),N.paddingBottom!==cr(0)&&(N.paddingBottom=cr(0))}else e(w)}))}n=g,o=x,r=_,i=b,s=E,a=v}))}return c(t.getEditorState()),VO(t.registerUpdateListener((({editorState:d})=>c(d))),(()=>{l()}))}function uj(t){let e=null,n=()=>{let o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();r!==null&&i!==null&&i.contains(r)?e!==null&&(e(),e=null):e===null&&(e=GO(t))};return document.addEventListener("selectionchange",n),()=>{e!==null&&e(),document.removeEventListener("selectionchange",n)}}var pj=ij,YO=zo,fj=KO,hj=lj,gj=oj,mj=cj,_j=xx,qO=rj,bj=aj,yj=sj;function xj(t,...e){let n=jO(...e);n.length>0&&t.classList.add(...n)}function vj(t,...e){let n=jO(...e);n.length>0&&t.classList.remove(...n)}function JO(t,e){for(let n of e)if(t.type.startsWith(n))return!0;return!1}function Cj(t,e){let n=t[Symbol.iterator]();return new Promise(((o,r)=>{let i=[],s=()=>{let{done:a,value:l}=n.next();if(a)return o(i);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",(()=>{let d=c.result;typeof d=="string"&&i.push({file:l,result:d}),s()})),JO(l,e)?c.readAsDataURL(l):s()};s()}))}function Ej(t,e){return Array.from(XO(t,e))}function wj(t){return t?t.getAdjacentCaret():null}function Tj(t,e){return Array.from(eI(t,e))}function XO(t,e){return ZO("next",t,e)}function ZO(t,e,n){let o=nt(),r=e||o,i=Y(r)?ro(r,t):kn(r,t),s=QO(r),a=n?Ds(tx(kn(n,t))):(function(c,d){let u=td(kn(c,d));return u&&u[0]})(r,t),l=s;return lx({hasNext:c=>c!==null,initial:i,map:c=>({depth:l,node:c.origin}),step:c=>{if(c.isSameNodeCaret(a))return null;Oi(c)&&l++;let d=td(c);return!d||d[0].isSameNodeCaret(a)?null:(l+=d[1],d[0])}})}function Sj(t){let e=td(kn(t,"next"));return e&&[e[0].origin,e[1]]}function QO(t){let e=-1;for(let n=t;n!==null;n=n.getParent())e++;return e}function kj(t){let e=td(tx(kn(t,"previous")),"root");return e&&e[0].origin}function eI(t,e){return ZO("previous",t,e)}function Nj(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function Dj(t){let e=tI(t,(n=>Y(n)&&!n.isInline()));return Y(e)||Df(4,t.__key),e}var tI=(t,e)=>{let n=t;for(;n!==nt()&&n!=null;){if(e(n))return n;n=n.getParent()}return null};function Oj(t,e,n,o){let r=i=>i instanceof e;return t.registerNodeTransform(e,(i=>{let s=(a=>{let l=a.getChildren();for(let u=0;u<l.length;u++){let p=l[u];if(r(p))return null}let c=a,d=a;for(;c!==null;)if(d=c,c=c.getParent(),r(c))return{child:d,parent:c};return null})(i);if(s!==null){let{child:a,parent:l}=s;if(a.is(i)){o(l,i);let c=a.getNextSiblings(),d=c.length;if(l.insertAfter(a),d!==0){let u=n(l);a.insertAfter(u);for(let p=0;p<d;p++)u.append(c[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}}))}function Ij(t,e){let n=new Map,o=t._pendingEditorState;for(let[i,s]of e._nodeMap)n.set(i,Di(s));o&&(o._nodeMap=n),t._dirtyType=2;let r=e._selection;vt(r===null?null:r.clone())}function Aj(t){let e=$()||Kr(),n;if(B(e))n=Ni(e.focus,"next");else{if(e!=null){let s=e.getNodes(),a=s[s.length-1];a&&(n=kn(a,"next"))}n=n||ro(nt(),"previous").getFlipped().insert(me())}let o=nI(t,n),r=Ds(o),i=Oi(r)?ar(r):o;return pf(VD(i)),t.getLatest()}function nI(t,e,n){let o=ex(e,"next");for(let r=o;r;r=QD(r,n))o=r;return df(o)&&Df(283),o.insert(t.isInline()?me().append(t):t),ex(kn(t.getLatest(),"next"),e.direction)}function Mj(t,e){let n=e();return t.replace(n),n.append(t),n}function Lj(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function Rj(t,e){let n=[];for(let o=0;o<t.length;o++){let r=e(t[o]);r!==null&&n.push(r)}return n}function Pj(t,e){ro(t,"next").insert(e)}var yx=!(qO||!YO)&&void 0;function Fj(t){let e=1;if((function(){if(yx===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let o=n.getBoundingClientRect();n.style.setProperty("zoom","2"),yx=n.getBoundingClientRect().width===o.width,document.body.removeChild(n)}return yx})())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Bj(t){return t._parentEditor!==null}function $j(t,e){return oI(t,e,null)}function oI(t,e,n){let o=!1;for(let r of vx(t))e(r)?n!==null&&n(r):(o=!0,Y(r)&&oI(r,e,n||(i=>r.insertAfter(i))),r.remove());return o}function zj(t,e){let n=[],o=Array.from(t).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(e(r))n.push(r);else if(Y(r))for(let i of vx(r))o.push(i);return n}function Hj(t){return rI(ro(t,"next"))}function vx(t){return rI(ro(t,"previous"))}function rI(t){return lx({hasNext:cf,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function Uj(t){XD(kn(t,"next")).splice(1,t.getChildren())}function td(t,e="root"){let n=0,o=t,r=Ds(o);for(;r===null;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=Ds(o)}return r&&[r,n]}function Kj(t){let e=o=>WD(o,t),n=(o,r)=>ZD(o,t,r);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:t}}var _e=Cx,Ex=_e.$descendantsMatching,iI=_e.$dfs,soe=_e.$dfsIterator,sI=_e.$filter,ue=_e.$findMatchingParent,aoe=_e.$firstToLastIterator,aI=_e.$getAdjacentCaret,loe=_e.$getAdjacentSiblingOrParentSiblingCaret,coe=_e.$getDepth,Rs=_e.$getNearestBlockElementAncestorOrThrow,Of=_e.$getNearestNodeOfType,doe=_e.$getNextRightPreorderNode,uoe=_e.$getNextSiblingOrParentSibling,lI=_e.$insertFirst,If=_e.$insertNodeToNearestRoot,poe=_e.$insertNodeToNearestRootAtCaret,cI=_e.$isEditorIsNestedEditor,foe=_e.$lastToFirstIterator,hoe=_e.$restoreEditorState,goe=_e.$reverseDfs,moe=_e.$reverseDfsIterator,_oe=_e.$splitNode,wx=_e.$unwrapAndFilterDescendants,boe=_e.$unwrapNode,yoe=_e.$wrapNodeInElement,xoe=_e.CAN_USE_BEFORE_INPUT,voe=_e.CAN_USE_DOM,Coe=_e.IS_ANDROID,Eoe=_e.IS_ANDROID_CHROME,Nt=_e.IS_APPLE,woe=_e.IS_APPLE_WEBKIT,Toe=_e.IS_CHROME,Soe=_e.IS_FIREFOX,koe=_e.IS_IOS,Noe=_e.IS_SAFARI,qe=_e.addClassNamesToElement,dI=_e.calculateZoomLevel,Tx=_e.isBlockDomNode,Sx=_e.isHTMLAnchorElement,en=_e.isHTMLElement,Doe=_e.isInlineDomNode,Ooe=_e.isMimeType,Ioe=_e.makeStateWrapper,Aoe=_e.markSelection,Moe=_e.mediaFileReader,Ue=_e.mergeRegister,so=_e.objectKlassEquals,Loe=_e.positionNodeOnRange,Roe=_e.registerNestedElementResolver,Vn=_e.removeClassNamesFromElement,Poe=_e.selectionAlwaysOnDisplay;var Dx={};ze(Dx,{$createAutoLinkNode:()=>kx,$createLinkNode:()=>sl,$isAutoLinkNode:()=>nd,$isLinkNode:()=>Bi,$toggleLink:()=>fI,AutoLinkNode:()=>od,LinkNode:()=>il,TOGGLE_LINK_COMMAND:()=>Wj,formatUrl:()=>Nx,toggleLink:()=>Gj});var jj=new Set(["http:","https:","mailto:","sms:","tel:"]),il=class t extends Ht{static getType(){return"link"}static clone(e){return new t(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",n={},o){super(o);let{target:r=null,rel:i=null,title:s=null}=n;this.__url=e,this.__target=r,this.__rel=i,this.__title=s}createDOM(e){let n=document.createElement("a");return this.updateLinkDOM(null,n,e),qe(n,e.theme.link),n}updateLinkDOM(e,n,o){if(Sx(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let r of["target","rel","title"]){let i=`__${r}`,s=this[i];e&&e[i]===s||(s?n[r]=s:n.removeAttribute(r))}}}updateDOM(e,n,o){return this.updateLinkDOM(e,n,o),!1}static importDOM(){return{a:e=>({conversion:Vj,priority:1})}}static importJSON(e){return sl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Nx(e);try{let n=new URL(Nx(e));if(!jj.has(n.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let n=this.getWritable();return n.__url=e,n}getTarget(){return this.getLatest().__target}setTarget(e){let n=this.getWritable();return n.__target=e,n}getRel(){return this.getLatest().__rel}setRel(e){let n=this.getWritable();return n.__rel=e,n}getTitle(){return this.getLatest().__title}setTitle(e){let n=this.getWritable();return n.__title=e,n}insertNewAfter(e,n=!0){let o=sl(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,n),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,o){if(!B(n))return!1;let r=n.anchor.getNode(),i=n.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Vj(t){let e=null;if(Sx(t)){let n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=sl(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function sl(t="",e){return It(new il(t,e))}function Bi(t){return t instanceof il}var od=class t extends il{constructor(e="",n={},o){super(e,n,o),this.__isUnlinked=n.isUnlinked!==void 0&&n.isUnlinked!==null&&n.isUnlinked}static getType(){return"autolink"}static clone(e){return new t(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let n=this.getWritable();return n.__isUnlinked=e,n}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,n,o){return super.updateDOM(e,n,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return kx().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,n=!0){let o=this.getParentOrThrow().insertNewAfter(e,n);if(Y(o)){let r=kx(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}};function kx(t="",e){return It(new od(t,e))}function nd(t){return t instanceof od}var Wj=Kn("TOGGLE_LINK_COMMAND");function uI(t,e){if(t.type==="element"){let n=t.getNode();return Y(n)||(function(o,...r){let i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",o);for(let a of r)s.append("v",a);throw i.search=s.toString(),Error(`Minified Lexical error #${o}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),n.getChildren()[t.offset+e]||null}return null}function fI(t,e={}){let{target:n,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,i=$();if(i===null||!B(i)&&!mt(i))return;if(mt(i)){let c=i.getNodes();return c.length===0?void 0:void c.forEach((d=>{if(t===null){let u=ue(d,(p=>!nd(p)&&Bi(p)));u&&(u.insertBefore(d),u.getChildren().length===0&&u.remove())}else{let u=ue(d,(p=>!nd(p)&&Bi(p)));if(u)u.setURL(t),n!==void 0&&u.setTarget(n),r!==void 0&&u.setRel(r);else{let p=sl(t,{rel:r,target:n});d.insertBefore(p),p.append(d)}}}))}let s=i.extract();if(t===null)return void s.forEach((c=>{let d=ue(c,(u=>!nd(u)&&Bi(u)));if(d){let u=d.getChildren();for(let p=0;p<u.length;p++)d.insertBefore(u[p]);d.remove()}}));let a=new Set,l=c=>{a.has(c.getKey())||(a.add(c.getKey()),c.setURL(t),n!==void 0&&c.setTarget(n),r!==void 0&&c.setRel(r),o!==void 0&&c.setTitle(o))};if(s.length===1){let c=pI(s[0],Bi);if(c!==null)return l(c)}(function(c){let d=$();if(!B(d))return c();let u=jr(d),p=u.isBackward(),h=uI(u.anchor,p?-1:0),g=uI(u.focus,p?0:-1),m=c();if(h||g){let _=$();if(B(_)){let b=_.clone();if(h){let y=h.getParent();y&&b.anchor.set(y.getKey(),h.getIndexWithinParent()+(p?1:0),"element")}if(g){let y=g.getParent();y&&b.focus.set(y.getKey(),g.getIndexWithinParent()+(p?0:1),"element")}vt(jr(b))}}})((()=>{let c=null;for(let d of s){if(!d.isAttached())continue;let u=pI(d,Bi);if(u){l(u);continue}if(Y(d)){if(!d.isInline())continue;if(Bi(d)){if(!(nd(d)||c!==null&&c.getParentOrThrow().isParentOf(d))){l(d),c=d;continue}for(let h of d.getChildren())d.insertBefore(h);d.remove();continue}}let p=d.getPreviousSibling();Bi(p)&&p.is(c)?p.append(d):(c=sl(t,{rel:r,target:n,title:o}),d.insertAfter(c),c.append(d))}}))}var Gj=fI;function pI(t,e){let n=t;for(;n!==null&&n.getParent()!==null&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}var Yj=/^\+?[0-9\s()-]{5,}$/;function Nx(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:Yj.test(t)?`tel:${t}`:`https://${t}`}var dr=Dx,zoe=dr.$createAutoLinkNode,Af=dr.$createLinkNode,rd=dr.$isAutoLinkNode,et=dr.$isLinkNode,Mf=dr.$toggleLink,hI=dr.AutoLinkNode,al=dr.LinkNode,Wn=dr.TOGGLE_LINK_COMMAND,Hoe=dr.formatUrl,Uoe=dr.toggleLink;var Lx={};ze(Lx,{$createListItemNode:()=>ao,$createListNode:()=>Gn,$getListDepth:()=>Lf,$handleListInsertParagraph:()=>TI,$insertList:()=>id,$isListItemNode:()=>Le,$isListNode:()=>Ie,$removeList:()=>Mx,INSERT_CHECK_LIST_COMMAND:()=>SI,INSERT_ORDERED_LIST_COMMAND:()=>OI,INSERT_UNORDERED_LIST_COMMAND:()=>DI,ListItemNode:()=>Fs,ListNode:()=>ll,REMOVE_LIST_COMMAND:()=>II,UPDATE_LIST_START_COMMAND:()=>NI,insertList:()=>rV,registerCheckList:()=>tV,registerList:()=>nV,registerListStrictIndentTransform:()=>oV,removeList:()=>iV});function $i(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Lf(t){let e=1,n=t.getParent();for(;n!=null;){if(Le(n)){let o=n.getParent();if(Ie(o)){e++,n=o.getParent();continue}$i(40)}return e}return e}function Ox(t){let e=t.getParent();Ie(e)||$i(40);let n=e;for(;n!==null;)n=n.getParent(),Ie(n)&&(e=n);return e}function CI(t){let e=[],n=t.getChildren().filter(Le);for(let o=0;o<n.length;o++){let r=n[o],i=r.getFirstChild();Ie(i)?e=e.concat(CI(i)):e.push(r)}return e}function ur(t){return Le(t)&&Ie(t.getFirstChild())}function gI(t){return ao().append(t)}function EI(t,e){return Le(t)&&(e.length===0||e.length===1&&t.is(e[0])&&t.getChildrenSize()===0)}function id(t){let e=$();if(e!==null){let n=e.getNodes();if(B(e)){let r=e.getStartEndPoints();r===null&&$i(143);let[i]=r,s=i.getNode(),a=s.getParent();if(zt(s)){let l=s.getFirstChild();if(l)n=l.selectStart().getNodes();else{let c=me();s.append(c),n=c.select().getNodes()}}else if(EI(s,n)){let l=Gn(t);if(zt(a)){s.replace(l);let c=ao();Y(s)&&(c.setFormat(s.getFormatType()),c.setIndent(s.getIndent())),l.append(c)}else if(Le(s)){let c=s.getParentOrThrow();Ps(l,c.getChildren()),c.replace(l)}return}}let o=new Set;for(let r=0;r<n.length;r++){let i=n[r];if(Y(i)&&i.isEmpty()&&!Le(i)&&!o.has(i.getKey())){mI(i,t);continue}let s=Jc(i)?i.getParent():Le(i)&&i.isEmpty()?i:null;for(;s!=null;){let a=s.getKey();if(Ie(s)){if(!o.has(a)){let l=Gn(t);Ps(l,s.getChildren()),s.replace(l),o.add(a)}break}{let l=s.getParent();if(zt(l)&&!o.has(a)){o.add(a),mI(s,t);break}s=l}}}}}function Ps(t,e){t.splice(t.getChildrenSize(),0,e)}function mI(t,e){if(Ie(t))return t;let n=t.getPreviousSibling(),o=t.getNextSibling(),r=ao(),i;if(Ps(r,t.getChildren()),Ie(n)&&e===n.getListType())n.append(r),Ie(o)&&e===o.getListType()&&(Ps(n,o.getChildren()),o.remove()),i=n;else if(Ie(o)&&e===o.getListType())o.getFirstChildOrThrow().insertBefore(r),i=o;else{let s=Gn(e);s.append(r),t.replace(s),i=s}return r.setFormat(t.getFormatType()),r.setIndent(t.getIndent()),t.remove(),i}function Ax(t,e){let n=t.getLastChild(),o=e.getFirstChild();n&&o&&ur(n)&&ur(o)&&(Ax(n.getFirstChild(),o.getFirstChild()),o.remove());let r=e.getChildren();r.length>0&&t.append(...r),e.remove()}function Mx(){let t=$();if(B(t)){let e=new Set,n=t.getNodes(),o=t.anchor.getNode();if(EI(o,n))e.add(Ox(o));else for(let r=0;r<n.length;r++){let i=n[r];if(Jc(i)){let s=Of(i,Fs);s!=null&&e.add(Ox(s))}}for(let r of e){let i=r,s=CI(r);for(let a of s){let l=me().setTextStyle(t.style).setTextFormat(t.format);Ps(l,a.getChildren()),i.insertAfter(l),i=l,a.__key===t.anchor.key&&Ii(t.anchor,ar(ro(l,"next"))),a.__key===t.focus.key&&Ii(t.focus,ar(ro(l,"next"))),a.remove()}r.remove()}}}function wI(t){let e=t.getListType()!=="check",n=t.getStart();for(let o of t.getChildren())Le(o)&&(o.getValue()!==n&&o.setValue(n),e&&o.getLatest().__checked!=null&&o.setChecked(void 0),Ie(o.getFirstChild())||n++)}function qj(t){let e=new Set;if(ur(t)||e.has(t.getKey()))return;let n=t.getParent(),o=t.getNextSibling(),r=t.getPreviousSibling();if(ur(o)&&ur(r)){let i=r.getFirstChild();if(Ie(i)){i.append(t);let s=o.getFirstChild();Ie(s)&&(Ps(i,s.getChildren()),o.remove(),e.add(o.getKey()))}}else if(ur(o)){let i=o.getFirstChild();if(Ie(i)){let s=i.getFirstChild();s!==null&&s.insertBefore(t)}}else if(ur(r)){let i=r.getFirstChild();Ie(i)&&i.append(t)}else if(Ie(n)){let i=ao().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=Gn(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());i.append(s),s.append(t),r?r.insertAfter(i):o?o.insertBefore(i):n.append(i)}}function Jj(t){if(ur(t))return;let e=t.getParent(),n=e?e.getParent():void 0;if(Ie(n?n.getParent():void 0)&&Le(n)&&Ie(e)){let o=e?e.getFirstChild():void 0,r=e?e.getLastChild():void 0;if(t.is(o))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(r))n.insertAfter(t),e.isEmpty()&&n.remove();else{let i=e.getListType(),s=ao(),a=Gn(i);s.append(a),t.getPreviousSiblings().forEach((d=>a.append(d)));let l=ao(),c=Gn(i);l.append(c),Ps(c,t.getNextSiblings()),n.insertBefore(s),n.insertAfter(l),n.replace(t)}}}function TI(){let t=$();if(!B(t)||!t.isCollapsed())return!1;let e=t.anchor.getNode();if(!Le(e)||e.getChildrenSize()!==0)return!1;let n=Ox(e),o=e.getParent();Ie(o)||$i(40);let r=o.getParent(),i;if(zt(r))i=me(),n.insertAfter(i);else{if(!Le(r))return!1;i=ao(),r.insertAfter(i)}i.setTextStyle(t.style).setTextFormat(t.format).select();let s=e.getNextSiblings();if(s.length>0){let a=Gn(o.getListType());if(Le(i)){let l=ao();l.append(a),i.insertAfter(l)}else i.insertAfter(a);a.append(...s)}return(function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){let c=l.getParent();if(c==null||!Le(c)&&!Ie(c))break;l=c}l.remove()})(e),!0}function Rf(...t){let e=[];for(let n of t)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))e.push(o);return e}var Fs=class extends Ht{$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;let n=e.getParent();Ie(n)&&n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:Ht,importDOM:sx({li:()=>({conversion:Xj,priority:0})})})}constructor(e=1,n=void 0,o){super(o),this.__value=e===void 0?1:e,this.__checked=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let n=document.createElement("li");return this.updateListItemDOM(null,n,e),n}updateListItemDOM(e,n,o){let r=this.getParent();Ie(r)&&r.getListType()==="check"&&(function(a,l,c,d){Ie(l.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&l.__checked===c.__checked||a.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(n,this,e),n.value=this.__value,(function(a,l,c){let d=[],u=[],p=l.list,h=p?p.listitem:void 0,g;if(p&&p.nested&&(g=p.nested.listitem),h!==void 0&&d.push(...Rf(h)),p){let m=c.getParent(),_=Ie(m)&&m.getListType()==="check",b=c.getChecked();_&&!b||u.push(p.listitemUnchecked),_&&b||u.push(p.listitemChecked),_&&d.push(b?p.listitemChecked:p.listitemUnchecked)}if(g!==void 0){let m=Rf(g);c.getChildren().some((_=>Ie(_)))?d.push(...m):u.push(...m)}u.length>0&&Vn(a,...u),d.length>0&&qe(a,...d)})(n,o.theme,this);let i=e?e.__style:"",s=this.__style;i!==s&&(s===""?n.removeAttribute("style"):n.style.cssText=s),(function(a,l,c){let d=bx(l.__textStyle);for(let u in d)a.style.setProperty(`--listitem-marker-${u}`,d[u]);if(c)for(let u in bx(c.__textStyle))u in d||a.style.removeProperty(`--listitem-marker-${u}`)})(n,this,e)}updateDOM(e,n,o){let r=n;return this.updateListItemDOM(e,r,o),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let n=this.createDOM(e._config),o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();return r&&(n.dir=r),{element:n}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let n=0;n<e.length;n++){let o=e[n];if(Y(o)&&this.canMergeWith(o)){let r=o.getChildren();this.append(...r),o.remove()}else super.append(o)}return this}replace(e,n){if(Le(e))return super.replace(e);this.setIndent(0);let o=this.getParentOrThrow();if(!Ie(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{let r=Gn(o.getListType()),i=this.getNextSibling();for(;i;){let s=i;i=i.getNextSibling(),r.append(s)}o.insertAfter(e),e.insertAfter(r)}return n&&(Y(e)||$i(139),this.getChildren().forEach((r=>{e.append(r)}))),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,n=!0){let o=this.getParentOrThrow();if(Ie(o)||$i(39),Le(e))return super.insertAfter(e,n);let r=this.getNextSiblings();if(o.insertAfter(e,n),r.length!==0){let i=Gn(o.getListType());r.forEach((s=>i.append(s))),e.insertAfter(i,n)}return e}remove(e){let n=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),n&&o&&ur(n)&&ur(o)&&(Ax(n.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,n=!0){let o=ao().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,n),o}collapseAtStart(e){let n=me();this.getChildren().forEach((s=>n.append(s)));let o=this.getParentOrThrow(),r=o.getParentOrThrow(),i=Le(r);if(o.getChildrenSize()===1)if(i)o.remove(),r.select();else{o.insertBefore(n),o.remove();let s=e.anchor,a=e.focus,l=n.getKey();s.type==="element"&&s.getNode().is(this)&&s.set(l,s.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else o.insertBefore(n),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let n=this.getWritable();return n.__value=e,n}getChecked(){let e=this.getLatest(),n,o=this.getParent();return Ie(o)&&(n=o.getListType()),n==="check"?!!e.__checked:void 0}setChecked(e){let n=this.getWritable();return n.__checked=e,n}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let n=e.getParentOrThrow(),o=0;for(;Le(n);)n=n.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&$i(117),(e=Math.floor(e))>=0||$i(199);let n=this.getIndent();for(;n!==e;)n<e?(qj(this),n++):(Jj(this),n--);return this}canInsertAfter(e){return Le(e)}canReplaceWith(e){return Le(e)}canMergeWith(e){return Le(e)||Qt(e)}extractWithChild(e,n){if(!B(n))return!1;let o=n.anchor.getNode(),r=n.focus.getNode();return this.isParentOf(o)&&this.isParentOf(r)&&this.getTextContent().length===n.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Gn("bullet")}canMergeWhenEmpty(){return!0}};function Xj(t){if(t.classList.contains("task-list-item")){for(let n of t.children)if(n.tagName==="INPUT")return Zj(n)}let e=t.getAttribute("aria-checked");return{node:ao(e==="true"||e!=="false"&&void 0)}}function Zj(t){return t.getAttribute("type")!=="checkbox"?{node:null}:{node:ao(t.hasAttribute("checked"))}}function ao(t){return It(new Fs(void 0,t))}function Le(t){return t instanceof Fs}var ll=class extends Ht{$config(){return this.config("list",{$transform:e=>{(function(n){let o=n.getNextSibling();Ie(o)&&n.getListType()===o.getListType()&&Ax(n,o)})(e),wI(e)},extends:Ht,importDOM:sx({ol:()=>({conversion:bI,priority:0}),ul:()=>({conversion:bI,priority:0})})})}constructor(e="number",n=1,o){super(o);let r=eV[e]||e;this.__listType=r,this.__tag=r==="number"?"ol":"ul",this.__start=n}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let n=this.getWritable();return n.__listType=e,n.__tag=e==="number"?"ol":"ul",n}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let n=this.getWritable();return n.__start=e,n}createDOM(e,n){let o=this.__tag,r=document.createElement(o);return this.__start!==1&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,_I(r,e.theme,this),r}updateDOM(e,n,o){return e.__tag!==this.__tag||(_I(n,o.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let n=this.createDOM(e._config,e);return en(n)&&(this.__start!==1&&n.setAttribute("start",String(this.__start)),this.__listType==="check"&&n.setAttribute("__lexicalListType","check")),{element:n}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,n,o){let r=o;for(let i=0;i<o.length;i++){let s=o[i];Le(s)||(r===o&&(r=[...o]),r[i]=ao().append(!Y(s)||Ie(s)||s.isInline()?s:St(s.getTextContent())))}return super.splice(e,n,r)}extractWithChild(e){return Le(e)}};function _I(t,e,n){let o=[],r=[],i=e.list;if(i!==void 0){let s=i[`${n.__tag}Depth`]||[],a=Lf(n)-1,l=a%s.length,c=s[l],d=i[n.__tag],u,p=i.nested,h=i.checklist;if(p!==void 0&&p.list&&(u=p.list),d!==void 0&&o.push(d),h!==void 0&&n.__listType==="check"&&o.push(h),c!==void 0){o.push(...Rf(c));for(let g=0;g<s.length;g++)g!==l&&r.push(n.__tag+g)}if(u!==void 0){let g=Rf(u);a>1?o.push(...g):r.push(...g)}}r.length>0&&Vn(t,...r),o.length>0&&qe(t,...o)}function Qj(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];if(Le(o)){e.push(o);let r=o.getChildren();r.length>1&&r.forEach((i=>{Ie(i)&&e.push(gI(i))}))}else e.push(gI(o))}return e}function bI(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=Gn("number",t.start):e==="ul"&&(n=(function(o){if(o.getAttribute("__lexicallisttype")==="check"||o.classList.contains("contains-task-list"))return!0;for(let r of o.childNodes)if(en(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(t)?Gn("check"):Gn("bullet")),{after:Qj,node:n}}var eV={ol:"number",ul:"bullet"};function Gn(t="number",e=1){return It(new ll(t,e))}function Ie(t){return t instanceof ll}var SI=Kn("INSERT_CHECK_LIST_COMMAND");function tV(t){return Ue(t.registerCommand(SI,(()=>(id("check"),!0)),Pe),t.registerCommand(Vr,(e=>vI(e,t,!1)),Pe),t.registerCommand($o,(e=>vI(e,t,!0)),Pe),t.registerCommand(Li,(()=>{if(Ix()!=null){let e=t.getRootElement();return e?.focus(),!0}return!1}),Pe),t.registerCommand(Cf,(e=>{let n=Ix();return!(n==null||!t.isEditable())&&(t.update((()=>{let o=an(n);Le(o)&&(e.preventDefault(),o.toggleChecked())})),!0)}),Pe),t.registerCommand(rl,(e=>t.getEditorState().read((()=>{let n=$();if(B(n)&&n.isCollapsed()){let{anchor:o}=n,r=o.type==="element";if(r||o.offset===0){let i=o.getNode(),s=ue(i,(a=>Y(a)&&!a.isInline()));if(Le(s)){let a=s.getParent();if(Ie(a)&&a.getListType()==="check"&&(r||s.getFirstDescendant()===i)){let l=t.getElementByKey(s.__key);if(l!=null&&document.activeElement!==l)return l.focus(),e.preventDefault(),!0}}}}return!1}))),Pe),t.registerRootListener(((e,n)=>{e!==null&&(e.addEventListener("click",yI),e.addEventListener("pointerdown",xI)),n!==null&&(n.removeEventListener("click",yI),n.removeEventListener("pointerdown",xI))})))}function kI(t,e){let n=t.target;if(!en(n))return;let o=n.firstChild;if(en(o)&&(o.tagName==="UL"||o.tagName==="OL"))return;let r=n.parentNode;if(!r||r.__lexicalListType!=="check")return;let i=n.getBoundingClientRect(),s=dI(n),a=t.clientX/s,l=window.getComputedStyle?window.getComputedStyle(n,"::before"):{width:"0px"},c=parseFloat(l.width),d=t.pointerType==="touch"?32:0;(n.dir==="rtl"?a<i.right+d&&a>i.right-c-d:a>i.left-d&&a<i.left+c+d)&&e()}function yI(t){kI(t,(()=>{if(en(t.target)){let e=t.target,n=xO(e);n!=null&&n.isEditable()&&n.update((()=>{let o=an(e);Le(o)&&(e.focus(),o.toggleChecked())}))}}))}function xI(t){kI(t,(()=>{t.preventDefault()}))}function Ix(){let t=document.activeElement;return en(t)&&t.tagName==="LI"&&t.parentNode!=null&&t.parentNode.__lexicalListType==="check"?t:null}function vI(t,e,n){let o=Ix();return o!=null&&e.update((()=>{let r=an(o);if(!Le(r))return;let i=(function(s,a){let l=a?s.getPreviousSibling():s.getNextSibling(),c=s;for(;l==null&&Le(c);)c=c.getParentOrThrow().getParent(),c!=null&&(l=a?c.getPreviousSibling():c.getNextSibling());for(;Le(l);){let d=a?l.getLastChild():l.getFirstChild();if(!Ie(d))return l;l=a?d.getLastChild():d.getFirstChild()}return null})(r,n);if(i!=null){i.selectStart();let s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout((()=>{s.focus()}),0))}})),!1}var NI=Kn("UPDATE_LIST_START_COMMAND"),DI=Kn("INSERT_UNORDERED_LIST_COMMAND"),OI=Kn("INSERT_ORDERED_LIST_COMMAND"),II=Kn("REMOVE_LIST_COMMAND");function nV(t){return Ue(t.registerCommand(OI,(()=>(id("number"),!0)),Pe),t.registerCommand(NI,(e=>{let{listNodeKey:n,newStart:o}=e,r=At(n);return!!Ie(r)&&(r.getListType()==="number"&&(r.setStart(o),wI(r)),!0)}),Pe),t.registerCommand(DI,(()=>(id("bullet"),!0)),Pe),t.registerCommand(II,(()=>(Mx(),!0)),Pe),t.registerCommand(Mi,(()=>TI()),Pe),t.registerNodeTransform(Fs,(e=>{let n=e.getFirstChild();if(n){if(te(n)){let o=n.getStyle(),r=n.getFormat();e.getTextStyle()!==o&&e.setTextStyle(o),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let o=$();B(o)&&(o.style!==e.getTextStyle()||o.format!==e.getTextFormat())&&o.isCollapsed()&&e.is(o.anchor.getNode())&&e.setTextStyle(o.style).setTextFormat(o.format)}})),t.registerNodeTransform(Ut,(e=>{let n=e.getParent();if(Le(n)&&e.is(n.getFirstChild())){let o=e.getStyle(),r=e.getFormat();o===n.getTextStyle()&&r===n.getTextFormat()||n.setTextStyle(o).setTextFormat(r)}})))}function oV(t){let e=n=>{let o=n.getParent();if(Ie(n.getFirstChild())||!Ie(o))return;let r=ue(n,(i=>Le(i)&&Ie(i.getParent())&&Le(i.getPreviousSibling())));if(r===null&&n.getIndent()>0)n.setIndent(0);else if(Le(r)){let i=r.getPreviousSibling();if(Le(i)){let s=(function(l){let c=l,d=c.getFirstChild();for(;Ie(d);){let u=d.getLastChild();if(!Le(u))break;c=u,d=c.getFirstChild()}return c})(i),a=s.getParent();if(Ie(a)){let l=Lf(a);l+1<Lf(o)&&n.setIndent(l)}}}};return t.registerNodeTransform(ll,(n=>{let o=[n];for(;o.length>0;){let r=o.shift();if(Ie(r)){for(let i of r.getChildren())if(Le(i)){e(i);let s=i.getFirstChild();Ie(s)&&o.push(s)}}}}))}function rV(t,e){t.update((()=>id(e)))}function iV(t){t.update((()=>Mx()))}var Mt=Lx,sd=Mt.$createListItemNode,cl=Mt.$createListNode,Goe=Mt.$getListDepth,Yoe=Mt.$handleListInsertParagraph,qoe=Mt.$insertList,ad=Mt.$isListItemNode,Nn=Mt.$isListNode,Joe=Mt.$removeList,Xoe=Mt.INSERT_CHECK_LIST_COMMAND,AI=Mt.INSERT_ORDERED_LIST_COMMAND,MI=Mt.INSERT_UNORDERED_LIST_COMMAND,zi=Mt.ListItemNode,pr=Mt.ListNode,Zoe=Mt.REMOVE_LIST_COMMAND,Qoe=Mt.UPDATE_LIST_START_COMMAND,ere=Mt.insertList,tre=Mt.registerCheckList,LI=Mt.registerList,RI=Mt.registerListStrictIndentTransform,nre=Mt.removeList;var Rx={};ze(Rx,{LexicalComposerContext:()=>PI,createLexicalComposerContext:()=>sV,useLexicalComposerContext:()=>aV});bt();var PI=ft(null);function sV(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}}function aV(){let t=ht(PI);return t==null&&(function(e,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(let i of n)r.append("v",i);throw o.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),t}var Px=Rx,FI=Px.LexicalComposerContext,BI=Px.createLexicalComposerContext,Ee=Px.useLexicalComposerContext;var Fx={};ze(Fx,{AutoFocusPlugin:()=>lV});bt();function lV({defaultSelection:t}){let[e]=Ee();return P((()=>{e.focus((()=>{let n=document.activeElement,o=e.getRootElement();o===null||n!==null&&o.contains(n)||o.focus({preventScroll:!0})}),{defaultSelection:t})}),[t,e]),null}var cV=Fx,$I=cV.AutoFocusPlugin;var Bx={};ze(Bx,{LexicalComposer:()=>uV});bt();var zI=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,dV=zI?mn:P,Pf={tag:ol};function uV({initialConfig:t,children:e}){let n=J((()=>{let{theme:o,namespace:r,nodes:i,onError:s,editorState:a,html:l}=t,c=BI(null,o),d=bO({editable:t.editable,html:l,namespace:r,nodes:i,onError:u=>s(u,d),theme:o});return(function(u,p){if(p!==null){if(p===void 0)u.update((()=>{let h=nt();if(h.isEmpty()){let g=me();h.append(g);let m=zI?document.activeElement:null;($()!==null||m!==null&&m===u.getRootElement())&&g.select()}}),Pf);else if(p!==null)switch(typeof p){case"string":{let h=u.parseEditorState(p);u.setEditorState(h,Pf);break}case"object":u.setEditorState(p,Pf);break;case"function":u.update((()=>{nt().isEmpty()&&p(u)}),Pf)}}})(d,a),[d,c]}),[]);return dV((()=>{let o=t.editable,[r]=n;r.setEditable(o===void 0||o)}),[]),f(FI.Provider,{value:n,children:e})}var pV=Bx,HI=pV.LexicalComposer;var zx={};ze(zx,{$canShowPlaceholder:()=>KI,$canShowPlaceholderCurry:()=>hV,$findTextIntersectionFromCharacters:()=>gV,$isRootTextContentEmpty:()=>$x,$isRootTextContentEmptyCurry:()=>fV,$rootTextContent:()=>UI,registerLexicalTextEntity:()=>_V});function UI(){return nt().getTextContent()}function $x(t,e=!0){if(t)return!1;let n=UI();return e&&(n=n.trim()),n===""}function fV(t,e){return()=>$x(t,e)}function KI(t){if(!$x(t,!1))return!1;let e=nt().getChildren(),n=e.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=e[o];if(zn(r))return!1;if(Y(r)){if(!Qt(r)||r.__indent!==0)return!1;let i=r.getChildren(),s=i.length;for(let a=0;a<s;a++){let l=i[o];if(!te(l))return!1}}}return!0}function hV(t){return()=>KI(t)}function gV(t,e){let n=t.getFirstChild(),o=0;e:for(;n!==null;){if(Y(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(te(n)){let s=n.getTextContentSize();if(o+s>e)return{node:n,offset:e-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let i=n.getParent();for(;i!==null;){let s=i.getNextSibling();if(s!==null){n=s;continue e}i=i.getParent()}break}return null}function mV(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _V(t,e,n,o){let r=s=>s instanceof n,i=s=>{let a=St(s.getTextContent());a.setFormat(s.getFormat()),s.replace(a)};return[t.registerNodeTransform(Ut,(s=>{if(!s.isSimpleText())return;let a,l=s.getPreviousSibling(),c=s.getTextContent(),d=s;if(te(l)){let p=l.getTextContent(),h=e(p+c);if(r(l)){if(h===null||(g=>g.getLatest().__mode)(l)!==0)return void i(l);{let g=h.end-p.length;if(g>0){let m=p+c.slice(0,g);if(l.select(),l.setTextContent(m),g===c.length)s.remove();else{let _=c.slice(g);s.setTextContent(_)}return}}}else if(h===null||h.start<p.length)return}let u=0;for(;;){a=e(c);let p,h=a===null?"":c.slice(a.end);if(c=h,h===""){let m=d.getNextSibling();if(te(m)){h=d.getTextContent()+m.getTextContent();let _=e(h);if(_===null)return void(r(m)?i(m):m.markDirty());if(_.start!==0)return}}if(a===null)return;if(a.start===0&&te(l)&&l.isTextEntity()){u+=a.end;continue}a.start===0?[p,d]=d.splitText(a.end):[,p,d]=d.splitText(a.start+u,a.end+u),p===void 0&&mV(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),d==null)return;u=0,l=g}})),t.registerNodeTransform(n,(s=>{let a=s.getTextContent(),l=e(a);if(l===null||l.start!==0)return void i(s);if(a.length>l.end)return void s.splitText(l.end);let c=s.getPreviousSibling();te(c)&&c.isTextEntity()&&(i(c),i(s));let d=s.getNextSibling();te(d)&&d.isTextEntity()&&(i(d),r(s)&&i(s))}))]}var Bs=zx,_re=Bs.$canShowPlaceholder,Ff=Bs.$canShowPlaceholderCurry,bre=Bs.$findTextIntersectionFromCharacters,yre=Bs.$isRootTextContentEmpty,xre=Bs.$isRootTextContentEmptyCurry,vre=Bs.$rootTextContent,Cre=Bs.registerLexicalTextEntity;var Hx={};ze(Hx,{ContentEditable:()=>yV,ContentEditableElement:()=>WI});bt();var VI=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?mn:P;function bV({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:c,ariaMultiline:d,ariaOwns:u,ariaRequired:p,autoCapitalize:h,className:g,id:m,role:_="textbox",spellCheck:b=!0,style:y,tabIndex:v,"data-testid":x,...E},C){let[k,T]=L(t.isEditable()),w=De((N=>{N&&N.ownerDocument&&N.ownerDocument.defaultView?t.setRootElement(N):t.setRootElement(null)}),[t]),S=J((()=>(function(...N){return D=>{N.forEach((O=>{typeof O=="function"?O(D):O!=null&&(O.current=D)}))}})(C,w)),[w,C]);return VI((()=>(T(t.isEditable()),t.registerEditableListener((N=>{T(N)})))),[t]),f("div",{"aria-activedescendant":k?e:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":k&&_==="combobox"?!!s:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":c,"aria-multiline":d,"aria-owns":k?u:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:h,className:g,contentEditable:k,"data-testid":x,id:m,ref:S,role:_,spellCheck:b,style:y,tabIndex:v,...E})}var WI=Wo(bV);function jI(t){return t.getEditorState().read(Ff(t.isComposing()))}var yV=Wo(xV);function xV(t,e){let{placeholder:n,...o}=t,[r]=Ee();return f(Ne,{children:[f(WI,{editor:r,...o,ref:e}),n!=null&&f(vV,{editor:r,content:n})]})}function vV({content:t,editor:e}){let n=(function(s){let[a,l]=L((()=>jI(s)));return VI((()=>{function c(){let d=jI(s);l(d)}return c(),Ue(s.registerUpdateListener((()=>{c()})),s.registerEditableListener((()=>{c()})))}),[s]),a})(e),[o,r]=L(e.isEditable());if(mn((()=>(r(e.isEditable()),e.registerEditableListener((s=>{r(s)})))),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(o):t!==null&&(i=t),i===null?null:f("div",{"aria-hidden":!0,children:i})}var GI=Hx,YI=GI.ContentEditable,Dre=GI.ContentEditableElement;var Kx={};ze(Kx,{LexicalErrorBoundary:()=>EV});bt();function Ux(t,e){return Ux=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ux(t,e)}var qI={error:null},CV=(function(t){var e,n;function o(){for(var i,s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return(i=t.call.apply(t,[this].concat(a))||this).state=qI,i.resetErrorBoundary=function(){for(var c,d=arguments.length,u=new Array(d),p=0;p<d;p++)u[p]=arguments[p];i.props.onReset==null||(c=i.props).onReset.apply(c,u),i.reset()},i}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,Ux(e,n),o.getDerivedStateFromError=function(i){return{error:i}};var r=o.prototype;return r.reset=function(){this.setState(qI)},r.componentDidCatch=function(i,s){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,s)},r.componentDidUpdate=function(i,s){var a,l,c,d,u=this.state.error,p=this.props.resetKeys;u!==null&&s.error!==null&&((c=i.resetKeys)===void 0&&(c=[]),(d=p)===void 0&&(d=[]),c.length!==d.length||c.some((function(h,g){return!Object.is(h,d[g])})))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,p),this.reset())},r.render=function(){var i=this.state.error,s=this.props,a=s.fallbackRender,l=s.FallbackComponent,c=s.fallback;if(i!==null){var d={error:i,resetErrorBoundary:this.resetErrorBoundary};if(yC(c))return c;if(typeof a=="function")return a(d);if(l)return Ji(l,d);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},o})(fC);function EV({children:t,onError:e}){return f(CV,{fallback:f("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var wV=Kx,JI=wV.LexicalErrorBoundary;var Wx={};ze(Wx,{createEmptyHistoryState:()=>IV,registerHistory:()=>OV});var Bf=0,jx=1,Vx=2,Ho=0,TV=1,XI=2,SV=3,kV=4;function NV(t,e,n,o,r){if(t===null||n.size===0&&o.size===0&&!r)return Ho;let i=e._selection,s=t._selection;if(r)return TV;if(!(B(i)&&B(s)&&s.isCollapsed()&&i.isCollapsed()))return Ho;let a=(function(b,y,v){let x=b._nodeMap,E=[];for(let C of y){let k=x.get(C);k!==void 0&&E.push(k)}for(let[C,k]of v){if(!k)continue;let T=x.get(C);T===void 0||sr(T)||E.push(T)}return E})(e,n,o);if(a.length===0)return Ho;if(a.length>1){let b=e._nodeMap,y=b.get(i.anchor.key),v=b.get(s.anchor.key);return y&&v&&!t._nodeMap.has(y.__key)&&te(y)&&y.__text.length===1&&i.anchor.offset===1?XI:Ho}let l=a[0],c=t._nodeMap.get(l.__key);if(!te(c)||!te(l)||c.__mode!==l.__mode)return Ho;let d=c.__text,u=l.__text;if(d===u)return Ho;let p=i.anchor,h=s.anchor;if(p.key!==h.key||p.type!=="text")return Ho;let g=p.offset,m=h.offset,_=u.length-d.length;return _===1&&m===g-1?XI:_===-1&&m===g+1?SV:_===-1&&m===g?kV:Ho}function DV(t,e){let n=Date.now(),o=Ho;return(r,i,s,a,l,c)=>{let d=Date.now();if(c.has(nl))return o=Ho,n=d,Vx;let u=NV(r,i,a,l,t.isComposing()),p=(()=>{let h=s===null||s.editor===t,g=c.has(lO);if(!g&&h&&c.has(ol))return Bf;if(r===null)return jx;let m=i._selection;return a.size>0||l.size>0?g===!1&&u!==Ho&&u===o&&d<n+e&&h||a.size===1&&(function(_,b,y){let v=b._nodeMap.get(_),x=y._nodeMap.get(_),E=b._selection,C=y._selection;return!(B(E)&&B(C)&&E.anchor.type==="element"&&E.focus.type==="element"&&C.anchor.type==="text"&&C.focus.type==="text"||!te(v)||!te(x)||v.__parent!==x.__parent)&&JSON.stringify(b.read((()=>v.exportJSON())))===JSON.stringify(y.read((()=>x.exportJSON())))})(Array.from(a)[0],r,i)?Bf:jx:m!==null?Bf:Vx})();return n=d,o=u,p}}function ZI(t){t.undoStack=[],t.redoStack=[],t.current=null}function OV(t,e,n){let o=DV(t,n);return Ue(t.registerCommand(_O,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(l.length!==0){let c=s.current,d=l.pop();c!==null&&(a.push(c),i.dispatchCommand(Is,!0)),l.length===0&&i.dispatchCommand(As,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:nl})}})(t,e),!0)),Se),t.registerCommand(pO,(()=>((function(i,s){let a=s.redoStack,l=s.undoStack;if(a.length!==0){let c=s.current;c!==null&&(l.push(c),i.dispatchCommand(As,!0));let d=a.pop();a.length===0&&i.dispatchCommand(Is,!1),s.current=d||null,d&&d.editor.setEditorState(d.editorState,{tag:nl})}})(t,e),!0)),Se),t.registerCommand(tO,(()=>(ZI(e),!1)),Se),t.registerCommand(nO,(()=>(ZI(e),t.dispatchCommand(Is,!1),t.dispatchCommand(As,!1),!0)),Se),t.registerUpdateListener((({editorState:i,prevEditorState:s,dirtyLeaves:a,dirtyElements:l,tags:c})=>{let d=e.current,u=e.redoStack,p=e.undoStack,h=d===null?null:d.editorState;if(d!==null&&i===h)return;let g=o(s,i,d,a,l,c);if(g===jx)u.length!==0&&(e.redoStack=[],t.dispatchCommand(Is,!1)),d!==null&&(p.push({...d}),t.dispatchCommand(As,!0));else if(g===Vx)return;e.current={editor:t,editorState:i}})))}function IV(){return{current:null,redoStack:[],undoStack:[]}}var QI=Wx,$f=QI.createEmptyHistoryState,eA=QI.registerHistory;var Gx={};ze(Gx,{HistoryPlugin:()=>AV,createEmptyHistoryState:()=>$f});bt();function AV({delay:t,externalHistoryState:e}){let[n]=Ee();return(function(o,r,i=1e3){let s=J((()=>r||$f()),[r]);P((()=>eA(o,s,i)),[i,o,s])})(n,e,t),null}var tA=Gx,nA=tA.HistoryPlugin,oA=tA.createEmptyHistoryState;var Yx={};ze(Yx,{useLexicalNodeSelection:()=>MV});bt();function rA(t,e){return t.getEditorState().read((()=>{let n=At(e);return n!==null&&n.isSelected()}))}function MV(t){let[e]=Ee(),[n,o]=L((()=>rA(e,t)));return P((()=>{let r=!0,i=e.registerUpdateListener((()=>{r&&o(rA(e,t))}));return()=>{r=!1,i()}}),[e,t]),[n,De((r=>{e.update((()=>{let i=$();mt(i)||(i=HD(),vt(i)),mt(i)&&(r?i.add(t):i.delete(t))}))}),[e,t]),De((()=>{e.update((()=>{let r=$();mt(r)&&r.clear()}))}),[e])]}var LV=Yx,zf=LV.useLexicalNodeSelection;var Jx={};ze(Jx,{$createHorizontalRuleNode:()=>qx,$isHorizontalRuleNode:()=>BV,HorizontalRuleNode:()=>ld,INSERT_HORIZONTAL_RULE_COMMAND:()=>RV});bt();var RV=Kn("INSERT_HORIZONTAL_RULE_COMMAND");function PV({nodeKey:t}){let[e]=Ee(),[n,o,r]=zf(t);return P((()=>Ue(e.registerCommand(lr,(i=>{let s=e.getElementByKey(t);return i.target===s&&(i.shiftKey||r(),o(!n),!0)}),Pe))),[r,e,n,t,o]),P((()=>{let i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?qe(i,s):Vn(i,s))}),[e,n,t]),null}var ld=class t extends tl{static getType(){return"horizontalrule"}static clone(e){return new t(e.__key)}static importJSON(e){return qx().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:FV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){let n=document.createElement("hr");return qe(n,e.theme.hr),n}getTextContent(){return`
116
- `}isInline(){return!1}updateDOM(){return!1}decorate(){return f(PV,{nodeKey:this.__key})}};function FV(){return{node:qx()}}function qx(){return It(new ld)}function BV(t){return t instanceof ld}var Hf=Jx,dl=Hf.$createHorizontalRuleNode,iA=Hf.$isHorizontalRuleNode,Uf=Hf.HorizontalRuleNode,Kf=Hf.INSERT_HORIZONTAL_RULE_COMMAND;var Xx={};ze(Xx,{HorizontalRulePlugin:()=>$V});bt();function $V(){let[t]=Ee();return P((()=>t.registerCommand(Kf,(e=>{let n=$();if(!B(n))return!1;if(n.focus.getNode()!==null){let o=dl();If(o)}return!0}),Se)),[t]),null}var zV=Xx,sA=zV.HorizontalRulePlugin;var Zx={};ze(Zx,{LinkPlugin:()=>HV});bt();function HV({validateUrl:t,attributes:e}){let[n]=Ee();return P((()=>{if(!n.hasNodes([al]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ue(n.registerCommand(Wn,(o=>{if(o===null)return Mf(o),!0;if(typeof o=="string")return!(t!==void 0&&!t(o))&&(Mf(o,e),!0);{let{url:r,target:i,rel:s,title:a}=o;return Mf(r,{...e,rel:s,target:i,title:a}),!0}}),Pe),t!==void 0?n.registerCommand(Pi,(o=>{let r=$();if(!B(r)||r.isCollapsed()||!so(o,ClipboardEvent)||o.clipboardData===null)return!1;let i=o.clipboardData.getData("text");return!!t(i)&&!r.getNodes().some((s=>Y(s)))&&(n.dispatchCommand(Wn,{...e,url:i}),o.preventDefault(),!0)}),Pe):()=>{})}),[n,t,e]),null}var UV=Zx,aA=UV.LinkPlugin;var Qx={};ze(Qx,{ListPlugin:()=>KV});bt();function KV({hasStrictIndent:t=!1}){let[e]=Ee();return P((()=>{if(!e.hasNodes([pr,zi]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[e]),P((()=>{if(t)return RI(e)}),[e,t]),(function(n){P((()=>LI(n)),[n])})(e),null}var jV=Qx,lA=jV.ListPlugin;var ev={};ze(ev,{useLexicalEditable:()=>GV});bt();var VV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?mn:P;function WV(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function GV(){return(function(t){let[e]=Ee(),n=J((()=>t(e)),[e,t]),[o,r]=L((()=>n.initialValueFn())),i=q(o);return VV((()=>{let{initialValueFn:s,subscribe:a}=n,l=s();return i.current!==l&&(i.current=l,r(l)),a((c=>{i.current=c,r(c)}))}),[n,t]),o})(WV)}var YV=ev,cA=YV.useLexicalEditable;var tv={};ze(tv,{registerDragonSupport:()=>qV});function qV(t){let e=window.location.origin,n=o=>{if(o.origin!==e)return;let r=t.getRootElement();if(document.activeElement!==r)return;let i=o.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let a=s.payload;if(a&&a.functionId==="makeChanges"){let l=a.args;if(l){let[c,d,u,p,h,g]=l;t.update((()=>{let m=$();if(B(m)){let _=m.anchor,b=_.getNode(),y=0,v=0;if(te(b)&&c>=0&&d>=0&&(y=c,v=c+d,m.setTextNodeRange(b,y,b,v)),y===v&&u===""||(m.insertRawText(u),b=_.getNode()),te(b)){y=p,v=p+h;let x=b.getTextContentSize();y=y>x?x:y,v=v>x?x:v,m.setTextNodeRange(b,y,b,v)}o.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var JV=tv,dA=JV.registerDragonSupport;var nv={};ze(nv,{$generateHtmlFromNodes:()=>ZV,$generateNodesFromDOM:()=>XV});function XV(t,e){let n=e.body?e.body.childNodes:[],o=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];if(!pA.has(s.nodeName)){let a=fA(s,t,r,!1);a!==null&&(o=o.concat(a))}}return(function(i){for(let s of i)s.getNextSibling()instanceof ox&&s.insertAfter(Po());for(let s of i){let a=s.getChildren();for(let l of a)s.insertBefore(l);s.remove()}})(r),o}function ZV(t,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=nt().getChildren();for(let r=0;r<o.length;r++)uA(t,o[r],n,e);return n.innerHTML}function uA(t,e,n,o=null){let r=o===null||e.isSelected(o),i=Y(e)&&e.excludeFromCopy("html"),s=e;if(o!==null){let h=Di(e);h=te(h)&&o!==null?kf(o,h):h,s=h}let a=Y(s)?s.getChildren():[],l=vO(t,s.getType()),c;c=l&&l.exportDOM!==void 0?l.exportDOM(t,s):s.exportDOM(t);let{element:d,after:u}=c;if(!d)return!1;let p=document.createDocumentFragment();for(let h=0;h<a.length;h++){let g=a[h],m=uA(t,g,p,o);!r&&Y(e)&&m&&e.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!i){if((en(d)||ax(d))&&d.append(p),n.append(d),u){let h=u.call(s,d);h&&(ax(d)?d.replaceChildren(h):d.replaceWith(h))}}else n.append(p);return r}var pA=new Set(["STYLE","SCRIPT"]);function fA(t,e,n,o,r=new Map,i){let s=[];if(pA.has(t.nodeName))return s;let a=null,l=(function(g,m){let{nodeName:_}=g,b=m._htmlConversions.get(_.toLowerCase()),y=null;if(b!==void 0)for(let v of b){let x=v(g);x!==null&&(y===null||(y.priority||0)<=(x.priority||0))&&(y=x)}return y!==null?y.conversion:null})(t,e),c=l?l(t):null,d=null;if(c!==null){d=c.after;let g=c.node;if(a=Array.isArray(g)?g[g.length-1]:g,a!==null){for(let[,m]of r)if(a=m(a,i),!a)break;a&&s.push(...Array.isArray(g)?g:[a])}c.forChild!=null&&r.set(t.nodeName,c.forChild)}let u=t.childNodes,p=[],h=(a==null||!zt(a))&&(a!=null&&Qa(a)||o);for(let g=0;g<u.length;g++)p.push(...fA(u[g],e,n,h,new Map(r),a));return d!=null&&(p=d(p)),Tx(t)&&(p=QV(t,p,h?()=>{let g=new ox;return n.push(g),g}:me)),a==null?p.length>0?s=s.concat(p):Tx(t)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:ed(g.nextSibling)&&ed(g.previousSibling)})(t)&&(s=s.concat(Po())):Y(a)&&a.append(...p),s}function QV(t,e,n){let o=t.style.textAlign,r=[],i=[];for(let s=0;s<e.length;s++){let a=e[s];if(Qa(a))o&&!a.getFormat()&&a.setFormat(o),r.push(a);else if(i.push(a),s===e.length-1||s<e.length-1&&Qa(e[s+1])){let l=n();l.setFormat(o),l.append(...i),r.push(l),i=[]}}return r}var hA=nv,gA=hA.$generateHtmlFromNodes,jf=hA.$generateNodesFromDOM;var rv={};ze(rv,{$generateJSONFromSelectedNodes:()=>xA,$generateNodesFromSerializedNodes:()=>vA,$getClipboardDataFromSelection:()=>CA,$getHtmlContent:()=>_A,$getLexicalContent:()=>bA,$insertDataTransferForPlainText:()=>e8,$insertDataTransferForRichText:()=>t8,$insertGeneratedNodes:()=>ov,copyToClipboard:()=>n8,setLexicalClipboardDataTransfer:()=>EA});function Vf(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _A(t,e=$()){return e==null&&Vf(166),B(e)&&e.isCollapsed()||e.getNodes().length===0?"":gA(t,e)}function bA(t,e=$()){return e==null&&Vf(166),B(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(xA(t,e))}function e8(t,e){let n=t.getData("text/plain")||t.getData("text/uri-list");n!=null&&e.insertRawText(n)}function t8(t,e,n){let o=t.getData("application/x-lexical-editor");if(o)try{let a=JSON.parse(o);if(a.namespace===n._config.namespace&&Array.isArray(a.nodes))return ov(n,vA(a.nodes),e)}catch{}let r=t.getData("text/html"),i=t.getData("text/plain");if(r&&i!==r)try{let a=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(l):l})(r),"text/html");return ov(n,jf(n,a),e)}catch{}let s=i||t.getData("text/uri-list");if(s!=null)if(B(e)){let a=s.split(/(\r?\n|\t)/);a[a.length-1]===""&&a.pop();for(let l=0;l<a.length;l++){let c=$();if(B(c)){let d=a[l];d===`
117
- `||d===`\r
118
- `?c.insertParagraph():d===" "?c.insertNodes([Fo()]):c.insertText(d)}}}else e.insertRawText(s)}function ov(t,e,n){t.dispatchCommand(Qc,{nodes:e,selection:n})||(n.insertNodes(e),(function(o){if(B(o)&&o.isCollapsed()){let r=o.anchor,i=null,s=Ni(r,"previous");if(s)if(df(s))i=s.origin;else{let a=af(s,ro(nt(),"next").getFlipped());for(let l of a){if(te(l.origin)){i=l.origin;break}if(Y(l.origin)&&!l.origin.isInline())break}}if(i&&te(i)){let a=i.getFormat(),l=i.getStyle();o.format===a&&o.style===l||(o.format=a,o.style=l,o.dirty=!0)}}})(n))}function yA(t,e,n,o=[]){let r=e===null||n.isSelected(e),i=Y(n)&&n.excludeFromCopy("html"),s=n;if(e!==null){let c=Di(n);c=te(c)&&e!==null?kf(e,c):c,s=c}let a=Y(s)?s.getChildren():[],l=(function(c){let d=c.exportJSON(),u=c.constructor;if(d.type!==u.getType()&&Vf(58,u.name),Y(c)){let p=d.children;Array.isArray(p)||Vf(59,u.name)}return d})(s);if(te(s)){let c=s.__text;c.length>0?l.text=c:r=!1}for(let c=0;c<a.length;c++){let d=a[c],u=yA(t,e,d,l.children);!r&&Y(n)&&u&&n.extractWithChild(d,e,"clone")&&(r=!0)}if(r&&!i)o.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){let d=l.children[c];o.push(d)}return r}function xA(t,e){let n=[],o=nt().getChildren();for(let r=0;r<o.length;r++)yA(t,e,o[r],n);return{namespace:t._config.namespace,nodes:n}}function vA(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=JD(o);te(r)&&zO(r),e.push(r)}return e}var ul=null;async function n8(t,e,n){if(ul!==null)return!1;if(e!==null)return new Promise(((c,d)=>{t.update((()=>{c(mA(t,e,n))}))}));let o=t.getRootElement(),r=t._window||window,i=window.document,s=io(r);if(o===null||s===null)return!1;let a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),o.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise(((c,d)=>{let u=t.registerCommand(gf,(p=>(so(p,ClipboardEvent)&&(u(),ul!==null&&(window.clearTimeout(ul),ul=null),c(mA(t,p,n))),!0)),kt);ul=window.setTimeout((()=>{u(),ul=null,c(!1)}),50),i.execCommand("copy"),a.remove()}))}function mA(t,e,n){if(n===void 0){let r=io(t._window);if(!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!SO(t,i,s))return!1;let a=$();if(a===null)return!1;n=CA(a)}e.preventDefault();let o=e.clipboardData;return o!==null&&(EA(o,n),!0)}var o8=[["text/html",_A],["application/x-lexical-editor",bA]];function CA(t=$()){let e={"text/plain":t?t.getTextContent():""};if(t){let n=Os();for(let[o,r]of o8){let i=r(n,t);i!==null&&(e[o]=i)}}return e}function EA(t,e){for(let n in e){let o=e[n];o!==void 0&&t.setData(n,o)}}var fr=rv,kie=fr.$generateJSONFromSelectedNodes,Nie=fr.$generateNodesFromSerializedNodes,wA=fr.$getClipboardDataFromSelection,Die=fr.$getHtmlContent,Oie=fr.$getLexicalContent,Iie=fr.$insertDataTransferForPlainText,iv=fr.$insertDataTransferForRichText,Aie=fr.$insertGeneratedNodes,cd=fr.copyToClipboard,Mie=fr.setLexicalClipboardDataTransfer;var cv={};ze(cv,{$createHeadingNode:()=>fl,$createQuoteNode:()=>lv,$isHeadingNode:()=>u8,$isQuoteNode:()=>c8,DRAG_DROP_PASTE:()=>av,HeadingNode:()=>pd,QuoteNode:()=>ud,eventFiles:()=>dd,registerRichText:()=>p8});function TA(t,e){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(t,e);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!=="undefined"){let n=document.caretPositionFromPoint(t,e);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}var hl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,r8=hl&&"documentMode"in document?document.documentMode:null,i8=!(!hl||!("InputEvent"in window)||r8)&&"getTargetRanges"in new window.InputEvent("input"),s8=hl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),SA=hl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a8=hl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),l8=hl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!a8,av=Kn("DRAG_DROP_PASTE_FILE"),ud=class t extends Ht{static getType(){return"quote"}static clone(e){return new t(e.__key)}createDOM(e){let n=document.createElement("blockquote");return qe(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:d8,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(en(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return lv().updateFromJSON(e)}insertNewAfter(e,n){let o=me(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,n),o}collapseAtStart(){let e=me();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function lv(){return It(new ud)}function c8(t){return t instanceof ud}var pd=class t extends Ht{static getType(){return"heading"}static clone(e){return new t(e.__tag,e.__key)}constructor(e,n){super(n),this.__tag=e}getTag(){return this.__tag}setTag(e){let n=this.getWritable();return this.__tag=e,n}createDOM(e){let n=this.__tag,o=document.createElement(n),r=e.theme.heading;if(r!==void 0){let i=r[n];qe(o,i)}return o}updateDOM(e,n,o){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:pl,priority:0}),h2:e=>({conversion:pl,priority:0}),h3:e=>({conversion:pl,priority:0}),h4:e=>({conversion:pl,priority:0}),h5:e=>({conversion:pl,priority:0}),h6:e=>({conversion:pl,priority:0}),p:e=>{let n=e.firstChild;return n!==null&&kA(n)?{conversion:()=>({node:null}),priority:3}:null},span:e=>kA(e)?{conversion:n=>({node:fl("h1")}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(en(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return fl(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let o=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?me():fl(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,n),o===0&&!this.isEmpty()&&e){let a=me();a.select(),this.replace(a,!0)}return i}collapseAtStart(){let e=this.isEmpty()?me():fl(this.getTag());return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}extractWithChild(){return!0}};function kA(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function pl(t){let e=t.nodeName.toLowerCase(),n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=fl(e),t.style!==null&&(cx(t,n),n.setFormat(t.style.textAlign))),{node:n}}function d8(t){let e=lv();return t.style!==null&&(e.setFormat(t.style.textAlign),cx(t,e)),{node:e}}function fl(t="h1"){return It(new pd(t))}function u8(t){return t instanceof pd}function dd(t){let e=null;if(so(t,DragEvent)?e=t.dataTransfer:so(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];let n=e.types,o=n.includes("Files"),r=n.includes("text/html")||n.includes("text/plain");return[o,Array.from(e.files),r]}function NA(t){let e=$();if(!B(e))return!1;let n=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){let i=o[r],s=i.getKey();if(n.has(s))continue;let a=ue(i,(c=>Y(c)&&!c.isInline()));if(a===null)continue;let l=a.getKey();a.canIndent()&&!n.has(l)&&(n.add(l),t(a))}return n.size>0}function DA(t){let e=an(t);return zn(e)}function sv(t){for(let e of["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e)}function p8(t){return Ue(t.registerCommand(lr,(e=>{let n=$();return!!mt(n)&&(n.clear(),!0)}),Se),t.registerCommand(el,(e=>{let n=$();return B(n)?(n.deleteCharacter(e),!0):!!mt(n)&&(n.deleteNodes(),!0)}),Se),t.registerCommand(_f,(e=>{let n=$();return!!B(n)&&(n.deleteWord(e),!0)}),Se),t.registerCommand(Xc,(e=>{let n=$();return!!B(n)&&(n.deleteLine(e),!0)}),Se),t.registerCommand(hf,(e=>{let n=$();if(typeof e=="string")n!==null&&n.insertText(e);else{if(n===null)return!1;let o=e.dataTransfer;if(o!=null)iv(o,n,t);else if(B(n)){let r=e.data;return r&&n.insertText(r),!0}}return!0}),Se),t.registerCommand(fO,(()=>{let e=$();return!!B(e)&&(e.removeText(),!0)}),Se),t.registerCommand(lt,(e=>{let n=$();return!!B(n)&&(n.formatText(e),!0)}),Se),t.registerCommand(bf,(e=>{let n=$();if(!B(n)&&!mt(n))return!1;let o=n.getNodes();for(let r of o){let i=ue(r,(s=>Y(s)&&!s.isInline()));i!==null&&i.setFormat(e)}return!0}),Se),t.registerCommand(rx,(e=>{let n=$();return!!B(n)&&(n.insertLineBreak(e),!0)}),Se),t.registerCommand(Mi,(()=>{let e=$();return!!B(e)&&(e.insertParagraph(),!0)}),Se),t.registerCommand(Ms,(()=>(Bo([Fo()]),!0)),Se),t.registerCommand(Un,(()=>NA((e=>{let n=e.getIndent();e.setIndent(n+1)}))),Se),t.registerCommand(Eo,(()=>NA((e=>{let n=e.getIndent();n>0&&e.setIndent(Math.max(0,n-1))}))),Se),t.registerCommand($o,(e=>{let n=$();if(mt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(B(n)){let o=Qy(n.focus,!0);if(!e.shiftKey&&zn(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),e.preventDefault(),!0}return!1}),Se),t.registerCommand(Vr,(e=>{let n=$();if(mt(n)){let o=n.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(B(n)){if((function(r){let i=r.focus;return i.key==="root"&&i.offset===nt().getChildrenSize()})(n))return e.preventDefault(),!0;let o=Qy(n.focus,!1);if(!e.shiftKey&&zn(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),e.preventDefault(),!0}return!1}),Se),t.registerCommand(rl,(e=>{let n=$();if(mt(n)){let o=n.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectPrevious(),!0}if(!B(n))return!1;if(_x(n,!0)){let o=e.shiftKey;return e.preventDefault(),mx(n,o,!0),!0}return!1}),Se),t.registerCommand(yf,(e=>{let n=$();if(mt(n)){let r=n.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}if(!B(n))return!1;let o=e.shiftKey;return!!_x(n,!1)&&(e.preventDefault(),mx(n,o,!1),!0)}),Se),t.registerCommand(xf,(e=>{if(DA(e.target))return!1;let n=$();if(B(n)){if((function(o){if(!o.isCollapsed())return!1;let{anchor:r}=o;if(r.offset!==0)return!1;let i=r.getNode();if(sr(i))return!1;let s=Rs(i);return s.getIndent()>0&&(s.is(i)||i.is(s.getFirstDescendant()))})(n))return e.preventDefault(),t.dispatchCommand(Eo,void 0);if(SA&&navigator.language==="ko-KR")return!1}else if(!mt(n))return!1;return e.preventDefault(),t.dispatchCommand(el,!0)}),Se),t.registerCommand(vf,(e=>{if(DA(e.target))return!1;let n=$();return!(!B(n)&&!mt(n))&&(e.preventDefault(),t.dispatchCommand(el,!1))}),Se),t.registerCommand(dO,(e=>{let n=$();if(!B(n))return!1;if(sv(n),e!==null){if((SA||s8||l8)&&i8)return!1;if(e.preventDefault(),e.shiftKey)return t.dispatchCommand(rx,!1)}return t.dispatchCommand(Mi,void 0)}),Se),t.registerCommand(Li,(()=>{let e=$();return!!B(e)&&(t.blur(),!0)}),Se),t.registerCommand(sO,(e=>{let[,n]=dd(e);if(n.length>0){let r=TA(e.clientX,e.clientY);if(r!==null){let{offset:i,node:s}=r,a=an(s);if(a!==null){let l=ir();if(te(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{let d=a.getParentOrThrow().getKey(),u=a.getIndexWithinParent()+1;l.anchor.set(d,u,"element"),l.focus.set(d,u,"element")}let c=jr(l);vt(c)}t.dispatchCommand(av,n)}return e.preventDefault(),!0}let o=$();return!!B(o)}),Se),t.registerCommand(iO,(e=>{let[n]=dd(e),o=$();return!(n&&!B(o))}),Se),t.registerCommand(rO,(e=>{let[n]=dd(e),o=$();if(n&&!B(o))return!1;let r=TA(e.clientX,e.clientY);if(r!==null){let i=an(r.node);zn(i)&&e.preventDefault()}return!0}),Se),t.registerCommand(gO,(()=>(uf(),!0)),Se),t.registerCommand(gf,(e=>(cd(t,so(e,ClipboardEvent)?e:null),!0)),Se),t.registerCommand(mf,(e=>((async function(n,o){await cd(o,so(n,ClipboardEvent)?n:null),o.update((()=>{let r=$();B(r)?r.removeText():mt(r)&&r.getNodes().forEach((i=>i.remove()))}))})(e,t),!0)),Se),t.registerCommand(Pi,(e=>{let[,n,o]=dd(e);return n.length>0&&!o?(t.dispatchCommand(av,n),!0):Fi(e.target)&&TO(e.target)?!1:$()!==null&&((function(r,i){r.preventDefault(),i.update((()=>{let s=$(),a=so(r,InputEvent)||so(r,KeyboardEvent)?null:r.clipboardData;a!=null&&s!==null&&iv(a,s,i)}),{tag:uO})})(e,t),!0)}),Se),t.registerCommand(Cf,(e=>{let n=$();return B(n)&&sv(n),!1}),Se),t.registerCommand(Ri,(e=>{let n=$();return B(n)&&sv(n),!1}),Se))}var Wr=cv,$s=Wr.$createHeadingNode,zs=Wr.$createQuoteNode,Gr=Wr.$isHeadingNode,Yr=Wr.$isQuoteNode,$ie=Wr.DRAG_DROP_PASTE,Wf=Wr.HeadingNode,Gf=Wr.QuoteNode,zie=Wr.eventFiles,OA=Wr.registerRichText;var uv={};ze(uv,{RichTextPlugin:()=>f8});bt();bt();var dv=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?mn:P;function IA(t){return t.getEditorState().read(Ff(t.isComposing()))}function f8({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){let[o]=Ee(),r=(function(i,s){let[a,l]=L((()=>i.getDecorators()));return dv((()=>i.registerDecoratorListener((c=>{Dl((()=>{l(c)}))}))),[i]),P((()=>{l(i.getDecorators())}),[i]),J((()=>{let c=[],d=Object.keys(a);for(let u=0;u<d.length;u++){let p=d[u],h=f(s,{onError:m=>i._onError(m),children:f(vd,{fallback:null,children:a[p]})}),g=i.getElementByKey(p);g!==null&&c.push(ii(h,g,p))}return c}),[s,a,i])})(o,n);return(function(i){dv((()=>Ue(OA(i),dA(i))),[i])})(o),f(Ne,{children:[t,f(h8,{content:e}),r]})}function h8({content:t}){let[e]=Ee(),n=(function(r){let[i,s]=L((()=>IA(r)));return dv((()=>{function a(){let l=IA(r);s(l)}return a(),Ue(r.registerUpdateListener((()=>{a()})),r.registerEditableListener((()=>{a()})))}),[r]),i})(e),o=cA();return n?typeof t=="function"?t(o):t:null}var g8=uv,AA=g8.RichTextPlugin;var pv={};ze(pv,{TabIndentationPlugin:()=>m8,registerTabIndentation:()=>MA});bt();function MA(t,e){return Ue(t.registerCommand(Ri,(n=>{let o=$();if(!B(o))return!1;n.preventDefault();let r=(function(i){let s=i.getNodes();if(sI(s,(p=>Qa(p)&&p.canIndent()?p:null)).length>0)return!0;let a=i.anchor,l=i.focus,c=l.isBefore(a)?l:a,d=c.getNode(),u=Rs(d);if(u.canIndent()){let p=u.getKey(),h=ir();if(h.anchor.set(p,0,"element"),h.focus.set(p,0,"element"),h=jr(h),h.anchor.is(c))return!0}return!1})(o)?n.shiftKey?Eo:Un:Ms;return t.dispatchCommand(r,void 0)}),Se),t.registerCommand(Un,(()=>{if(e==null)return!1;let n=$();if(!B(n))return!1;let o=n.getNodes().map((r=>Rs(r).getIndent()));return Math.max(...o)+1>=e}),kt))}function m8({maxIndent:t}){let[e]=Ee();return P((()=>MA(e,t)),[e,t]),null}var LA=pv,RA=LA.TabIndentationPlugin,nse=LA.registerTabIndentation;var Iv={};ze(Iv,{$computeTableMap:()=>ln,$computeTableMapSkipCellCheck:()=>Jr,$createTableCellNode:()=>Yn,$createTableNode:()=>nh,$createTableNodeWithDimensions:()=>VA,$createTableRowNode:()=>Ks,$createTableSelection:()=>kv,$createTableSelectionFrom:()=>QA,$deleteTableColumn:()=>k8,$deleteTableColumnAtSelection:()=>JA,$deleteTableColumn__EXPERIMENTAL:()=>D8,$deleteTableRowAtSelection:()=>qA,$deleteTableRow__EXPERIMENTAL:()=>N8,$findCellNode:()=>_l,$findTableNode:()=>Us,$getElementForTableNode:()=>rM,$getNodeTriplet:()=>Kt,$getTableAndElementByKey:()=>Nv,$getTableCellNodeFromLexicalNode:()=>y8,$getTableCellNodeRect:()=>bv,$getTableColumnIndexFromTableCellNode:()=>v8,$getTableNodeFromLexicalNodeOrThrow:()=>th,$getTableRowIndexFromTableCellNode:()=>x8,$getTableRowNodeFromTableCellNodeOrThrow:()=>Tv,$insertTableColumn:()=>T8,$insertTableColumnAtSelection:()=>YA,$insertTableColumn__EXPERIMENTAL:()=>S8,$insertTableRow:()=>E8,$insertTableRowAtSelection:()=>GA,$insertTableRow__EXPERIMENTAL:()=>w8,$isScrollableTablesActive:()=>eh,$isTableCellNode:()=>pe,$isTableNode:()=>ct,$isTableRowNode:()=>Je,$isTableSelection:()=>je,$mergeCells:()=>XA,$removeTableRowAtIndex:()=>C8,$unmergeCell:()=>I8,INSERT_TABLE_COMMAND:()=>jA,TableCellHeaderStates:()=>Xe,TableCellNode:()=>Hi,TableNode:()=>Ki,TableObserver:()=>Qf,TableRowNode:()=>yl,applyTableHandlers:()=>eM,getDOMCellFromTarget:()=>gd,getTableElement:()=>Ui,getTableObserverFromTableElement:()=>xv,registerTableCellUnmergeTransform:()=>G8,registerTablePlugin:()=>q8,registerTableSelectionObserver:()=>Y8,setScrollableTablesActive:()=>z8});var Ev=/^(\d+(?:\.\d+)?)px$/,Xe={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},Hi=class t extends Ht{static getType(){return"tablecell"}static clone(e){return new t(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:PA,priority:0}),th:e=>({conversion:PA,priority:0})}}static importJSON(e){return Yn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Xe.NO_STATUS,n=1,o,r){super(r),this.__colSpan=n,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),hv(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),qe(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(Ls(n.element)){let o=n.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return n}exportJSON(){return{...super.exportJSON(),...hv(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let n=this.getWritable();return n.__colSpan=e,n}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let n=this.getWritable();return n.__rowSpan=e,n}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,n=Xe.BOTH){let o=this.getWritable();return o.__headerState=e&n|o.__headerState&~n,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let n=this.getWritable();return n.__width=e,n}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let n=this.getWritable();return n.__backgroundColor=e,n}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let n=this.getWritable();return n.__verticalAlign=e||void 0,n}toggleHeaderStyle(e){let n=this.getWritable();return(n.__headerState&e)===e?n.__headerState-=e:n.__headerState+=e,n}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Xe.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function hv(t){return t==="middle"||t==="bottom"}function PA(t){let e=t,n=t.nodeName.toLowerCase(),o;Ev.test(e.style.width)&&(o=parseFloat(e.style.width));let r=Yn(n==="th"?Xe.ROW:Xe.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;let i=e.style.backgroundColor;i!==""&&(r.__backgroundColor=i);let s=e.style.verticalAlign;hv(s)&&(r.__verticalAlign=s);let a=e.style,l=(a&&a.textDecoration||"").split(" "),c=a.fontWeight==="700"||a.fontWeight==="bold",d=l.includes("line-through"),u=a.fontStyle==="italic",p=l.includes("underline");return{after:h=>{let g=[],m=null,_=()=>{if(m){let b=m.getFirstChild();Qe(b)&&m.getChildrenSize()===1&&b.remove()}};for(let b of h)qD(b)||te(b)||Qe(b)?(te(b)&&(c&&b.toggleFormat("bold"),d&&b.toggleFormat("strikethrough"),u&&b.toggleFormat("italic"),p&&b.toggleFormat("underline")),m?m.append(b):(m=me().append(b),g.push(m))):(g.push(b),_(),m=null);return _(),g.length===0&&g.push(me()),g},node:r}}function Yn(t=Xe.NO_STATUS,e=1,n){return It(new Hi(t,e,n))}function pe(t){return t instanceof Hi}var jA=Kn("INSERT_TABLE_COMMAND");function le(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var yl=class t extends Ht{static getType(){return"tablerow"}static clone(e){return new t(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:_8,priority:0})}}static importJSON(e){return Ks().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,n){super(n),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),qe(n,e.theme.tableRow),n}extractWithChild(e,n,o){return o==="html"}isShadowRoot(){return!0}setHeight(e){let n=this.getWritable();return n.__height=e,n}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function _8(t){let e=t,n;return Ev.test(e.style.height)&&(n=parseFloat(e.style.height)),{after:o=>Ex(o,pe),node:Ks(n)}}function Ks(t){return It(new yl(t))}function Je(t){return t instanceof yl}var wv=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,b8=wv&&"documentMode"in document?document.documentMode:null,FA=wv&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function VA(t,e,n=!0){let o=nh();for(let r=0;r<t;r++){let i=Ks();for(let s=0;s<e;s++){let a=Xe.NO_STATUS;typeof n=="object"?(r===0&&n.rows&&(a|=Xe.ROW),s===0&&n.columns&&(a|=Xe.COLUMN)):n&&(r===0&&(a|=Xe.ROW),s===0&&(a|=Xe.COLUMN));let l=Yn(a),c=me();c.append(St()),l.append(c),i.append(l)}o.append(i)}return o}function y8(t){let e=ue(t,(n=>pe(n)));return pe(e)?e:null}function Tv(t){let e=ue(t,(n=>Je(n)));if(Je(e))return e;throw new Error("Expected table cell to be inside of table row.")}function th(t){let e=ue(t,(n=>ct(n)));if(ct(e))return e;throw new Error("Expected table cell to be inside of table.")}function x8(t){let e=Tv(t);return th(e).getChildren().findIndex((n=>n.is(e)))}function v8(t){return Tv(t).getChildren().findIndex((e=>e.is(t)))}function WA(t,e){let n=th(t),{x:o,y:r}=n.getCordsFromCellNode(t,e);return{above:n.getCellNodeFromCords(o,r-1,e),below:n.getCellNodeFromCords(o,r+1,e),left:n.getCellNodeFromCords(o-1,r,e),right:n.getCellNodeFromCords(o+1,r,e)}}function C8(t,e){let n=t.getChildren();if(e>=n.length||e<0)throw new Error("Expected table cell to be inside of table row.");return n[e].remove(),t}function E8(t,e,n=!0,o,r){let i=t.getChildren();if(e>=i.length||e<0)throw new Error("Table row target index out of range");let s=i[e];if(!Je(s))throw new Error("Row before insertion index does not exist.");for(let a=0;a<o;a++){let l=s.getChildren(),c=l.length,d=Ks();for(let u=0;u<c;u++){let p=l[u];pe(p)||le(12);let{above:h,below:g}=WA(p,r),m=Xe.NO_STATUS,_=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(Xe.COLUMN)||g&&g.hasHeaderState(Xe.COLUMN))&&(m|=Xe.COLUMN);let b=Yn(m,1,_);b.append(me()),d.append(b)}n?s.insertAfter(d):s.insertBefore(d)}return t}wv&&"InputEvent"in window&&!b8&&new window.InputEvent("input");var gv=(t,e)=>t===Xe.BOTH||t===e?e:Xe.NO_STATUS;function GA(t=!0){let e=$();B(e)||je(e)||le(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Kt(n),[i,,s]=Kt(o),[,a,l]=ln(s,i,r),{startRow:c}=l,{startRow:d}=a;return t?mv(c+r.__rowSpan>d+i.__rowSpan?r:i,!0):mv(d<c?i:r,!1)}var w8=GA;function mv(t,e=!0){let[,,n]=Kt(t),[o,r]=ln(n,t,t),i=o[0].length,{startRow:s}=r,a=null;if(e){let l=s+t.__rowSpan-1,c=o[l],d=Ks();for(let p=0;p<i;p++){let{cell:h,startRow:g}=c[p];if(g+h.__rowSpan-1<=l){let m=c[p].cell.__headerState,_=gv(m,Xe.COLUMN);d.append(Yn(_).append(me()))}else h.setRowSpan(h.__rowSpan+1)}let u=n.getChildAtIndex(l);Je(u)||le(256),u.insertAfter(d),a=d}else{let l=s,c=o[l],d=Ks();for(let p=0;p<i;p++){let{cell:h,startRow:g}=c[p];if(g===l){let m=c[p].cell.__headerState,_=gv(m,Xe.COLUMN);d.append(Yn(_).append(me()))}else h.setRowSpan(h.__rowSpan+1)}let u=n.getChildAtIndex(l);Je(u)||le(257),u.insertBefore(d),a=d}return a}function T8(t,e,n=!0,o,r){let i=t.getChildren(),s=[];for(let a=0;a<i.length;a++){let l=i[a];if(Je(l))for(let c=0;c<o;c++){let d=l.getChildren();if(e>=d.length||e<0)throw new Error("Table column target index out of range");let u=d[e];pe(u)||le(12);let{left:p,right:h}=WA(u,r),g=Xe.NO_STATUS;(p&&p.hasHeaderState(Xe.ROW)||h&&h.hasHeaderState(Xe.ROW))&&(g|=Xe.ROW);let m=Yn(g);m.append(me()),s.push({newTableCell:m,targetCell:u})}}return s.forEach((({newTableCell:a,targetCell:l})=>{n?l.insertAfter(a):l.insertBefore(a)})),t}function YA(t=!0){let e=$();B(e)||je(e)||le(188);let n=e.anchor.getNode(),o=e.focus.getNode(),[r]=Kt(n),[i,,s]=Kt(o),[,a,l]=ln(s,i,r),{startColumn:c}=l,{startColumn:d}=a;return t?_v(c+r.__colSpan>d+i.__colSpan?r:i,!0):_v(d<c?i:r,!1)}var S8=YA;function _v(t,e=!0,n=!0){let[,,o]=Kt(t),[r,i]=ln(o,t,t),s=r.length,{startColumn:a}=i,l=e?a+t.__colSpan-1:a-1,c=o.getFirstChild();Je(c)||le(120);let d=null;function u(g=Xe.NO_STATUS){let m=Yn(g).append(me());return d===null&&(d=m),m}let p=c;e:for(let g=0;g<s;g++){if(g!==0){let E=p.getNextSibling();Je(E)||le(121),p=E}let m=r[g],_=m[l<0?0:l].cell.__headerState,b=gv(_,Xe.ROW);if(l<0){Sv(p,u(b));continue}let{cell:y,startColumn:v,startRow:x}=m[l];if(v+y.__colSpan-1<=l){let E=y,C=x,k=l;for(;C!==g&&E.__rowSpan>1;){if(k-=y.__colSpan,!(k>=0)){p.append(u(b));continue e}{let{cell:T,startRow:w}=m[k];E=T,C=w}}E.insertAfter(u(b))}else y.setColSpan(y.__colSpan+1)}d!==null&&n&&hd(d);let h=o.getColWidths();if(h){let g=[...h],m=l<0?0:l,_=g[m];g.splice(m,0,_),o.setColWidths(g)}return d}function k8(t,e){let n=t.getChildren();for(let o=0;o<n.length;o++){let r=n[o];if(Je(r)){let i=r.getChildren();if(e>=i.length||e<0)throw new Error("Table column target index out of range");i[e].remove()}}return t}function qA(){let t=$();B(t)||je(t)||le(188);let[e,n]=t.isBackward()?[t.focus.getNode(),t.anchor.getNode()]:[t.anchor.getNode(),t.focus.getNode()],[o,,r]=Kt(e),[i]=Kt(n),[s,a,l]=ln(r,o,i),{startRow:c}=a,{startRow:d}=l,u=d+i.__rowSpan-1;if(s.length===u-c+1)return void r.remove();let p=s[0].length,h=s[u+1],g=r.getChildAtIndex(u+1);for(let m=u;m>=c;m--){for(let b=p-1;b>=0;b--){let{cell:y,startRow:v,startColumn:x}=s[m][b];if(x===b){if(v<c||v+y.__rowSpan-1>u){let E=Math.max(v,c),C=Math.min(y.__rowSpan+v-1,u),k=E<=C?C-E+1:0;y.setRowSpan(y.__rowSpan-k)}if(v>=c&&v+y.__rowSpan-1>u&&m===u){g===null&&le(122);let E=null;for(let C=0;C<b;C++){let k=h[C],T=k.cell;k.startRow===m+1&&(E=T),T.__colSpan>1&&(C+=T.__colSpan-1)}E===null?Sv(g,y):E.insertAfter(y)}}}let _=r.getChildAtIndex(m);Je(_)||le(206,String(m)),_.remove()}if(h!==void 0){let{cell:m}=h[0];hd(m)}else{let m=s[c-1],{cell:_}=m[0];hd(_)}}var N8=qA;function JA(){let t=$();B(t)||je(t)||le(188);let e=t.anchor.getNode(),n=t.focus.getNode(),[o,,r]=Kt(e),[i]=Kt(n),[s,a,l]=ln(r,o,i),{startColumn:c}=a,{startRow:d,startColumn:u}=l,p=Math.min(c,u),h=Math.max(c+o.__colSpan-1,u+i.__colSpan-1),g=h-p+1;if(s[0].length===h-p+1)return r.selectPrevious(),void r.remove();let m=s.length;for(let v=0;v<m;v++)for(let x=p;x<=h;x++){let{cell:E,startColumn:C}=s[v][x];if(C<p){if(x===p){let k=p-C;E.setColSpan(E.__colSpan-Math.min(g,E.__colSpan-k))}}else if(C+E.__colSpan-1>h){if(x===h){let k=h-C+1;E.setColSpan(E.__colSpan-k)}}else E.remove()}let _=s[d],b=c>u?_[c+o.__colSpan]:_[u+i.__colSpan];if(b!==void 0){let{cell:v}=b;hd(v)}else{let v=u<c?_[u-1]:_[c-1],{cell:x}=v;hd(x)}let y=r.getColWidths();if(y){let v=[...y];v.splice(p,g),r.setColWidths(v)}}var D8=JA;function hd(t){let e=t.getFirstDescendant();e==null?t.selectStart():e.getParentOrThrow().selectStart()}function Sv(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)}function XA(t){if(t.length===0)return null;let e=th(t[0]),[n]=Jr(e,null,null),o=1/0,r=-1/0,i=1/0,s=-1/0,a=new Set;for(let h of n)for(let g of h){if(!g||!g.cell)continue;let m=g.cell.getKey();if(!a.has(m)&&t.some((_=>_.is(g.cell)))){a.add(m);let _=g.startRow,b=g.startColumn,y=g.cell.__rowSpan||1,v=g.cell.__colSpan||1;o=Math.min(o,_),r=Math.max(r,_+y-1),i=Math.min(i,b),s=Math.max(s,b+v-1)}}if(o===1/0||i===1/0)return null;let l=r-o+1,c=s-i+1,d=n[o][i];if(!d.cell)return null;let u=d.cell;u.setColSpan(c),u.setRowSpan(l);let p=new Set([u.getKey()]);for(let h=o;h<=r;h++)for(let g=i;g<=s;g++){let m=n[h][g];if(!m.cell)continue;let _=m.cell,b=_.getKey();p.has(b)||(p.add(b),O8(_)||u.append(..._.getChildren()),_.remove())}return u.getChildrenSize()===0&&u.append(me()),u}function O8(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Qt(e)||!e.isEmpty())}function I8(){let t=$();B(t)||je(t)||le(188);let e=t.anchor.getNode(),n=ue(e,pe);return pe(n)||le(148),ZA(n)}function ZA(t){let[e,n,o]=Kt(t),r=e.__colSpan,i=e.__rowSpan;if(r===1&&i===1)return;let[s,a]=ln(o,e,e),{startColumn:l,startRow:c}=a,d=e.__headerState&Xe.COLUMN,u=Array.from({length:r},((g,m)=>{let _=d;for(let b=0;_!==0&&b<s.length;b++)_&=s[b][m+l].cell.__headerState;return _})),p=e.__headerState&Xe.ROW,h=Array.from({length:i},((g,m)=>{let _=p;for(let b=0;_!==0&&b<s[0].length;b++)_&=s[m+c][b].cell.__headerState;return _}));if(r>1){for(let g=1;g<r;g++)e.insertAfter(Yn(u[g]|h[0]).append(me()));e.setColSpan(1)}if(i>1){let g;for(let m=1;m<i;m++){let _=c+m,b=s[_];g=(g||n).getNextSibling(),Je(g)||le(125);let y=null;for(let v=0;v<l;v++){let x=b[v],E=x.cell;x.startRow===_&&(y=E),E.__colSpan>1&&(v+=E.__colSpan-1)}if(y===null)for(let v=r-1;v>=0;v--)Sv(g,Yn(u[v]|h[m]).append(me()));else for(let v=r-1;v>=0;v--)y.insertAfter(Yn(u[v]|h[m]).append(me()))}e.setRowSpan(1)}}function ln(t,e,n){let[o,r,i]=Jr(t,e,n);return r===null&&le(207),i===null&&le(208),[o,r,i]}function Jr(t,e,n){let o=[],r=null,i=null;function s(l){let c=o[l];return c===void 0&&(o[l]=c=[]),c}let a=t.getChildren();for(let l=0;l<a.length;l++){let c=a[l];Je(c)||le(209);let d=s(l);for(let u=c.getFirstChild(),p=0;u!=null;u=u.getNextSibling()){for(pe(u)||le(147);d[p]!==void 0;)p++;let h={cell:u,startColumn:p,startRow:l},{__rowSpan:g,__colSpan:m}=u;for(let _=0;_<g&&!(l+_>=a.length);_++){let b=s(l+_);for(let y=0;y<m;y++)b[p+y]=h}e!==null&&r===null&&e.is(u)&&(r=h),n!==null&&i===null&&n.is(u)&&(i=h)}}return[o,r,i]}function Kt(t){let e;if(t instanceof Hi)e=t;else if("__type"in t){let r=ue(t,pe);pe(r)||le(148),e=r}else{let r=ue(t.getNode(),pe);pe(r)||le(148),e=r}let n=e.getParent();Je(n)||le(149);let o=n.getParent();return ct(o)||le(210),[e,n,o]}function Xf(t,e,n){let o,r=Math.min(e.startColumn,n.startColumn),i=Math.min(e.startRow,n.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),a=Math.max(e.startRow+e.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{o=!1;for(let l=0;l<t.length;l++)for(let c=0;c<t[0].length;c++){let d=t[l][c];if(!d)continue;let u=d.startColumn+d.cell.__colSpan-1,p=d.startRow+d.cell.__rowSpan-1,h=d.startColumn<=s&&u>=r,g=d.startRow<=a&&p>=i;if(h&&g){let m=Math.min(r,d.startColumn),_=Math.max(s,u),b=Math.min(i,d.startRow),y=Math.max(a,p);m===r&&_===s&&b===i&&y===a||(r=m,s=_,i=b,a=y,o=!0)}}}while(o);return{maxColumn:s,maxRow:a,minColumn:r,minRow:i}}function bv(t){let[e,,n]=Kt(t),o=n.getChildren(),r=o.length,i=o[0].getChildren().length,s=new Array(r);for(let a=0;a<r;a++)s[a]=new Array(i);for(let a=0;a<r;a++){let l=o[a].getChildren(),c=0;for(let d=0;d<l.length;d++){for(;s[a][c];)c++;let u=l[d],p=u.__rowSpan||1,h=u.__colSpan||1;for(let g=0;g<p;g++)for(let m=0;m<h;m++)s[a+g][c+m]=u;if(e===u)return{colSpan:h,columnIndex:c,rowIndex:a,rowSpan:p};c+=h}}return null}function BA(t){let[[e,n,o,r],[i,s,a,l]]=["anchor","focus"].map((c=>{let d=t[c].getNode(),u=ue(d,pe);pe(u)||le(238,c,d.getKey(),d.getType());let p=u.getParent();Je(p)||le(239,c);let h=p.getParent();return ct(h)||le(240,c),[d,u,p,h]}));return r.is(l)||le(241),{anchorCell:n,anchorNode:e,anchorRow:o,anchorTable:r,focusCell:s,focusNode:i,focusRow:a,focusTable:l}}var Zf=class t{constructor(e,n,o){this.anchor=n,this.focus=o,n._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){return this.tableKey!=="root"&&this.anchor.key!=="root"&&this.anchor.type==="element"&&this.focus.key!=="root"&&this.focus.type==="element"}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return je(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,n,o){this.dirty=this.dirty||e!==this.tableKey||n!==this.anchor.key||o!==this.focus.key,this.tableKey=e,this.anchor.key=n,this.focus.key=o,this._cachedNodes=null}clone(){return new t(this.tableKey,rr(this.anchor.key,this.anchor.offset,this.anchor.type),rr(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(pe).forEach((r=>{let i=r.getFirstChild();Qt(i)&&(n|=i.getTextFormat())}));let o=mO[e];return!!(n&o)}insertNodes(e){let n=this.focus.getNode();Y(n)||le(151),jr(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:n}=BA(this),o=bv(e);o===null&&le(153);let r=bv(n);r===null&&le(155);let i=Math.min(o.columnIndex,r.columnIndex),s=Math.max(o.columnIndex+o.colSpan-1,r.columnIndex+r.colSpan-1),a=Math.min(o.rowIndex,r.rowIndex),l=Math.max(o.rowIndex+o.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(a,l),toX:Math.max(i,s),toY:Math.max(a,l)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:o,focusCell:r}=BA(this),i=r.getParents()[1];if(i!==n){if(n.isParentOf(r)){let _=i.getParent();_==null&&le(159),this.set(this.tableKey,r.getKey(),_.getKey())}else{let _=n.getParent();_==null&&le(158),this.set(this.tableKey,_.getKey(),r.getKey())}return this.getNodes()}let[s,a,l]=ln(n,o,r),{minColumn:c,maxColumn:d,minRow:u,maxRow:p}=Xf(s,a,l),h=new Map([[n.getKey(),n]]),g=null;for(let _=u;_<=p;_++)for(let b=c;b<=d;b++){let{cell:y}=s[_][b],v=y.getParent();Je(v)||le(160),v!==g&&(h.set(v.getKey(),v),g=v),h.has(y.getKey())||A8(y,(x=>{h.set(x.getKey(),x)}))}let m=Array.from(h.values());return EO()||(this._cachedNodes=m),m}getTextContent(){let e=this.getNodes().filter((o=>pe(o))),n="";for(let o=0;o<e.length;o++){let r=e[o],i=r.__parent,s=(e[o+1]||{}).__parent;n+=r.getTextContent()+(s!==i?`
119
- `:" ")}return n}};function je(t){return t instanceof Zf}function kv(){let t=rr("root",0,"element"),e=rr("root",0,"element");return new Zf("root",t,e)}function QA(t,e,n){t.getKey(),e.getKey(),n.getKey();let o=$(),r=je(o)?o.clone():kv();return r.set(t.getKey(),e.getKey(),n.getKey()),r}function A8(t,e){let n=[[t]];for(let o=n.at(-1);o!==void 0&&n.length>0;o=n.at(-1)){let r=o.pop();r===void 0?n.pop():e(r)!==!1&&Y(r)&&n.push(r.getChildren())}}function Nv(t,e=Os()){let n=At(t);ct(n)||le(231,t);let o=Ui(n,e.getElementByKey(t));return o===null&&le(232,t),{tableElement:o,tableNode:n}}var Qf=class{constructor(e,n){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Nv(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver((n=>{this.editor.getEditorState().read((()=>{let o=!1;for(let s=0;s<n.length;s++){let a=n[s].target.nodeName;if(a==="TABLE"||a==="TBODY"||a==="THEAD"||a==="TR"){o=!0;break}}if(!o)return;let{tableNode:r,tableElement:i}=this.$lookup();this.table=bl(r,i)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{let{tableNode:n,tableElement:o}=this.$lookup();this.table=bl(n,o),e.observe(o,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:n,tableElement:o}=this.$lookup();Yf(e,bl(n,o),null),$()!==null&&(vt(null),e.dispatchCommand(hn,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();Vn(n,e._config.theme.tableSelection),n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();qe(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&le(233,e.tableKey,this.tableNodeKey);let n=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Yf(n,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=io(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let o=this.editor,{tableNode:r}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===i&&this.anchorY===s&&!n){if(i===this.focusX&&s===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=i,this.focusY=s,this.isHighlightingCells){let a=vv(r,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&a!==null)return this.focusCellNodeKey=a.getKey(),this.tableSelection=QA(r,this.$getAnchorTableCellOrThrow(),a),vt(this.tableSelection),o.dispatchCommand(hn,void 0),Yf(o,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?At(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&le(234),e}$getFocusTableCell(){return this.focusCellNodeKey?At(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&le(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;let{tableNode:n}=this.$lookup(),o=vv(n,e.elem);if(o!==null){let r=o.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():kv(),this.anchorCellNodeKey=r}}$formatCells(e){let n=$();je(n)||le(236);let o=ir(),r=o.anchor,i=o.focus,s=n.getNodes().filter(pe);s.length>0||le(237);let a=s[0].getFirstChild(),l=Qt(a)?a.getFormatFlags(e,null):null;s.forEach((c=>{r.set(c.getKey(),0,"element"),i.set(c.getKey(),c.getChildrenSize(),"element"),o.formatText(e,l)})),vt(n),this.editor.dispatchCommand(hn,void 0)}$clearText(){let{editor:e}=this,n=At(this.tableNodeKey);if(!ct(n))throw new Error("Expected TableNode.");let o=$();je(o)||le(253);let r=o.getNodes().filter(pe),i=n.getFirstChild(),s=n.getLastChild();if(r.length>0&&i!==null&&s!==null&&Je(i)&&Je(s)&&r[0]===i.getFirstChild()&&r[r.length-1]===s.getLastChild()){n.selectPrevious();let a=n.getParent();return n.remove(),void(sr(a)&&a.isEmpty()&&e.dispatchCommand(Mi,void 0))}r.forEach((a=>{if(Y(a)){let l=me(),c=St();l.append(c),a.append(l),a.getChildren().forEach((d=>{d!==l&&d.remove()}))}})),Yf(e,this.table,null),vt(null),e.dispatchCommand(hn,void 0)}},yv="__lexicalTableSelection",M8=t=>!(1&~t.buttons);function ml(t){return Ls(t)&&t.nodeName==="TABLE"}function Ui(t,e){if(!e)return e;let n=ml(e)?e:t.getDOMSlot(e).element;return n.nodeName!=="TABLE"&&le(245,e.nodeName),n}function Dv(t){return t._window}function fd(t,e){for(let n=e,o=null;n!==null;n=n.getParent()){if(t.is(n))return o;pe(n)&&(o=n)}return null}var L8=[[Vr,"down"],[$o,"up"],[rl,"backward"],[yf,"forward"]],R8=[_f,Xc,el],P8=[xf,vf];function eM(t,e,n,o){let r=n.getRootElement(),i=Dv(n);r!==null&&i!==null||le(246);let s=new Qf(n,t.getKey()),a=Ui(t,e);(function(h,g){xv(h)!==null&&le(205),h[yv]=g})(a,s),s.listenersToRemove.add((()=>(function(h,g){xv(h)===g&&delete h[yv]})(a,s)));let l=h=>{if(s.pointerType=h.pointerType,h.button!==0||!Fi(h.target)||!i)return;let g=gd(h.target);g!==null&&n.update((()=>{let m=Kr();if(FA&&h.shiftKey&&hr(m,t)&&(B(m)||je(m))){let _=m.anchor.getNode(),b=fd(t,m.anchor.getNode());b?(s.$setAnchorCellForSelection(Hs(s,b)),s.$setFocusCellForSelection(g),qr(h)):(t.isBefore(_)?t.selectStart():t.selectEnd()).anchor.set(m.anchor.key,m.anchor.offset,m.anchor.type)}else h.pointerType!=="touch"&&s.$setAnchorCellForSelection(g)})),(()=>{if(s.isSelecting)return;let m=()=>{s.isSelecting=!1,i.removeEventListener("pointerup",m),i.removeEventListener("pointermove",_)},_=b=>{if(!M8(b)&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("pointerup",m),void i.removeEventListener("pointermove",_);if(!Fi(b.target))return;let y=null,v=!(FA||a.contains(b.target));if(v)y=$A(a,b.target);else for(let x of document.elementsFromPoint(b.clientX,b.clientY))if(y=$A(a,x),y)break;!y||s.focusCell!==null&&y.elem===s.focusCell.elem||(s.setNextFocus({focusCell:y,override:v}),n.dispatchCommand(hn,void 0))};s.isSelecting=!0,i.addEventListener("pointerup",m,s.listenerOptions),i.addEventListener("pointermove",_,s.listenerOptions)})()};a.addEventListener("pointerdown",l,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("pointerdown",l)}));let c=h=>{h.detail>=3&&Fi(h.target)&&gd(h.target)!==null&&h.preventDefault()};a.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));let d=h=>{let g=h.target;h.button===0&&Fi(g)&&n.update((()=>{let m=$();je(m)&&m.tableKey===s.tableNodeKey&&r.contains(g)&&s.$clearHighlight()}))};i.addEventListener("pointerdown",d,s.listenerOptions),s.listenersToRemove.add((()=>{i.removeEventListener("pointerdown",d)}));for(let[h,g]of L8)s.listenersToRemove.add(n.registerCommand(h,(m=>oM(n,m,g,t,s)),Ai));s.listenersToRemove.add(n.registerCommand(Li,(h=>{let g=$();if(je(g)){let m=fd(t,g.focus.getNode());if(m!==null)return qr(h),m.selectEnd(),!0}return!1}),Ai));let u=h=>()=>{let g=$();if(!hr(g,t))return!1;if(je(g))return s.$clearText(),!0;if(B(g)){if(!pe(fd(t,g.anchor.getNode())))return!1;let m=g.anchor.getNode(),_=g.focus.getNode(),b=t.isParentOf(m),y=t.isParentOf(_);if(b&&!y||y&&!b)return s.$clearText(),!0;let v=ue(g.anchor.getNode(),(E=>Y(E))),x=v&&ue(v,(E=>Y(E)&&pe(E.getParent())));if(!Y(x)||!Y(v))return!1;if(h===Xc&&x.getPreviousSibling()===null)return!0}return!1};for(let h of R8)s.listenersToRemove.add(n.registerCommand(h,u(h),kt));let p=h=>{let g=$();if(!je(g)&&!B(g))return!1;let m=t.isParentOf(g.anchor.getNode());if(m!==t.isParentOf(g.focus.getNode())){let _=m?"anchor":"focus",b=m?"focus":"anchor",{key:y,offset:v,type:x}=g[b];return t[g[_].isBefore(g[b])?"selectPrevious":"selectNext"]()[b].set(y,v,x),!1}return!!hr(g,t)&&!!je(g)&&(h&&(h.preventDefault(),h.stopPropagation()),s.$clearText(),!0)};for(let h of P8)s.listenersToRemove.add(n.registerCommand(h,p,kt));return s.listenersToRemove.add(n.registerCommand(mf,(h=>{let g=$();if(g){if(!je(g)&&!B(g))return!1;cd(n,so(h,ClipboardEvent)?h:null,wA(g));let m=p(h);return B(g)?(g.removeText(),!0):m}return!1}),kt)),s.listenersToRemove.add(n.registerCommand(lt,(h=>{let g=$();if(!hr(g,t))return!1;if(je(g))return s.$formatCells(h),!0;if(B(g)){let m=ue(g.anchor.getNode(),(_=>pe(_)));if(!pe(m))return!1}return!1}),kt)),s.listenersToRemove.add(n.registerCommand(bf,(h=>{let g=$();if(!je(g)||!hr(g,t))return!1;let m=g.anchor.getNode(),_=g.focus.getNode();if(!pe(m)||!pe(_))return!1;if((function(w,S){if(je(w)){let N=w.anchor.getNode(),D=w.focus.getNode();if(S&&N&&D){let[O]=ln(S,N,D);return N.getKey()===O[0][0].cell.getKey()&&D.getKey()===O[O.length-1].at(-1).cell.getKey()}}return!1})(g,t))return t.setFormat(h),!0;let[b,y,v]=ln(t,m,_),x=Math.max(y.startRow+y.cell.__rowSpan-1,v.startRow+v.cell.__rowSpan-1),E=Math.max(y.startColumn+y.cell.__colSpan-1,v.startColumn+v.cell.__colSpan-1),C=Math.min(y.startRow,v.startRow),k=Math.min(y.startColumn,v.startColumn),T=new Set;for(let w=C;w<=x;w++)for(let S=k;S<=E;S++){let N=b[w][S].cell;if(T.has(N))continue;T.add(N),N.setFormat(h);let D=N.getChildren();for(let O=0;O<D.length;O++){let A=D[O];Y(A)&&!A.isInline()&&A.setFormat(h)}}return!0}),kt)),s.listenersToRemove.add(n.registerCommand(hf,(h=>{let g=$();if(!hr(g,t))return!1;if(je(g))return s.$clearHighlight(),!1;if(B(g)){let m=ue(g.anchor.getNode(),(_=>pe(_)));if(!pe(m))return!1;if(typeof h=="string"){let _=UA(n,g,t);if(_)return HA(_,t,[St(h)]),!0}}return!1}),kt)),o&&s.listenersToRemove.add(n.registerCommand(Ri,(h=>{let g=$();if(!B(g)||!g.isCollapsed()||!hr(g,t))return!1;let m=_l(g.anchor.getNode());return!(m===null||!t.is(Us(m)))&&(qr(h),(function(_,b){let y=b==="next"?"getNextSibling":"getPreviousSibling",v=b==="next"?"getFirstChild":"getLastChild",x=_[y]();if(Y(x))return x.selectEnd();let E=ue(_,Je);E===null&&le(247);for(let k=E[y]();Je(k);k=k[y]()){let T=k[v]();if(Y(T))return T.selectEnd()}let C=ue(E,ct);C===null&&le(248),b==="next"?C.selectNext():C.selectPrevious()})(m,h.shiftKey?"previous":"next"),!0)}),kt)),s.listenersToRemove.add(n.registerCommand(aO,(h=>t.isSelected()),Ai)),s.listenersToRemove.add(n.registerCommand(Qc,((h,g)=>{if(n!==g)return!1;let{nodes:m,selection:_}=h,b=_.getStartEndPoints(),y=je(_),v=B(_)&&ue(_.anchor.getNode(),(ee=>pe(ee)))!==null&&ue(_.focus.getNode(),(ee=>pe(ee)))!==null||y;if(m.length!==1||!ct(m[0])||!v||b===null)return!1;let[x,E]=b,[C,k,T]=Kt(x),w=ue(E.getNode(),(ee=>pe(ee)));if(!(pe(C)&&pe(w)&&Je(k)&&ct(T)))return!1;let S=m[0],[N,D,O]=ln(T,C,w),[A]=Jr(S,null,null),I=N.length,R=I>0?N[0].length:0,z=D.startRow,W=D.startColumn,Z=A.length,F=Z>0?A[0].length:0;if(y){let ee=Xf(N,D,O),xe=ee.maxRow-ee.minRow+1,Be=ee.maxColumn-ee.minColumn+1;z=ee.minRow,W=ee.minColumn,Z=Math.min(Z,xe),F=Math.min(F,Be)}let se=!1,ye=Math.min(I,z+Z)-1,ut=Math.min(R,W+F)-1,Rt=new Set;for(let ee=z;ee<=ye;ee++)for(let xe=W;xe<=ut;xe++){let Be=N[ee][xe];Rt.has(Be.cell.getKey())||Be.cell.__rowSpan===1&&Be.cell.__colSpan===1||(ZA(Be.cell),Rt.add(Be.cell.getKey()),se=!0)}let[ot]=Jr(T.getWritable(),null,null),pt=Z-I+z;for(let ee=0;ee<pt;ee++)mv(ot[I-1][0].cell);let oe=F-R+W;for(let ee=0;ee<oe;ee++)_v(ot[0][R-1].cell,!0,!1);[ot]=Jr(T.getWritable(),null,null);for(let ee=z;ee<z+Z;ee++)for(let xe=W;xe<W+F;xe++){let Be=ee-z,cn=xe-W,$e=A[Be][cn];if($e.startRow!==Be||$e.startColumn!==cn)continue;let nn=$e.cell;if(nn.__rowSpan!==1||nn.__colSpan!==1){let co=[],xd=Math.min(ee+nn.__rowSpan,z+Z)-1,U=Math.min(xe+nn.__colSpan,W+F)-1;for(let re=ee;re<=xd;re++)for(let ge=xe;ge<=U;ge++){let ae=ot[re][ge];co.push(ae.cell)}XA(co),se=!0}let{cell:Sl}=ot[ee][xe],mr=Sl.getChildren();nn.getChildren().forEach((co=>{te(co)&&me().append(co),Sl.append(co)})),mr.forEach((co=>co.remove()))}if(y&&se){let[ee]=Jr(T.getWritable(),null,null);ee[D.startRow][D.startColumn].cell.selectEnd()}return!0}),kt)),s.listenersToRemove.add(n.registerCommand(hn,(()=>{let h=$(),g=Kr(),m=s.getAndClearNextFocus();if(m!==null){let{focusCell:_}=m;if(je(h)&&h.tableKey===s.tableNodeKey)return(_.x!==s.focusX||_.y!==s.focusY)&&(s.$setFocusCellForSelection(_),!0);if(_!==s.anchorCell&&hr(h,t))return s.$setFocusCellForSelection(_),!0}if(s.getAndClearShouldCheckSelection()&&B(g)&&B(h)&&h.isCollapsed()){let _=h.anchor.getNode(),b=t.getFirstChild(),y=_l(_);if(y!==null&&Je(b)){let v=b.getFirstChild();if(pe(v)&&t.is(ue(y,(x=>x.is(t)||x.is(v)))))return v.selectStart(),!0}}if(B(h)){let{anchor:_,focus:b}=h,y=_.getNode(),v=b.getNode(),x=_l(y),E=_l(v),C=!(!x||!t.is(Us(x))),k=!(!E||!t.is(Us(E))),T=C!==k,w=C&&k,S=h.isBackward();if(T){let N=h.clone();if(k){let[D]=ln(t,E,E),O=D[0][0].cell,A=D[D.length-1].at(-1).cell;N.focus.set(S?O.getKey():A.getKey(),S?O.getChildrenSize():A.getChildrenSize(),"element")}else if(C){let[D]=ln(t,x,x),O=D[0][0].cell,A=D[D.length-1].at(-1).cell;N.anchor.set(S?A.getKey():O.getKey(),S?A.getChildrenSize():0,"element")}vt(N),zA(n,s)}else if(w&&(x.is(E)||(s.$setAnchorCellForSelection(Hs(s,x)),s.$setFocusCellForSelection(Hs(s,E),!0)),s.pointerType==="touch"&&s.isSelecting&&h.isCollapsed()&&B(g)&&g.isCollapsed())){let N=_l(g.anchor.getNode());N&&!N.is(E)&&(s.$setAnchorCellForSelection(Hs(s,N)),s.$setFocusCellForSelection(Hs(s,E),!0),s.pointerType=null)}}else if(h&&je(h)&&h.is(g)&&h.tableKey===t.getKey()){let _=io(i);if(_&&_.anchorNode&&_.focusNode){let b=an(_.focusNode),y=b&&!t.isParentOf(b),v=an(_.anchorNode),x=v&&t.isParentOf(v);if(y&&x&&_.rangeCount>0){let E=UD(_,n);E&&(E.anchor.set(t.getKey(),h.isBackward()?t.getChildrenSize():0,"element"),_.removeAllRanges(),vt(E))}}}return h&&!h.is(g)&&(je(h)||je(g))&&s.tableSelection&&!s.tableSelection.is(g)?(je(h)&&h.tableKey===s.tableNodeKey?s.$updateTableTableSelection(h):!je(h)&&je(g)&&g.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!t.isSelected()?(function(_,b){b.$enableHighlightStyle(),Ov(b.table,(y=>{let v=y.elem;y.highlighted=!1,nM(_,y),v.getAttribute("style")||v.removeAttribute("style")}))})(n,s):!s.hasHijackedSelectionStyles&&t.isSelected()&&zA(n,s),!1)}),kt)),s.listenersToRemove.add(n.registerCommand(Mi,(()=>{let h=$();if(!B(h)||!h.isCollapsed()||!hr(h,t))return!1;let g=UA(n,h,t);return!!g&&(HA(g,t),!0)}),kt)),s}function xv(t){return t[yv]||null}function gd(t){let e=t;for(;e!=null;){let n=e.nodeName;if(n==="TD"||n==="TH"){let o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function $A(t,e){if(!t.contains(e))return null;let n=null;for(let o=e;o!=null;o=o.parentNode){if(o===t)return n;let r=o.nodeName;r!=="TD"&&r!=="TH"||(n=o._cell||null)}return null}function bl(t,e){let n=[],o={columns:0,domRows:n,rows:0},r=Ui(t,e).querySelector("tr"),i=0,s=0;for(n.length=0;r!=null;){let a=r.nodeName;if(a==="TD"||a==="TH"){let d={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=d;let u=n[s];u===void 0&&(u=n[s]=[]),u[i]=d}else{let d=r.firstChild;if(d!=null){r=d;continue}}let l=r.nextSibling;if(l!=null){i++,r=l;continue}let c=r.parentNode;if(c!=null){let d=c.nextSibling;if(d==null)break;s++,i=0,r=d}}return o.columns=i+1,o.rows=s+1,o}function Yf(t,e,n){let o=new Set(n?n.getNodes():[]);Ov(e,((r,i)=>{let s=r.elem;o.has(i)?(r.highlighted=!0,tM(t,r)):(r.highlighted=!1,nM(t,r),s.getAttribute("style")||s.removeAttribute("style"))}))}function Ov(t,e){let{domRows:n}=t;for(let o=0;o<n.length;o++){let r=n[o];if(r)for(let i=0;i<r.length;i++){let s=r[i];if(!s)continue;let a=an(s.elem);a!==null&&e(s,a,{x:i,y:o})}}}function zA(t,e){e.$disableHighlightStyle(),Ov(e.table,(n=>{n.highlighted=!0,tM(t,n)}))}var F8=(t,e,n,o,r)=>{let i=r==="forward";switch(r){case"backward":case"forward":return n!==(i?t.table.columns-1:0)?Jf(e.getCellNodeFromCordsOrThrow(n+(i?1:-1),o,t.table),i):o!==(i?t.table.rows-1:0)?Jf(e.getCellNodeFromCordsOrThrow(i?0:t.table.columns-1,o+(i?1:-1),t.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?Jf(e.getCellNodeFromCordsOrThrow(n,o-1,t.table),!1):e.selectPrevious(),!0;case"down":return o!==t.table.rows-1?Jf(e.getCellNodeFromCordsOrThrow(n,o+1,t.table),!0):e.selectNext(),!0;default:return!1}};function fv(t,e){let n,o;if(e.startColumn===t.minColumn)n="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==t.maxColumn)return null;n="maxColumn"}if(e.startRow===t.minRow)o="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==t.maxRow)return null;o="maxRow"}return[n,o]}function qf([t,e]){return[t==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function gl(t,e,[n,o]){let r=e[o],i=t[r];i===void 0&&le(250,o,String(r));let s=e[n],a=i[s];return a===void 0&&le(250,n,String(s)),a}function B8(t,e,n,o,r){let i=Xf(e,n,o),s=(function(C,k){let{minColumn:T,maxColumn:w,minRow:S,maxRow:N}=k,D=1,O=1,A=1,I=1,R=C[S],z=C[N];for(let W=T;W<=w;W++)D=Math.max(D,R[W].cell.__rowSpan),I=Math.max(I,z[W].cell.__rowSpan);for(let W=S;W<=N;W++)O=Math.max(O,C[W][T].cell.__colSpan),A=Math.max(A,C[W][w].cell.__colSpan);return{bottomSpan:I,leftSpan:O,rightSpan:A,topSpan:D}})(e,i),{topSpan:a,leftSpan:l,bottomSpan:c,rightSpan:d}=s,u=(function(C,k){let T=fv(C,k);return T===null&&le(249,k.cell.getKey()),T})(i,n),[p,h]=qf(u),g=i[p],m=i[h];r==="forward"?g+=p==="maxColumn"?1:l:r==="backward"?g-=p==="minColumn"?1:d:r==="down"?m+=h==="maxRow"?1:a:r==="up"&&(m-=h==="minRow"?1:c);let _=e[m];if(_===void 0)return!1;let b=_[g];if(b===void 0)return!1;let[y,v]=(function(C,k,T){let w=Xf(C,k,T),S=fv(w,k);if(S)return[gl(C,w,S),gl(C,w,qf(S))];let N=fv(w,T);if(N)return[gl(C,w,qf(N)),gl(C,w,N)];let D=["minColumn","minRow"];return[gl(C,w,D),gl(C,w,qf(D))]})(e,n,b),x=Hs(t,y.cell),E=Hs(t,v.cell);return t.$setAnchorCellForSelection(x),t.$setFocusCellForSelection(E,!0),!0}function hr(t,e){if(B(t)||je(t)){let n=e.isParentOf(t.anchor.getNode()),o=e.isParentOf(t.focus.getNode());return n&&o}return!1}function Jf(t,e){e?t.selectStart():t.selectEnd()}function tM(t,e){let n=e.elem,o=t._config.theme;pe(an(n))||le(131),qe(n,o.tableCellSelected)}function nM(t,e){let n=e.elem;pe(an(n))||le(131);let o=t._config.theme;Vn(n,o.tableCellSelected)}function _l(t){let e=ue(t,pe);return pe(e)?e:null}function Us(t){let e=ue(t,ct);return ct(e)?e:null}function $8(t,e,n,o,r,i,s){let a=Ni(n.focus,r?"previous":"next");if(lf(a))return!1;let l=a;for(let _ of qc(a).iterNodeCarets("shadowRoot")){if(!cf(_)||!Y(_.origin))return!1;l=_}let c=l.getParentAtCaret();if(!pe(c))return!1;let d=c,u=(function(_){for(let b of qc(_).iterNodeCarets("root")){let{origin:y}=b;if(pe(y)){if(Oi(b))return ro(y,_.direction)}else if(!Je(y))break}return null})(kn(d,l.direction)),p=ue(d,ct);if(!p||!p.is(i))return!1;let h=t.getElementByKey(d.getKey()),g=gd(h);if(!h||!g)return!1;let m=rM(t,p);if(s.table=m,u)if(o==="extend"){let _=gd(t.getElementByKey(u.origin.getKey()));if(!_)return!1;s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(_,!0)}else{let _=ar(u);Ii(n.anchor,_),Ii(n.focus,_)}else if(o==="extend")s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(g,!0);else{let _=(function(b){let y=Ds(b);return Oi(y)?ar(y):b})(kn(p,a.direction));Ii(n.anchor,_),Ii(n.focus,_)}return qr(e),!0}function oM(t,e,n,o,r){if((n==="up"||n==="down")&&(function(s){let a=s.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1})(t))return!1;let i=$();if(!hr(i,o)){if(B(i)){if(n==="backward"){if(i.focus.offset>0)return!1;let s=(function(l){for(let c=l,d=l;d!==null;c=d,d=d.getParent())if(Y(d)){if(d!==c&&d.getFirstChild()!==c)return null;if(!d.isInline())return d}return null})(i.focus.getNode());if(!s)return!1;let a=s.getPreviousSibling();return!!ct(a)&&(qr(e),e.shiftKey?i.focus.set(a.getParentOrThrow().getKey(),a.getIndexWithinParent(),"element"):a.selectEnd(),!0)}if(e.shiftKey&&(n==="up"||n==="down")){let s=i.focus.getNode();if(!i.isCollapsed()&&(n==="up"&&!i.isBackward()||n==="down"&&i.isBackward())){let a=ue(s,(p=>ct(p)));if(pe(a)&&(a=ue(a,ct)),a!==o||!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(!l)return!1;let c=0;n==="up"&&Y(l)&&(c=l.getChildrenSize());let d=l;n==="up"&&Y(l)&&(d=l.getLastChild()||l,c=te(d)?d.getTextContentSize():0);let u=i.clone();return u.focus.set(d.getKey(),c,te(d)?"text":"element"),vt(u),qr(e),!0}if(zt(s)){let a=n==="up"?i.getNodes()[i.getNodes().length-1]:i.getNodes()[0];if(a&&fd(o,a)!==null){let l=o.getFirstDescendant(),c=o.getLastDescendant();if(!l||!c)return!1;let[d]=Kt(l),[u]=Kt(c),p=o.getCordsFromCellNode(d,r.table),h=o.getCordsFromCellNode(u,r.table),g=o.getDOMCellFromCordsOrThrow(p.x,p.y,r.table),m=o.getDOMCellFromCordsOrThrow(h.x,h.y,r.table);return r.$setAnchorCellForSelection(g),r.$setFocusCellForSelection(m,!0),!0}return!1}{let a=ue(s,(c=>Y(c)&&!c.isInline()));if(pe(a)&&(a=ue(a,ct)),!a)return!1;let l=n==="down"?a.getNextSibling():a.getPreviousSibling();if(ct(l)&&r.tableNodeKey===l.getKey()){let c=l.getFirstDescendant(),d=l.getLastDescendant();if(!c||!d)return!1;let[u]=Kt(c),[p]=Kt(d),h=i.clone();return h.focus.set((n==="up"?u:p).getKey(),n==="up"?0:p.getChildrenSize(),"element"),qr(e),vt(h),!0}}}}return n==="down"&&eh(t)&&r.setShouldCheckSelection(),!1}if(B(i)){if(n==="backward"||n==="forward")return $8(t,e,i,e.shiftKey?"extend":"move",n==="backward",o,r);if(i.isCollapsed()){let{anchor:s,focus:a}=i,l=ue(s.getNode(),pe),c=ue(a.getNode(),pe);if(!pe(l)||!l.is(c))return!1;let d=Us(l);if(d!==o&&d!=null){let b=Ui(d,t.getElementByKey(d.getKey()));if(b!=null)return r.table=bl(d,b),oM(t,e,n,d,r)}let u=t.getElementByKey(l.__key),p=t.getElementByKey(s.key);if(p==null||u==null)return!1;let h;if(s.type==="element")h=p.getBoundingClientRect();else{let b=io(Dv(t));if(b===null||b.rangeCount===0)return!1;h=b.getRangeAt(0).getBoundingClientRect()}let g=n==="up"?l.getFirstChild():l.getLastChild();if(g==null)return!1;let m=t.getElementByKey(g.__key);if(m==null)return!1;let _=m.getBoundingClientRect();if(n==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){qr(e);let b=o.getCordsFromCellNode(l,r.table);if(!e.shiftKey)return F8(r,o,b.x,b.y,n);{let y=o.getDOMCellFromCordsOrThrow(b.x,b.y,r.table);r.$setAnchorCellForSelection(y),r.$setFocusCellForSelection(y,!0)}return!0}}}else if(je(i)){let{anchor:s,focus:a}=i,l=ue(s.getNode(),pe),c=ue(a.getNode(),pe),[d]=i.getNodes();ct(d)||le(251);let u=Ui(d,t.getElementByKey(d.getKey()));if(!pe(l)||!pe(c)||!ct(d)||u==null)return!1;r.$updateTableTableSelection(i);let p=bl(d,u),h=o.getCordsFromCellNode(l,p),g=o.getDOMCellFromCordsOrThrow(h.x,h.y,p);if(r.$setAnchorCellForSelection(g),qr(e),e.shiftKey){let[m,_,b]=ln(o,l,c);return B8(r,m,_,b,n)}return c.selectEnd(),!0}return!1}function qr(t){t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation()}function HA(t,e,n){let o=me();t==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...n||[]),o.selectEnd()}function UA(t,e,n){let o=n.getParent();if(!o)return;let r=io(Dv(t));if(!r)return;let i=r.anchorNode,s=t.getElementByKey(o.getKey()),a=Ui(n,t.getElementByKey(n.getKey()));if(!i||!s||!a||!s.contains(i)||a.contains(i))return;let l=ue(e.anchor.getNode(),(y=>pe(y)));if(!l)return;let c=ue(l,(y=>ct(y)));if(!ct(c)||!c.is(n))return;let[d,u]=ln(n,l,l),p=d[0][0],h=d[d.length-1][d[0].length-1],{startRow:g,startColumn:m}=u,_=g===p.startRow&&m===p.startColumn,b=g===h.startRow&&m===h.startColumn;return _?"first":b?"last":void 0}function Hs(t,e){let{tableNode:n}=t.$lookup(),o=n.getCordsFromCellNode(e,t.table);return n.getDOMCellFromCordsOrThrow(o.x,o.y,t.table)}function vv(t,e,n){return fd(t,an(e,n))}function KA(t,e,n){if(!e.theme.tableAlignment)return;let o=[],r=[];for(let i of["center","right"]){let s=e.theme.tableAlignment[i];s&&(i===n?r:o).push(s)}Vn(t,...o),qe(t,...r)}var Cv=new WeakSet;function eh(t=Os()){return Cv.has(t)}function z8(t,e){e?Cv.add(t):Cv.delete(t)}var Ki=class t extends Ht{static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let n=this.getWritable();return n.__colWidths=e,n}static clone(e){return new t(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:H8,priority:1})}}static importJSON(e){return nh().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,n,o){return o==="html"}getDOMSlot(e){let n=ml(e)?e:e.querySelector("table");return ml(n)||le(229),super.getDOMSlot(e).withElement(n).withAfter(n.querySelector("colgroup"))}createDOM(e,n){let o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);let r=document.createElement("colgroup");if(o.appendChild(r),kO(r),qe(o,e.theme.table),this.updateTableElement(null,o,e),eh(n)){let i=document.createElement("div"),s=e.theme.tableScrollableWrapper;return s?qe(i,s):i.style.cssText="overflow-x: auto;",i.appendChild(o),this.updateTableWrapper(null,i,o,e),i}return o}updateTableWrapper(e,n,o,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,s,a,l){l>0?(qe(i,a.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(Vn(i,a.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(n,o,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,s,a,l){l>0?(qe(i,a.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(Vn(i,a.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(n,o,r,this.__frozenRowCount)}updateTableElement(e,n,o){this.__style!==(e?e.__style:"")&&(n.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(r,i,s){s?(qe(r,i.theme.tableRowStriping),r.setAttribute("data-lexical-row-striping","true")):(Vn(r,i.theme.tableRowStriping),r.removeAttribute("data-lexical-row-striping"))})(n,o,this.__rowStriping),(function(r,i,s,a){let l=r.querySelector("colgroup");if(!l)return;let c=[];for(let d=0;d<s;d++){let u=document.createElement("col"),p=a&&a[d];p&&(u.style.width=`${p}px`),c.push(u)}l.replaceChildren(...c)})(n,0,this.getColumnCount(),this.getColWidths()),KA(n,o,this.getFormatType())}updateDOM(e,n,o){let r=this.getDOMSlot(n).element;return n===r===eh()||(en(i=n)&&i.nodeName==="DIV"&&this.updateTableWrapper(e,n,r,o),this.updateTableElement(e,r,o),!1);var i}exportDOM(e){let n=super.exportDOM(e),{element:o}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!ml(r)&&en(r)&&(r=r.querySelector("table")),!ml(r))return null;KA(r,e._config,this.getFormatType());let[i]=Jr(this,null,null),s=new Map;for(let d of i)for(let u of d){let p=u.cell.getKey();s.has(p)||s.set(p,{colSpan:u.cell.getColSpan(),startColumn:u.startColumn})}let a=new Set;for(let d of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){let u=d.getAttribute("data-temporary-table-cell-lexical-key");if(u){let p=s.get(u);if(d.removeAttribute("data-temporary-table-cell-lexical-key"),p){s.delete(u);for(let h=0;h<p.colSpan;h++)a.add(h+p.startColumn)}}}let l=r.querySelector(":scope > colgroup");if(l){let d=Array.from(r.querySelectorAll(":scope > colgroup > col")).filter(((u,p)=>a.has(p)));l.replaceChildren(...d)}let c=r.querySelectorAll(":scope > tr");if(c.length>0){let d=document.createElement("tbody");for(let u of c)d.appendChild(u);r.append(d)}return r},element:!ml(o)&&en(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,n){let{rows:o,domRows:r}=n;for(let i=0;i<o;i++){let s=r[i];if(s!=null)for(let a=0;a<s.length;a++){let l=s[a];if(l==null)continue;let{elem:c}=l,d=vv(this,c);if(d!==null&&e.is(d))return{x:a,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,n,o){let{domRows:r}=o,i=r[n];if(i==null)return null;let s=i[e<i.length?e:i.length-1];return s??null}getDOMCellFromCordsOrThrow(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,n,o){let r=this.getDOMCellFromCords(e,n,o);if(r==null)return null;let i=an(r.elem);return pe(i)?i:null}getCellNodeFromCordsOrThrow(e,n,o){let r=this.getCellNodeFromCords(e,n,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let n=this.getWritable();return n.__rowStriping=e,n}setFrozenColumns(e){let n=this.getWritable();return n.__frozenColumnCount=e,n}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let n=this.getWritable();return n.__frozenRowCount=e,n}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!e)return 0;let n=0;return e.getChildren().forEach((o=>{pe(o)&&(n+=o.getColSpan())})),n}};function rM(t,e){let n=t.getElementByKey(e.getKey());return n===null&&le(230),bl(e,n)}function H8(t){let e=nh();t.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),t.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),t.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);let n=t.querySelector(":scope > colgroup");if(n){let o=[];for(let r of n.querySelectorAll(":scope > col")){let i=r.style.width||"";if(!Ev.test(i)&&(i=r.getAttribute("width")||"",!/^\d+$/.test(i))){o=void 0;break}o.push(parseFloat(i))}o&&e.setColWidths(o)}return{after:o=>Ex(o,Je),node:e}}function nh(){return It(new Ki)}function ct(t){return t instanceof Ki}function U8({rows:t,columns:e,includeHeaders:n}){let o=$()||Kr();if(!o||!B(o)||Us(o.anchor.getNode()))return!1;let r=VA(Number(t),Number(e),n);If(r);let i=r.getFirstDescendant();return te(i)&&i.select(),!0}function K8(t){Je(t.getParent())?t.isEmpty()&&t.append(me()):t.remove()}function j8(t){ct(t.getParent())?wx(t,pe):t.remove()}function V8(t){wx(t,Je);let[e]=Jr(t,null,null),n=e.reduce(((r,i)=>Math.max(r,i.length)),0),o=t.getChildren();for(let r=0;r<e.length;++r){let i=o[r];if(!i)continue;Je(i)||le(254,i.constructor.name,i.getType());let s=e[r].reduce(((a,l)=>l?1+a:a),0);if(s!==n)for(let a=s;a<n;++a){let l=Yn();l.append(me()),i.append(l)}}}function W8(t){if(t.detail<3||!Fi(t.target))return!1;let e=an(t.target);if(e===null)return!1;let n=ue(e,(o=>Y(o)&&!o.isInline()));return n===null?!1:!!pe(n.getParent())&&(n.select(0),!0)}function G8(t){return t.registerNodeTransform(Hi,(e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,n]=Kt(e),[o]=ln(n,e,e),r=o.length,i=o[0].length,s=n.getFirstChild();Je(s)||le(175);let a=[];for(let l=0;l<r;l++){l!==0&&(s=s.getNextSibling(),Je(s)||le(175));let c=null;for(let d=0;d<i;d++){let u=o[l][d],p=u.cell;if(u.startRow===l&&u.startColumn===d)c=p,a.push(p);else if(p.getColSpan()>1||p.getRowSpan()>1){pe(p)||le(176);let h=Yn(p.__headerState);c!==null?c.insertAfter(h):lI(s,h)}}}for(let l of a)l.setColSpan(1),l.setRowSpan(1)}}))}function Y8(t,e=!0){let n=new Map,o=(i,s,a)=>{let l=Ui(i,a),c=eM(i,l,t,e);n.set(s,[c,l])},r=t.registerMutationListener(Ki,(i=>{t.getEditorState().read((()=>{for(let[s,a]of i){let l=n.get(s);if(a==="created"||a==="updated"){let{tableNode:c,tableElement:d}=Nv(s);l===void 0?o(c,s,d):d!==l[1]&&(l[0].removeListeners(),n.delete(s),o(c,s,d))}else a==="destroyed"&&l!==void 0&&(l[0].removeListeners(),n.delete(s))}}),{editor:t})}),{skipInitialization:!1});return()=>{r();for(let[,[i]]of n)i.removeListeners()}}function q8(t){return t.hasNodes([Ki])||le(255),Ue(t.registerCommand(jA,U8,Se),t.registerCommand(Qc,(({nodes:e,selection:n},o)=>t!==o||!B(n)?!1:Us(n.anchor.getNode())!==null&&e.some(ct)),Se),t.registerCommand(lr,W8,Se),t.registerNodeTransform(Ki,V8),t.registerNodeTransform(yl,j8),t.registerNodeTransform(Hi,K8))}var he=Iv,ase=he.$computeTableMap,lse=he.$computeTableMapSkipCellCheck,iM=he.$createTableCellNode,sM=he.$createTableNode,cse=he.$createTableNodeWithDimensions,aM=he.$createTableRowNode,dse=he.$createTableSelection,use=he.$createTableSelectionFrom,pse=he.$deleteTableColumn,lM=he.$deleteTableColumnAtSelection,fse=he.$deleteTableColumn__EXPERIMENTAL,cM=he.$deleteTableRowAtSelection,hse=he.$deleteTableRow__EXPERIMENTAL,gse=he.$findCellNode,mse=he.$findTableNode,_se=he.$getElementForTableNode,bse=he.$getNodeTriplet,yse=he.$getTableAndElementByKey,Av=he.$getTableCellNodeFromLexicalNode,xse=he.$getTableCellNodeRect,vse=he.$getTableColumnIndexFromTableCellNode,md=he.$getTableNodeFromLexicalNodeOrThrow,Cse=he.$getTableRowIndexFromTableCellNode,Ese=he.$getTableRowNodeFromTableCellNodeOrThrow,wse=he.$insertTableColumn,Mv=he.$insertTableColumnAtSelection,Tse=he.$insertTableColumn__EXPERIMENTAL,Sse=he.$insertTableRow,Lv=he.$insertTableRowAtSelection,kse=he.$insertTableRow__EXPERIMENTAL,dM=he.$isScrollableTablesActive,Uo=he.$isTableCellNode,uM=he.$isTableNode,wo=he.$isTableRowNode,pM=he.$isTableSelection,Nse=he.$mergeCells,Dse=he.$removeTableRowAtIndex,Ose=he.$unmergeCell,fM=he.INSERT_TABLE_COMMAND,Dn=he.TableCellHeaderStates,oh=he.TableCellNode,rh=he.TableNode,Ise=he.TableObserver,hM=he.TableRowNode,Ase=he.applyTableHandlers,Mse=he.getDOMCellFromTarget,Lse=he.getTableElement,Rse=he.getTableObserverFromTableElement,gM=he.registerTableCellUnmergeTransform,mM=he.registerTablePlugin,_M=he.registerTableSelectionObserver,bM=he.setScrollableTablesActive;var Rv={};ze(Rv,{TablePlugin:()=>J8});bt();function J8({hasCellMerge:t=!0,hasCellBackgroundColor:e=!0,hasTabHandler:n=!0,hasHorizontalScroll:o=!1}){let[r]=Ee();return P((()=>{dM(r)!==o&&(bM(r,o),r.registerNodeTransform(rh,(()=>{}))())}),[r,o]),P((()=>mM(r)),[r]),P((()=>_M(r,n)),[r,n]),P((()=>{if(!t)return gM(r)}),[r,t]),P((()=>{if(!e)return r.registerNodeTransform(oh,(i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)}))}),[r,e,t]),null}var X8=Rv,yM=X8.TablePlugin;ke();function Pv(t){return{type:"string",...t}}function xM(t){return{type:"image",...t}}function Z8(t){return t}var Fv=Z8;var CM=new Set(["paragraph","heading","quote","orderedList","unorderedList","table","delimiter"]),vM=40,eW=200,zv="root:openRichTextBlock",Hv="root:openRichTextInline";function Hse(t,e,n,o={}){let r=(t||"").trim();if(!r)return[];let i={query:r,queryLower:r.toLowerCase(),results:[],types:o},s=[];for(Bv(s,i,n,e,"fields",[]);s.length>0&&i.results.length<eW;)s.shift()();return i.results}function Bv(t,e,n,o,r,i){if(o)for(let s of n){if(!s.id||s.hidden)continue;let a=o[s.id],l=`${r}.${s.id}`,c=s.label||s.id;t.push(()=>EM(t,e,s,a,l,[...i,c]))}}function EM(t,e,n,o,r,i){if(o!=null)switch(n.type){case"object":{Bv(t,e,n.fields||[],o,r,i);return}case"array":{let s=n;(o?._array||[]).forEach((l,c)=>{let d=o?.[l];if(d==null)return;let u=`[${c}]`,p=s.of;t.push(()=>EM(t,e,p,d,`${r}.${l}`,[...i,u]))});return}case"oneof":{let s=n,a=o?._type;if(!a)return;let l=s.types||[],c;if(typeof l[0]=="string"?l.includes(a)&&(c=e.types[a]):c=l.find(d=>d?.name===a),!c)return;Bv(t,e,c.fields||[],o,r,[...i.slice(0,-1),`${i.at(-1)} (${a})`]);return}case"string":{typeof o=="string"&&gn(e,o,n.type,r,i);return}case"select":{typeof o=="string"&&gn(e,o,n.type,r,i);return}case"multiselect":{if(Array.isArray(o)){let s=o.filter(a=>typeof a=="string").join(", ");s&&gn(e,s,n.type,r,i)}return}case"number":{typeof o=="number"&&gn(e,String(o),n.type,r,i);return}case"boolean":return;case"date":case"datetime":{typeof o=="string"&&gn(e,o,n.type,r,i);return}case"image":case"file":{if(o&&typeof o=="object"){let s=[];typeof o.alt=="string"&&s.push(o.alt),typeof o.filename=="string"&&s.push(o.filename),typeof o.src=="string"&&s.push(o.src),s.length>0&&gn(e,s.join(" "),n.type,r,i)}return}case"reference":{o&&typeof o=="object"&&typeof o.id=="string"&&gn(e,o.id,n.type,r,i);return}case"references":{if(Array.isArray(o)){let s=o.map(a=>a&&typeof a=="object"?a.id:null).filter(a=>typeof a=="string").join(", ");s&&gn(e,s,n.type,r,i)}return}case"richtext":{wM(e,n,o,r,i);return}default:return}}function wM(t,e,n,o,r){if(!n||!Array.isArray(n.blocks))return;let i=new Map;(e.blockComponents||[]).forEach(a=>{a?.name&&i.set(a.name,a)});let s=-1;n.blocks.forEach(a=>{if(!a?.type)return;if(CM.has(a.type)){SM(t,a,o,r);return}s+=1;let l=s,c={block:{richTextDeepKey:o,blockIndex:l,blockName:a.type}},d=i.get(a.type);if(!d){ih(t,a.data,o,[...r,`${a.type} [block ${l}]`],c);return}let u=[...r,`${d.label||d.name} [block ${l}]`];$v(t,d.fields||[],a.data||{},o,u,c)})}function $v(t,e,n,o,r,i){for(let s of e){if(!s.id||s.hidden)continue;let a=n?.[s.id];if(a==null)continue;let l=[...r,s.label||s.id];TM(t,s,a,o,l,i)}}function TM(t,e,n,o,r,i){switch(e.type){case"object":{$v(t,e.fields||[],n,o,r,i);return}case"array":{let s=e;(n?._array||[]).forEach((l,c)=>{let d=n?.[l];d!=null&&TM(t,s.of,d,o,[...r,`[${c}]`],i)});return}case"oneof":{let s=e,a=n?._type;if(!a)return;let l=s.types||[],c;typeof l[0]=="string"?l.includes(a)&&(c=t.types[a]):c=l.find(d=>d?.name===a),c&&$v(t,c.fields||[],n,o,[...r.slice(0,-1),`${r.at(-1)} (${a})`],i);return}case"string":case"select":{typeof n=="string"&&gn(t,n,e.type,o,r,i);return}case"multiselect":{if(Array.isArray(n)){let s=n.filter(a=>typeof a=="string").join(", ");s&&gn(t,s,e.type,o,r,i)}return}case"number":{typeof n=="number"&&gn(t,String(n),e.type,o,r,i);return}case"image":case"file":{if(n&&typeof n=="object"){let s=[];typeof n.alt=="string"&&s.push(n.alt),typeof n.filename=="string"&&s.push(n.filename),typeof n.src=="string"&&s.push(n.src),s.length>0&&gn(t,s.join(" "),e.type,o,r,i)}return}case"richtext":{wM(t,e,n,o,r);return}default:return}}function ih(t,e,n,o,r){if(e!=null){if(typeof e=="string"){gn(t,e,"string",n,o,r);return}if(typeof e=="number"){gn(t,String(e),"number",n,o,r);return}if(Array.isArray(e)){e.forEach((i,s)=>ih(t,i,n,[...o,`[${s}]`],r));return}if(typeof e=="object")for(let i of Object.keys(e))i.startsWith("_")||ih(t,e[i],n,[...o,i],r)}}function SM(t,e,n,o){switch(e.type){case"heading":case"paragraph":{let r=DM(e.data?.text);r&&gn(t,r,"richtext",n,[...o,e.type]),NM(t,e.data?.components,n,o);return}case"orderedList":case"unorderedList":{kM(t,e.data?.items,n,[...o,e.type]);return}case"table":{(e.data?.rows||[]).forEach((i,s)=>{(i.cells||[]).forEach((a,l)=>{(a.blocks||[]).forEach(c=>{CM.has(c.type)&&SM(t,c,n,[...o,`table [${s},${l}]`])})})});return}default:return}}function kM(t,e,n,o){e&&e.forEach((r,i)=>{let s=DM(r.content);s&&gn(t,s,"richtext",n,[...o,`[${i}]`]),NM(t,r.components,n,o),kM(t,r.items,n,[...o,`[${i}]`])})}function NM(t,e,n,o){if(e)for(let r of Object.keys(e)){let i=e[r];if(!i?.type)continue;let s={inline:{richTextDeepKey:n,componentId:r,componentName:i.type}};ih(t,i?.data,n,[...o,`inline:${i.type}`],s)}}function DM(t){return t?t.replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim():""}function gn(t,e,n,o,r,i){if(!e||e.toLowerCase().indexOf(t.queryLower)===-1)return;let{snippet:l,matches:c}=tW(e,t.queryLower);t.results.push({deepKey:o,label:r.join(" \u203A "),snippet:l,matches:c,fieldType:n,richTextBlock:i?.block,richTextInline:i?.inline})}function tW(t,e){let n=t.toLowerCase(),o=e.length,r=n.indexOf(e);if(r===-1)return{snippet:t,matches:[]};let i=Math.max(0,r-vM),s=Math.min(t.length,r+o+vM),a=i>0?"\u2026":"",l=s<t.length?"\u2026":"",c=t.slice(i,s),d=`${a}${c}${l}`,u=[],p=c.toLowerCase(),h=0;for(;h<p.length;){let g=p.indexOf(e,h);if(g===-1)break;u.push({start:g+a.length,end:g+a.length+o}),h=g+o}return{snippet:d,matches:u}}ri();ke();var OM=ft({blocks:new Map});function IM(t){return f(OM.Provider,{value:{blocks:t.blocks,onEditBlock:t.onEditBlock},children:t.children})}function AM(){return ht(OM)}ri();ke();var MM=ft({components:new Map});function LM(t){return f(MM.Provider,{value:{components:t.components,onEditComponent:t.onEditComponent},children:t.children})}function RM(){return ht(MM)}ri();ke();var PM=ft({});function FM(t){let e=J(()=>({historyState:oA()}),[]);return f(PM.Provider,{value:e,children:t.children})}function BM(){return ht(PM)}ri();ke();var sh={paragraph:"Normal",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",bullet:"Bulleted List",number:"Numbered List",quote:"Quote"},nW={blockType:"paragraph",canRedo:!1,canUndo:!1,codeLanguage:"",elementFormat:"left",isBold:!1,isCode:!1,isHighlight:!1,isImageCaption:!1,isItalic:!1,isLink:!1,isRTL:!1,isStrikethrough:!1,isSubscript:!1,isSuperscript:!1,isUnderline:!1,isLowercase:!1,isUppercase:!1,isCapitalize:!1,rootType:"root"},$M=ft(void 0);function zM(t){let[e,n]=L(nW),o=De((i,s)=>{n(a=>({...a,[i]:s}))},[]),r=J(()=>({toolbarState:e,updateToolbarState:o}),[e,o]);return f($M.Provider,{value:r,children:t.children})}function ah(){let t=ht($M);if(t===void 0)throw new Error("useToolbar must be used within a ToolbarProvider");return t}var HM={autocomplete:"LexicalTheme__autocomplete",blockCursor:"LexicalTheme__blockCursor",characterLimit:"LexicalTheme__characterLimit",code:"LexicalTheme__code",codeHighlight:{atrule:"LexicalTheme__tokenAttr",attr:"LexicalTheme__tokenAttr",boolean:"LexicalTheme__tokenProperty",builtin:"LexicalTheme__tokenSelector",cdata:"LexicalTheme__tokenComment",char:"LexicalTheme__tokenSelector",class:"LexicalTheme__tokenFunction","class-name":"LexicalTheme__tokenFunction",comment:"LexicalTheme__tokenComment",constant:"LexicalTheme__tokenProperty",deleted:"LexicalTheme__tokenProperty",doctype:"LexicalTheme__tokenComment",entity:"LexicalTheme__tokenOperator",function:"LexicalTheme__tokenFunction",important:"LexicalTheme__tokenVariable",inserted:"LexicalTheme__tokenSelector",keyword:"LexicalTheme__tokenAttr",namespace:"LexicalTheme__tokenVariable",number:"LexicalTheme__tokenProperty",operator:"LexicalTheme__tokenOperator",prolog:"LexicalTheme__tokenComment",property:"LexicalTheme__tokenProperty",punctuation:"LexicalTheme__tokenPunctuation",regex:"LexicalTheme__tokenVariable",selector:"LexicalTheme__tokenSelector",string:"LexicalTheme__tokenSelector",symbol:"LexicalTheme__tokenProperty",tag:"LexicalTheme__tokenProperty",url:"LexicalTheme__tokenOperator",variable:"LexicalTheme__tokenVariable"},embedBlock:{base:"LexicalTheme__embedBlock",focus:"LexicalTheme__embedBlockFocus"},hashtag:"LexicalTheme__hashtag",heading:{h1:"LexicalTheme__h1",h2:"LexicalTheme__h2",h3:"LexicalTheme__h3",h4:"LexicalTheme__h4",h5:"LexicalTheme__h5",h6:"LexicalTheme__h6"},hr:"LexicalTheme__hr",hrSelected:"LexicalTheme__hrSelected",htmlCode:"LexicalTheme__htmlCode",image:"LexicalTheme__image",indent:"LexicalTheme__indent",layoutContainer:"LexicalTheme__layoutContainer",layoutItem:"LexicalTheme__layoutItem",link:"LexicalTheme__link",list:{checklist:"LexicalTheme__checklist",listitem:"LexicalTheme__listItem",listitemChecked:"LexicalTheme__listItemChecked",listitemUnchecked:"LexicalTheme__listItemUnchecked",nested:{listitem:"LexicalTheme__nestedListItem"},ol:"LexicalTheme__ol",olDepth:["LexicalTheme__ol1","LexicalTheme__ol2","LexicalTheme__ol3","LexicalTheme__ol4","LexicalTheme__ol5"],ul:"LexicalTheme__ul"},ltr:"LexicalTheme__ltr",mark:"LexicalTheme__mark",markOverlap:"LexicalTheme__markOverlap",paragraph:"LexicalTheme__paragraph",quote:"LexicalTheme__quote",rtl:"LexicalTheme__rtl",specialText:"LexicalTheme__specialText",tab:"LexicalTheme__tabNode",table:"LexicalTheme__table",tableAddColumns:"LexicalTheme__tableAddColumns",tableAddRows:"LexicalTheme__tableAddRows",tableCell:"LexicalTheme__tableCell",tableCellActionButton:"LexicalTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalTheme__tableCellEditing",tableCellHeader:"LexicalTheme__tableCellHeader",tableCellPrimarySelected:"LexicalTheme__tableCellPrimarySelected",tableCellResizer:"LexicalTheme__tableCellResizer",tableCellSelected:"LexicalTheme__tableCellSelected",tableCellSortedIndicator:"LexicalTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalTheme__tableResizeRuler",tableSelected:"LexicalTheme__tableSelected",tableSelection:"LexicalTheme__tableSelection",text:{bold:"LexicalTheme__textBold",capitalize:"LexicalTheme__textCapitalize",code:"LexicalTheme__textCode",highlight:"LexicalTheme__textHighlight",italic:"LexicalTheme__textItalic",lowercase:"LexicalTheme__textLowercase",strikethrough:"LexicalTheme__textStrikethrough",subscript:"LexicalTheme__textSubscript",superscript:"LexicalTheme__textSuperscript",underline:"LexicalTheme__textUnderline",underlineStrikethrough:"LexicalTheme__textUnderlineStrikethrough",uppercase:"LexicalTheme__textUppercase"}};ke();var xl=class extends ho{constructor(n,o="block"){super();this.listeners=new Map;this.docId="custom-block";this.collectionId="custom-block";this.slug="custom-block";this.data={[o]:tt(n)}}getValue(n){return Go(this.data,n)}async updateKey(n,o){UM(this.data,n,o),this.notify(n)}async updateKeys(n){for(let[o,r]of Object.entries(n))UM(this.data,o,r),this.notify(o)}async removeKey(n){oW(this.data,n),this.notify(n)}subscribe(n,o){return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(o),o(this.getValue(n)),()=>{this.listeners.get(n)?.delete(o)}}subscribeSubtree(n,o){return this.subscribe(n,o)}getDataSnapshot(){return tt(this.data)}getData(){return this.getDataSnapshot()}notify(n){this.dispatch("VALUE_CHANGE",n,this.getValue(n));for(let o of rW(n)){let r=this.listeners.get(o);if(!r)continue;let i=this.getValue(o);r.forEach(s=>s(i))}}};function UM(t,e,n){let o=e.split("."),r=t;for(let i=0;i<o.length-1;i++){let s=o[i];(typeof r[s]!="object"||r[s]===null||Array.isArray(r[s]))&&(r[s]={}),r=r[s]}r[o.at(-1)]=n}function oW(t,e){let n=e.split("."),o=t;for(let r=0;r<n.length-1;r++)if(o=o?.[n[r]],typeof o!="object"||o===null)return;o&&delete o[n.at(-1)]}function rW(t){let e=t.split("."),n=[];for(let o=e.length;o>0;o--)n.push(e.slice(0,o).join("."));return n}function KM(t){let e=J(()=>new xl(t.initialValue||{}),[t.schema,t.initialValue]),n=J(()=>({loading:!1,controller:e}),[e]),o=J(()=>({type:"object",id:"block",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),r=()=>{let s=e.getValue("block")||{},a=tt(s);t.schema.name==="image"&&a?.file?.src&&(a.file.url=iW(a.file.src)),t.onSubmit(a)},i=it();return f(Xi,{...i,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:f(po,{spacing:"md",children:[t.schema.fields.length>0?f(cu,{value:n,children:f(Ae.ObjectField,{field:o,deepKey:"block"})}):f(un,{size:"sm",color:"dimmed",children:"This block does not define any editable fields."}),f(pn,{position:"right",spacing:"sm",children:[f(X,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),f(X,{size:"xs",onClick:r,children:t.mode==="edit"?"Save block":"Insert block"})]})]})})}function iW(t){return sW(t)?`${t}=s0-e365`:t}function sW(t){return t.startsWith("https://lh3.googleusercontent.com/")}var Uv={};ze(Uv,{$isDecoratorBlockNode:()=>aW,DecoratorBlockNode:()=>lh});var lh=class extends tl{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||"")}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){let n=this.getWritable();return n.__format=e,n}isInline(){return!1}};function aW(t){return t instanceof lh}var jM=Uv,VM=jM.$isDecoratorBlockNode,WM=jM.DecoratorBlockNode;ke();function lW(t){let{nodeKey:e}=t,[n]=Ee(),[o,r,i]=zf(e),{blocks:s,onEditBlock:a}=AM(),l=s.get(t.blockName),c=l?.label||l?.name||t.blockName,d=J(()=>{if(l)return zT(l,t.data)},[l,t.data]),u=J(()=>{if(l)return HT(l,t.data)},[l,t.data]);return P(()=>Ue(n.registerCommand(lr,p=>{let h=p.target;return!h||!h.closest(`[data-node-key="${e}"]`)?!1:(p.preventDefault(),p.stopPropagation(),o?r(!1):(i(),r(!0)),!0)},Pe)),[n,o,e,i,r]),f("div",{className:Ce("LexicalEditor__customBlock",o&&"LexicalEditor__customBlock--selected"),"data-node-key":e,children:[f("div",{className:"LexicalEditor__customBlock__header",children:[f("div",{className:"LexicalEditor__customBlock__header__title",children:c}),l&&a&&f("div",{className:"LexicalEditor__customBlock__actions",children:f(X,{size:"xs",variant:"default",compact:!0,onClick:()=>a(t.blockName,{mode:"edit",nodeKey:t.nodeKey,initialValue:t.data}),children:"Edit block"})})]}),u&&yr(u)&&f("div",{className:"LexicalEditor__customBlock__previewImage",children:[f("img",{src:u,alt:""}),t.data.loading&&f("div",{className:"LexicalEditor__customBlock__previewImage__loading",children:f(Ft,{variant:"oval",color:"gray"})})]}),d&&f("div",{className:Ce("LexicalEditor__customBlock__preview",l?.name==="html"&&"LexicalEditor__customBlock__preview--html"),children:d})]})}var vl=class t extends WM{static getType(){return"block-component"}static clone(e){return new t(e.__blockName,e.__blockData,e.__key)}static importJSON(e){let{blockName:n,data:o}=e;return new t(n,o)}exportJSON(){return{...super.exportJSON(),type:"block-component",blockName:this.__blockName,data:tt(this.__blockData),version:1}}constructor(e,n,o){super("",o),this.__blockName=e,this.__blockData=n?tt(n):{}}createDOM(){let e=document.createElement("div");return e.className="LexicalEditor__customBlockWrapper",e}updateDOM(){return!1}decorate(){return f(lW,{blockName:this.__blockName,data:this.__blockData,nodeKey:this.__key})}getBlockName(){return this.__blockName}getBlockData(){return this.__blockData}setBlockData(e){let n=this.getWritable();n.__blockData=tt(e)}};function js(t,e){return new vl(t,e)}function Xr(t){return t instanceof vl}ke();function GM(t){let[e,n]=L(t.componentId);P(()=>{n(t.componentId)},[t.componentId]);let o=J(()=>new xl(t.initialValue||{},"component"),[t.schema,t.initialValue]),r=J(()=>({loading:!1,controller:o}),[o]),i=J(()=>({type:"object",id:"component",label:t.schema.label||t.schema.name,variant:"inline",fields:t.schema.fields}),[t.schema]),s=()=>{let l=o.getValue("component")||{},c=tt(l);t.onSubmit({componentId:e.trim(),data:c})},a=it();return f(Xi,{...a,opened:t.opened,onClose:t.onClose,title:t.schema.label||t.schema.name,size:"lg",zIndex:190,children:f(po,{spacing:"md",children:[f(qn,{label:"Component ID",value:e,onChange:l=>n(l.currentTarget.value),placeholder:"component-id",required:!0}),t.schema.fields.length>0?f(cu,{value:r,children:f(Ae.ObjectField,{field:i,deepKey:"component"})}):f(un,{size:"sm",color:"dimmed",children:"This component does not define any editable fields."}),f(pn,{position:"right",spacing:"sm",children:[f(X,{variant:"default",size:"xs",onClick:t.onClose,children:"Cancel"}),f(X,{size:"xs",onClick:s,disabled:!e.trim(),children:t.mode==="edit"?"Save component":"Insert component"})]})]})})}si();function cW(t){let{componentName:e,componentId:n,nodeKey:o}=t,{components:r,onEditComponent:i}=RM(),s=r.get(e),a=s?.label||s?.name||e,l=De(c=>{c.preventDefault(),c.stopPropagation(),i&&i(e,{componentId:n,initialValue:t.data,mode:"edit",nodeKey:o})},[e,n,o,i,t.data]);return f("span",{className:"LexicalEditor__inlineComponent","data-node-key":o,contentEditable:!1,children:f("button",{type:"button",className:Ce("LexicalEditor__inlineComponent__button",!i&&"LexicalEditor__inlineComponent__button--disabled"),onClick:i?l:void 0,title:a?`${a} (${n})`:n,contentEditable:!1,children:[f("span",{className:"LexicalEditor__inlineComponent__label",children:a}),f("span",{className:"LexicalEditor__inlineComponent__id",children:n})]})})}var Cl=class t extends tl{static getType(){return"inline-component"}static clone(e){return new t(e.__componentName,e.__componentId,e.__componentData,e.__key)}static importJSON(e){let{componentName:n,componentId:o,data:r}=e;return new t(n,o,r)}exportJSON(){return{...super.exportJSON(),type:"inline-component",componentName:this.__componentName,componentId:this.__componentId,data:tt(this.__componentData),version:1}}constructor(e,n,o,r){super(r),this.__componentName=e,this.__componentId=n,this.__componentData=o?tt(o):{}}createDOM(){let e=document.createElement("span");return e.className="LexicalEditor__inlineComponentWrapper",e.contentEditable="false",e}updateDOM(){return!1}isInline(){return!0}isIsolated(){return!0}decorate(){return f(cW,{componentName:this.__componentName,componentId:this.__componentId,data:this.__componentData,nodeKey:this.__key})}getComponentName(){return this.__componentName}setComponentName(e){let n=this.getWritable();n.__componentName=e}getComponentId(){return this.__componentId}setComponentId(e){let n=this.getWritable();n.__componentId=e}getComponentData(){return this.__componentData}setComponentData(e){let n=this.getWritable();n.__componentData=tt(e)}};function ch(t,e,n){return new Cl(t,e,n)}function El(t){return t instanceof Cl}var ji=class t extends Ut{static getType(){return"special-character"}static clone(e){return new t(e.__text,e.__key)}static importJSON(e){return Kv(e.text)}constructor(e,n){super(e,n)}exportJSON(){return{...super.exportJSON(),type:"special-character"}}createDOM(e){let n=super.createDOM(e);return qe(n,"SpecialCharacterNode"),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o);return qe(n,"SpecialCharacterNode"),r}isTextEntity(){return!0}canInsertTextAfter(){return!1}};function Kv(t){return new ji(t)}function YM(t){return t instanceof ji}si();ke();function Zr(t){let e=t.anchor,n=t.focus,o=t.anchor.getNode(),r=t.focus.getNode();return o===r?o:t.isBackward()?gx(n)?o:r:gx(e)?o:r}function qM(t,e){let n=t.getRangeAt(0),o;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!==null;)r=r.firstElementChild;o=r.getBoundingClientRect()}else o=n.getBoundingClientRect();return o}var dW=10,uW=5;function pW(t){let{editor:e,isLink:n,setIsLink:o,anchorElem:r,isLinkEditMode:i,setIsLinkEditMode:s,onDismiss:a}=t,l=q(null),c=q(null),[d,u]=L(""),[p,h]=L(""),[g,m]=L(null),[_,b]=L(null),[y,v]=L(null),x=q(""),E=De(()=>{let S=$();if(B(S)){let I=Zr(S),R=ue(I,et),z="",W=null;R?(z=R.getURL(),W=R.getTarget()||null):et(I)&&(z=I.getURL(),W=I.getTarget()||null),u(z),m(W);let Z=c.current===document.activeElement,F=z!==x.current;(!Z||F)&&(h(Qr(z)),b(W)),x.current=z}else if(mt(S)){let I=S.getNodes();if(I.length>0){let R=I[0],z=R.getParent(),W="",Z=null;et(z)?(W=z.getURL(),Z=z.getTarget()||null):et(R)&&(W=R.getURL(),Z=R.getTarget()||null),u(W),m(Z);let F=c.current===document.activeElement,se=W!==x.current;(!F||se)&&(h(Qr(W)),b(Z)),x.current=W}}let N=l.current,D=io(e._window),O=document.activeElement;if(N===null)return;let A=e.getRootElement();if(S!==null&&A!==null&&e.isEditable()){let I;if(mt(S)){let R=S.getNodes();if(R.length>0){let z=e.getElementByKey(R[0].getKey());z&&(I=z.getBoundingClientRect())}}else D!==null&&A.contains(D.anchorNode)&&(I=D.focusNode?.parentElement?.getBoundingClientRect());I&&(I.y+=40,JM(I,N,r)),v(S)}else(!O||O.className!=="link-input")&&(A!==null&&JM(null,N,r),v(null),s(!1),u(""),x.current="");return!0},[r,e,s,i,d]);P(()=>{let S=r.parentElement,N=()=>{e.getEditorState().read(()=>{E()})};return window.addEventListener("resize",N),S&&S.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),S&&S.removeEventListener("scroll",N)}},[r.parentElement,e,E]),P(()=>Ue(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{E()})}),e.registerCommand(hn,()=>(E(),!0),Pe),e.registerCommand(Li,()=>n?(o(!1),a?.(),!0):!1,Ai)),[e,E,o,n]),P(()=>{e.getEditorState().read(()=>{E()})},[e,E]),P(()=>{n&&e.getEditorState().read(()=>{E()})},[n,e,E]),P(()=>{i&&c.current&&c.current.focus()},[i,n]),P(()=>{if(!n)return;let S=()=>{o(!1),s(!1),a?.()},N=O=>{let A=O.target;A&&(l.current&&l.current.contains(A)||r.contains(A)||r.parentElement&&r.parentElement.contains(A)||S())},D=O=>{O.key==="Escape"&&l.current&&l.current.contains(document.activeElement)&&(O.preventDefault(),S())};return window.addEventListener("mousedown",N),window.addEventListener("keydown",D),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",D)}},[n,r,o,s]);let C=S=>{S.key==="Enter"?(S.preventDefault(),k()):S.key==="Escape"&&(S.preventDefault(),o(!1),s(!1),a?.())},k=S=>{if(S&&S.preventDefault(),y!==null){if(d!==null){let N=_==="_blank"?"_blank":null;e.update(()=>{let D=$();if(B(D)){let O=Zr(D),A=ue(O,et);A?(A.setURL(Qr(p)),A.setTarget(N)):et(O)?(O.setURL(Qr(p)),O.setTarget(N)):e.dispatchCommand(Wn,{url:Qr(p),target:N})}else if(mt(D)){let O=D.getNodes();if(O.length>0){let A=O[0],I=A.getParent();et(I)?(I.setURL(Qr(p)),I.setTarget(N)):et(A)&&(A.setURL(Qr(p)),A.setTarget(N))}}})}s(!1)}},T=Qr(p)!==Qr(d)||_!==g,w=()=>{h(d),b(g)};return f("div",{ref:l,className:Ce("LexicalEditor__linkEditor",!n&&"LexicalEditor__linkEditor--hidden"),children:!n||!y?null:f("div",{className:"LexicalEditor__link__editForm",children:[f(_n,{ref:c,className:"LexicalEditor__link__input",value:p,onChange:S=>{let N=S.target;h(N.value)},onKeyDown:S=>{C(S)},autosize:!0,minRows:1,radius:"xs",placeholder:"https://"}),f("div",{className:"LexicalEditor__link__row",children:[f(uo,{className:"LexicalEditor__link__target",label:"Open in new tab",checked:_==="_blank",onChange:S=>b(S.currentTarget.checked?"_blank":null),size:"xs"}),f("div",{className:"LexicalEditor__link__controls",children:[f(jv,{tooltip:"Remove",onClick:()=>{e.dispatchCommand(Wn,null)},children:f(Jn,{size:12})}),f(jv,{tooltip:"Undo",onClick:w,disabled:!T,children:f(li,{size:12})}),f(jv,{tooltip:"Save",onClick:()=>k(),disabled:!T,color:"green",children:f(Qi,{size:12})})]})]})]})})}function jv(t){return f(Oe,{label:t.tooltip,position:"top",withArrow:!0,children:f(Me,{radius:"xl",variant:t.color?"filled":"default",color:t.color||"dark",size:"sm",title:t.tooltip,onClick:t.onClick,disabled:t.disabled,children:t.children})})}function fW(t,e,n,o){let[r,i]=L(t),[s,a]=L(!1),l=q(0),c=300,d=De(()=>{l.current=Date.now()},[]);return P(()=>{function u(){if(Date.now()-l.current<c)return;let p=$();if(B(p)){let h=Zr(p),g=ue(h,et),m=ue(h,rd);if(!(g||m)){a(!1);return}let _=p.getNodes().filter(b=>!Qe(b)).find(b=>{let y=ue(b,et),v=ue(b,rd);return g&&!g.is(y)||y&&!y.is(g)||m&&!m.is(v)||v&&(!v.is(m)||v.getIsUnlinked())});a(!_)}else if(mt(p)){let h=p.getNodes();if(h.length===0){a(!1);return}let g=h[0],m=g.getParent();et(m)||et(g)?a(!0):a(!1)}}return Ue(t.registerUpdateListener(({editorState:p})=>{p.read(()=>{u()})}),t.registerCommand(hn,(p,h)=>(u(),i(h),!1),kt),t.registerCommand(lr,p=>{let h=$();if(B(h)){let g=Zr(h),m=ue(g,et);if(m)return p.metaKey||p.ctrlKey?(window.open(m.getURL(),"_blank"),!0):(p.preventDefault(),p.stopPropagation(),!0)}return!1},Pe))},[t]),ii(f(pW,{editor:r,isLink:s,anchorElem:e,setIsLink:a,isLinkEditMode:n,setIsLinkEditMode:o,onDismiss:d}),e)}function XM(t){let{anchorElem:e=document.body,isLinkEditMode:n,setIsLinkEditMode:o}=t,[r]=Ee();return fW(r,e,n,o)}function JM(t,e,n,o=dW,r=uW){let i=n.parentElement;if(t===null||!i){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=e.getBoundingClientRect(),a=n.getBoundingClientRect(),l=i.getBoundingClientRect(),c=t.top-o,d=t.left-r;c<l.top&&(c+=s.height+t.height+o*2),d+s.width>l.right&&(d=l.right-s.width-r),c-=a.top,d-=a.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}function Qr(t){return t&&t.trim()}var Wle=Eh(Vv(),1);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,n){var o={};o["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[n]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};r["language-"+n]={pattern:/[\s\S]+/,inside:Prism.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(d){return d=d.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+d+")")}var o=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return o}),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+i+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+i+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(o),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(o),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(d){["url","bold","italic","strike","code-snippet"].forEach(function(u){d!==u&&(t.languages.markdown[d].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(d){if(d.language!=="markdown"&&d.language!=="md")return;function u(p){if(!(!p||typeof p=="string"))for(var h=0,g=p.length;h<g;h++){var m=p[h];if(m.type!=="code"){u(m.content);continue}var _=m.content[1],b=m.content[3];if(_&&b&&_.type==="code-language"&&b.type==="code-block"&&typeof _.content=="string"){var y=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");y=(/[a-z][\w-]*/i.exec(y)||[""])[0].toLowerCase();var v="language-"+y;b.alias?typeof b.alias=="string"?b.alias=[b.alias,v]:b.alias.push(v):b.alias=[v]}}}u(d.tokens)}),t.hooks.add("wrap",function(d){if(d.type==="code-block"){for(var u="",p=0,h=d.classes.length;p<h;p++){var g=d.classes[p],m=/language-(.+)/.exec(g);if(m){u=m[1];break}}var _=t.languages[u];if(_)d.content=t.highlight(c(d.content),_,u);else if(u&&u!=="none"&&t.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);d.attributes.id=b,t.plugins.autoloader.loadLanguages(u,function(){var y=document.getElementById(b);y&&(y.innerHTML=t.highlight(y.textContent,t.languages[u],u))})}}});var s=RegExp(t.languages.markup.tag.pattern.source,"gi"),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;function c(d){var u=d.replace(s,"");return u=u.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,h){if(h=h.toLowerCase(),h[0]==="#"){var g;return h[1]==="x"?g=parseInt(h.slice(2),16):g=Number(h.slice(1)),l(g)}else{var m=a[h];return m||p}}),u}t.languages.md=t.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var e=t.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism);Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=Prism.languages.swift});(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism);(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,o={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[o,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:o.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:o.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":o,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:o.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:o.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);(function(t){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(Prism);(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
120
- ?|
121
- |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var lce=globalThis.Prism||window.Prism;var eC={};ze(eC,{$createCodeHighlightNode:()=>fh,$createCodeNode:()=>wl,$getEndOfCodeInLine:()=>Qv,$getFirstCodeNodeOfLine:()=>Wi,$getLastCodeNodeOfLine:()=>Ws,$getStartOfCodeInLine:()=>Zv,$isCodeHighlightNode:()=>Lt,$isCodeNode:()=>Ko,CODE_LANGUAGE_FRIENDLY_NAME_MAP:()=>lL,CODE_LANGUAGE_MAP:()=>cL,CodeHighlightNode:()=>Gs,CodeNode:()=>Vi,DEFAULT_CODE_LANGUAGE:()=>Xv,PrismTokenizer:()=>pL,getCodeLanguages:()=>yW,getDefaultCodeLanguage:()=>bW,getEndOfCodeInLine:()=>wW,getFirstCodeNodeOfLine:()=>CW,getLanguageFriendlyName:()=>_W,getLastCodeNodeOfLine:()=>EW,getStartOfCodeInLine:()=>TW,normalizeCodeLang:()=>dL,registerCodeHighlighting:()=>vW});var pce=Eh(Vv(),1);function ph(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach((function(n){var o=e[n],r=[];/^\w+$/.test(n)||r.push(/\w+/.exec(n)[0]),n==="diff"&&r.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+o+`].*(?:\r
122
- ?|
123
- |(?![\\s\\S])))+`,"m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e})})(Prism);var To=globalThis.Prism||window.Prism;function qv(t){return typeof t=="string"?t:Array.isArray(t)?t.map(qv).join(""):qv(t.content)}var ZM=t=>{let e=/^diff-([\w-]+)/i;try{if(!t)return!1;let n=e.exec(t);return n?To.languages.hasOwnProperty("diff")&&To.languages.hasOwnProperty(n[1]):To.languages.hasOwnProperty(t)}catch{return!1}};function aL(t,e){for(let n of t.childNodes){if(en(n)&&n.tagName===e)return!0;aL(n,e)}return!1}var _d="data-language",uh="data-highlight-language",Vi=class t extends Ht{static getType(){return"code"}static clone(e){return new t(e.__language,e.__key)}constructor(e,n){super(n),this.__language=e||void 0,this.__isSyntaxHighlightSupported=ZM(e)}createDOM(e){let n=document.createElement("code");qe(n,e.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(_d,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(uh,o)),n}updateDOM(e,n,o){let r=this.__language,i=e.__language;return r?r!==i&&(n.setAttribute(_d,r),this.__isSyntaxHighlightSupported&&n.setAttribute(uh,r)):i&&(n.removeAttribute(_d),e.__isSyntaxHighlightSupported&&n.removeAttribute(uh)),!1}exportDOM(e){let n=document.createElement("pre");qe(n,e._config.theme.code),n.setAttribute("spellcheck","false");let o=this.getLanguage();return o&&(n.setAttribute(_d,o),this.getIsSyntaxHighlightSupported()&&n.setAttribute(uh,o)),{element:n}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||aL(e,"BR"))?{conversion:QM,priority:1}:null,div:()=>({conversion:gW,priority:1}),pre:()=>({conversion:QM,priority:0}),table:e=>Wv(e)?{conversion:mW,priority:3}:null,td:e=>{let n=e,o=n.closest("table");return n.classList.contains("js-file-line")||o&&Wv(o)?{conversion:eL,priority:3}:null},tr:e=>{let n=e.closest("table");return n&&Wv(n)?{conversion:eL,priority:3}:null}}}static importJSON(e){return wl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(e,n=!0){let o=this.getChildren(),r=o.length;if(r>=2&&o[r-1].getTextContent()===`
124
- `&&o[r-2].getTextContent()===`
125
- `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){o[r-1].remove(),o[r-2].remove();let l=me();return this.insertAfter(l,n),l}let{anchor:i,focus:s}=e,a=(i.isBefore(s)?i:s).getNode();if(te(a)){let l=Wi(a),c=[];for(;;)if(Hn(l))c.push(Fo()),l=l.getNextSibling();else{if(!Lt(l))break;{let _=0,b=l.getTextContent(),y=l.getTextContentSize();for(;_<y&&b[_]===" ";)_++;if(_!==0&&c.push(fh(" ".repeat(_))),_!==y)break;l=l.getNextSibling()}}let d=a.splitText(i.offset)[0],u=i.offset===0?0:1,p=d.getIndexWithinParent()+u,h=a.getParentOrThrow(),g=[Po(),...c];h.splice(p,0,g);let m=c[c.length-1];m?m.select():i.offset===0?d.selectPrevious():d.getNextSibling().selectNext(0,0)}if(Ko(a)){let{offset:l}=e.anchor;a.splice(l,0,[Po()]),a.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){let e=me();return this.getChildren().forEach((n=>e.append(n))),this.replace(e),!0}setLanguage(e){let n=this.getWritable();return n.__language=e||void 0,n.__isSyntaxHighlightSupported=ZM(e),n}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function wl(t){return It(new Vi(t))}function Ko(t){return t instanceof Vi}function QM(t){return{node:wl(t.getAttribute(_d))}}function gW(t){let e=t,n=tL(e);return n||(function(o){let r=o.parentElement;for(;r!==null;){if(tL(r))return!0;r=r.parentElement}return!1})(e)?{node:n?wl():null}:{node:null}}function mW(){return{node:wl()}}function eL(){return{node:null}}function tL(t){return t.style.fontFamily.match("monospace")!==null}function Wv(t){return t.classList.contains("js-file-line-container")}var Xv="javascript",lL={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},cL={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function dL(t){return cL[t]||t}function _W(t){let e=dL(t);return lL[e]||e}var bW=()=>Xv,yW=()=>Object.keys(To.languages).filter((t=>typeof To.languages[t]!="function")).sort(),Gs=class t extends Ut{constructor(e="",n,o){super(e,o),this.__highlightType=n}static getType(){return"code-highlight"}static clone(e){return new t(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let n=this.getWritable();return n.__highlightType=e||void 0,n}canHaveFormat(){return!1}createDOM(e){let n=super.createDOM(e),o=Gv(e.theme,this.__highlightType);return qe(n,o),n}updateDOM(e,n,o){let r=super.updateDOM(e,n,o),i=Gv(o.theme,e.__highlightType),s=Gv(o.theme,this.__highlightType);return i!==s&&(i&&Vn(n,i),s&&qe(n,s)),r}static importJSON(e){return fh().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return wl()}};function Gv(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function fh(t="",e){return It(new Gs(t,e))}function Lt(t){return t instanceof Gs}function uL(t,e){let n=t;for(let o=kn(t,e);o&&(Lt(o.origin)||Hn(o.origin));o=aI(o))n=o.origin;return n}function Wi(t){return uL(t,"previous")}function Ws(t){return uL(t,"next")}var pL={defaultLanguage:Xv,tokenize(t,e){return To.tokenize(t,To.languages[e||""]||To.languages[this.defaultLanguage])}};function Zv(t,e){let n=null,o=null,r=t,i=e,s=t.getTextContent();for(;;){if(i===0){if(r=r.getPreviousSibling(),r===null)break;if(Lt(r)||Hn(r)||Qe(r)||ph(167),Qe(r)){n={node:r,offset:1};break}i=Math.max(0,r.getTextContentSize()-1),s=r.getTextContent()}else i--;let l=s[i];Lt(r)&&l!==" "&&(o={node:r,offset:i})}if(o!==null)return o;let a=null;if(e<t.getTextContentSize())Lt(t)&&(a=t.getTextContent()[e]);else{let l=t.getNextSibling();Lt(l)&&(a=l.getTextContent()[0])}if(a!==null&&a!==" ")return n;{let l=(function(c,d){let u=c,p=d,h=c.getTextContent(),g=c.getTextContentSize();for(;;){if(!Lt(u)||p===g){if(u=u.getNextSibling(),u===null||Qe(u))return null;Lt(u)&&(p=0,h=u.getTextContent(),g=u.getTextContentSize())}if(Lt(u)){if(h[p]!==" ")return{node:u,offset:p};p++}}})(t,e);return l!==null?l:n}}function Qv(t){let e=Ws(t);return Qe(e)&&ph(168),e}function nL(t,e,n){let o=t.getParent();Ko(o)?fL(o,e,n):Lt(t)&&t.replace(St(t.__text))}function xW(t,e){let n=e.getElementByKey(t.getKey());if(n===null)return;let o=t.getChildren(),r=o.length;if(r===n.__cachedChildrenLength)return;n.__cachedChildrenLength=r;let i="1",s=1;for(let a=0;a<r;a++)Qe(o[a])&&(i+=`
126
- `+ ++s);n.setAttribute("data-gutter",i)}var Yv=new Set;function fL(t,e,n){let o=t.getKey();Yv.has(o)||(Yv.add(o),t.getLanguage()===void 0&&t.setLanguage(n.defaultLanguage),e.update((()=>{(function(r,i){let s=At(r);if(!Ko(s)||!s.isAttached())return;let a=$();if(!B(a))return void i();let l=a.anchor,c=l.offset,d=l.type==="element"&&Qe(s.getChildAtIndex(l.offset-1)),u=0;if(!d){let p=l.getNode();u=c+p.getPreviousSiblings().reduce(((h,g)=>h+g.getTextContentSize()),0)}if(i()){if(d)return void l.getNode().select(c,c);s.getChildren().some((p=>{let h=te(p);if(h||Qe(p)){let g=p.getTextContentSize();if(h&&g>=u)return p.select(u,u),!0;u-=g}return!1}))}})(o,(()=>{let r=At(o);if(!Ko(r)||!r.isAttached())return!1;let i=r.getLanguage()||n.defaultLanguage,s=/^diff-([\w-]+)/i.exec(i),a=r.getTextContent(),l=n.tokenize(a,s?"diff":i);s&&(l=(function(g,m){let _=m,b=To.languages[_],y={tokens:g},v=To.languages.diff.PREFIXES;for(let x of y.tokens){if(typeof x=="string"||!(x.type in v)||!Array.isArray(x.content))continue;let E=x.type,C=0,k=()=>(C++,new To.Token("prefix",v[E],E.replace(/^(\w+).*/,"$1"))),T=x.content.filter((A=>typeof A=="string"||A.type!=="prefix")),w=x.content.length-T.length,S=To.tokenize(qv(T),b);S.unshift(k());let N=/\r\n|\n/g,D=A=>{let I=[];N.lastIndex=0;let R,z=0;for(;C<w&&(R=N.exec(A));){let W=R.index+R[0].length;I.push(A.slice(z,W)),z=W,I.push(k())}if(I.length!==0)return z<A.length&&I.push(A.slice(z)),I},O=A=>{for(let I=0;I<A.length&&C<w;I++){let R=A[I];if(typeof R=="string"){let z=D(R);z&&(A.splice(I,1,...z),I+=z.length-1)}else if(typeof R.content=="string"){let z=D(R.content);z&&(R.content=z)}else Array.isArray(R.content)?O(R.content):O([R.content])}};O(S),C<w&&S.push(k()),x.content=S}return y.tokens})(l,s[1]));let c=Jv(l),d=(function(g,m){let _=0;for(;_<g.length&&oL(g[_],m[_]);)_++;let b=g.length,y=m.length,v=Math.min(b,y)-_,x=0;for(;x<v;)if(x++,!oL(g[b-x],m[y-x])){x--;break}let E=_,C=b-x,k=m.slice(_,y-x);return{from:E,nodesForReplacement:k,to:C}})(r.getChildren(),c),{from:u,to:p,nodesForReplacement:h}=d;return!(u===p&&!h.length)&&(t.splice(u,p-u,h),!0)}))}),{onUpdate:()=>{Yv.delete(o)},skipTransforms:!0}))}function Jv(t,e){let n=[];for(let o of t)if(typeof o=="string"){let r=o.split(/(\n|\t)/),i=r.length;for(let s=0;s<i;s++){let a=r[s];a===`
127
- `||a===`\r
128
- `?n.push(Po()):a===" "?n.push(Fo()):a.length>0&&n.push(fh(a,e))}}else{let{content:r,alias:i}=o;typeof r=="string"?n.push(...Jv([r],o.type==="prefix"&&typeof i=="string"?i:o.type)):Array.isArray(r)&&n.push(...Jv(r,o.type==="unchanged"?void 0:o.type))}return n}function oL(t,e){return Lt(t)&&Lt(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||Hn(t)&&Hn(e)||Qe(t)&&Qe(e)}function Vs(t){if(!B(t))return!1;let e=t.anchor.getNode(),n=Ko(e)?e:e.getParent(),o=t.focus.getNode(),r=Ko(o)?o:o.getParent();return Ko(n)&&n.is(r)}function hL(t){let e=t.getNodes(),n=[];if(e.length===1&&Ko(e[0]))return n;let o=[];for(let r=0;r<e.length;r++){let i=e[r];Lt(i)||Hn(i)||Qe(i)||ph(169),Qe(i)?o.length>0&&(n.push(o),o=[]):o.push(i)}if(o.length>0){let r=t.isBackward()?t.anchor:t.focus,i=rr(o[0].getKey(),0,"text");r.is(i)||n.push(o)}return n}function rL(t){let e=$();if(!B(e)||!Vs(e))return!1;let n=hL(e),o=n.length;if(o===0&&e.isCollapsed())return t===Un&&e.insertNodes([Fo()]),!0;if(o===0&&t===Un&&e.getTextContent()===`
129
- `){let r=Fo(),i=Po(),s=e.isBackward()?"previous":"next";return e.insertNodes([r,i]),pf(KD(af(GD(r,"next",0),ar(kn(i,"next"))),s)),!0}for(let r=0;r<o;r++){let i=n[r];if(i.length>0){let s=i[0];if(r===0&&(s=Wi(s)),t===Un){let a=Fo();if(s.insertBefore(a),r===0){let l=e.isBackward()?"focus":"anchor",c=rr(s.getKey(),0,"text");e[l].is(c)&&e[l].set(a.getKey(),0,"text")}}else Hn(s)&&s.remove()}}return!0}function iL(t,e){let n=$();if(!B(n))return!1;let{anchor:o,focus:r}=n,i=o.offset,s=r.offset,a=o.getNode(),l=r.getNode(),c=t===$o;if(!Vs(n)||!Lt(a)&&!Hn(a)||!Lt(l)&&!Hn(l))return!1;if(!e.altKey){if(n.isCollapsed()){let b=a.getParentOrThrow();if(c&&i===0&&a.getPreviousSibling()===null){if(b.getPreviousSibling()===null)return b.selectPrevious(),e.preventDefault(),!0}else if(!c&&i===a.getTextContentSize()&&a.getNextSibling()===null&&b.getNextSibling()===null)return b.selectNext(),e.preventDefault(),!0}return!1}let d,u;if(a.isBefore(l)?(d=Wi(a),u=Ws(l)):(d=Wi(l),u=Ws(a)),d==null||u==null)return!1;let p=d.getNodesBetween(u);for(let b=0;b<p.length;b++){let y=p[b];if(!Lt(y)&&!Hn(y)&&!Qe(y))return!1}e.preventDefault(),e.stopPropagation();let h=c?d.getPreviousSibling():u.getNextSibling();if(!Qe(h))return!0;let g=c?h.getPreviousSibling():h.getNextSibling();if(g==null)return!0;let m=Lt(g)||Hn(g)||Qe(g)?c?Wi(g):Ws(g):null,_=m??g;return h.remove(),p.forEach((b=>b.remove())),t===$o?(p.forEach((b=>_.insertBefore(b))),_.insertBefore(h)):(_.insertAfter(h),_=h,p.forEach((b=>{_.insertAfter(b),_=b}))),n.setTextNodeRange(a,i,l,s),!0}function sL(t,e){let n=$();if(!B(n))return!1;let{anchor:o,focus:r}=n,i=o.getNode(),s=r.getNode(),a=t===Ef;if(!Vs(n)||!Lt(i)&&!Hn(i)||!Lt(s)&&!Hn(s))return!1;if(a){let l=Zv(s,r.offset);if(l!==null){let{node:c,offset:d}=l;Qe(c)?c.selectNext(0,0):n.setTextNodeRange(c,d,c,d)}else s.getParentOrThrow().selectStart()}else Qv(s).select();return e.preventDefault(),e.stopPropagation(),!0}function vW(t,e){if(!t.hasNodes([Vi,Gs]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");e==null&&(e=pL);let n=[];return t._headless!==!0&&n.push(t.registerMutationListener(Vi,(o=>{t.update((()=>{for(let[r,i]of o)if(i!=="destroyed"){let s=At(r);s!==null&&xW(s,t)}}))}),{skipInitialization:!1})),n.push(t.registerNodeTransform(Vi,(o=>fL(o,t,e))),t.registerNodeTransform(Ut,(o=>nL(o,t,e))),t.registerNodeTransform(Gs,(o=>nL(o,t,e))),t.registerCommand(Ri,(o=>{let r=(function(i){let s=$();if(!B(s)||!Vs(s))return null;let a=i?Eo:Un,l=i?Eo:Ms,c=s.anchor,d=s.focus;if(c.is(d))return l;let u=hL(s);if(u.length!==1)return a;let p=u[0],h,g;p.length===0&&ph(285),s.isBackward()?(h=d,g=c):(h=c,g=d);let m=Wi(p[0]),_=Ws(p[0]),b=rr(m.getKey(),0,"text"),y=rr(_.getKey(),_.getTextContentSize(),"text");return h.isBefore(b)||y.isBefore(g)?a:b.isBefore(h)||g.isBefore(y)?l:a})(o.shiftKey);return r!==null&&(o.preventDefault(),t.dispatchCommand(r,void 0),!0)}),Pe),t.registerCommand(Ms,(()=>!!Vs($())&&(Bo([Fo()]),!0)),Pe),t.registerCommand(Un,(o=>rL(Un)),Pe),t.registerCommand(Eo,(o=>rL(Eo)),Pe),t.registerCommand($o,(o=>{let r=$();if(!B(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Vs(r)&&(r.isCollapsed()&&i.offset===0&&s.getPreviousSibling()===null&&Ko(s.getParentOrThrow())?(o.preventDefault(),!0):iL($o,o))}),Pe),t.registerCommand(Vr,(o=>{let r=$();if(!B(r))return!1;let{anchor:i}=r,s=i.getNode();return!!Vs(r)&&(r.isCollapsed()&&i.offset===s.getTextContentSize()&&s.getNextSibling()===null&&Ko(s.getParentOrThrow())?(o.preventDefault(),!0):iL(Vr,o))}),Pe),t.registerCommand(Ef,(o=>sL(Ef,o)),Pe),t.registerCommand(ix,(o=>sL(ix,o)),Pe)),Ue(...n)}var CW=Wi,EW=Ws,wW=Qv,TW=Zv;var _t=eC,Dce=_t.$createCodeHighlightNode,bd=_t.$createCodeNode,Oce=_t.$getEndOfCodeInLine,Ice=_t.$getFirstCodeNodeOfLine,Ace=_t.$getLastCodeNodeOfLine,Mce=_t.$getStartOfCodeInLine,gL=_t.$isCodeHighlightNode,tC=_t.$isCodeNode,Lce=_t.CODE_LANGUAGE_FRIENDLY_NAME_MAP,Rce=_t.CODE_LANGUAGE_MAP,Pce=_t.CodeHighlightNode,mL=_t.CodeNode,Fce=_t.DEFAULT_CODE_LANGUAGE,Bce=_t.PrismTokenizer,$ce=_t.getCodeLanguages,zce=_t.getDefaultCodeLanguage,Hce=_t.getEndOfCodeInLine,Uce=_t.getFirstCodeNodeOfLine,Kce=_t.getLanguageFriendlyName,jce=_t.getLastCodeNodeOfLine,Vce=_t.getStartOfCodeInLine,Wce=_t.normalizeCodeLang,Gce=_t.registerCodeHighlighting;si();ke();var tn=Object.freeze({NORMAL:Nt?"\u2318+Opt+0":"Ctrl+Alt+0",HEADING1:Nt?"\u2318+Opt+1":"Ctrl+Alt+1",HEADING2:Nt?"\u2318+Opt+2":"Ctrl+Alt+2",HEADING3:Nt?"\u2318+Opt+3":"Ctrl+Alt+3",NUMBERED_LIST:Nt?"\u2318+Shift+7":"Ctrl+Shift+7",BULLET_LIST:Nt?"\u2318+Shift+8":"Ctrl+Shift+8",STRIKETHROUGH:Nt?"\u2318+Shift+X":"Ctrl+Shift+X",SUBSCRIPT:Nt?"\u2318+,":"Ctrl+,",SUPERSCRIPT:Nt?"\u2318+.":"Ctrl+.",INDENT:Nt?"\u2318+]":"Ctrl+]",OUTDENT:Nt?"\u2318+[":"Ctrl+[",CLEAR_FORMATTING:Nt?"\u2318+\\":"Ctrl+\\",REDO:Nt?"\u2318+Shift+Z":"Ctrl+Y",UNDO:Nt?"\u2318+Z":"Ctrl+Z",BOLD:Nt?"\u2318+B":"Ctrl+B",ITALIC:Nt?"\u2318+I":"Ctrl+I",UNDERLINE:Nt?"\u2318+U":"Ctrl+U",INSERT_LINK:Nt?"\u2318+K":"Ctrl+K"}),jo={ctrlKey:!Nt,metaKey:Nt};function _L(t){let{code:e}=t;return(e==="Numpad0"||e==="Digit0")&&jn(t,{...jo,altKey:!0})}function bL(t){let{code:e}=t,n=e[e.length-1];return["1","2","3","4","5"].includes(n)&&jn(t,{...jo,altKey:!0})}function yL(t){let{code:e}=t;return(e==="Numpad7"||e==="Digit7")&&jn(t,{...jo,shiftKey:!0})}function xL(t){let{code:e}=t;return(e==="Numpad8"||e==="Digit8")&&jn(t,{...jo,shiftKey:!0})}function vL(t){let{code:e}=t;return e==="KeyX"&&jn(t,{...jo,shiftKey:!0})}function CL(t){let{code:e}=t;return e==="BracketRight"&&jn(t,jo)}function EL(t){let{code:e}=t;return e==="BracketLeft"&&jn(t,jo)}function wL(t){let{code:e}=t;return e==="Comma"&&jn(t,jo)}function TL(t){let{code:e}=t;return e==="Period"&&jn(t,jo)}function SL(t){let{code:e}=t;return e==="Backslash"&&jn(t,jo)}function kL(t){let{code:e}=t;return e==="KeyK"&&jn(t,jo)}var Ys=t=>{t.update(()=>{let e=$();Sf(e,()=>me())})},Gi=(t,e,n)=>{e!==n&&t.update(()=>{let o=$();Sf(o,()=>$s(n))})},hh=(t,e)=>{e!=="bullet"?t.dispatchCommand(MI,void 0):Ys(t)},gh=(t,e)=>{console.log("formatNumberedList"),e!=="number"?t.dispatchCommand(AI,void 0):Ys(t)},Tl=t=>{t.update(()=>{let e=$();if(B(e)){let n=e.anchor,o=e.focus,r=e.getNodes(),i=e.extract();if(n.key===o.key&&n.offset===o.offset)return;r.forEach((s,a)=>{if(te(s)){let l=s;a===0&&n.offset!==0&&(l=l.splitText(n.offset)[1]||l),a===r.length-1&&(l=l.splitText(o.offset)[0]||l);let c=i[0];r.length===1&&te(c)&&(l=c),l.__style!==""&&l.setStyle(""),l.__format!==0&&l.setFormat(0);let d=Rs(l);d.__format!==0&&d.setFormat(""),d.__indent!==0&&d.setIndent(0)}else Gr(s)||Yr(s)?s.replace(me(),!0):VM(s)&&s.setFormat("")})}})},NL=(t,e)=>{e!=="quote"?t.update(()=>{let n=$();Sf(n,()=>zs())}):Ys(t)};si();var SW=new Set(["http:","https:","mailto:","sms:","tel:"]);function DL(t){try{let e=new URL(t);if(!SW.has(e.protocol))return"about:blank"}catch{return t}return t}var ade=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function lo(t){return t?"active dropdown-item-active":""}function gr(t){let{blockType:e}=t;return e==="paragraph"?f(oE,{size:16}):e==="h1"?f(_E,{size:16}):e==="h2"?f(bE,{size:16}):e==="h3"?f(yE,{size:16}):e==="h4"?f(xE,{size:16}):e==="h5"?f(vE,{size:16}):e==="number"?f(NE,{size:16}):e==="bullet"?f(DE,{size:16}):e==="quote"?f(FE,{size:16}):null}function kW(t){let{editor:e,blockType:n}=t;return f(G,{control:f(X,{className:Ce("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__blockFormatDropdown"),variant:"default",compact:!0,leftIcon:f(gr,{blockType:n}),rightIcon:f(fo,{size:16}),children:sh[n]}),children:[f(G.Item,{icon:f(gr,{blockType:"paragraph"}),className:lo(n==="paragraph"),onClick:()=>Ys(e),children:"Normal"}),f(G.Item,{icon:f(gr,{blockType:"bullet"}),className:lo(n==="bullet"),onClick:()=>hh(e,n),children:"Bullet List"}),f(G.Item,{icon:f(gr,{blockType:"number"}),className:lo(n==="number"),onClick:()=>gh(e,n),children:"Numbered List"}),f(G.Item,{icon:f(gr,{blockType:"h1"}),className:lo(n==="h1"),onClick:()=>Gi(e,n,"h1"),children:"Heading 1"}),f(G.Item,{icon:f(gr,{blockType:"h2"}),className:lo(n==="h2"),onClick:()=>Gi(e,n,"h2"),children:"Heading 2"}),f(G.Item,{icon:f(gr,{blockType:"h3"}),className:lo(n==="h3"),onClick:()=>Gi(e,n,"h3"),children:"Heading 3"}),f(G.Item,{icon:f(gr,{blockType:"h4"}),className:lo(n==="h4"),onClick:()=>Gi(e,n,"h4"),children:"Heading 4"}),f(G.Item,{icon:f(gr,{blockType:"h5"}),className:lo(n==="h5"),onClick:()=>Gi(e,n,"h5"),children:"Heading 5"}),f(G.Item,{icon:f(gr,{blockType:"quote"}),className:lo(n==="quote"),onClick:()=>NL(e,n),children:"Quote"})]})}function yd(){return f("div",{className:"divider"})}function NW(t){let{editor:e,isStrikethrough:n,isSuperscript:o,isSubscript:r,isCode:i}=t;return f(G,{styles:{body:{minWidth:"240px"}},control:f(Oe,{className:Ce("LexicalEditor__toolbar__actionIcon",(n||o||r||i)&&"LexicalEditor__toolbar__actionIcon--active"),label:"More formatting",position:"top",withArrow:!0,children:f(Me,{variant:"default",title:"More formatting",children:f(fo,{size:16})})}),children:[f(G.Item,{icon:f(Xd,{size:16}),className:lo(n),onClick:()=>{e.dispatchCommand(lt,"strikethrough")},children:["Strikethrough (",tn.STRIKETHROUGH,")"]}),f(G.Item,{icon:f(Qd,{size:16}),className:lo(o),onClick:()=>{e.dispatchCommand(lt,"superscript")},children:["Superscript (",tn.SUPERSCRIPT,")"]}),f(G.Item,{icon:f(Zd,{size:16}),className:lo(r),onClick:()=>{e.dispatchCommand(lt,"subscript")},children:["Subscript (",tn.SUBSCRIPT,")"]}),f(G.Item,{icon:f(Ud,{size:16}),className:lo(i),onClick:()=>{e.dispatchCommand(lt,"code")},children:"Code"})]})}function OL(t){let{editor:e,blockComponents:n,inlineComponents:o,activeEditor:r,setActiveEditor:i,setIsLinkEditMode:s,variant:a="document",onInsertBlockComponent:l,onInsertInlineComponent:c}=t,[d,u]=L(()=>e.isEditable()),{toolbarState:p,updateToolbarState:h}=ah(),g=De(()=>{let x=$();if(B(x)){if(r!==e&&cI(r)){let O=r.getRootElement();h("isImageCaption",!!O?.parentElement?.classList.contains("image-caption-container"))}else h("isImageCaption",!1);let E=x.anchor.getNode(),C=E.getKey()==="root"?E:ue(E,O=>{let A=O.getParent();return A!==null&&zt(A)});C===null&&(C=E.getTopLevelElementOrThrow());let k=C.getKey(),T=r.getElementByKey(k);h("isRTL",HO(x));let w=Zr(x),S=w.getParent(),N=et(S)||et(w);if(h("isLink",N),h("rootType","root"),T!==null)if(Nn(C)){let O=Of(E,pr),A=O?O.getListType():C.getListType();h("blockType",A)}else{let O=Gr(C)?C.getTag():C.getType();O in sh&&h("blockType",O)}let D;et(S)&&(D=ue(w,O=>Y(O)&&!O.isInline())),h("elementFormat",Y(D)?D.getFormatType():Y(w)?w.getFormatType():S?.getFormatType()||"left")}B(x)&&(h("isBold",x.hasFormat("bold")),h("isItalic",x.hasFormat("italic")),h("isUnderline",x.hasFormat("underline")),h("isStrikethrough",x.hasFormat("strikethrough")),h("isSuperscript",x.hasFormat("superscript")),h("isSubscript",x.hasFormat("subscript")),h("isCode",x.hasFormat("code")))},[r,e,h]);P(()=>e.registerCommand(hn,(x,E)=>(i(E),g(),!1),kt),[e,g,i]),P(()=>{r.getEditorState().read(()=>{g()})},[r,g]),P(()=>Ue(e.registerEditableListener(x=>{u(x)}),r.registerUpdateListener(({editorState:x})=>{x.read(()=>{g()})}),r.registerCommand(As,x=>(h("canUndo",x),!1),kt),r.registerCommand(Is,x=>(h("canRedo",x),!1),kt)),[g,r,e,h]);let m=De(()=>{p.isLink?(s(!1),r.dispatchCommand(Wn,null)):(s(!0),r.dispatchCommand(Wn,DL("https://")))},[r,s,p.isLink]),_=J(()=>n?[...n].sort((x,E)=>{let C=x.label||x.name,k=E.label||E.name;return C.localeCompare(k)}):[],[n]),b=J(()=>o?[...o].sort((x,E)=>{let C=x.label||x.name,k=E.label||E.name;return C.localeCompare(k)}):[],[o]),y=x=>{switch(x){case"image":return f(ME,{size:16});case"html":return f(rE,{size:16});default:break}return f(HE,{size:16})},v=a==="comment";return f("div",{className:Ce("LexicalEditor__toolbar",v&&"LexicalEditor__toolbar--comment"),children:[!v&&p.blockType in sh&&r===e&&f(Ne,{children:[f(kW,{disabled:!d,blockType:p.blockType,rootType:p.rootType,editor:r}),f(yd,{})]}),f(Ne,{children:[f("div",{className:"LexicalEditor__toolbar__group",children:[f(On,{tooltip:`Bold (${tn.BOLD})`,active:p.isBold,onClick:()=>{r.dispatchCommand(lt,"bold")},children:f($d,{size:16})}),f(On,{tooltip:`Italic (${tn.ITALIC})`,active:p.isItalic,onClick:()=>{r.dispatchCommand(lt,"italic")},children:f(Vd,{size:16})}),f(On,{tooltip:`Underline (${tn.UNDERLINE})`,active:p.isUnderline,onClick:()=>{r.dispatchCommand(lt,"underline")},children:f(tu,{size:16})}),f(NW,{editor:r,isStrikethrough:p.isStrikethrough,isSuperscript:p.isSuperscript,isSubscript:p.isSubscript,isCode:p.isCode})]}),f(yd,{}),f("div",{className:"LexicalEditor__toolbar__group",children:f(On,{tooltip:`Insert link (${tn.INSERT_LINK})`,active:p.isLink,onClick:m,children:f(Wd,{size:16})})}),f(yd,{}),f(On,{tooltip:`Clear formatting (${tn.CLEAR_FORMATTING})`,onClick:()=>{Tl(r)},children:f(zd,{size:16})}),f(yd,{}),!v&&f(Ne,{children:[f(G,{control:f(X,{className:Ce("LexicalEditor__toolbar__dropdown","LexicalEditor__toolbar__insertDropdown"),variant:"default",compact:!0,leftIcon:f(PE,{size:16}),rightIcon:f(fo,{size:16}),children:"Components"}),children:[f(G.Label,{children:"Insert"}),f(G.Item,{icon:f(eu,{size:16}),onClick:()=>{r.dispatchCommand(fM,{columns:"3",rows:"3"})},children:"Table"}),f(G.Item,{icon:f(zE,{size:16}),onClick:()=>{r.dispatchCommand(Kf,void 0)},children:"Horizontal Rule"}),b.length>0&&f(Ne,{children:[f(G.Label,{children:"Inline Components"}),b.map(x=>f(G.Item,{icon:f(iE,{size:16}),onClick:()=>c?.(x.name),children:x.label||x.name},x.name))]}),_.length>0&&f(Ne,{children:[f(G.Label,{children:"Block Components"}),_.map(x=>f(G.Item,{icon:y(x.name),onClick:()=>l?.(x.name),children:x.label||x.name},x.name))]})]}),f(yd,{})]})]})]})}function On(t){return f(Oe,{className:Ce("LexicalEditor__toolbar__actionIcon",t.active&&"LexicalEditor__toolbar__actionIcon--active"),label:t.tooltip,position:"top",withArrow:!0,children:f(Me,{variant:t.variant||"default",onClick:t.onClick,title:t.tooltip,children:t.children})})}var DW=12,OW=5;function IW(t){let{editor:e,anchorElem:n,isLink:o,isBold:r,isCode:i,isItalic:s,isUnderline:a,isStrikethrough:l,isSubscript:c,isSuperscript:d,setIsLinkEditMode:u}=t,p=q(null),h=De(()=>{o?(u(!1),e.dispatchCommand(Wn,null)):(u(!0),e.dispatchCommand(Wn,""))},[e,o,u]);function g(b){if(p?.current&&(b.buttons===1||b.buttons===3)&&p.current.style.pointerEvents!=="none"){let y=b.clientX,v=b.clientY,x=document.elementFromPoint(y,v);p.current.contains(x)||(p.current.style.pointerEvents="none")}}function m(){p?.current&&p.current.style.pointerEvents!=="auto"&&(p.current.style.pointerEvents="auto")}P(()=>{if(p?.current)return document.addEventListener("mousemove",g),document.addEventListener("mouseup",m),()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m)}},[p]);let _=De(()=>{let b=$(),y=p.current,v=io(e._window);if(y===null)return;let x=e.getRootElement();if(b!==null&&v!==null&&!v.isCollapsed&&x!==null&&x.contains(v.anchorNode)){let E=qM(v,x);MW(E,y,n,o)}},[e,n,o]);return P(()=>{let b=n.parentElement,y=()=>{e.getEditorState().read(()=>{_()})};return window.addEventListener("resize",y),b&&b.addEventListener("scroll",y),()=>{window.removeEventListener("resize",y),b&&b.removeEventListener("scroll",y)}},[e,_,n]),P(()=>(e.getEditorState().read(()=>{_()}),Ue(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{_()})}),e.registerCommand(hn,()=>(_(),!1),Pe))),[e,_]),f("div",{ref:p,className:"LexicalEditor__floatingToolbar",children:e.isEditable()&&f(Ne,{children:[f(On,{variant:"hover",tooltip:`Bold (${tn.BOLD})`,active:r,onClick:()=>{e.dispatchCommand(lt,"bold")},children:f($d,{size:16})}),f(On,{variant:"hover",tooltip:`Italic (${tn.ITALIC})`,active:s,onClick:()=>{e.dispatchCommand(lt,"italic")},children:f(Vd,{size:16})}),f(On,{variant:"hover",tooltip:`Underline (${tn.UNDERLINE})`,active:a,onClick:()=>{e.dispatchCommand(lt,"underline")},children:f(tu,{size:16})}),f(On,{variant:"hover",tooltip:`Strikethrough (${tn.STRIKETHROUGH})`,active:l,onClick:()=>{e.dispatchCommand(lt,"strikethrough")},children:f(Xd,{size:16})}),f(On,{variant:"hover",tooltip:`Superscript (${tn.SUPERSCRIPT})`,active:d,onClick:()=>{e.dispatchCommand(lt,"superscript")},children:f(Qd,{size:16})}),f(On,{variant:"hover",tooltip:`Subscript (${tn.SUBSCRIPT})`,active:c,onClick:()=>{e.dispatchCommand(lt,"subscript")},children:f(Zd,{size:16})}),f(On,{variant:"hover",tooltip:"Code",active:i,onClick:()=>{e.dispatchCommand(lt,"code")},children:f(Ud,{size:16})}),f(On,{variant:"hover",tooltip:`Insert link (${tn.INSERT_LINK})`,active:o,onClick:h,children:f(Wd,{size:16})}),f(On,{variant:"hover",tooltip:`Clear formatting (${tn.CLEAR_FORMATTING})`,onClick:()=>{Tl(e)},children:f(zd,{size:16})})]})})}function AW(t,e,n){let[o,r]=L(!1),[i,s]=L(!1),[a,l]=L(!1),[c,d]=L(!1),[u,p]=L(!1),[h,g]=L(!1),[m,_]=L(!1),[b,y]=L(!1),[v,x]=L(!1),E=De(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let C=$(),k=io(t._window),T=t.getRootElement();if(k!==null&&(!B(C)||T===null||!T.contains(k.anchorNode))){r(!1);return}if(!B(C))return;let w=Zr(C);l(C.hasFormat("bold")),d(C.hasFormat("code")),p(C.hasFormat("italic")),y(C.hasFormat("underline")),g(C.hasFormat("strikethrough")),_(C.hasFormat("subscript")),x(C.hasFormat("superscript"));let S=w.getParent();et(S)||et(w)?s(!0):s(!1),!gL(C.anchor.getNode())&&C.getTextContent()!==""?r(te(w)||Qt(w)):r(!1);let N=C.getTextContent().replace(/\n/g,"");if(!C.isCollapsed()&&N===""){r(!1);return}})},[t]);return P(()=>(document.addEventListener("selectionchange",E),()=>{document.removeEventListener("selectionchange",E)}),[E]),P(()=>Ue(t.registerUpdateListener(()=>{E()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,E]),o?ii(f(IW,{editor:t,anchorElem:e,isLink:i,isBold:a,isCode:c,isItalic:u,isStrikethrough:h,isSubscript:m,isSuperscript:v,isUnderline:b,setIsLinkEditMode:n}),e):null}function IL(t){let{anchorElem:e=document.body,setIsLinkEditMode:n}=t,[o]=Ee();return AW(o,e,n)}function MW(t,e,n,o=!1,r=DW,i=OW){let s=n.parentElement;if(t===null||!s){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let a=e.getBoundingClientRect(),l=n.getBoundingClientRect(),c=s.getBoundingClientRect(),d=t.top-a.height-r,u=t.left-i,p=window.getSelection();if(p&&p.rangeCount>0){let g=p.getRangeAt(0).startContainer;if(g.nodeType===Node.ELEMENT_NODE||g.parentElement){let m=g.nodeType===Node.ELEMENT_NODE?g:g.parentElement,_=window.getComputedStyle(m).textAlign;(_==="right"||_==="end")&&(u=t.right-a.width+i)}}d<c.top&&(d+=a.height+t.height+r*(o?9:2)),u+a.width>c.right&&(u=c.right-a.width-i),u<c.left&&(u=c.left+i),d-=l.top,u-=l.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${d}px)`}ke();function AL(){let[t]=Ee();P(()=>t.registerCommand(Pi,n=>{let{clipboardData:o}=n;if(!o)return!1;let i=Array.from(o.files).find(s=>s.type.startsWith("image/"));return i?(n.preventDefault(),e(i),!0):!1},Pe),[t]);let e=async n=>{let o=URL.createObjectURL(n),r=null;t.update(()=>{let i=js("image",{file:{src:o,width:0,height:0},loading:!0}),s=$();if(B(s)){Bo([i]);let a=me();i.insertAfter(a),a.select()}r=i.getKey()});try{let i=await ai(n);t.update(()=>{if(r){let s=At(r);Xr(s)&&s.setBlockData({file:i,loading:!1})}})}catch(i){console.error("Failed to upload image",i),ce({type:"error",message:"Failed to upload image"})}};return null}var aC={};ze(aC,{$convertFromMarkdownString:()=>WW,$convertToMarkdownString:()=>GW,BOLD_ITALIC_STAR:()=>XL,BOLD_ITALIC_UNDERSCORE:()=>ZL,BOLD_STAR:()=>QL,BOLD_UNDERSCORE:()=>eR,CHECK_LIST:()=>VW,CODE:()=>WL,ELEMENT_TRANSFORMERS:()=>iR,HEADING:()=>jL,HIGHLIGHT:()=>JL,INLINE_CODE:()=>qL,ITALIC_STAR:()=>nR,ITALIC_UNDERSCORE:()=>oR,LINK:()=>rR,MULTILINE_ELEMENT_TRANSFORMERS:()=>sR,ORDERED_LIST:()=>YL,QUOTE:()=>VL,STRIKETHROUGH:()=>tR,TEXT_FORMAT_TRANSFORMERS:()=>aR,TEXT_MATCH_TRANSFORMERS:()=>lR,TRANSFORMERS:()=>xh,UNORDERED_LIST:()=>GL,registerMarkdownShortcuts:()=>HW});function nC(t,e){let n={};for(let o of t){let r=e(o);r&&(n[r]?n[r].push(o):n[r]=[o])}return n}function iC(t){let e=nC(t,(n=>n.type));return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}var _h=/[!-/:-@[-`{-~\s]/,LW=/^\s{0,3}$/;function oC(t){if(!Qt(t))return!1;let e=t.getFirstChild();return e==null||t.getChildrenSize()===1&&te(e)&&LW.test(e.getTextContent())}function RW(t,e,n,o){for(let r of e){if(!r.export)continue;let i=r.export(t,(s=>bh(s,n,o)));if(i!=null)return i}return Y(t)?bh(t,n,o):zn(t)?t.getTextContent():null}function bh(t,e,n,o,r){let i=[],s=t.getChildren();o||(o=[]),r||(r=[]);e:for(let a of s){for(let l of n){if(!l.export)continue;let c=l.export(a,(d=>bh(d,e,n,o,[...r,...o])),((d,u)=>ML(d,u,e,o,r)));if(c!=null){i.push(c);continue e}}Qe(a)?i.push(`
130
- `):te(a)?i.push(ML(a,a.getTextContent(),e,o,r)):Y(a)?i.push(bh(a,e,n,o,r)):zn(a)&&i.push(a.getTextContent())}return i.join("")}function ML(t,e,n,o,r){let i=t.getFormat()===0?e:(function(p){return p.replace(/^\s+|\s+$/g,(h=>[...h].map((g=>"&#"+g.codePointAt(0)+";")).join("")))})(e);t.hasFormat("code")||(i=i.replace(/([*_`~\\])/g,"\\$1"));let s="",a="",l="",c=LL(t,!0),d=LL(t,!1),u=new Set;for(let p of n){let h=p.format[0],g=p.tag;mh(t,h)&&!u.has(h)&&(u.add(h),mh(c,h)&&o.find((m=>m.tag===g))||(o.push({format:h,tag:g}),s+=g))}for(let p=0;p<o.length;p++){let h=mh(t,o[p].format),g=mh(d,o[p].format);if(h&&g)continue;let m=[...o];for(;m.length>p;){let _=m.pop();r&&_&&r.find((b=>b.tag===_.tag))||(_&&typeof _.tag=="string"&&(h?g||(l+=_.tag):a+=_.tag),o.pop())}break}return i=s+i+l,a+i}function LL(t,e){let n=e?t.getPreviousSibling():t.getNextSibling();if(!n){let o=t.getParentOrThrow();o.isInline()&&(n=e?o.getPreviousSibling():o.getNextSibling())}for(;n;){if(Y(n)){if(!n.isInline())break;let o=e?n.getLastDescendant():n.getFirstDescendant();if(te(o))return o;n=e?n.getPreviousSibling():n.getNextSibling()}if(te(n))return n;if(!Y(n))return null}return null}function mh(t,e){return te(t)&&t.hasFormat(e)}function PW(t,e){let n=(function(r,i){let s=r.match(i.openTagsRegExp);if(s==null)return null;for(let a of s){let l=a.replace(/^\s/,""),c=i.fullMatchRegExpByTag[l];if(c==null)continue;let d=r.match(c),u=i.transformersByTag[l];if(d!=null&&u!=null){if(u.intraword!==!1)return d;let{index:p=0}=d,h=r[p-1],g=r[p+d[0].length];if((!h||_h.test(h))&&(!g||_h.test(g)))return d}}return null})(t.getTextContent(),e);if(!n)return null;let o=n.index||0;return{endIndex:o+n[0].length,match:n,startIndex:o,transformer:e.transformersByTag[n[1]]}}function qs(t){return te(t)&&!t.hasFormat("code")}function Js(t,e,n){let o=PW(t,e),r=(function(s,a){let l=s,c,d,u,p;for(let h of a){if(!h.replace||!h.importRegExp)continue;let g=l.getTextContent().match(h.importRegExp);if(!g)continue;let m=g.index||0,_=h.getEndIndex?h.getEndIndex(l,g):m+g[0].length;_!==!1&&(c===void 0||d===void 0||m<c&&_>d)&&(c=m,d=_,u=h,p=g)}return c===void 0||d===void 0||u===void 0||p===void 0?null:{endIndex:d,match:p,startIndex:c,transformer:u}})(t,n);if(o&&r&&(o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null),o){let s=(function(a,l,c,d,u){let p=a.getTextContent(),h,g,m;if(u[0]===p?h=a:l===0?[h,g]=a.splitText(c):[m,h,g]=a.splitText(l,c),h.setTextContent(u[2]),d)for(let _ of d.format)h.hasFormat(_)||h.toggleFormat(_);return{nodeAfter:g,nodeBefore:m,transformedNode:h}})(t,o.startIndex,o.endIndex,o.transformer,o.match);qs(s.nodeAfter)&&Js(s.nodeAfter,e,n),qs(s.nodeBefore)&&Js(s.nodeBefore,e,n),qs(s.transformedNode)&&Js(s.transformedNode,e,n)}else if(r){let s=(function(a,l,c,d,u){let p,h,g;return l===0?[p,h]=a.splitText(c):[g,p,h]=a.splitText(l,c),d.replace?{nodeAfter:h,nodeBefore:g,transformedNode:d.replace(p,u)||void 0}:null})(t,r.startIndex,r.endIndex,r.transformer,r.match);if(!s)return;qs(s.nodeAfter)&&Js(s.nodeAfter,e,n),qs(s.nodeBefore)&&Js(s.nodeBefore,e,n),qs(s.transformedNode)&&Js(s.transformedNode,e,n)}let i=t.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,((s,a)=>String.fromCodePoint(a)));t.setTextContent(i)}function FW(t,e=!1){let n=iC(t),o=(function(r){let i={},s={},a=[],l="(?<![\\\\])";for(let c of r){let{tag:d}=c;i[d]=c;let u=d.replace(/(\*|\^|\+)/g,"\\$1");a.push(u),d.length===1?s[d]=new RegExp(`(?<![\\\\${u}])(${u})((\\\\${u})?.*?[^${u}\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?![\\\\${u}])`):s[d]=new RegExp(`(?<!\\\\)(${u})((\\\\${u})?.*?[^\\s](\\\\${u})?)((?<!\\\\)|(?<=\\\\\\\\))(${u})(?!\\\\)`)}return{fullMatchRegExpByTag:s,openTagsRegExp:new RegExp(`${l}(${a.join("|")})`,"g"),transformersByTag:i}})(n.textFormat);return(r,i)=>{let s=r.split(`
131
- `),a=s.length,l=i||nt();l.clear();for(let d=0;d<a;d++){let u=s[d],[p,h]=BW(s,d,n.multilineElement,l);p?d=h:$W(u,l,n.element,o,n.textMatch,e)}let c=l.getChildren();for(let d of c)!e&&oC(d)&&l.getChildrenSize()>1&&d.remove();$()!==null&&l.selectStart()}}function BW(t,e,n,o){for(let r of n){let{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:a,replace:l}=r,c=t[e].match(a);if(!c)continue;if(i){let g=i({lines:t,rootNode:o,startLineIndex:e,startMatch:c,transformer:r});if(g===null)continue;if(g)return g}let d=typeof s=="object"&&"regExp"in s?s.regExp:s,u=s&&typeof s=="object"&&"optional"in s?s.optional:!s,p=e,h=t.length;for(;p<h;){let g=d?t[p].match(d):null;if(!g&&(!u||u&&p<h-1)){p++;continue}if(g&&e===p&&g.index===c.index){p++;continue}let m=[];if(g&&e===p)m.push(t[e].slice(c[0].length,-g[0].length));else for(let _=e;_<=p;_++)if(_===e){let b=t[_].slice(c[0].length);m.push(b)}else if(_===p&&g){let b=t[_].slice(0,-g[0].length);m.push(b)}else m.push(t[_]);if(l(o,null,c,g,m,!0)!==!1)return[!0,p];break}}return[!1,e]}function $W(t,e,n,o,r,i){let s=St(t),a=me();a.append(s),e.append(a);for(let{regExp:l,replace:c}of n){let d=t.match(l);if(d&&(s.setTextContent(t.slice(d[0].length)),c(a,[s],d,!0)!==!1))break}if(Js(s,o,r),a.isAttached()&&t.length>0){let l=a.getPreviousSibling();if(!i&&(Qt(l)||Yr(l)||Nn(l))){let c=l;if(Nn(l)){let d=l.getLastDescendant();c=d==null?null:ue(d,ad)}c!=null&&c.getTextContentSize()>0&&(c.splice(c.getChildrenSize(),0,[Po(),...a.getChildren()]),a.remove())}}}function zW(t,...e){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(let r of e)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function RL(t,e,n){let o=n.length;for(let r=e;r>=o;r--){let i=r-o;if(PL(t,i,n,0,o)&&t[i+o]!==" ")return i}return-1}function PL(t,e,n,o,r){for(let i=0;i<r;i++)if(t[e+i]!==n[o+i])return!1;return!0}function HW(t,e=xh){let n=iC(e),o=nC(n.textFormat,(({tag:s})=>s[s.length-1])),r=nC(n.textMatch,(({trigger:s})=>s));for(let s of e){let a=s.type;if(a==="element"||a==="text-match"||a==="multiline-element"){let l=s.dependencies;for(let c of l)t.hasNode(c)||zW(173,c.getType())}}let i=(s,a,l)=>{(function(c,d,u,p){let h=c.getParent();if(!zt(h)||c.getFirstChild()!==d)return!1;let g=d.getTextContent();if(g[u-1]!==" ")return!1;for(let{regExp:m,replace:_}of p){let b=g.match(m);if(b&&b[0].length===(b[0].endsWith(" ")?u:u-1)){let y=d.getNextSiblings(),[v,x]=d.splitText(u);if(_(c,x?[x,...y]:y,b,!1)!==!1)return v.remove(),!0}}return!1})(s,a,l,n.element)||(function(c,d,u,p){let h=c.getParent();if(!zt(h)||c.getFirstChild()!==d)return!1;let g=d.getTextContent();if(g[u-1]!==" ")return!1;for(let{regExpStart:m,replace:_,regExpEnd:b}of p){if(b&&!("optional"in b)||b&&"optional"in b&&!b.optional)continue;let y=g.match(m);if(y&&y[0].length===(y[0].endsWith(" ")?u:u-1)){let v=d.getNextSiblings(),[x,E]=d.splitText(u);if(_(c,E?[E,...v]:v,y,null,null,!1)!==!1)return x.remove(),!0}}return!1})(s,a,l,n.multilineElement)||(function(c,d,u){let p=c.getTextContent(),h=u[p[d-1]];if(h==null)return!1;d<p.length&&(p=p.slice(0,d));for(let g of h){if(!g.replace||!g.regExp)continue;let m=p.match(g.regExp);if(m===null)continue;let _=m.index||0,b=_+m[0].length,y;return _===0?[y]=c.splitText(b):[,y]=c.splitText(_,b),y.selectNext(0,0),g.replace(y,m),!0}return!1})(a,l,r)||(function(c,d,u){let p=c.getTextContent(),h=d-1,g=p[h],m=u[g];if(!m)return!1;for(let _ of m){let{tag:b}=_,y=b.length,v=h-y+1;if(y>1&&!PL(p,v,b,0,y)||p[v-1]===" ")continue;let x=p[h+1];if(_.intraword===!1&&x&&!_h.test(x))continue;let E=c,C=E,k=RL(p,v,b),T=C;for(;k<0&&(T=T.getPreviousSibling())&&!Qe(T);)if(te(T)){if(T.hasFormat("code"))continue;let z=T.getTextContent();C=T,k=RL(z,z.length,b)}if(k<0||C===E&&k+y===v)continue;let w=C.getTextContent();if(k>0&&w[k-1]===g)continue;let S=w[k-1];if(_.intraword===!1&&S&&!_h.test(S))continue;let N=E.getTextContent(),D=N.slice(0,v)+N.slice(h+1);E.setTextContent(D);let O=C===E?D:w;C.setTextContent(O.slice(0,k)+O.slice(k+y));let A=$(),I=ir();vt(I);let R=h-y*(C===E?2:1)+1;I.anchor.set(C.__key,k,"text"),I.focus.set(E.__key,R,"text");for(let z of _.format)I.hasFormat(z)||I.formatText(z);I.anchor.set(I.focus.key,I.focus.offset,I.focus.type);for(let z of _.format)I.hasFormat(z)&&I.toggleFormat(z);return B(A)&&(I.format=A.format),!0}})(a,l,o)};return t.registerUpdateListener((({tags:s,dirtyLeaves:a,editorState:l,prevEditorState:c})=>{if(s.has(oO)||s.has(nl)||t.isComposing())return;let d=l.read($),u=c.read($);if(!B(u)||!B(d)||!d.isCollapsed()||d.is(u))return;let p=d.anchor.key,h=d.anchor.offset,g=l._nodeMap.get(p);!te(g)||!a.has(p)||h!==1&&h>u.anchor.offset+1||t.update((()=>{if(!qs(g))return;let m=g.getParent();m===null||tC(m)||i(m,g,d.anchor.offset)}))}))}var FL=/^(\s*)(\d{1,})\.\s/,BL=/^(\s*)[-*+]\s/,$L=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,rC=/^(#{1,6})\s/,zL=/^>\s/,HL=/^[ \t]*```([\w-]+)?/,UL=/[ \t]*```$/,UW=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,KW=/^(?:\|)(.+)(?:\|)\s?$/,jW=/^(\| ?:?-*:? ?)+\|\s?$/,KL=t=>(e,n,o,r)=>{let i=t(o);i.append(...n),e.replace(i),r||i.select(0,0)},sC=t=>(e,n,o,r)=>{let i=e.getPreviousSibling(),s=e.getNextSibling(),a=sd(t==="check"?o[3]==="x":void 0);if(Nn(s)&&s.getListType()===t){let c=s.getFirstChild();c!==null?c.insertBefore(a):s.append(a),e.remove()}else if(Nn(i)&&i.getListType()===t)i.append(a),e.remove();else{let c=cl(t,t==="number"?Number(o[2]):void 0);c.append(a),e.replace(c)}a.append(...n),r||a.select(0,0);let l=(function(c){let d=c.match(/\t/g),u=c.match(/ /g),p=0;return d&&(p+=d.length),u&&(p+=Math.floor(u.length/4)),p})(o[1]);l&&a.setIndent(l)},yh=(t,e,n)=>{let o=[],r=t.getChildren(),i=0;for(let s of r)if(ad(s)){if(s.getChildrenSize()===1){let d=s.getFirstChild();if(Nn(d)){o.push(yh(d,e,n+1));continue}}let a=" ".repeat(4*n),l=t.getListType(),c=l==="number"?`${t.getStart()+i}. `:l==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";o.push(a+c+e(s)),i++}return o.join(`
132
- `)},jL={dependencies:[Wf],export:(t,e)=>{if(!Gr(t))return null;let n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:rC,replace:KL((t=>{let e="h"+t[1].length;return $s(e)})),type:"element"},VL={dependencies:[Gf],export:(t,e)=>{if(!Yr(t))return null;let n=e(t).split(`
133
- `),o=[];for(let r of n)o.push("> "+r);return o.join(`
134
- `)},regExp:zL,replace:(t,e,n,o)=>{if(o){let i=t.getPreviousSibling();if(Yr(i))return i.splice(i.getChildrenSize(),0,[Po(),...e]),void t.remove()}let r=zs();r.append(...e),t.replace(r),o||r.select(0,0)},type:"element"},WL={dependencies:[mL],export:t=>{if(!tC(t))return null;let e=t.getTextContent();return"```"+(t.getLanguage()||"")+(e?`
135
- `+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:UL},regExpStart:HL,replace:(t,e,n,o,r,i)=>{let s,a;if(!e&&r){if(r.length===1)o?(s=bd(),a=n[1]+r[0]):(s=bd(n[1]),a=r[0].startsWith(" ")?r[0].slice(1):r[0]);else{if(s=bd(n[1]),r[0].trim().length===0)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();a=r.join(`
136
- `)}let l=St(a);s.append(l),t.append(s)}else e&&KL((l=>bd(l?l[1]:void 0)))(t,e,n,i)},type:"multiline-element"},GL={dependencies:[pr,zi],export:(t,e)=>Nn(t)?yh(t,e,0):null,regExp:BL,replace:sC("bullet"),type:"element"},VW={dependencies:[pr,zi],export:(t,e)=>Nn(t)?yh(t,e,0):null,regExp:$L,replace:sC("check"),type:"element"},YL={dependencies:[pr,zi],export:(t,e)=>Nn(t)?yh(t,e,0):null,regExp:FL,replace:sC("number"),type:"element"},qL={format:["code"],tag:"`",type:"text-format"},JL={format:["highlight"],tag:"==",type:"text-format"},XL={format:["bold","italic"],tag:"***",type:"text-format"},ZL={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},QL={format:["bold"],tag:"**",type:"text-format"},eR={format:["bold"],intraword:!1,tag:"__",type:"text-format"},tR={format:["strikethrough"],tag:"~~",type:"text-format"},nR={format:["italic"],tag:"*",type:"text-format"},oR={format:["italic"],intraword:!1,tag:"_",type:"text-format"},rR={dependencies:[al],export:(t,e,n)=>{if(!et(t)||rd(t))return null;let o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{let[,n,o,r]=e,i=Af(o,{title:r}),s=St(n);return s.setFormat(t.getFormat()),i.append(s),t.replace(i),s},trigger:")",type:"text-match"},iR=[jL,VL,GL,YL],sR=[WL],aR=[qL,XL,ZL,QL,eR,JL,nR,oR,tR],lR=[rR],xh=[...iR,...sR,...aR,...lR];function WW(t,e=xh,n,o=!1,r=!1){let i=o?t:(function(s,a=!1){let l=s.split(`
137
- `),c=!1,d=[];for(let u=0;u<l.length;u++){let p=l[u],h=d[d.length-1];UW.test(p)?d.push(p):HL.test(p)||UL.test(p)?(c=!c,d.push(p)):c||p===""||h===""||!h||rC.test(h)||rC.test(p)||zL.test(p)||FL.test(p)||BL.test(p)||$L.test(p)||KW.test(p)||jW.test(p)||!a?d.push(p):d[d.length-1]=h+p}return d.join(`
138
- `)})(t,r);return FW(e,o)(i,n)}function GW(t=xh,e,n=!1){return(function(r,i=!1){let s=iC(r),a=[...s.multilineElement,...s.element],l=!i,c=s.textFormat.filter((d=>d.format.length===1)).sort(((d,u)=>Number(d.format.includes("code"))-Number(u.format.includes("code"))));return d=>{let u=[],p=(d||nt()).getChildren();for(let h=0;h<p.length;h++){let g=p[h],m=RW(g,a,c,s.textMatch);m!=null&&u.push(l&&h>0&&!oC(g)&&!oC(p[h-1])?`
139
- `.concat(m):m)}return u.join(`
140
- `)}})(t,n)(e)}var dt=aC,lue=dt.$convertFromMarkdownString,cue=dt.$convertToMarkdownString,due=dt.BOLD_ITALIC_STAR,uue=dt.BOLD_ITALIC_UNDERSCORE,pue=dt.BOLD_STAR,fue=dt.BOLD_UNDERSCORE,hue=dt.CHECK_LIST,gue=dt.CODE,mue=dt.ELEMENT_TRANSFORMERS,cR=dt.HEADING,_ue=dt.HIGHLIGHT,dR=dt.INLINE_CODE,bue=dt.ITALIC_STAR,yue=dt.ITALIC_UNDERSCORE,xue=dt.LINK,vue=dt.MULTILINE_ELEMENT_TRANSFORMERS,uR=dt.ORDERED_LIST,pR=dt.QUOTE,Cue=dt.STRIKETHROUGH,Eue=dt.TEXT_FORMAT_TRANSFORMERS,wue=dt.TEXT_MATCH_TRANSFORMERS,fR=dt.TRANSFORMERS,hR=dt.UNORDERED_LIST,gR=dt.registerMarkdownShortcuts;var lC={};ze(lC,{DEFAULT_TRANSFORMERS:()=>mR,MarkdownShortcutPlugin:()=>YW});bt();var mR=[{dependencies:[Uf],export:t=>iA(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,o)=>{let r=dl();o||t.getNextSibling()!=null?t.replace(r):t.insertBefore(r),r.selectNext()},type:"element"},...fR];function YW({transformers:t=mR}){let[e]=Ee();return P((()=>gR(e,t)),[e,t]),null}var _R=lC,Oue=_R.DEFAULT_TRANSFORMERS,bR=_R.MarkdownShortcutPlugin;function yR(){return f(bR,{transformers:[cR,hR,uR,pR,dR]})}var cC={};ze(cC,{OnChangePlugin:()=>JW});bt();var qW=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?mn:P;function JW({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:n}){let[o]=Ee();return qW((()=>{if(n)return o.registerUpdateListener((({editorState:r,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{e&&i.size===0&&s.size===0||t&&l.has(ol)||a.isEmpty()||n(r,o,l)}))}),[o,t,e,n]),null}var XW=cC,xR=XW.OnChangePlugin;ke();function ZW(){return{text:"",components:{}}}var QW=[{tag:"code",format:"code"},{tag:"s",format:"strikethrough"},{tag:"u",format:"underline"},{tag:"i",format:"italic"},{tag:"b",format:"bold"},{tag:"sup",format:"superscript"},{tag:"sub",format:"subscript"}];function CR(t){let e=[];return QW.forEach(({tag:n,format:o})=>{t.hasFormat(o)&&e.push(n)}),e}function dC(t,e){t.text+=e.text,Object.assign(t.components,e.components)}function eG(t,e,n){for(let o=t.length-1;o>=0;o-=1){let r=t[o];e.includes(r)||(n.text+=`</${r}>`,t.splice(o,1))}e.forEach(o=>{t.includes(o)||(n.text+=`<${o}>`,t.push(o))})}function vR(t,e){for(let n=t.length-1;n>=0;n-=1)e.text+=`</${t[n]}>`;t.length=0}function ER(t,e){let n=t.getChildren();for(let o of n)if(te(o)){let r=CR(o);if(r.length!==e.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==e[i])return!1}else{if(Qe(o)||El(o))continue;if(o instanceof Ht){if(!ER(o,e))return!1}else return!1}return!0}function tG(t){let e=t.getComponentId(),n=t.getComponentName(),o=tt(t.getComponentData()),r={[e]:{type:n,data:o}};return{text:`{${n}:${e}}`,components:r}}function nG(t){let e=et(t)&&t.getURL()||"",n=et(t)&&t.getTarget()||"",o=ei(t),r=lG(n)?` target="${n}"`:"";return{text:`<a href="${e}"${r}>${o.text}</a>`,components:o.components}}function ei(t){let e=ZW(),n=[];return t.getChildren().forEach(r=>{if(Qe(r)){e.text+="<br>";return}if(El(r)){dC(e,tG(r));return}if(te(r)){let i=CR(r);eG(n,i,e);let s=r.getTextContent();s&&(e.text+=sG(s));return}if(et(r)){n.length>0&&!ER(r,n)&&vR(n,e),dC(e,nG(r));return}if(r instanceof Ht){dC(e,ei(r));return}console.log("unhandled node"),console.log(r)}),n.length>0&&vR(n,e),e}function uC(t){let e=[];return t.getChildren().forEach(n=>{ad(n)&&e.push(oG(n))}),aG(e)}function oG(t){let e=t.getFirstChild();if(e&&Nn(e))return{itemsType:e.getTag()==="ol"?"orderedList":"unorderedList",items:uC(e)};let n=ei(t),o={content:n.text};return Yi(n.components)&&(o.components=n.components),o}function rG(t){let e=[];return t.getChildren().forEach(n=>{if(wo(n)){let o=[];n.getChildren().forEach(r=>{if(Uo(r)){let s=r.getHeaderStyles()>0,a=r.getChildren(),l=[];a.forEach(c=>{if(Xr(c))l.push({type:c.getBlockName(),data:tt(c.getBlockData())});else if(Qt(c)){let d=ei(c),u={type:"paragraph",data:{text:d.text}};Yi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Gr(c)){let d=c.getTag().slice(1),u=ei(c),p={type:"heading",data:{text:u.text,level:parseInt(d)}};Yi(u.components)&&(p.data.components=u.components),l.push(p)}else if(Yr(c)){let d=ei(c),u={type:"quote",data:{text:d.text}};Yi(d.components)&&(u.data.components=d.components),l.push(u)}else if(Nn(c)){let d=c.getTag(),u={type:d==="ol"?"orderedList":"unorderedList",data:{style:d==="ol"?"ordered":"unordered",items:uC(c)}};l.push(u)}}),o.push({blocks:l,type:s?"header":"data"})}}),e.push({cells:o})}}),{rows:e}}function wR(){let t=[];for(nt().getChildren().forEach(o=>{if(Qt(o)){let r=ei(o),i={type:"paragraph",data:{text:r.text}};Yi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Gr(o)){let r=o.getTag().slice(1),i=ei(o),s={type:"heading",data:{text:i.text,level:parseInt(r)}};Yi(i.components)&&(s.data.components=i.components),t.push(s)}else if(Yr(o)){let r=ei(o),i={type:"quote",data:{text:r.text}};Yi(r.components)&&(i.data.components=r.components),t.push(i)}else if(Nn(o)){let r=o.getTag(),i={type:r==="ol"?"orderedList":"unorderedList",data:{style:r==="ol"?"ordered":"unordered",items:uC(o)}};t.push(i)}else if(uM(o)){let i={type:"table",data:rG(o)};t.push(i)}else if(Xr(o)){let r={type:o.getBlockName(),data:tt(o.getBlockData())};t.push(r)}else if(zn(o)&&o.getType()==="horizontalrule"){let r={type:"delimiter",data:{}};t.push(r)}});iG(t);)t.pop();return t.length===0?null:{time:Date.now(),blocks:t,version:"lexical-0.31.2"}}function iG(t){let e=t.length>0&&t.at(-1);return!!(e&&e.type==="paragraph"&&!e.data?.text&&!Yi(e.data?.components||{}))}function Yi(t){return t?Object.keys(t).length>0:!1}function sG(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function aG(t){let e=[];return t.forEach(n=>{n.itemsType&&n.items&&e.length>0?(e.at(-1).itemsType=n.itemsType,e.at(-1).items=n.items):e.push(n)}),e}function lG(t){return["_blank","_self","_parent","_top"].includes(t)}function TR(t){let e=nt();e.clear();let n=t?.blocks||[];for(let o of n)if(o.type==="paragraph"){let r=me();if(o.data.text){let i=Xs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="heading"){let r=`h${o.data?.level||2}`,i=$s(r);if(o.data.text){let s=Xs(o.data.text,o.data.components);i.append(...s)}e.append(i)}else if(o.type==="quote"){let r=zs();if(o.data?.text){let i=Xs(o.data.text,o.data.components);r.append(...i)}e.append(r)}else if(o.type==="orderedList"||o.type==="unorderedList"){let r=o.data.style==="ordered"?"number":"bullet",i=cl(r);for(let s of o.data.items)i.append(...pC(s,r));e.append(i)}else if(o.type==="table"){let r=sM();(o.data?.rows||[]).forEach(s=>{let a=aM();(s.cells||[]).forEach(c=>{let d=c.blocks||[],p=(c.type||"data")==="header"?1:0,h=iM(p);d.forEach(g=>{if(g.type==="paragraph"){let m=me();if(g.data?.text){let _=Xs(g.data.text,g.data.components);m.append(..._)}h.append(m)}else if(g.type==="heading"){let m=`h${g.data?.level||2}`,_=$s(m);if(g.data?.text){let b=Xs(g.data.text,g.data.components);_.append(...b)}h.append(_)}else if(g.type==="quote"){let m=zs();if(g.data?.text){let _=Xs(g.data.text,g.data.components);m.append(..._)}h.append(m)}else if(g.type==="orderedList"||g.type==="unorderedList"){let m=g.data.style==="ordered"?"number":"bullet",_=cl(m);for(let b of g.data.items)_.append(...pC(b,m));h.append(_)}else{let m=js(g.type,g.data||{});h.append(m)}}),a.append(h)}),r.append(a)}),e.append(r)}else if(o.type==="delimiter"){let r=dl();e.append(r)}else if(o.type){let r=js(o.type,o.data||{});e.append(r)}}function Xs(t,e){let n=document.createElement("template");n.innerHTML=t;let o=n.content,r=[];function i(s){if(s.nodeType===Node.TEXT_NODE)return cG(s.textContent||"",e);if(s.nodeType===Node.ELEMENT_NODE){let a=s,l=Array.from(a.childNodes).map(i).filter(c=>!!c).flat();switch(a.tagName.toLowerCase()){case"b":case"strong":return l.map(c=>(c instanceof Ut&&c.toggleFormat("bold"),c));case"i":case"em":return l.map(c=>(c instanceof Ut&&c.toggleFormat("italic"),c));case"u":return l.map(c=>(c instanceof Ut&&c.toggleFormat("underline"),c));case"s":return l.map(c=>(c instanceof Ut&&c.toggleFormat("strikethrough"),c));case"sup":return l.map(c=>(c instanceof Ut&&c.toggleFormat("superscript"),c));case"sub":return l.map(c=>(c instanceof Ut&&c.toggleFormat("subscript"),c));case"code":return l.map(c=>(c instanceof Ut&&c.toggleFormat("code"),c));case"br":return[];case"a":{let c=Af(a.getAttribute("href")||""),d=a.getAttribute("target");return d&&c.setTarget(d),c.append(...l),[It(c)]}default:return console.log("unhandled tag: "+a.tagName),console.log(l),l}}return null}return o.childNodes.forEach(s=>{let a=i(s);Array.isArray(a)?r.push(...a):a&&r.push(a)}),r}function cG(t,e){let n=[];if(!t)return n;let o=/\{([^:{}]+):([^}]+)\}/g,r=0,i;for(;(i=o.exec(t))!==null;){let a=t.slice(r,i.index);a&&n.push(St(a));let l=i[1],c=i[2],d=e?.[c];d?n.push(ch(l||d.type,c,d.data?tt(d.data):{})):n.push(St(i[0])),r=o.lastIndex}let s=t.slice(r);return s&&n.push(St(s)),n}function pC(t,e){let n=[];if(t.content){let o=dG(t);n.push(o)}if(t.items&&t.items.length>0){let o=uG(t,e);n.push(o)}return n}function dG(t){let e=sd();if(t.content){let n=Xs(t.content,t.components);e.append(...n)}return e}function uG(t,e){let n=sd();if(t.items&&t.items.length>0){let o=e;t.itemsType==="orderedList"?o="number":t.itemsType==="unorderedList"&&(o="bullet");let r=cl(o);for(let i of t.items)r.append(...pC(i,o));n.append(r)}return n}function SR(t){let[e]=Ee(),n=q(0),o=q(!1);return P(()=>{let i=t.value?.time||0;i>n.current&&(n.current=i,e.update(()=>{o.current=!0,TR(t.value)}))},[e,t.value]),f(xR,{onChange:i=>{if(o.current){o.current=!1;return}i.read(()=>{let s=wR();n.current=s?.time||0,t.onChange&&t.onChange(s)})},ignoreSelectionChange:!0})}ke();function pG(t){let e=!1;return t.querySelectorAll("a [style]").forEach(n=>{if(!(n instanceof HTMLElement))return;let o=n.style;(o.textDecoration?.includes("underline")||o.getPropertyValue("text-decoration")?.includes("underline"))&&(o.removeProperty("text-decoration"),o.removeProperty("text-decoration-skip-ink"),o.removeProperty("-webkit-text-decoration-skip"),e=!0)}),e}function fG(t){let e=!1;return t.querySelectorAll("[style]").forEach(n=>{n instanceof HTMLElement&&n.style.textAlign&&(n.style.removeProperty("text-align"),e=!0)}),e}function kR(){let[t]=Ee();return P(()=>t.registerCommand(Pi,e=>{let{clipboardData:n}=e;if(!n)return!1;let o=n.getData("text/html");if(!o)return!1;let i=new DOMParser().parseFromString(o,"text/html"),s=!1;if(s=pG(i)||s,s=fG(i)||s,!s)return!1;e.preventDefault();let a=jf(t,i),l=$();return B(l)?l.insertNodes(a):Bo(a),!0},ff),[t]),null}ke();function NR(t){let{editor:e,setIsLinkEditMode:n}=t,{toolbarState:o}=ah();return P(()=>{let r=i=>{if(jn(i,{}))return!1;if(_L(i))Ys(e);else if(bL(i)){let{code:s}=i,a=`h${s[s.length-1]}`;Gi(e,o.blockType,a)}else if(xL(i))hh(e,o.blockType);else if(yL(i))gh(e,o.blockType);else if(vL(i))e.dispatchCommand(lt,"strikethrough");else if(CL(i))e.dispatchCommand(Un,void 0);else if(EL(i))e.dispatchCommand(Eo,void 0);else if(wL(i))e.dispatchCommand(lt,"subscript");else if(TL(i))e.dispatchCommand(lt,"superscript");else if(SL(i))Tl(e);else if(kL(i)){let s=o.isLink?null:"";n(!o.isLink),e.dispatchCommand(Wn,s)}else return!1;return i.preventDefault(),!0};return e.registerCommand(cO,r,ff)},[e,o.isLink,o.blockType,n]),null}ke();var hG=/[\u00A0\u2011]/;function DR(){let[t]=Ee();return P(()=>{if(!t.hasNodes([ji]))throw new Error("SpecialCharacterPlugin: SpecialCharacterNode not registered on editor");return t.registerNodeTransform(Ut,e=>{if(YM(e))return;let n=e.getTextContent(),o=hG.exec(n);if(o){let r=o.index,i=o[0],s;r===0?[s]=e.splitText(r+1):[,s]=e.splitText(r,r+1);let a=Kv(i);s.replace(a)}})},[t]),null}si();ke();function OR(t){let{editor:e}=t,n=q(null),o=q(null),[r,i]=L(null),[s,a]=L(!1),[l,c]=L(!1),[d,u]=L(!1),p=De(()=>{if(!r){c(!1),u(!1);return}e.getEditorState().read(()=>{try{let w=md(r).getChildren(),S=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!wo(O))continue;if(O.getChildren().some(I=>I.getKey()===r.getKey())){S=D;break}}if(S!==-1){let D=w[S];if(wo(D)){let A=D.getChildren()[0];if(Uo(A)){let I=A.getHeaderStyles();c((I&Dn.ROW)===Dn.ROW)}}}let N=-1;for(let D=0;D<w.length;D++){let O=w[D];if(!wo(O))continue;let A=O.getChildren();for(let I=0;I<A.length;I++)if(A[I].getKey()===r.getKey()){N=I;break}if(N!==-1)break}if(N!==-1){let D=w[0];if(wo(D)){let A=D.getChildren()[N];if(Uo(A)){let I=A.getHeaderStyles();u((I&Dn.COLUMN)===Dn.COLUMN)}}}}catch{c(!1),u(!1)}})},[e,r]);P(()=>{r&&s&&p()},[r,s,p]),P(()=>{if(!(!r||!s))return e.registerUpdateListener(()=>{p()})},[e,r,s,p]);let h=De(()=>{let T=o.current,w=n.current;if(!w||!r)return;let S=e.getElementByKey(r.getKey());if(!S)return;let N=S.getBoundingClientRect(),D=window.innerWidth,O=window.innerHeight;if(w.style.left=`${N.right-25}px`,w.style.top=`${N.top+5}px`,w.style.display="flex",T)if(s){let R=N.right-185,z=N.top+30;R<10&&(R=N.left),R+185>D-10&&(R=D-185-10),z+280>O-10&&(z=N.top-280-5,z<10&&(z=10)),T.style.left=`${R}px`,T.style.top=`${z}px`,T.style.display="block"}else T.style.display="none"},[e,r,s]);P(()=>{if(!r){n.current&&(n.current.style.display="none"),o.current&&(o.current.style.display="none"),a(!1);return}h();let T=()=>{h()},w=N=>{N.key==="Escape"&&s&&(a(!1),N.preventDefault(),N.stopPropagation())},S=N=>{o.current&&n.current&&!o.current.contains(N.target)&&!n.current.contains(N.target)&&a(!1)};return window.addEventListener("scroll",T,!0),document.addEventListener("keydown",w),document.addEventListener("mousedown",S),()=>{window.removeEventListener("scroll",T,!0),document.removeEventListener("keydown",w),document.removeEventListener("mousedown",S)}},[r,h,s]),P(()=>e.registerCommand(hn,()=>{let T=$();if(B(T)){let w=T.anchor.getNode(),S=Av(w);Uo(S)?(r&&S.getKey()!==r.getKey()&&a(!1),i(S)):i(null)}else if(pM(T)){let w=T.getNodes();if(w.length>0){let S=Av(w[0]);Uo(S)&&(r&&S.getKey()!==r.getKey()&&a(!1),i(S))}}else i(null);return!1},Ai),[e,r]);let g=De(()=>{e.update(()=>{r&&Lv(!1)}),a(!1)},[e,r]),m=De(()=>{e.update(()=>{r&&Lv(!0)}),a(!1)},[e,r]),_=De(()=>{e.update(()=>{r&&Mv(!1)}),a(!1)},[e,r]),b=De(()=>{e.update(()=>{r&&Mv(!0)}),a(!1)},[e,r]),y=De(()=>{e.update(()=>{r&&lM()}),a(!1)},[e,r]),v=De(()=>{e.update(()=>{r&&cM()}),a(!1)},[e,r]),x=De(()=>{e.update(()=>{if(!r)return;md(r).remove()}),a(!1)},[e,r]),E=De(()=>{e.update(()=>{if(!r)return;let w=md(r).getChildren(),S=-1;for(let R=0;R<w.length;R++){let z=w[R];if(!wo(z))continue;if(z.getChildren().some(Z=>Z.getKey()===r.getKey())){S=R;break}}if(S===-1)return;let N=w[S];if(!wo(N))return;let D=N.getChildren(),O=D[0],I=((Uo(O)?O.getHeaderStyles():0)&Dn.ROW)===Dn.ROW;D.forEach(R=>{if(Uo(R)){let z=R.getHeaderStyles(),W=I?z^Dn.ROW:z|Dn.ROW;R.setHeaderStyles(W,Dn.ROW)}})}),a(!1)},[e,r]),C=De(()=>{e.update(()=>{if(!r)return;let w=md(r).getChildren(),S=-1;for(let R=0;R<w.length;R++){let z=w[R];if(!wo(z))continue;let W=z.getChildren();for(let Z=0;Z<W.length;Z++)if(W[Z].getKey()===r.getKey()){S=Z;break}if(S!==-1)break}if(S===-1)return;let N=w[0];if(!wo(N))return;let O=N.getChildren()[S],I=((Uo(O)?O.getHeaderStyles():0)&Dn.COLUMN)===Dn.COLUMN;w.forEach(R=>{if(!wo(R))return;let W=R.getChildren()[S];if(Uo(W)){let Z=W.getHeaderStyles(),F=I?Z^Dn.COLUMN:Z|Dn.COLUMN;W.setHeaderStyles(F,Dn.COLUMN)}})}),a(!1)},[e,r]);if(!r)return null;let k=e.getRootElement();return k?ii(f(Ne,{children:[f("button",{ref:n,className:"LexicalEditor__tableActionMenuButton",onClick:()=>a(!s),type:"button",children:"\u22EE"}),s&&f("div",{ref:o,className:"LexicalEditor__tableActionMenu",children:[f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:g,children:"Insert row above"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:m,children:"Insert row below"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:_,children:"Insert column left"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:b,children:"Insert column right"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:y,children:"Delete column"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:v,children:"Delete row"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:x,children:"Delete table"}),f("div",{className:"LexicalEditor__tableActionMenuDivider"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:E,children:l?"Remove row header":"Convert to row header"}),f("button",{className:"LexicalEditor__tableActionMenuItem",onClick:C,children:d?"Remove column header":"Convert to column header"})]})]}),k.parentElement||document.body):null}ke();function IR(){let[t]=Ee();return P(()=>t.registerNodeTransform(hO,e=>{let n=e.getLastChild();Qt(n)||e.append(me())}),[t]),null}var gG={namespace:"RootCMS",theme:HM,nodes:[hI,Wf,Gf,al,pr,zi,Uf,rh,oh,hM,vl,Cl,ji],onError:t=>{throw console.error("[LexicalEditor] error:",t),t}};function MR(t){return f(HI,{initialConfig:gG,children:f(FM,{children:f(zM,{children:f("div",{className:Ce(t.className,"LexicalEditor",t.variant==="comment"&&"LexicalEditor--comment",!t.autosize&&"LexicalEditor--withMaxHeight"),children:f(yG,{deepKey:t.deepKey,placeholder:t.placeholder,value:t.value,onChange:t.onChange,onFocus:t.onFocus,onBlur:t.onBlur,variant:t.variant,autoFocus:t.autoFocus,blockComponents:t.blockComponents,inlineComponents:t.inlineComponents})})})})})}var mG=Fv({name:"image",label:"Image Embed",preview:{title:"{file.alt}",image:"{file.src}"},fields:[xM({id:"file",label:"Image"}),Pv({id:"caption",label:"Caption",variant:"textarea",translate:!0,deprecated:!0})]}),_G=Fv({name:"html",label:"HTML Code",preview:{title:"{html}"},fields:[Pv({id:"html",label:"HTML",help:"HTML code to embed. Please use caution when inserting HTML.",variant:"textarea",autosize:!0,maxRows:50})]}),bG=[mG,_G];function yG(t){let{historyState:e}=BM(),[n]=Ee(),[o,r]=L(n),[i,s]=L(!1),[a,l]=L(null),c=J(()=>{let D=new Map;return t.variant!=="comment"&&bG.forEach(O=>{D.set(O.name,O)}),t.blockComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.blockComponents]),d=Array.from(c.values()),[u,p]=L(null),h=J(()=>{let D=new Map;return t.inlineComponents?.forEach(O=>{D.set(O.name,O)}),D},[t.inlineComponents]),g=Array.from(h.values()),[m,_]=L(null),b=D=>{D&&l(D)},y=(D,O)=>{let A=c.get(D);if(!A)return;let I=O?.initialValue?tt(O.initialValue):sa(A);p({schema:A,mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},v=(D,O)=>{n.update(()=>{let A=js(D,O);Bo([A]),A.selectNext()})},x=(D,O)=>{n.update(()=>{let A=At(D);Xr(A)&&A.setBlockData(O)})},E=()=>{p(null)};P(()=>{if(!t.deepKey)return;let D=O=>{let A=O.detail;if(!A||A.richTextDeepKey!==t.deepKey)return;let I=c.get(A.blockName);if(!I)return;let R=null,z=null;n.getEditorState().read(()=>{let W=nt(),Z=-1;for(let F of W.getChildren())if(Xr(F)){Z+=1;let se=F.getBlockName();if(Z===A.blockIndex&&se===A.blockName){R=F.getKey(),z=F.getBlockData();break}}if(!R){for(let F of W.getChildren())if(Xr(F)&&F.getBlockName()===A.blockName){R=F.getKey(),z=F.getBlockData();break}}}),R&&p({schema:I,mode:"edit",initialValue:z?tt(z):{},nodeKey:R})};return window.addEventListener(zv,D),()=>window.removeEventListener(zv,D)},[n,t.deepKey,c]),P(()=>{if(!t.deepKey)return;let D=O=>{let A=O.detail;if(!A||A.richTextDeepKey!==t.deepKey)return;let I=h.get(A.componentName);if(!I)return;let R=null,z=null,W=null;n.getEditorState().read(()=>{for(let{node:Z}of iI())if(El(Z)&&Z.getComponentId()===A.componentId){R=Z.getKey(),z=Z.getComponentData(),W=Z.getComponentName();break}}),R&&_({schema:I,componentName:W||A.componentName,componentId:A.componentId,mode:"edit",initialValue:z?tt(z):{},nodeKey:R})};return window.addEventListener(Hv,D),()=>window.removeEventListener(Hv,D)},[n,t.deepKey,h]);let C=D=>{u&&(u.mode==="edit"&&u.nodeKey?x(u.nodeKey,D):v(u.schema.name,D),E())},k=(D,O)=>{let A=h.get(D);if(!A)return;let I=O?.initialValue?tt(O.initialValue):sa(A);_({schema:A,componentName:D,componentId:O?.componentId||So(),mode:O?.mode??"create",initialValue:I,nodeKey:O?.nodeKey})},T=(D,O,A)=>{n.update(()=>{let I=ch(D,O,A);Bo([I]),I.selectNext()})},w=(D,O,A,I)=>{n.update(()=>{let R=At(D);El(R)&&(R.setComponentName(O),R.setComponentId(A),R.setComponentData(I))})},S=()=>{_(null)},N=D=>{if(!m)return;let{componentName:O,mode:A,nodeKey:I}=m;A==="edit"&&I?w(I,O,D.componentId,D.data):T(O,D.componentId,D.data),S()};return f(LM,{components:h,onEditComponent:(D,O)=>k(D,{mode:O?.mode??"edit",initialValue:O?.initialValue,componentId:O?.componentId,nodeKey:O?.nodeKey}),children:f(IM,{blocks:c,onEditBlock:y,children:[f(SR,{value:t.value,onChange:t.onChange}),f(OL,{editor:n,activeEditor:o,setActiveEditor:r,setIsLinkEditMode:s,variant:t.variant,blockComponents:d,inlineComponents:g,onInsertBlockComponent:D=>y(D,{mode:"create"}),onInsertInlineComponent:D=>k(D,{mode:"create"})}),f(NR,{editor:o,setIsLinkEditMode:s}),f(nA,{externalHistoryState:e}),f(AA,{contentEditable:f("div",{className:"LexicalEditor__scroller",children:f("div",{className:"LexicalEditor__root",ref:b,children:f(YI,{className:"LexicalEditor__editor",placeholder:f(vG,{placeholder:t.placeholder})})})}),ErrorBoundary:JI}),f(aA,{}),f(lA,{}),t.variant!=="comment"&&f(Ne,{children:[f(sA,{}),f(yM,{}),f(OR,{editor:o}),f(RA,{maxIndent:7})]}),f(yR,{}),t.autoFocus&&f($I,{}),f(IR,{}),f(DR,{}),f(kR,{}),t.variant!=="comment"&&f(AL,{}),a&&f(Ne,{children:[f(IL,{anchorElem:a,setIsLinkEditMode:s}),f(XM,{anchorElem:a,isLinkEditMode:i,setIsLinkEditMode:s})]}),u&&f(KM,{schema:u.schema,opened:!0,initialValue:u.initialValue,mode:u.mode,onClose:E,onSubmit:C}),m&&f(GM,{schema:m.schema,opened:!0,componentId:m.componentId,initialValue:m.initialValue,mode:m.mode,onClose:S,onSubmit:N})]})})}var AR=["Once upon a placeholder...","Start writing something legendary...","Words go here. Preferably brilliant ones...","Compose like nobody\u2019s watching...","Add text that makes Hemingway jealous...","Here lies your unwritten brilliance...","This is where the magic happens...","Let the words flow...","In the beginning, there was a blank page...","To write, or not to write, that is the question..."];function xG(){let t=Math.floor(Math.random()*AR.length);return AR[t]}function vG(t){let e=J(()=>t.placeholder||xG(),[]);return f("div",{className:"LexicalEditor__placeholder",children:e})}function LR(t){if(pw().preferences.EnableEditorJSEditor){let{deepKey:n,...o}=t;return f(fN,{...o})}return f(MR,{...t})}function RR(t){let e=t.field,[n,o]=L(null),r=on().controller,i=s=>{o(a=>(a?.time!==s?.time&&r.updateKey(t.deepKey,s),s))};return qo(t.deepKey,s=>{o(s)}),f(LR,{deepKey:t.deepKey,value:n,placeholder:e.placeholder,blockComponents:e.blockComponents,inlineComponents:e.inlineComponents,onChange:i,onFocus:t.onFocus,onBlur:t.onBlur,autosize:e.autosize})}ke();function PR(t){let e=t.field,[n,o]=Ot(t.deepKey,""),r=J(()=>(e.options||[]).map(i=>typeof i=="string"?{label:i,value:i}:{label:i.label??i.value??"",value:i.value??i.label??""}),[e.options]);return f("div",{className:"DocEditor__SelectField",children:f(Mn,{data:r,placeholder:e.placeholder,value:n,onChange:i=>o(i||""),size:"xs",radius:0,searchable:e.searchable??!0,clearable:!0,dropdownComponent:"div"})})}ke();function FR(t){let{value:e,variant:n,scrollRef:o}=t,r=e.split(/([\u00A0\u2011])/g);return f("div",{ref:o,className:`StringField__highlighter StringField__highlighter--${n}`,"aria-hidden":"true",children:[r.map((i,s)=>i==="\xA0"||i==="\u2011"?f("span",{className:"StringField__highlight",children:i},s):f("span",{children:i},s)),n==="textarea"&&e.endsWith(`
141
- `)&&f("br",{})]})}function BR(t){let e=t.field,[n,o]=Ot(t.deepKey,""),r=q(null),i=q(null),[s,a]=L(null),l=g=>{o(g.currentTarget.value)},c=g=>{t.onFocus?.(g),eo(t.deepKey,{scroll:!0})},d=g=>{t.onBlur?.(g),eo(null)},u=g=>{let m=g.target.value;if(m.trim()){let _=m;try{let b=m.replace(/'([^'\\]*(?:\\.[^'\\]*)*)'/g,'"$1"').replace(/,\s*([\]}])/g,"$1");JSON.parse(b),_=b}catch{}try{let b=JSON.parse(_),y=JSON.stringify(b,null,2);o(y),a(null)}catch(b){a(b.message)}}else a(null);t.onBlur?.(g),eo(null)},p=g=>{r.current&&(r.current.scrollTop=g.target.scrollTop,r.current.scrollLeft=g.target.scrollLeft)},h=g=>{i.current&&(i.current.scrollLeft=g.target.scrollLeft)};return e.variant==="json"?f("div",{className:"StringField__container",children:[f(_n,{className:Ce("StringField__input","StringField__input--json",s&&"StringField__input--error"),size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||20,value:n,onChange:l,onFocus:c,onBlur:u,onScroll:p}),s&&f("div",{className:"StringField__jsonError",children:["Invalid JSON: ",s]})]}):e.variant==="textarea"?f("div",{className:"StringField__container",children:[f(FR,{value:n||"",variant:"textarea",scrollRef:r}),f(_n,{className:"StringField__input",size:"xs",radius:0,autosize:e.autosize,minRows:4,maxRows:e.maxRows||12,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:p})]}):f("div",{className:"StringField__container",children:[f(FR,{value:n||"",variant:"input",scrollRef:i}),f(qn,{className:"StringField__input",size:"xs",radius:0,value:n,onChange:l,onFocus:c,onBlur:d,onScroll:h})]})}var zR=ft({});function vh(){return ht(zR)}function Ae(t){let e=t.docId.split("/")[0],n=QE(e),o=on(),r=n.loading||o.loading,i=n.schema?.fields||[];return f(zR.Provider,{value:n?.schema?.types||{},children:f(FT,{children:f("div",{className:Ce(t.className,"DocEditor"),children:[f(Ed,{visible:r,loaderProps:{color:"gray",size:"xl"}}),!r&&!t.hideStatusBar&&f(Ae.StatusBar,{...t,draft:o,collection:n.schema}),f("div",{className:"DocEditor__fields",children:i.map(s=>f(Ae.Field,{field:s,deepKey:`fields.${s.id}`},s.id))})]})})})}Ae.StatusBar=t=>{let{route:e,query:n}=DC(),{roles:o}=nu(),r=window.firebase.user.email||"",i=ou(o,r),s=qE(o,r),a=t.draft,[l,c]=L(a.controller.getData());qo("sys",S=>{c({sys:S})});let d=De(S=>{S==="unlocked"&&a.controller.removePublishingLock()},[a.controller]),u=sw({docId:t.docId,onChange:d}),p=De(S=>{if(S.action==="delete"){let N=t.docId.split("/")[0];e(`/cms/content/${N}`)}else S.action==="unlocked"&&a.controller.removePublishingLock()},[t.docId]),h=De(()=>{if(!s)return;let S=l?.sys?.publishingLocked;S&&u.open({existingLock:{reason:S.reason,until:S.until?S.until.toMillis():void 0}})},[s,l?.sys?.publishingLocked,u]),g=Aw({docId:t.docId}),m=Nw(),[_,b]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::checksVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[y,v]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::searchVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),[x,E]=L(()=>{try{let S=window.localStorage.getItem("root::DocumentPage::aiVisible");return S?JSON.parse(S)===!0:!1}catch{return!1}}),C=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai);P(()=>{let S=N=>{b(N.detail===!0)};return window.addEventListener("root:checks-visible",S),()=>window.removeEventListener("root:checks-visible",S)},[]),P(()=>{let S=N=>{v(N.detail===!0)};return window.addEventListener("root:search-visible",S),()=>window.removeEventListener("root:search-visible",S)},[]),P(()=>{let S=N=>{E(N.detail===!0)};return window.addEventListener("root:ai-visible",S),()=>window.removeEventListener("root:ai-visible",S)},[]);let k=n.locale||"",T=n.modal||"";P(()=>{T==="localization"&&a.controller&&m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:k||void 0})},[]);let w=!l?.sys;return w?null:f("div",{className:"DocEditor__statusBar",children:[f("div",{className:"DocEditor__statusBar__viewers",children:f(jT,{id:`doc/${t.docId}`})}),f(Ae.SaveState,{}),l?.sys&&f("div",{className:"DocEditor__statusBar__statusBadges",children:f(eE,{doc:l,docId:t.docId,onPublishingLockClick:s?h:void 0})}),f("div",{className:"DocEditor__statusBar__buttonGroup",children:[f("div",{className:"DocEditor__statusBar__search",children:f(Oe,{label:"\u2318 + Shift + f",transition:"pop",withArrow:!0,children:f(X,{className:Ce("DocEditor__statusBar__buttonGroup__button",y?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(Jd,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},children:"Search"})})}),(window.__ROOT_CTX.checks||[]).length>0&&f("div",{className:"DocEditor__statusBar__checks",children:f(X,{className:Ce("DocEditor__statusBar__buttonGroup__button",_?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(kE,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-checks"))},children:"Checks"})}),C&&f("div",{className:"DocEditor__statusBar__ai",children:f(Oe,{label:"\u2318 + i",transition:"pop",withArrow:!0,children:f(X,{className:Ce("DocEditor__statusBar__buttonGroup__button",x?"DocEditor__statusBar__buttonGroup__button--active":""),variant:"default",color:"dark",size:"xs",leftIcon:f(ts,{size:16}),onClick:()=>{window.dispatchEvent(new CustomEvent("root:toggle-ai"))},children:"Root AI"})})})]}),f("div",{className:"DocEditor__statusBar__i18n",children:f(X,{variant:"default",color:"dark",size:"xs",leftIcon:f(LE,{size:16}),onClick:()=>{m.open({docId:t.docId,collection:t.collection,draft:a.controller,locale:n.locale||void 0})},children:"Localization"})}),f("div",{className:"DocEditor__statusBar__publishButton",children:w?f(X,{color:"dark",size:"xs",onClick:()=>g.open(),loading:!0,disabled:!0,children:"Publish"}):GC(l)?f(Oe,{label:`Scheduled ${IC(l.sys.scheduledAt)} by ${l.sys.scheduledBy}`,transition:"pop",children:f(X,{color:"dark",size:"xs",leftIcon:f(Fh,{size:16}),disabled:!0,children:"Publish"})}):YC(l)?f(Oe,{label:tE(l),transition:"pop",children:f(X,{color:"dark",size:"xs",leftIcon:f(OE,{size:16}),disabled:!0,children:"Publish"})}):f(dw,{label:"You don't have access to publish this document",condition:!i,children:f(X,{color:"dark",size:"xs",leftIcon:f(Fh,{size:16}),onClick:()=>g.open(),disabled:!i,children:"Publish"})})}),f("div",{className:"DocEditor__statusBar__actionsMenu",children:f(uw,{docId:t.docId,data:l,onAction:p})})]})};Ae.SaveState=()=>{let[t,e]=L("NO_CHANGES");return Bw(n=>{e(n)}),f("div",{className:"DocEditor__statusBar__saveState",children:[t==="SAVED"&&"saved!",t==="SAVING"&&"saving...",t==="UPDATE_PENDING"&&"saving...",t==="ERROR"&&"error saving"]})};Ae.Field=t=>t.field.deprecated?f(Ae.DeprecatedField,{...t}):f(Ae.FieldBody,{...t});Ae.DeprecatedField=t=>{let[e,n]=L(!0),o=vh();return qo(t.deepKey,r=>{n(as(t.field,r,o))}),e?null:f(Ae.FieldBody,{...t})};Ae.FieldBody=t=>{let e=t.field,n=t.level??0,r=ic().value===t.deepKey,i=q(null),s=J(()=>e.type==="object"&&(e.variant||"drawer")==="drawer"?!1:!t.hideHeader&&!e.hideLabel,[t.hideHeader,e]);return P(()=>{r&&tm(i.current)},[r]),f("div",{className:Ce("DocEditor__field",e.deprecated&&"DocEditor__field--deprecated",r&&"deeplink-target"),"data-type":e.type,"data-level":n,id:t.deepKey,ref:i,children:[s&&f(Ae.FieldHeader,{...t}),f("div",{className:"DocEditor__field__input",children:e.type==="array"?f(Ae.ArrayField,{...t}):e.type==="boolean"?f(VT,{...t}):e.type==="date"?f(WT,{...t}):e.type==="datetime"?f(MS,{...t}):e.type==="file"?f(vn,{...t}):e.type==="image"?f(zS,{...t}):e.type==="multiselect"?f(HS,{...t}):e.type==="number"?f(US,{...t}):e.type==="object"?f(Ae.ObjectField,{...t}):e.type==="oneof"?f(Ae.OneOfField,{...t}):e.type==="reference"?f(xa,{...t}):e.type==="references"?f(jS,{...t}):e.type==="richtext"?f(RR,{...t}):e.type==="select"?f(PR,{...t}):e.type==="string"?f(BR,{...t}):f("div",{className:"DocEditor__field__input__unknown",children:["Unknown field type: ",e.type]})})]})};Ae.FieldHeader=t=>{let e=t.field,n=e.label||e.id,o=ic(),r=J(()=>BT(t.deepKey||""),[t.deepKey]);return f("div",{className:Ce(t.className,"DocEditor__FieldHeader"),children:[e.deprecated?f("div",{className:"DocEditor__FieldHeader__label",children:["DEPRECATED: ",n]}):f("div",{className:"DocEditor__FieldHeader__label",children:[f("span",{children:n}),t.deepKey&&f("a",{className:"DocEditor__FieldHeader__label__deeplink",href:r,tabIndex:-1,title:"Link to field",onClick:i=>{i.preventDefault(),window.history.replaceState({},"",r),o.setValue(t.deepKey)},children:"#"})]}),e.help&&f("div",{className:"DocEditor__FieldHeader__help",children:e.help}),f(Ae.FieldHeaderTranslationsActionIcon,{field:e,deepKey:t.deepKey})]})};Ae.FieldHeaderTranslationsActionIcon=t=>{let n=!!t.field.translate,r=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];return!n||r.length<=1?null:f(Ae.FieldHeaderTranslationsActionIconInner,{...t})};Ae.FieldHeaderTranslationsActionIconInner=t=>{let e=t.field,n=Ew(),o=on(),[r,i]=L(()=>o.controller.getValue(t.deepKey));qo(t.deepKey,d=>{i(d)});let s=vh(),a=J(()=>as(e,r,s),[e,s,r]),[l,c]=L(!1);return P(()=>{if(!t.deepKey||!o.controller)return;let d=SG(t.deepKey);return o.controller.subscribe(d,p=>{c(p?.translate===!1)})},[t.deepKey,o.controller]),f("div",{className:"DocEditor__FieldHeader__translate",children:l?f(Oe,{label:"Translations are disabled",children:f(Me,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;Kh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:f(EE,{size:16})})}):a?f("div",{className:"DocEditor__FieldHeader__translate__iconDisabled",children:f(es,{size:16})}):f(Oe,{label:"Show translations",children:f(Me,{size:"xs",onClick:()=>{let d=o.controller.getData();if(!d)return;let u=new Set;Kh(u,e,r,s);let p=Array.from(u);n.open({docId:o.controller.docId,strings:p,l10nSheet:d?.sys?.l10nSheet,field:{id:e.id||t.deepKey,deepKey:t.deepKey},draft:o})},children:f(es,{size:16})})})})};Ae.ObjectField=t=>{let e=t.field,n=e.variant;return n||(t.isArrayChild?n="inline":n="drawer"),n==="drawer"?f(Ae.ObjectFieldDrawer,{...t}):f("div",{className:"DocEditor__ObjectField",children:f("div",{className:"DocEditor__ObjectField__fields",children:e.fields.map(o=>f(Ae.Field,{field:o,deepKey:`${t.deepKey}.${o.id}`},o.id))})})};Ae.ObjectFieldDrawer=t=>{let e=t.field,n=e.drawerOptions?.collapsed||!1,o=e.drawerOptions?.inline||!1,r=on().controller,i=nm(),s=qh(),a=Et(),l=it(),c=ic(),d=!n||c.value.includes(t.deepKey),u=()=>{let _=r.getValue(t.deepKey)||{};i.set(_),ce({message:"Copied to clipboard",autoClose:2e3})},p=async()=>{let _=await i.get();if(!_||typeof _!="object"){ce({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}r.updateKey(t.deepKey,_),ce({message:"Pasted from clipboard",autoClose:2e3})},h=async _=>{await r.removeKey(t.deepKey),ce({message:"Cleared",autoClose:2e3}),await r.flush(),_&&a.closeModal(_)},g=()=>{let _=e.label||e.id||"drawer",b=a.openConfirmModal({...l,title:`Clear ${_}?`,children:f(ns,{size:"body-sm",weight:"semi-bold",className:"DocEditor__ObjectFieldDrawer__confirmText",children:"This will clear all values in this section. There is no undo."}),labels:{confirm:"Clear",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},closeOnConfirm:!1,onConfirm:()=>h(b)})},m=()=>{let _=r.getValue(t.deepKey)||{};s.open({data:_,onSave:b=>{r.updateKey(t.deepKey,b),s.close()}})};return f("div",{className:Ce("DocEditor__ObjectFieldDrawer",o&&"DocEditor__ObjectFieldDrawer--inline"),children:f("details",{className:"DocEditor__ObjectFieldDrawer__drawer",open:d,children:[f("summary",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle",children:[f("div",{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__icon",children:f(sE,{size:16})}),f(Ae.FieldHeader,{className:"DocEditor__ObjectFieldDrawer__drawer__toggle__header",field:e,deepKey:t.deepKey}),f(G,{className:"DocEditor__ObjectFieldDrawer__drawer__menu",position:"bottom",transitionDuration:0,control:f(Me,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__dots",onClick:_=>{_.stopPropagation(),_.preventDefault()},children:f(ia,{size:16})}),children:[f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Lh,{size:18}),onClick:u,children:"Copy"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Hd,{size:18}),onClick:p,children:"Paste"}),f(G.Label,{children:"CODE"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Mh,{size:18}),onClick:m,children:"Edit JSON"}),f(G.Label,{children:"ACTIONS"}),f(G.Item,{className:"DocEditor__ObjectFieldDrawer__drawer__menu__item",icon:f(Jn,{size:18}),onClick:g,children:"Clear"})]})]}),f("div",{className:"DocEditor__ObjectFieldDrawer__drawer__content DocEditor__ObjectFieldDrawer__fields",children:e.fields.map(_=>f(Ae.Field,{field:_,deepKey:`${t.deepKey}.${_.id}`},_.id))})]})})};function CG(t,e){switch(e.type){case"update":{let n=t._new||[];return{...e.newValue,_new:n}}case"updateItem":{let n=t??{},r=[...n._array||[]][e.index],i=e.newValue??{};return e.draft.updateKey(`${e.deepKey}.${r}`,i),{...n,[r]:i}}case"add":{let n=t??{},o=So(),r=structuredClone(e.defaultValue||{}),i=[...n._array||[],o];e.draft.updateKeys({[`${e.deepKey}._array`]:i,[`${e.deepKey}.${o}`]:r});let s=t._new||[];return{...n,[o]:r,_array:i,_new:[...s,o]}}case"insertBefore":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.defaultValue||{});o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"insertAfter":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.defaultValue||{});o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"duplicate":{let n=t??{},o=[...n._array||[]],r=So(),i=structuredClone(e.value);o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:[...s,r]}}case"moveUp":{if(e.index===0)return t;let n=t??{},o=[...n._array||[]];return $R(o,e.index,e.index-1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index-1]}}case"moveDown":{let n=t??{},o=[...n._array||[]];return e.index>=o.length-1?t:($R(o,e.index,e.index+1),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:o[e.index+1]})}case"moveTo":{let n=t??{},o=[...n._array||[]];if(e.fromIndex<0||e.fromIndex>=o.length||e.toIndex<0||e.toIndex>=o.length)return console.error("Invalid moveTo index",e),t;let r=o[e.fromIndex];return EG(o,e.fromIndex,e.toIndex),e.draft.updateKeys({[`${e.deepKey}._array`]:o}),{...n,_array:o,_moved:r}}case"removeAt":{let n={...t??{}},r=[...n._array||[]],i=r[e.index];return delete n[i],r.splice(e.index,1),e.draft.updateKeys({[`${e.deepKey}._array`]:r}),e.draft.removeKey(`${e.deepKey}.${i}`),{...n,_array:r}}case"pasteAfter":{let n=t??{},o=[...n._array||[]],r=So(),i=e.data;if(!i)return ce({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index+1,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}case"pasteBefore":{let n=t??{},o=[...n._array||[]],r=So(),i=e.data;if(!i)return ce({title:"Skipped",message:"Nothing to paste.",autoClose:!0}),t;o.splice(e.index,0,r),e.draft.updateKeys({[`${e.deepKey}._array`]:o,[`${e.deepKey}.${r}`]:i});let s=t._new||[];return{...n,[r]:i,_array:o,_new:s,_pasted:r}}default:return console.error("unknown action",e),t}}Ae.ArrayField=t=>{let e=on().controller,n=t.field,[o,r]=hC(CG,{_array:[]}),i=ic(),s=nm(),a=window.__ROOT_CTX.experiments||{},c=(o??{})._array||[],d=o._new||[],[u,p]=L(null);qo(t.deepKey,F=>{r({type:"update",newValue:F})}),P(()=>{o._moved?k(t.deepKey,c.indexOf(o._moved)):o._pasted&&k(t.deepKey,c.indexOf(o._pasted))},[o]);let h=F=>{let se=c[F],ye=`${t.deepKey}.${se}`;return e.getValue(ye)||{}},g=()=>{r({type:"add",draft:e,deepKey:t.deepKey,defaultValue:n.itemDefault||{}})},m=(F,se)=>{r({type:"pasteBefore",draft:e,deepKey:t.deepKey,index:F,data:se})},_=(F,se)=>{r({type:"pasteAfter",draft:e,deepKey:t.deepKey,index:F,data:se})},b=async F=>{m(F,await s.get())},y=async F=>{_(F,await s.get())},v=F=>{r({type:"insertBefore",draft:e,deepKey:t.deepKey,index:F,defaultValue:n.itemDefault||{}})},x=F=>{r({type:"insertAfter",draft:e,deepKey:t.deepKey,index:F,defaultValue:n.itemDefault||{}})},E=F=>{r({type:"duplicate",draft:e,deepKey:t.deepKey,index:F,value:h(F)})},C=F=>{r({type:"removeAt",draft:e,deepKey:t.deepKey,index:F})},k=(F,se)=>{document.getElementById(`summary-for-${F}.${c[se]}`)?.focus()},T=F=>{F>0&&r({type:"moveUp",draft:e,deepKey:t.deepKey,index:F})},w=F=>{F<c.length-1&&r({type:"moveDown",draft:e,deepKey:t.deepKey,index:F})},S=F=>{let se=h(F);s.set(se),p(null),ce({message:"Copied to clipboard",autoClose:2e3})},N=F=>{let se=h(F);s.set(se),p(F),ce({message:"Cut to clipboard",autoClose:2e3})},D=async F=>{let se=await s.get();if(!se){ce({message:"Clipboard empty (nothing to paste)",color:"red",autoClose:2e3});return}if(_(F,se),u!==null){let ye=u;F<u&&(ye+=1),C(ye),p(null)}ce({message:"Pasted item",autoClose:2e3})},O=qh(),A=_w(),I=F=>{let se=h(F);O.open({data:se,onSave:ye=>{console.log("[edit json] onSave()",ye),r({type:"updateItem",draft:e,index:F,newValue:ye,deepKey:t.deepKey}),O.close()}})},R=F=>{let se=h(F);A.open({data:se,onSave:ye=>{console.log("[ai edit] onSave()",ye),r({type:"updateItem",draft:e,index:F,newValue:ye,deepKey:t.deepKey}),A.close()}})};function z(F){return!!i.value.startsWith(`${t.deepKey}.${F}`)}let W=De((F,se)=>{if(!F.target)return;let ye=c.indexOf(se);F.metaKey&&F.key==="x"?(F.preventDefault(),N(ye)):F.metaKey&&F.key==="c"?(F.preventDefault(),S(ye)):F.metaKey&&F.key==="v"?(F.preventDefault(),D(ye)):F.metaKey&&(F.key==="Backspace"||F.key==="Delete")?(F.preventDefault(),C(ye),ce({message:"Deleted item",autoClose:2e3})):F.key==="ArrowUp"?(F.preventDefault(),T(ye)):F.key==="ArrowDown"?(F.preventDefault(),w(ye)):F.key==="ArrowLeft"?F.target.closest("details").open=!1:F.key==="ArrowRight"&&(F.target.closest("details").open=!0)},[t.deepKey,c,u]),Z=f("div",{className:"DocEditor__ArrayField__add",children:[f(X,{className:"DocEditor__ArrayField__add__button",color:"dark",size:"xs",leftIcon:f(cE,{size:16}),onClick:()=>g(),children:n.buttonLabel||"Add"}),f(G,{className:"DocEditor__ArrayField__add__menu",control:f(Me,{className:"DocEditor__ArrayField__item__header__controls__dots",children:f(ia,{size:16})}),children:[f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(qd,{size:18}),onClick:()=>D(c.length-1),children:"Paste item to end"})]})]});return c.length===0&&!o._new?f("div",{className:"DocEditor__ArrayField",children:[f("div",{className:"DocEditor__ArrayField__items",children:f("div",{className:"DocEditor__ArrayField__items__empty",children:"No items"})}),Z]}):f("div",{className:"DocEditor__ArrayField",children:[f(Su,{onDragEnd:F=>{let{source:se,destination:ye}=F;ye&&r({type:"moveTo",fromIndex:se.index,toIndex:ye.index,draft:e,deepKey:t.deepKey})},children:f(Nu,{droppableId:"dnd-list",direction:"vertical",children:F=>f("div",{...F.droppableProps,ref:F.innerRef,className:"DocEditor__ArrayField__items",children:[c.map((se,ye)=>f(Ae.ArrayFieldItem,{field:n,parentDeepKey:t.deepKey,itemKey:se,index:ye,initialOpen:d.includes(se)||z(se)||!!n.defaultOpen,isCut:u===ye,aiEnabled:!!a.ai,onFocusHeader:k,onHeaderKeyDown:W,onMoveUp:T,onMoveDown:w,onInsertBefore:v,onInsertAfter:x,onDuplicate:E,onCopy:S,onPasteBefore:b,onPasteAfter:y,onEditJson:I,onAiEdit:R,onRemove:C},se)),F.placeholder]})})}),Z]})};Ae.ArrayFieldItem=t=>{let e=`${t.parentDeepKey}.${t.itemKey}`;return f(ku,{index:t.index,draggableId:t.itemKey,children:(n,o)=>f("div",{ref:n.innerRef,...n.draggableProps,className:Ce("DocEditor__ArrayField__item__wrapper",o.isDragging&&"DocEditor__ArrayField__item__wrapper--dragging",t.isCut&&"DocEditor__ArrayField__item__wrapper--cut"),children:[f("div",{className:"DocEditor__ArrayField__item__handle",...n.dragHandleProps,onClick:()=>t.onFocusHeader(t.parentDeepKey,t.index),children:f(jd,{size:18,stroke:"1.5"})}),f("details",{className:"DocEditor__ArrayField__item",open:t.initialOpen,onToggle:r=>{r.target.open?eo(e,{scroll:!0}):eo(null)},onMouseEnter:()=>{eo(e)},onMouseLeave:()=>{eo(null)},children:[f("summary",{id:`summary-for-${e}`,className:"DocEditor__ArrayField__item__header",onKeyDown:r=>t.onHeaderKeyDown(r,t.itemKey),tabIndex:0,children:[f("div",{className:"DocEditor__ArrayField__item__header__icon",children:f(KE,{size:6})}),f(Ae.ArrayFieldPreview,{field:t.field,deepKey:e,index:t.index}),f("div",{className:"DocEditor__ArrayField__item__header__controls",children:[f("div",{className:"DocEditor__ArrayField__item__header__controls__arrows",children:[f("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--up",onClick:()=>t.onMoveUp(t.index),children:f(lE,{size:20,strokeWidth:1.75})}),f("button",{className:"DocEditor__ArrayField__item__header__controls__arrow DocEditor__ArrayField__item__header__controls__arrows--down",onClick:()=>t.onMoveDown(t.index),children:f(aE,{size:20,strokeWidth:1.75})})]}),f(G,{className:"DocEditor__ArrayField__item__header__controls__menu",position:"bottom",transitionDuration:0,control:f(Me,{className:"DocEditor__ArrayField__item__header__controls__dots",children:f(ia,{size:16})}),children:[f(G.Label,{children:"INSERT"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Bh,{size:18}),onClick:()=>t.onInsertBefore(t.index),children:"Add before"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(qd,{size:18}),onClick:()=>t.onInsertAfter(t.index),children:"Add after"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Kd,{size:18}),onClick:()=>t.onDuplicate(t.index),children:"Duplicate"}),f(G.Label,{children:"CLIPBOARD"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Lh,{size:18}),onClick:()=>t.onCopy(t.index),children:"Copy"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Bh,{size:18}),onClick:()=>t.onPasteBefore(t.index),children:"Paste before"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(qd,{size:18}),onClick:()=>t.onPasteAfter(t.index),children:"Paste after"}),f(G.Label,{children:"CODE"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Mh,{size:18}),onClick:()=>t.onEditJson(t.index),children:"Edit JSON"}),t.aiEnabled&&f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(iu,{size:16}),onClick:()=>t.onAiEdit(t.index),children:"Edit with Root AI"}),f(G.Label,{children:"REMOVE"}),f(G.Item,{className:"DocEditor__ArrayField__menu__item",icon:f(Jn,{size:18}),onClick:()=>t.onRemove(t.index),children:"Remove"})]})]})]}),f("div",{className:"DocEditor__ArrayField__item__body",children:f(Ae.Field,{field:t.field.of,deepKey:e,hideHeader:!0,isArrayChild:!0,onFocus:()=>{eo(e,{scroll:!0})},onBlur:()=>{eo(null)}},e)})]})]})},t.itemKey)};Ae.ArrayFieldPreview=t=>{let e=on().controller,n=vh(),[o,r]=L(e.getValue(t.deepKey)),i=J(()=>wG(t.field,o,n),[t.field,n,o]),s=J(()=>TG(t.field,o,t.index,n),[t.field,t.index,n,o]),a=J(()=>su(l=>{r(l&&typeof l=="object"?{...l}:l)},250),[]);return P(()=>e.subscribeSubtree(t.deepKey,a),[t.deepKey,e,a]),f("div",{className:"DocEditor__ArrayField__item__header__preview",children:[i&&f("div",{className:"DocEditor__ArrayField__item__header__preview__image",children:f("img",{src:i,alt:"",className:"DocEditor__ArrayField__item__header__preview__image__img",loading:"lazy"})}),f("div",{className:"DocEditor__ArrayField__item__header__preview__title","data-preview":s})]})};Ae.OneOfField=t=>{let e=t.field,n=e.variant||window.__ROOT_CTX.defaultOneOfVariant||"dropdown",[o,r]=L(""),i=vh(),s=Array.isArray(e.types)?e.types:[],a={},l=[],c=[{value:"",label:e.placeholder||"Select type"}];s.forEach(x=>{let E,C;typeof x=="string"?(E=i[x],C=x):(E=x,C=x.name),C&&(E&&(a[C]=E,l.push(E)),c.push({value:C,label:C}))});let d=a[o||""],u=on().controller,p=yw(),h=J(()=>({}),[]);async function g(x,E){let C={};if(x){let k=a[x];if(E&&k){let T=sa(k),w=ew(k,E,i);Object.assign(C,QC(T,w))}else x in h?Object.assign(C,h[x]):k&&Object.assign(C,sa(k))}C._type=x,await u.updateKey(t.deepKey,C),r(x)}async function m(x){await g(x)}qo(t.deepKey,x=>{r(x?._type||""),x?._type&&(h[x._type]=x)});function _(x){let E=x.target;E&&E.select&&E.select()}function b(){let x=[];return l.forEach(E=>{x.push({key:`${E.name}::__blank__`,schema:E}),(E.presets||[]).forEach(C=>{x.push({key:`${E.name}::${C.id}`,schema:E,preset:C})})}),x}function y(){p.open({options:b(),onSelect:async x=>{await g(x.schema.name,x.preset?.data),p.close()},onRemove:d?async()=>{await g(""),p.close()}:void 0})}let v=d&&f("div",{className:"DocEditor__OneOfField__fields",children:d.fields.map(x=>f(Ae.Field,{field:x,deepKey:`${t.deepKey}.${x.id}`,onBlur:()=>{eo(null)},onFocus:()=>{eo(`${t.deepKey}.${x.id}`,{scroll:!0})}},`${o}::${x.id}`))});if(n==="picker"){let x=d?d.label||d.name:e.placeholder||"Select type";return f("div",{className:"DocEditor__OneOfField DocEditor__OneOfField--picker",children:[f("div",{className:"DocEditor__OneOfField__pickerButton",children:[f("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),f(X,{variant:"default",color:"dark",size:"xs",onClick:y,rightIcon:f(fo,{size:16}),children:x})]}),v]})}return f("div",{className:"DocEditor__OneOfField",children:[f("div",{className:"DocEditor__OneOfField__select",children:[f("div",{className:"DocEditor__OneOfField__select__label",children:"Type:"}),f(Mn,{data:c,value:o,placeholder:e.placeholder,onChange:x=>m(x||""),onFocus:_,size:"xs",radius:0,searchable:!0,dropdownComponent:"div"})]}),v]})};function $R(t,e,n){if(t.length<=1)return t;let o=t[e];return t[e]=t[n],t[n]=o,t}function EG(t,e,n){let[o]=t.splice(e,1);t.splice(n,0,o)}function HR(t,e,n,o="title"){if(t.type==="oneof"){let r=t,i=e?._type;if(i){let s,a=Array.isArray(r.types)?r.types:[];return typeof a[0]=="string"?s=n[i]:s=a.find(l=>l.name===i),s?.preview?.[o]||null}}return null}function wG(t,e,n){let o=HR(t.of,e,n,"image");if(o)return ga(o,e)}function TG(t,e,n,o){let r=HR(t.of,e,o,"title");if(r){let i=ga(r,e,{index:n});if(i)return i}return t.preview?ga(t.preview,e,{index:n})??`item ${n}`:`item ${n}`}function SG(t){let e=t.split("."),n=e.pop();return[...e,`@${n}`].join(".")}export{iP as a,sP as b,Gh as c,qh as d,cP as e,Xh as f,Zh as g,Yo as h,gP as i,su as j,Fw as k,on as l,Bw as m,bq as n,zv as o,Hv as p,Hse as q,MR as r,Ae as s,vm as t};