@grapesjs/studio-sdk-plugins 1.0.13-rc.1 → 1.0.13

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 (40) hide show
  1. package/dist/dialogComponent/index.cjs.js +1 -1
  2. package/dist/dialogComponent/index.es.js +1 -1
  3. package/dist/dialogComponent/index.umd.js +1 -1
  4. package/dist/fsLightboxComponent/index.cjs.js +1 -1
  5. package/dist/fsLightboxComponent/index.es.js +1 -1
  6. package/dist/fsLightboxComponent/index.umd.js +1 -1
  7. package/dist/iconifyComponent/types.d.ts +1 -1
  8. package/dist/iconifyComponent/typesSchema.d.ts +1 -1
  9. package/dist/iconifyComponent/utils.d.ts +1 -1
  10. package/dist/index.cjs.js +37 -269
  11. package/dist/index.es.js +7002 -21882
  12. package/dist/index.umd.js +37 -269
  13. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  14. package/dist/lightGalleryComponent/index.es.js +1 -1
  15. package/dist/lightGalleryComponent/index.umd.js +1 -1
  16. package/dist/listPagesComponent/index.cjs.js +1 -1
  17. package/dist/listPagesComponent/index.es.js +1 -1
  18. package/dist/listPagesComponent/index.umd.js +1 -1
  19. package/dist/prosemirror/index.cjs.js +1 -1
  20. package/dist/prosemirror/index.es.js +10 -12
  21. package/dist/prosemirror/index.umd.js +1 -1
  22. package/dist/rteTinyMce/index.cjs.js +1 -233
  23. package/dist/rteTinyMce/index.es.js +176 -15056
  24. package/dist/rteTinyMce/index.umd.js +1 -233
  25. package/dist/rteTinyMce/types.d.ts +2 -5
  26. package/dist/rteTinyMce/utils.d.ts +1 -1
  27. package/dist/swiperComponent/index.cjs.js +1 -1
  28. package/dist/swiperComponent/index.es.js +1 -1
  29. package/dist/swiperComponent/index.umd.js +1 -1
  30. package/dist/tableComponent/index.cjs.js +1 -1
  31. package/dist/tableComponent/index.es.js +2 -2
  32. package/dist/tableComponent/index.umd.js +1 -1
  33. package/dist/types.d.ts +10 -0
  34. package/dist/utils.d.ts +2 -3
  35. package/dist/youtubeAssetProvider/assetProviders/youtube.d.ts +1 -1
  36. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  37. package/dist/youtubeAssetProvider/index.es.js +2 -4
  38. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  39. package/dist/youtubeAssetProvider/types.d.ts +41 -2
  40. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("grapesjs");const m=require("react"),ir=require("react-dom");function b0(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const kn=b0(m),b2=b0(ir),v0="app.grapesjs.com",y0="app-stage.grapesjs.com",Mh=[v0,y0,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],v2="license:check:start",y2="license:check:end",Zf=()=>typeof window<"u",Dd=t=>t&&t.stopPropagation(),x2=(t="",e)=>{const r=new DOMParser().parseFromString(t,"text/html");if(e){const i=r.querySelectorAll("svg")[0].style||{},s=O2(e)?`${e}px`:e;i.width=s,i.height=s,i.fill="currentColor"}return new XMLSerializer().serializeToString(r)},w2=({isDev:t,isStage:e})=>`${t?"":`https://${e?y0:v0}`}/api`,x0=(t={})=>{const{width:e=300,height:n,text:r="IMAGE",bg:o="777",fg:i="white"}=t,s=n?`x${n}`:"";return`https://placehold.co/${e}${s}/${o}/${i}.png?text=${r}`},S2=x0(),C2=()=>{const t=Zf()&&window.location.hostname;return!!t&&(Mh.includes(t)||Mh.some(e=>t.endsWith(e)))},Ld=t=>t&&t.charAt(0).toUpperCase()+t.substring(1),E2=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,n)=>(n?"-":"")+e.toLowerCase()),Wa=t=>typeof t<"u",w0=t=>typeof t=="string",O2=t=>typeof t=="number";function xo(t){return typeof t=="function"}const _2=t=>(t||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim();var Ht=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(Ht||{});async function k2({path:t,baseApiUrl:e,method:n="GET",headers:r={},params:o,body:i}){const l=`${e||w2({isDev:!1,isStage:!1})}${t}`,a={method:n,headers:{"Content-Type":"application/json",...r}};i&&(a.body=JSON.stringify(i));const c=o?new URLSearchParams(o).toString():"",u=c?`?${c}`:"",d=await fetch(`${l}${u}`,a);if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}const jh={[Ht.free]:0,[Ht.startup]:10,[Ht.business]:20,[Ht.enterprise]:30};function T2(t){const e=t;return e.init=n=>r=>t(r,n),e}const xr=t=>T2(t);async function wr({editor:t,plan:e,pluginName:n,licenseKey:r,cleanup:o}){let i="",s=!1;const l=C2(),a=u=>{console.warn("Cleanup plugin:",n,"Reason:",u),o()},c=(u={})=>{var b;const{error:d,sdkLicense:f}=u,p=(b=u.plan)==null?void 0:b.category;if(!(f||u.license)||d)a(d||"Invalid license");else if(p){const v=jh[e],y=jh[p];v>y&&a({pluginRequiredPlan:e,licensePlan:p})}};t.on(v2,u=>{i=u==null?void 0:u.baseApiUrl,s=!0}),t.on(y2,u=>{c(u)}),setTimeout(async()=>{if(!s){if(l)return;if(r){const u=await A2({licenseKey:r,pluginName:n,baseApiUrl:i});u&&c(u)}else a("The `licenseKey` option not provided")}},2e3)}async function A2(t){const{licenseKey:e,pluginName:n,baseApiUrl:r}=t;try{return(await k2({baseApiUrl:r,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const Ma=(t,e)=>{var n;return!!((n=t==null?void 0:t.hasAttribute)!=null&&n.call(t,e))},ri=(t,e)=>{var n;return!!((n=t==null?void 0:t.classList)!=null&&n.contains(e))},M2=(t,e={})=>{var i;const n={},r=[],o=[];for(const s in t){const{value:l,...a}=t[s];r.push({id:s,name:s,changeProp:!0,category:e.category,...a}),n[s]=l,!Wa(l)&&o.push(s);const{subTraits:c={}}=a;for(const u in a.subTraits)(i=c[u])==null||i.forEach(d=>{const f=d.id||d.name;n[f]=d.value})}return{propKeys:Object.keys(n),propsNoValues:o,props:n,traits:r}},j2=(t,e)=>{e.forEach(n=>{if(n.subTraits){const r=`${n.id||n.name}`,o=n.changeProp?`change:${r}`:`change:attributes:${r}`;t.on(o,()=>Rh(t,r)),Rh(t,r)}})},Rh=(t,e)=>{const n=t.getTrait(e),r=n.get("category"),o=n.get("subTraits")||{},s=(Object.values(o).flat()||[]).map(c=>c.id||c.name);t.removeTrait(s);const l=o[n.getValue()],a=t.getTraitIndex(e)+1;l&&t.addTrait(l.map(c=>({category:r,...c})),{at:a})},R2=(t,e)=>{e.forEach(n=>{const r=E2(n);r!==n&&t.has(r)&&t.set({[n]:t.get(r),[r]:void 0})})},Vd="gjs-plg-",Nh=(...t)=>t.map(e=>`[data-gjs-type="${e}"]`).join(","),N2="dialogComponent",P2=function(t,e={}){const{Blocks:n,Components:r}=t,{licenseKey:o}=e,i="gjs-plg-dialog",s="gjs-plg-dialog-overlay",l="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",u="gjs-plg-dialog-body",d="gjs-plg-dialog-description",f="gjs-plg-dialog-placeholder";n.add(i,{label:"Dialog",media:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("grapesjs");const Hs="app.grapesjs.com",Fs="app-stage.grapesjs.com",Uo=[Hs,Fs,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],tc="license:check:start",nc="license:check:end",ic=()=>typeof window<"u",oc=({isDev:n,isStage:e})=>`${n?"":`https://${e?Fs:Hs}`}/api`,rc=()=>{const n=ic()&&window.location.hostname;return!!n&&(Uo.includes(n)||Uo.some(e=>n.endsWith(e)))},sc=n=>n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase()),lc=n=>typeof n<"u";function $s(n){return typeof n=="function"}async function ac({path:n,baseApiUrl:e,method:t="GET",headers:i={},params:o,body:r}){const l=`${e||oc({isDev:!1,isStage:!1})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...i}};r&&(a.body=JSON.stringify(r));const c=o?new URLSearchParams(o).toString():"",d=c?`?${c}`:"",h=await fetch(`${l}${d}`,a);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}var ee=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(ee||{}),Ws=(n=>(n.Info="info",n.Error="error",n.Success="success",n.Warning="warning",n))(Ws||{}),Y=(n=>(n.toastAdd="studio:toastAdd",n.dialogOpen="studio:dialogOpen",n.dialogClose="studio:dialogClose",n.sidebarLeftSet="studio:sidebarLeft:set",n.sidebarLeftGet="studio:sidebarLeft:get",n.sidebarLeftToggle="studio:sidebarLeft:toggle",n.sidebarRightSet="studio:sidebarRight:set",n.sidebarRightGet="studio:sidebarRight:get",n.sidebarRightToggle="studio:sidebarRight:toggle",n.sidebarTopSet="studio:sidebarTop:set",n.sidebarTopGet="studio:sidebarTop:get",n.sidebarTopToggle="studio:sidebarTop:toggle",n.sidebarBottomSet="studio:sidebarBottom:set",n.sidebarBottomGet="studio:sidebarBottom:get",n.sidebarBottomToggle="studio:sidebarBottom:toggle",n.symbolAdd="studio:symbolAdd",n.symbolDetach="studio:symbolDetach",n.symbolOverride="studio:symbolOverride",n.symbolPropagateStyles="studio:propagateStyles",n.getPagesConfig="studio:getPagesConfig",n.setPagesConfig="studio:setPagesConfig",n.getPageSettings="studio:getPageSettings",n.setPageSettings="studio:setPageSettings",n.projectFiles="studio:projectFiles",n.canvasReload="studio:canvasReload",n.getBlocksPanel="studio:getBlocksPanel",n.setBlocksPanel="studio:setBlocksPanel",n.getStateContextMenu="studio:getStateContextMenu",n.setStateContextMenu="studio:setStateContextMenu",n.contextMenuComponent="studio:contextMenuComponent",n.layoutAdd="studio:layoutAdd",n.layoutRemove="studio:layoutRemove",n.layoutToggle="studio:layoutToggle",n.getStateTheme="studio:getStateTheme",n.setStateTheme="studio:setStateTheme",n.assetProviderGet="studio:assetProviderGet",n.assetProviderAdd="studio:assetProviderAdd",n.assetProviderRemove="studio:assetProviderRemove",n))(Y||{}),_s=(n=>(n.dark="dark",n.light="light",n.auto="auto",n))(_s||{});const Zo={[ee.free]:0,[ee.startup]:10,[ee.business]:20,[ee.enterprise]:30};function cc(n){const e=n;return e.init=t=>i=>n(i,t),e}const Me=n=>cc(n);async function Ae({editor:n,plan:e,pluginName:t,licenseKey:i,cleanup:o}){let r="",s=!1;const l=rc(),a=d=>{console.warn("Cleanup plugin:",t,"Reason:",d),o()},c=(d={})=>{var m;const{error:h,sdkLicense:u}=d,f=(m=d.plan)==null?void 0:m.category;if(!(u||d.license)||h)a(h||"Invalid license");else if(f){const g=Zo[e],y=Zo[f];g>y&&a({pluginRequiredPlan:e,licensePlan:f})}};n.on(tc,d=>{r=d==null?void 0:d.baseApiUrl,s=!0}),n.on(nc,d=>{c(d)}),setTimeout(async()=>{if(!s){if(l)return;if(i){const d=await dc({licenseKey:i,pluginName:t,baseApiUrl:r});d&&c(d)}else a("The `licenseKey` option not provided")}},2e3)}async function dc(n){const{licenseKey:e,pluginName:t,baseApiUrl:i}=n;try{return(await ac({baseApiUrl:i,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const zn=(n,e)=>{var t;return!!((t=n==null?void 0:n.hasAttribute)!=null&&t.call(n,e))},mt=(n,e)=>{var t;return!!((t=n==null?void 0:n.classList)!=null&&t.contains(e))},hc=(n,e={})=>{var r;const t={},i=[],o=[];for(const s in n){const{value:l,...a}=n[s];i.push({id:s,name:s,changeProp:!0,category:e.category,...a}),t[s]=l,!lc(l)&&o.push(s);const{subTraits:c={}}=a;for(const d in a.subTraits)(r=c[d])==null||r.forEach(h=>{const u=h.id||h.name;t[u]=h.value})}return{propKeys:Object.keys(t),propsNoValues:o,props:t,traits:i}},uc=(n,e)=>{e.forEach(t=>{if(t.subTraits){const i=`${t.id||t.name}`,o=t.changeProp?`change:${i}`:`change:attributes:${i}`;n.on(o,()=>Yo(n,i)),Yo(n,i)}})},Yo=(n,e)=>{const t=n.getTrait(e),i=t.get("category"),o=t.get("subTraits")||{},s=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(s);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:i,...c})),{at:a})},fc=(n,e)=>{e.forEach(t=>{const i=sc(t);i!==t&&n.has(i)&&n.set({[t]:n.get(i),[i]:void 0})})},Gi="gjs-plg-",Xo=(...n)=>n.map(e=>`[data-gjs-type="${e}"]`).join(","),pc="dialogComponent",mc=function(n,e={}){const{Blocks:t,Components:i}=n,{licenseKey:o}=e,r="gjs-plg-dialog",s="gjs-plg-dialog-overlay",l="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",d="gjs-plg-dialog-body",h="gjs-plg-dialog-description",u="gjs-plg-dialog-placeholder";t.add(r,{label:"Dialog",media:`
2
2
  <svg viewBox="0 0 24 24">
3
3
  <path d="M4 4h16v10H8l-4 4V4z"></path>
4
4
  </svg>
5
- `,category:"Extra",content:{type:i},activate:!0,...e.block}),r.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:s},{type:f}],draggable:Nh("wrapper"),droppable:Nh(i),styles:`
6
- .${i} {
5
+ `,category:"Extra",content:{type:r},activate:!0,...e.block}),i.addType(r,{model:{defaults:{tagName:"div",attributes:{class:r,"data-type-role":r},components:[{type:s},{type:u}],draggable:Xo("wrapper"),droppable:Xo(r),styles:`
6
+ .${r} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
10
- `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(g){var b;(b=g.getSelected())==null||b.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(g){const b=this;function v(C){const x=b.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),E=b.querySelector('[data-type-role="gjs-plg-dialog-close"]');function _(){x.style.display="none"}C?(b._onCloseWhenPressingX=_,E.addEventListener("click",b._onCloseWhenPressingX)):(E.removeEventListener("click",b._onCloseWhenPressingX),b._onCloseWhenPressingX=null)}function y(C){const x=b.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(_){_.key==="Escape"&&(x.style.display="none")}C?(b._onCloseWhenPressingEsc=E,b.addEventListener("keydown",b._onCloseWhenPressingEsc)):(b.removeEventListener("keydown",b._onCloseWhenPressingEsc),b._onCloseWhenPressingEsc=null)}function w(C){const x=b.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(){x.style.display="flex"}C?(b._onOpenWhenLeavingWindow=E,document.addEventListener("mouseleave",b._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",b._onOpenWhenLeavingWindow),b._onOpenWhenLeavingWindow=null)}function S(C){const x=b.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(){const _=document.documentElement.scrollTop;C&&_>=Number(C)&&(x.style.display="flex")}C?(b._onOpenWhenScrollingToLevel=E,document.addEventListener("scroll",b._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",b._onOpenWhenScrollingToLevel),b._onOpenWhenScrollingToLevel=null)}v(g.closeWhenPressingX),y(g.closeWhenPressingEsc),w(g.openWhenLeavingWindow),S(g.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const b=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');b.style.display="flex"})}},view:{onActive(){const g=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');g.style.display="flex"}}}),r.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:{type:l},droppable:!1,draggable:!1,styles:`
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(p){var m;(m=p.getSelected())==null||m.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(p){const m=this;function g(S){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),k=m.querySelector('[data-type-role="gjs-plg-dialog-close"]');function A(){v.style.display="none"}S?(m._onCloseWhenPressingX=A,k.addEventListener("click",m._onCloseWhenPressingX)):(k.removeEventListener("click",m._onCloseWhenPressingX),m._onCloseWhenPressingX=null)}function y(S){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(A){A.key==="Escape"&&(v.style.display="none")}S?(m._onCloseWhenPressingEsc=k,m.addEventListener("keydown",m._onCloseWhenPressingEsc)):(m.removeEventListener("keydown",m._onCloseWhenPressingEsc),m._onCloseWhenPressingEsc=null)}function x(S){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(){v.style.display="flex"}S?(m._onOpenWhenLeavingWindow=k,document.addEventListener("mouseleave",m._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",m._onOpenWhenLeavingWindow),m._onOpenWhenLeavingWindow=null)}function b(S){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(){const A=document.documentElement.scrollTop;S&&A>=Number(S)&&(v.style.display="flex")}S?(m._onOpenWhenScrollingToLevel=k,document.addEventListener("scroll",m._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",m._onOpenWhenScrollingToLevel),m._onOpenWhenScrollingToLevel=null)}g(p.closeWhenPressingX),y(p.closeWhenPressingEsc),x(p.openWhenLeavingWindow),b(p.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const m=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');m.style.display="flex"})}},view:{onActive(){const p=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');p.style.display="flex"}}}),i.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:{type:l},droppable:!1,draggable:!1,styles:`
11
11
  .${s} {
12
12
  position: fixed;
13
13
  top: 0;
@@ -19,7 +19,7 @@
19
19
  justify-content: center;
20
20
  background-color: rgba(0, 0, 0, 0.5);
21
21
  }
22
- `}}}),r.addType(l,{model:{defaults:{tagName:"div",attributes:{class:l,"data-type-role":l},components:[{type:a},{type:c},{type:u}],droppable:!1,draggable:!1,styles:`
22
+ `}}}),i.addType(l,{model:{defaults:{tagName:"div",attributes:{class:l,"data-type-role":l},components:[{type:a},{type:c},{type:d}],droppable:!1,draggable:!1,styles:`
23
23
  .${l} {
24
24
  position: relative;
25
25
  background-color: #fff;
@@ -30,7 +30,7 @@
30
30
  height: 600px;
31
31
  box-sizing: border-box;
32
32
  }
33
- `}}}),r.addType(a,{model:{defaults:{tagName:"button",attributes:{class:a,"data-type-role":a},components:"&times;",droppable:!1,draggable:!1,styles:`
33
+ `}}}),i.addType(a,{model:{defaults:{tagName:"button",attributes:{class:a,"data-type-role":a},components:"&times;",droppable:!1,draggable:!1,styles:`
34
34
  .${a} {
35
35
  position: absolute;
36
36
  top: 10px;
@@ -42,270 +42,38 @@
42
42
  font-size: 20px;
43
43
  cursor: pointer;
44
44
  }
45
- `}}}),r.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
45
+ `}}}),i.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
46
  .${c} {
47
47
  margin: 0;
48
48
  padding: 0 40px 20px 0;
49
49
  }
50
- `}}}),r.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:d}],styles:`
51
- .${u} {
50
+ `}}}),i.addType(d,{model:{defaults:{tagName:"div",attributes:{class:d,"data-type-role":d},components:[{type:h}],styles:`
51
+ .${d} {
52
52
  height: 90%;
53
53
  overflow: auto;
54
54
  }
55
- `}}}),r.addType(d,{model:{defaults:{tagName:"p",attributes:{class:d,"data-type-role":d},components:"This is a customizable dialog!",editable:!0,styles:`
56
- .${d} {
55
+ `}}}),i.addType(h,{model:{defaults:{tagName:"p",attributes:{class:h,"data-type-role":h},components:"This is a customizable dialog!",editable:!0,styles:`
56
+ .${h} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),r.addType(f,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:f,"data-type-role":f},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:g,el:b}=this,v="core:preview",y=g.Commands.events;this.listenTo(g,`${y.runCommand}${v}`,()=>{b.style.display="none"}),this.listenTo(g,`${y.stopCommand}${v}`,()=>{b.style.display=""})}}}),wr({editor:t,licenseKey:o,plan:Ht.startup,pluginName:N2,cleanup:()=>{n.remove(i),r.removeType(i)}})},D2=xr(P2);var vt=(t=>(t.toastAdd="studio:toastAdd",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.projectFiles="studio:projectFiles",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t))(vt||{}),S0=(t=>(t.layoutToggleId="studio:layoutToggle:",t.toggleBlocksPanel="studio:toggleBlocksPanel",t.pageSettingsUpdate="studio:pageSettingsUpdate",t))(S0||{});function Xf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Id={exports:{}},ks={};/**
60
- * @license React
61
- * react-jsx-runtime.production.min.js
62
- *
63
- * Copyright (c) Facebook, Inc. and its affiliates.
64
- *
65
- * This source code is licensed under the MIT license found in the
66
- * LICENSE file in the root directory of this source tree.
67
- */var Ph;function L2(){if(Ph)return ks;Ph=1;var t=m,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(l,a,c){var u,d={},f=null,p=null;c!==void 0&&(f=""+c),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(p=a.ref);for(u in a)r.call(a,u)&&!i.hasOwnProperty(u)&&(d[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)d[u]===void 0&&(d[u]=a[u]);return{$$typeof:e,type:l,key:f,ref:p,props:d,_owner:o.current}}return ks.Fragment=n,ks.jsx=s,ks.jsxs=s,ks}var Ts={},Dh;function V2(){if(Dh)return Ts;Dh=1;var t={};/**
68
- * @license React
69
- * react-jsx-runtime.development.js
70
- *
71
- * Copyright (c) Facebook, Inc. and its affiliates.
72
- *
73
- * This source code is licensed under the MIT license found in the
74
- * LICENSE file in the root directory of this source tree.
75
- */return t.NODE_ENV!=="production"&&function(){var e=m,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),b=Symbol.iterator,v="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var Z=b&&O[b]||O[v];return typeof Z=="function"?Z:null}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(O){{for(var Z=arguments.length,le=new Array(Z>1?Z-1:0),ye=1;ye<Z;ye++)le[ye-1]=arguments[ye];C("error",O,le)}}function C(O,Z,le){{var ye=w.ReactDebugCurrentFrame,$e=ye.getStackAddendum();$e!==""&&(Z+="%s",le=le.concat([$e]));var Ge=le.map(function(je){return String(je)});Ge.unshift("Warning: "+Z),Function.prototype.apply.call(console[O],console,Ge)}}var x=!1,E=!1,_=!1,M=!1,k=!1,j;j=Symbol.for("react.module.reference");function N(O){return!!(typeof O=="string"||typeof O=="function"||O===o||O===s||k||O===i||O===u||O===d||M||O===g||x||E||_||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===f||O.$$typeof===l||O.$$typeof===a||O.$$typeof===c||O.$$typeof===j||O.getModuleId!==void 0))}function P(O,Z,le){var ye=O.displayName;if(ye)return ye;var $e=Z.displayName||Z.name||"";return $e!==""?le+"("+$e+")":le}function z(O){return O.displayName||"Context"}function W(O){if(O==null)return null;if(typeof O.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case o:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case a:var Z=O;return z(Z)+".Consumer";case l:var le=O;return z(le._context)+".Provider";case c:return P(O,O.render,"ForwardRef");case f:var ye=O.displayName||null;return ye!==null?ye:W(O.type)||"Memo";case p:{var $e=O,Ge=$e._payload,je=$e._init;try{return W(je(Ge))}catch{return null}}}return null}var F=Object.assign,$=0,J,ee,L,I,A,R,q;function D(){}D.__reactDisabledLog=!0;function V(){{if($===0){J=console.log,ee=console.info,L=console.warn,I=console.error,A=console.group,R=console.groupCollapsed,q=console.groupEnd;var O={configurable:!0,enumerable:!0,value:D,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}$++}}function te(){{if($--,$===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},O,{value:J}),info:F({},O,{value:ee}),warn:F({},O,{value:L}),error:F({},O,{value:I}),group:F({},O,{value:A}),groupCollapsed:F({},O,{value:R}),groupEnd:F({},O,{value:q})})}$<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=w.ReactCurrentDispatcher,Q;function se(O,Z,le){{if(Q===void 0)try{throw Error()}catch($e){var ye=$e.stack.trim().match(/\n( *(at )?)/);Q=ye&&ye[1]||""}return`
76
- `+Q+O}}var be=!1,de;{var Pe=typeof WeakMap=="function"?WeakMap:Map;de=new Pe}function X(O,Z){if(!O||be)return"";{var le=de.get(O);if(le!==void 0)return le}var ye;be=!0;var $e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ge;Ge=G.current,G.current=null,V();try{if(Z){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(Gt){ye=Gt}Reflect.construct(O,[],je)}else{try{je.call()}catch(Gt){ye=Gt}O.call(je.prototype)}}else{try{throw Error()}catch(Gt){ye=Gt}O()}}catch(Gt){if(Gt&&ye&&typeof Gt.stack=="string"){for(var Ae=Gt.stack.split(`
77
- `),It=ye.stack.split(`
78
- `),ct=Ae.length-1,pt=It.length-1;ct>=1&&pt>=0&&Ae[ct]!==It[pt];)pt--;for(;ct>=1&&pt>=0;ct--,pt--)if(Ae[ct]!==It[pt]){if(ct!==1||pt!==1)do if(ct--,pt--,pt<0||Ae[ct]!==It[pt]){var Cn=`
79
- `+Ae[ct].replace(" at new "," at ");return O.displayName&&Cn.includes("<anonymous>")&&(Cn=Cn.replace("<anonymous>",O.displayName)),typeof O=="function"&&de.set(O,Cn),Cn}while(ct>=1&&pt>=0);break}}}finally{be=!1,G.current=Ge,te(),Error.prepareStackTrace=$e}var Si=O?O.displayName||O.name:"",Do=Si?se(Si):"";return typeof O=="function"&&de.set(O,Do),Do}function qe(O,Z,le){return X(O,!1)}function Qe(O){var Z=O.prototype;return!!(Z&&Z.isReactComponent)}function at(O,Z,le){if(O==null)return"";if(typeof O=="function")return X(O,Qe(O));if(typeof O=="string")return se(O);switch(O){case u:return se("Suspense");case d:return se("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case c:return qe(O.render);case f:return at(O.type,Z,le);case p:{var ye=O,$e=ye._payload,Ge=ye._init;try{return at(Ge($e),Z,le)}catch{}}}return""}var xt=Object.prototype.hasOwnProperty,wt={},rn=w.ReactDebugCurrentFrame;function Le(O){if(O){var Z=O._owner,le=at(O.type,O._source,Z?Z.type:null);rn.setExtraStackFrame(le)}else rn.setExtraStackFrame(null)}function ot(O,Z,le,ye,$e){{var Ge=Function.call.bind(xt);for(var je in O)if(Ge(O,je)){var Ae=void 0;try{if(typeof O[je]!="function"){var It=Error((ye||"React class")+": "+le+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw It.name="Invariant Violation",It}Ae=O[je](Z,je,ye,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ct){Ae=ct}Ae&&!(Ae instanceof Error)&&(Le($e),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ye||"React class",le,je,typeof Ae),Le(null)),Ae instanceof Error&&!(Ae.message in wt)&&(wt[Ae.message]=!0,Le($e),S("Failed %s type: %s",le,Ae.message),Le(null))}}}var T=Array.isArray;function re(O){return T(O)}function ie(O){{var Z=typeof Symbol=="function"&&Symbol.toStringTag,le=Z&&O[Symbol.toStringTag]||O.constructor.name||"Object";return le}}function Ce(O){try{return Xe(O),!1}catch{return!0}}function Xe(O){return""+O}function Te(O){if(Ce(O))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ie(O)),Xe(O)}var me=w.ReactCurrentOwner,on={key:!0,ref:!0,__self:!0,__source:!0},yn,ft,Ut;Ut={};function Sr(O){if(xt.call(O,"ref")){var Z=Object.getOwnPropertyDescriptor(O,"ref").get;if(Z&&Z.isReactWarning)return!1}return O.ref!==void 0}function xn(O){if(xt.call(O,"key")){var Z=Object.getOwnPropertyDescriptor(O,"key").get;if(Z&&Z.isReactWarning)return!1}return O.key!==void 0}function it(O,Z){if(typeof O.ref=="string"&&me.current&&Z&&me.current.stateNode!==Z){var le=W(me.current.type);Ut[le]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',W(me.current.type),O.ref),Ut[le]=!0)}}function et(O,Z){{var le=function(){yn||(yn=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Z))};le.isReactWarning=!0,Object.defineProperty(O,"key",{get:le,configurable:!0})}}function Rt(O,Z){{var le=function(){ft||(ft=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Z))};le.isReactWarning=!0,Object.defineProperty(O,"ref",{get:le,configurable:!0})}}var wn=function(O,Z,le,ye,$e,Ge,je){var Ae={$$typeof:n,type:O,key:Z,ref:le,props:je,_owner:Ge};return Ae._store={},Object.defineProperty(Ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(Ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:$e}),Object.freeze&&(Object.freeze(Ae.props),Object.freeze(Ae)),Ae};function qt(O,Z,le,ye,$e){{var Ge,je={},Ae=null,It=null;le!==void 0&&(Te(le),Ae=""+le),xn(Z)&&(Te(Z.key),Ae=""+Z.key),Sr(Z)&&(It=Z.ref,it(Z,$e));for(Ge in Z)xt.call(Z,Ge)&&!on.hasOwnProperty(Ge)&&(je[Ge]=Z[Ge]);if(O&&O.defaultProps){var ct=O.defaultProps;for(Ge in ct)je[Ge]===void 0&&(je[Ge]=ct[Ge])}if(Ae||It){var pt=typeof O=="function"?O.displayName||O.name||"Unknown":O;Ae&&et(je,pt),It&&Rt(je,pt)}return wn(O,Ae,It,$e,ye,me.current,je)}}var Cr=w.ReactCurrentOwner,Vt=w.ReactDebugCurrentFrame;function Sn(O){if(O){var Z=O._owner,le=at(O.type,O._source,Z?Z.type:null);Vt.setExtraStackFrame(le)}else Vt.setExtraStackFrame(null)}var Er;Er=!1;function Kr(O){return typeof O=="object"&&O!==null&&O.$$typeof===n}function Yr(){{if(Cr.current){var O=W(Cr.current.type);if(O)return`
80
-
81
- Check the render method of \``+O+"`."}return""}}function Jr(O){return""}var Po={};function Gl(O){{var Z=Yr();if(!Z){var le=typeof O=="string"?O:O.displayName||O.name;le&&(Z=`
82
-
83
- Check the top-level render call using <`+le+">.")}return Z}}function _s(O,Z){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=Gl(Z);if(Po[le])return;Po[le]=!0;var ye="";O&&O._owner&&O._owner!==Cr.current&&(ye=" It was passed a child from "+W(O._owner.type)+"."),Sn(O),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,ye),Sn(null)}}function kh(O,Z){{if(typeof O!="object")return;if(re(O))for(var le=0;le<O.length;le++){var ye=O[le];Kr(ye)&&_s(ye,Z)}else if(Kr(O))O._store&&(O._store.validated=!0);else if(O){var $e=y(O);if(typeof $e=="function"&&$e!==O.entries)for(var Ge=$e.call(O),je;!(je=Ge.next()).done;)Kr(je.value)&&_s(je.value,Z)}}}function c2(O){{var Z=O.type;if(Z==null||typeof Z=="string")return;var le;if(typeof Z=="function")le=Z.propTypes;else if(typeof Z=="object"&&(Z.$$typeof===c||Z.$$typeof===f))le=Z.propTypes;else return;if(le){var ye=W(Z);ot(le,O.props,"prop",ye,O)}else if(Z.PropTypes!==void 0&&!Er){Er=!0;var $e=W(Z);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",$e||"Unknown")}typeof Z.getDefaultProps=="function"&&!Z.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function u2(O){{for(var Z=Object.keys(O.props),le=0;le<Z.length;le++){var ye=Z[le];if(ye!=="children"&&ye!=="key"){Sn(O),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),Sn(null);break}}O.ref!==null&&(Sn(O),S("Invalid attribute `ref` supplied to `React.Fragment`."),Sn(null))}}var Th={};function Ah(O,Z,le,ye,$e,Ge){{var je=N(O);if(!je){var Ae="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var It=Jr();It?Ae+=It:Ae+=Yr();var ct;O===null?ct="null":re(O)?ct="array":O!==void 0&&O.$$typeof===n?(ct="<"+(W(O.type)||"Unknown")+" />",Ae=" Did you accidentally export a JSX literal instead of a component?"):ct=typeof O,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ct,Ae)}var pt=qt(O,Z,le,$e,Ge);if(pt==null)return pt;if(je){var Cn=Z.children;if(Cn!==void 0)if(ye)if(re(Cn)){for(var Si=0;Si<Cn.length;Si++)kh(Cn[Si],O);Object.freeze&&Object.freeze(Cn)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else kh(Cn,O)}if(xt.call(Z,"key")){var Do=W(O),Gt=Object.keys(Z).filter(function(m2){return m2!=="key"}),yu=Gt.length>0?"{key: someKey, "+Gt.join(": ..., ")+": ...}":"{key: someKey}";if(!Th[Do+yu]){var g2=Gt.length>0?"{"+Gt.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
84
- let props = %s;
85
- <%s {...props} />
86
- React keys must be passed directly to JSX without using spread:
87
- let props = %s;
88
- <%s key={someKey} {...props} />`,yu,Do,g2,Do),Th[Do+yu]=!0}}return O===o?u2(pt):c2(pt),pt}}function d2(O,Z,le){return Ah(O,Z,le,!0)}function f2(O,Z,le){return Ah(O,Z,le,!1)}var p2=f2,h2=d2;Ts.Fragment=o,Ts.jsx=p2,Ts.jsxs=h2}(),Ts}var I2={};I2.NODE_ENV==="production"?Id.exports=L2():Id.exports=V2();var h=Id.exports;const C0=new Set,fn=new WeakMap,Hi=new WeakMap,oi=new WeakMap,$d=new WeakMap,$2=new WeakMap,Ki=new WeakMap,Ua=new WeakMap;let wo;const Wo="__aa_tgt",Hd="__aa_del",H2=t=>{const e=U2(t);e&&e.forEach(n=>q2(n))},B2=t=>{t.forEach(e=>{e.target===wo&&F2(),fn.has(e.target)&&mi(e.target)})};function z2(t){const e=$d.get(t);e==null||e.disconnect();let n=fn.get(t),r=0;const o=5;n||(n=Yi(t),fn.set(t,n));const{offsetWidth:i,offsetHeight:s}=wo,a=[n.top-o,i-(n.left+o+n.width),s-(n.top+o+n.height),n.left-o].map(u=>`${-1*Math.floor(u)}px`).join(" "),c=new IntersectionObserver(()=>{++r>1&&mi(t)},{root:wo,threshold:1,rootMargin:a});c.observe(t),$d.set(t,c)}function mi(t){clearTimeout(Ua.get(t));const e=Ac(t),n=typeof e=="function"?500:e.duration;Ua.set(t,setTimeout(()=>{const r=oi.get(t);(!r||r.finished)&&(fn.set(t,Yi(t)),z2(t))},n))}function F2(){clearTimeout(Ua.get(wo)),Ua.set(wo,setTimeout(()=>{C0.forEach(t=>_0(t,e=>E0(()=>mi(e))))},100))}function W2(t){setTimeout(()=>{$2.set(t,setInterval(()=>E0(mi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function E0(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Bd,Ri;typeof window<"u"&&(wo=document.documentElement,Bd=new MutationObserver(H2),Ri=new ResizeObserver(B2),Ri.observe(wo));function U2(t){return t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(xu(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const o=n.target.children.item(r);if(o){if(Hd in o)return!1;xu(n.target,o),e.add(o)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const o=n.removedNodes[r];if(Hd in o)return!1;o instanceof Element&&(e.add(o),xu(n.target,o),Hi.set(o,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function xu(t,e){!e&&!(Wo in t)?Object.defineProperty(t,Wo,{value:t}):e&&!(Wo in e)&&Object.defineProperty(e,Wo,{value:t})}function q2(t){var e;const n=wo.contains(t),r=fn.has(t);n&&Hi.has(t)&&Hi.delete(t),oi.has(t)&&((e=oi.get(t))===null||e===void 0||e.cancel()),r&&n?G2(t):r&&!n?Y2(t):K2(t)}function tr(t){return Number(t.replace(/[^0-9.\-]/g,""))}function Yi(t){const e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height}}function O0(t,e,n){let r=e.width,o=e.height,i=n.width,s=n.height;const l=getComputedStyle(t);if(l.getPropertyValue("box-sizing")==="content-box"){const c=tr(l.paddingTop)+tr(l.paddingBottom)+tr(l.borderTopWidth)+tr(l.borderBottomWidth),u=tr(l.paddingLeft)+tr(l.paddingRight)+tr(l.borderRightWidth)+tr(l.borderLeftWidth);r-=u,i-=u,o-=c,s-=c}return[r,i,o,s].map(Math.round)}function Ac(t){return Wo in t&&Ki.has(t[Wo])?Ki.get(t[Wo]):{duration:250,easing:"ease-in-out"}}function _0(t,...e){e.forEach(n=>n(t,Ki.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(o=>o(r,Ki.has(r)))}}function G2(t){const e=fn.get(t),n=Yi(t);let r;if(!e)return;const o=Ac(t);if(typeof o!="function"){const i=e.left-n.left,s=e.top-n.top,[l,a,c,u]=O0(t,e,n),d={transform:`translate(${i}px, ${s}px)`},f={transform:"translate(0, 0)"};l!==a&&(d.width=`${l}px`,f.width=`${a}px`),c!==u&&(d.height=`${c}px`,f.height=`${u}px`),r=t.animate([d,f],o)}else r=new Animation(o(t,"remain",e,n)),r.play();oi.set(t,r),fn.set(t,n),r.addEventListener("finish",mi.bind(null,t))}function K2(t){const e=Yi(t);fn.set(t,e);const n=Ac(t);let r;typeof n!="function"?r=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(r=new Animation(n(t,"add",e)),r.play()),oi.set(t,r),r.addEventListener("finish",mi.bind(null,t))}function Y2(t){if(!Hi.has(t)||!fn.has(t))return;const[e,n]=Hi.get(t);Object.defineProperty(t,Hd,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(t,n):e&&e.parentNode&&e.parentNode.appendChild(t);const[r,o,i,s]=J2(t),l=Ac(t),a=fn.get(t);let c;Object.assign(t.style,{position:"absolute",top:`${r}px`,left:`${o}px`,width:`${i}px`,height:`${s}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof l!="function"?c=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:l.duration,easing:"ease-out"}):(c=new Animation(l(t,"remove",a)),c.play()),oi.set(t,c),c.addEventListener("finish",()=>{var u;t.remove(),fn.delete(t),Hi.delete(t),oi.delete(t),(u=$d.get(t))===null||u===void 0||u.disconnect()})}function J2(t){const e=fn.get(t),[n,,r]=O0(t,e,Yi(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const i=getComputedStyle(o),s=fn.get(o)||Yi(o),l=Math.round(e.top-s.top)-tr(i.borderTopWidth),a=Math.round(e.left-s.left)-tr(i.borderLeftWidth);return[l,a,n,r]}function Z2(t,e={}){Bd&&Ri&&(getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),_0(t,mi,W2,n=>Ri==null?void 0:Ri.observe(n)),typeof e=="function"?Ki.set(t,e):Ki.set(t,{duration:250,easing:"ease-in-out",...e}),Bd.observe(t,{childList:!0}),C0.add(t))}function X2(t){const e=m.useRef(null);return m.useEffect(()=>{e.current instanceof HTMLElement&&Z2(e.current,t)},[e]),e}var H={},Q2={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,n){return"Cannot apply '"+e+"' to '"+n.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,n){return"[mobx.array] Index out of bounds, "+e+" is larger than "+n},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,n){return"the entry '"+e+"' does not exist in the observable map '"+n+"'"},26:"please specify a property",27:function(e,n){return"no observable property '"+e.toString()+"' found on the observable object '"+n+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,n){return"Cycle detected in computation "+e+": "+n},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},ew=H.NODE_ENV!=="production"?Q2:{};function ce(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(H.NODE_ENV!=="production"){var o=typeof t=="string"?t:ew[t];throw typeof o=="function"&&(o=o.apply(null,n)),new Error("[MobX] "+o)}throw new Error(typeof t=="number"?"[MobX] minified error nr: "+t+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+t)}var tw={};function Mc(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:tw}var k0=Object.assign,qa=Object.getOwnPropertyDescriptor,cr=Object.defineProperty,jc=Object.prototype,Ga=[];Object.freeze(Ga);var T0={};Object.freeze(T0);var nw=typeof Proxy<"u",rw=Object.toString();function A0(){nw||ce(H.NODE_ENV!=="production"?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function As(t){H.NODE_ENV!=="production"&&Y.verifyProxies&&ce("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+t)}function Zn(){return++Y.mobxGuid}function Qf(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var Ni=function(){};function yt(t){return typeof t=="function"}function ii(t){var e=typeof t;switch(e){case"string":case"symbol":case"number":return!0}return!1}function Rc(t){return t!==null&&typeof t=="object"}function hr(t){if(!Rc(t))return!1;var e=Object.getPrototypeOf(t);if(e==null)return!0;var n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n.toString()===rw}function M0(t){var e=t==null?void 0:t.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function Nc(t,e,n){cr(t,e,{enumerable:!1,writable:!0,configurable:!0,value:n})}function j0(t,e,n){cr(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function bi(t,e){var n="isMobX"+t;return e.prototype[n]=!0,function(r){return Rc(r)&&r[n]===!0}}function ps(t){return t!=null&&Object.prototype.toString.call(t)==="[object Map]"}function ow(t){var e=Object.getPrototypeOf(t),n=Object.getPrototypeOf(e),r=Object.getPrototypeOf(n);return r===null}function Nr(t){return t!=null&&Object.prototype.toString.call(t)==="[object Set]"}var R0=typeof Object.getOwnPropertySymbols<"u";function iw(t){var e=Object.keys(t);if(!R0)return e;var n=Object.getOwnPropertySymbols(t);return n.length?[].concat(e,n.filter(function(r){return jc.propertyIsEnumerable.call(t,r)})):e}var Pc=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:R0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function zd(t){return typeof t=="string"?t:typeof t=="symbol"?t.toString():new String(t).toString()}function N0(t){return t===null?null:typeof t=="object"?""+t:t}function Dn(t,e){return jc.hasOwnProperty.call(t,e)}var sw=Object.getOwnPropertyDescriptors||function(e){var n={};return Pc(e).forEach(function(r){n[r]=qa(e,r)}),n};function ln(t,e){return!!(t&e)}function an(t,e,n){return n?t|=e:t&=~e,t}function Lh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function lw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,cw(r.key),r)}}function hs(t,e,n){return e&&lw(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pi(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=uw(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
89
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hr(){return Hr=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hr.apply(null,arguments)}function P0(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Fd(t,e)}function Fd(t,e){return Fd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Fd(t,e)}function aw(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function cw(t){var e=aw(t,"string");return typeof e=="symbol"?e:e+""}function uw(t,e){if(t){if(typeof t=="string")return Lh(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lh(t,e):void 0}}var Kt=Symbol("mobx-stored-annotations");function ur(t){function e(n,r){if(_l(r))return t.decorate_20223_(n,r);Ol(n,r,t)}return Object.assign(e,t)}function Ol(t,e,n){if(Dn(t,Kt)||Nc(t,Kt,Hr({},t[Kt])),H.NODE_ENV!=="production"&&Ya(n)&&!Dn(t[Kt],e)){var r=t.constructor.name+".prototype."+e.toString();ce("'"+r+"' is decorated with 'override', but no such decorated member was found on prototype.")}dw(t,n,e),Ya(n)||(t[Kt][e]=n)}function dw(t,e,n){if(H.NODE_ENV!=="production"&&!Ya(e)&&Dn(t[Kt],n)){var r=t.constructor.name+".prototype."+n.toString(),o=t[Kt][n].annotationType_,i=e.annotationType_;ce("Cannot apply '@"+i+"' to '"+r+"':"+(`
90
- The field is already decorated with '@`+o+"'.")+`
91
- Re-decorating fields is not allowed.
92
- Use '@override' decorator for methods overridden by subclass.`)}}function fw(t){return Dn(t,Kt)||Nc(t,Kt,Hr({},t[Kt])),t[Kt]}function _l(t){return typeof t=="object"&&typeof t.kind=="string"}function Dc(t,e){H.NODE_ENV!=="production"&&!e.includes(t.kind)&&ce("The decorator applied to '"+String(t.name)+"' cannot be used on a "+t.kind+" element")}var xe=Symbol("mobx administration"),ko=function(){function t(n){n===void 0&&(n=H.NODE_ENV!=="production"?"Atom@"+Zn():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Ve.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var e=t.prototype;return e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},e.reportObserved=function(){return J0(this)},e.reportChanged=function(){Rn(),Z0(this),Nn()},e.toString=function(){return this.name_},hs(t,[{key:"isBeingObserved",get:function(){return ln(this.flags_,t.isBeingObservedMask_)},set:function(r){this.flags_=an(this.flags_,t.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return ln(this.flags_,t.isPendingUnobservationMask_)},set:function(r){this.flags_=an(this.flags_,t.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return ln(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=an(this.flags_,t.diffValueMask_,r===1)}}])}();ko.isBeingObservedMask_=1;ko.isPendingUnobservationMask_=2;ko.diffValueMask_=4;var ep=bi("Atom",ko);function D0(t,e,n){e===void 0&&(e=Ni),n===void 0&&(n=Ni);var r=new ko(t);return e!==Ni&&_S(r,e),n!==Ni&&rb(r,n),r}function pw(t,e){return t===e}function hw(t,e){return ap(t,e)}function gw(t,e){return ap(t,e,1)}function mw(t,e){return Object.is?Object.is(t,e):t===e?t!==0||1/t===1/e:t!==t&&e!==e}var Ka={identity:pw,structural:hw,default:mw,shallow:gw};function si(t,e,n){return cl(t)?t:Array.isArray(t)?Tt.array(t,{name:n}):hr(t)?Tt.object(t,void 0,{name:n}):ps(t)?Tt.map(t,{name:n}):Nr(t)?Tt.set(t,{name:n}):typeof t=="function"&&!Ji(t)&&!al(t)?M0(t)?Zi(t):ll(n,t):t}function bw(t,e,n){if(t==null||Ml(t)||Hc(t)||To(t)||or(t))return t;if(Array.isArray(t))return Tt.array(t,{name:n,deep:!1});if(hr(t))return Tt.object(t,void 0,{name:n,deep:!1});if(ps(t))return Tt.map(t,{name:n,deep:!1});if(Nr(t))return Tt.set(t,{name:n,deep:!1});H.NODE_ENV!=="production"&&ce("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Lc(t){return t}function vw(t,e){return H.NODE_ENV!=="production"&&cl(t)&&ce("observable.struct should not be used with observable values"),ap(t,e)?e:t}var yw="override";function Ya(t){return t.annotationType_===yw}function kl(t,e){return{annotationType_:t,options_:e,make_:xw,extend_:ww,decorate_20223_:Sw}}function xw(t,e,n,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(t,e,n,!1)===null?0:1;if(r===t.target_)return this.extend_(t,e,n,!1)===null?0:2;if(Ji(n.value))return 1;var i=L0(t,this,e,n,!1);return cr(r,e,i),2}function ww(t,e,n,r){var o=L0(t,this,e,n);return t.defineProperty_(e,o,r)}function Sw(t,e){H.NODE_ENV!=="production"&&Dc(e,["method","field"]);var n=e.kind,r=e.name,o=e.addInitializer,i=this,s=function(c){var u,d,f,p;return li((u=(d=i.options_)==null?void 0:d.name)!=null?u:r.toString(),c,(f=(p=i.options_)==null?void 0:p.autoAction)!=null?f:!1)};if(n=="field")return function(a){var c,u=a;return Ji(u)||(u=s(u)),(c=i.options_)!=null&&c.bound&&(u=u.bind(this),u.isMobxAction=!0),u};if(n=="method"){var l;return Ji(t)||(t=s(t)),(l=this.options_)!=null&&l.bound&&o(function(){var a=this,c=a[r].bind(a);c.isMobxAction=!0,a[r]=c}),t}ce("Cannot apply '"+i.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
93
- '`+i.annotationType_+"' can only be used on properties with a function value."))}function Cw(t,e,n,r){var o=e.annotationType_,i=r.value;H.NODE_ENV!=="production"&&!yt(i)&&ce("Cannot apply '"+o+"' to '"+t.name_+"."+n.toString()+"':"+(`
94
- '`+o+"' can only be used on properties with a function value."))}function L0(t,e,n,r,o){var i,s,l,a,c,u,d;o===void 0&&(o=Y.safeDescriptors),Cw(t,e,n,r);var f=r.value;if((i=e.options_)!=null&&i.bound){var p;f=f.bind((p=t.proxy_)!=null?p:t.target_)}return{value:li((s=(l=e.options_)==null?void 0:l.name)!=null?s:n.toString(),f,(a=(c=e.options_)==null?void 0:c.autoAction)!=null?a:!1,(u=e.options_)!=null&&u.bound?(d=t.proxy_)!=null?d:t.target_:void 0),configurable:o?t.isPlainObject_:!0,enumerable:!1,writable:!o}}function V0(t,e){return{annotationType_:t,options_:e,make_:Ew,extend_:Ow,decorate_20223_:_w}}function Ew(t,e,n,r){var o;if(r===t.target_)return this.extend_(t,e,n,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!Dn(t.target_,e)||!al(t.target_[e]))&&this.extend_(t,e,n,!1)===null)return 0;if(al(n.value))return 1;var i=I0(t,this,e,n,!1,!1);return cr(r,e,i),2}function Ow(t,e,n,r){var o,i=I0(t,this,e,n,(o=this.options_)==null?void 0:o.bound);return t.defineProperty_(e,i,r)}function _w(t,e){var n;H.NODE_ENV!=="production"&&Dc(e,["method"]);var r=e.name,o=e.addInitializer;return al(t)||(t=Zi(t)),(n=this.options_)!=null&&n.bound&&o(function(){var i=this,s=i[r].bind(i);s.isMobXFlow=!0,i[r]=s}),t}function kw(t,e,n,r){var o=e.annotationType_,i=r.value;H.NODE_ENV!=="production"&&!yt(i)&&ce("Cannot apply '"+o+"' to '"+t.name_+"."+n.toString()+"':"+(`
95
- '`+o+"' can only be used on properties with a generator function value."))}function I0(t,e,n,r,o,i){i===void 0&&(i=Y.safeDescriptors),kw(t,e,n,r);var s=r.value;if(al(s)||(s=Zi(s)),o){var l;s=s.bind((l=t.proxy_)!=null?l:t.target_),s.isMobXFlow=!0}return{value:s,configurable:i?t.isPlainObject_:!0,enumerable:!1,writable:!i}}function tp(t,e){return{annotationType_:t,options_:e,make_:Tw,extend_:Aw,decorate_20223_:Mw}}function Tw(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function Aw(t,e,n,r){return jw(t,this,e,n),t.defineComputedProperty_(e,Hr({},this.options_,{get:n.get,set:n.set}),r)}function Mw(t,e){H.NODE_ENV!=="production"&&Dc(e,["getter"]);var n=this,r=e.name,o=e.addInitializer;return o(function(){var i=gs(this)[xe],s=Hr({},n.options_,{get:t,context:this});s.name||(s.name=H.NODE_ENV!=="production"?i.name_+"."+r.toString():"ObservableObject."+r.toString()),i.values_.set(r,new $n(s))}),function(){return this[xe].getObservablePropValue_(r)}}function jw(t,e,n,r){var o=e.annotationType_,i=r.get;H.NODE_ENV!=="production"&&!i&&ce("Cannot apply '"+o+"' to '"+t.name_+"."+n.toString()+"':"+(`
96
- '`+o+"' can only be used on getter(+setter) properties."))}function Vc(t,e){return{annotationType_:t,options_:e,make_:Rw,extend_:Nw,decorate_20223_:Pw}}function Rw(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function Nw(t,e,n,r){var o,i;return Dw(t,this,e,n),t.defineObservableProperty_(e,n.value,(o=(i=this.options_)==null?void 0:i.enhancer)!=null?o:si,r)}function Pw(t,e){if(H.NODE_ENV!=="production"){if(e.kind==="field")throw ce("Please use `@observable accessor "+String(e.name)+"` instead of `@observable "+String(e.name)+"`");Dc(e,["accessor"])}var n=this,r=e.kind,o=e.name,i=new WeakSet;function s(l,a){var c,u,d=gs(l)[xe],f=new Yo(a,(c=(u=n.options_)==null?void 0:u.enhancer)!=null?c:si,H.NODE_ENV!=="production"?d.name_+"."+o.toString():"ObservableObject."+o.toString(),!1);d.values_.set(o,f),i.add(l)}if(r=="accessor")return{get:function(){return i.has(this)||s(this,t.get.call(this)),this[xe].getObservablePropValue_(o)},set:function(a){return i.has(this)||s(this,a),this[xe].setObservablePropValue_(o,a)},init:function(a){return i.has(this)||s(this,a),a}}}function Dw(t,e,n,r){var o=e.annotationType_;H.NODE_ENV!=="production"&&!("value"in r)&&ce("Cannot apply '"+o+"' to '"+t.name_+"."+n.toString()+"':"+(`
97
- '`+o+"' cannot be used on getter/setter properties"))}var Lw="true",Vw=$0();function $0(t){return{annotationType_:Lw,options_:t,make_:Iw,extend_:$w,decorate_20223_:Hw}}function Iw(t,e,n,r){var o,i;if(n.get)return Ic.make_(t,e,n,r);if(n.set){var s=li(e.toString(),n.set);return r===t.target_?t.defineProperty_(e,{configurable:Y.safeDescriptors?t.isPlainObject_:!0,set:s})===null?0:2:(cr(r,e,{configurable:!0,set:s}),2)}if(r!==t.target_&&typeof n.value=="function"){var l;if(M0(n.value)){var a,c=(a=this.options_)!=null&&a.autoBind?Zi.bound:Zi;return c.make_(t,e,n,r)}var u=(l=this.options_)!=null&&l.autoBind?ll.bound:ll;return u.make_(t,e,n,r)}var d=((o=this.options_)==null?void 0:o.deep)===!1?Tt.ref:Tt;if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var f;n.value=n.value.bind((f=t.proxy_)!=null?f:t.target_)}return d.make_(t,e,n,r)}function $w(t,e,n,r){var o,i;if(n.get)return Ic.extend_(t,e,n,r);if(n.set)return t.defineProperty_(e,{configurable:Y.safeDescriptors?t.isPlainObject_:!0,set:li(e.toString(),n.set)},r);if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var s;n.value=n.value.bind((s=t.proxy_)!=null?s:t.target_)}var l=((i=this.options_)==null?void 0:i.deep)===!1?Tt.ref:Tt;return l.extend_(t,e,n,r)}function Hw(t,e){ce("'"+this.annotationType_+"' cannot be used as a decorator")}var Bw="observable",zw="observable.ref",Fw="observable.shallow",Ww="observable.struct",H0={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(H0);function Kl(t){return t||H0}var Wd=Vc(Bw),Uw=Vc(zw,{enhancer:Lc}),qw=Vc(Fw,{enhancer:bw}),Gw=Vc(Ww,{enhancer:vw}),B0=ur(Wd);function Yl(t){return t.deep===!0?si:t.deep===!1?Lc:Yw(t.defaultDecorator)}function Kw(t){var e;return t?(e=t.defaultDecorator)!=null?e:$0(t):void 0}function Yw(t){var e,n;return t&&(e=(n=t.options_)==null?void 0:n.enhancer)!=null?e:si}function z0(t,e,n){if(_l(e))return Wd.decorate_20223_(t,e);if(ii(e)){Ol(t,e,Wd);return}return cl(t)?t:hr(t)?Tt.object(t,e,n):Array.isArray(t)?Tt.array(t,e):ps(t)?Tt.map(t,e):Nr(t)?Tt.set(t,e):typeof t=="object"&&t!==null?t:Tt.box(t,e)}k0(z0,B0);var Jw={box:function(e,n){var r=Kl(n);return new Yo(e,Yl(r),r.name,!0,r.equals)},array:function(e,n){var r=Kl(n);return(Y.useProxies===!1||r.proxy===!1?XS:zS)(e,Yl(r),r.name)},map:function(e,n){var r=Kl(n);return new cb(e,Yl(r),r.name)},set:function(e,n){var r=Kl(n);return new ub(e,Yl(r),r.name)},object:function(e,n,r){return yi(function(){return MS(Y.useProxies===!1||(r==null?void 0:r.proxy)===!1?gs({},r):IS({},r),e,n)})},ref:ur(Uw),shallow:ur(qw),deep:B0,struct:ur(Gw)},Tt=k0(z0,Jw),F0="computed",Zw="computed.struct",Ud=tp(F0),Xw=tp(Zw,{equals:Ka.structural}),Ic=function(e,n){if(_l(n))return Ud.decorate_20223_(e,n);if(ii(n))return Ol(e,n,Ud);if(hr(e))return ur(tp(F0,e));H.NODE_ENV!=="production"&&(yt(e)||ce("First argument to `computed` should be an expression."),yt(n)&&ce("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var r=hr(n)?n:{};return r.get=e,r.name||(r.name=e.name||""),new $n(r)};Object.assign(Ic,Ud);Ic.struct=ur(Xw);var Vh,Ih,Ja=0,Qw=1,eS=(Vh=(Ih=qa(function(){},"name"))==null?void 0:Ih.configurable)!=null?Vh:!1,$h={value:"action",configurable:!0,writable:!1,enumerable:!1};function li(t,e,n,r){n===void 0&&(n=!1),H.NODE_ENV!=="production"&&(yt(e)||ce("`action` can only be invoked on functions"),(typeof t!="string"||!t)&&ce("actions should have valid names, got: '"+t+"'"));function o(){return tS(t,n,e,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return e.toString()},eS&&($h.value=t,cr(o,"name",$h)),o}function tS(t,e,n,r,o){var i=nS(t,e,r,o);try{return n.apply(r,o)}catch(s){throw i.error_=s,s}finally{rS(i)}}function nS(t,e,n,r){var o=H.NODE_ENV!=="production"&&At()&&!!t,i=0;if(H.NODE_ENV!=="production"&&o){i=Date.now();var s=r?Array.from(r):Ga;pn({type:ip,name:t,object:n,arguments:s})}var l=Y.trackingDerivation,a=!e||!l;Rn();var c=Y.allowStateChanges;a&&(vi(),c=np(!0));var u=op(!0),d={runAsAction_:a,prevDerivation_:l,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:o,startTime_:i,actionId_:Qw++,parentActionId_:Ja};return Ja=d.actionId_,d}function rS(t){Ja!==t.actionId_&&ce(30),Ja=t.parentActionId_,t.error_!==void 0&&(Y.suppressReactionErrors=!0),rp(t.prevAllowStateChanges_),Us(t.prevAllowStateReads_),Nn(),t.runAsAction_&&Vr(t.prevDerivation_),H.NODE_ENV!=="production"&&t.notifySpy_&&hn({time:Date.now()-t.startTime_}),Y.suppressReactionErrors=!1}function np(t){var e=Y.allowStateChanges;return Y.allowStateChanges=t,e}function rp(t){Y.allowStateChanges=t}var oS="create",Yo=function(t){function e(r,o,i,s,l){var a;return i===void 0&&(i=H.NODE_ENV!=="production"?"ObservableValue@"+Zn():"ObservableValue"),s===void 0&&(s=!0),l===void 0&&(l=Ka.default),a=t.call(this,i)||this,a.enhancer=void 0,a.name_=void 0,a.equals=void 0,a.hasUnreportedChange_=!1,a.interceptors_=void 0,a.changeListeners_=void 0,a.value_=void 0,a.dehancer=void 0,a.enhancer=o,a.name_=i,a.equals=l,a.value_=o(r,void 0,i),H.NODE_ENV!=="production"&&s&&At()&&ai({type:oS,object:a,observableKind:"value",debugObjectName:a.name_,newValue:""+a.value_}),a}P0(e,t);var n=e.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){var i=this.value_;if(o=this.prepareNewValue_(o),o!==Y.UNCHANGED){var s=At();H.NODE_ENV!=="production"&&s&&pn({type:Un,object:this,observableKind:"value",debugObjectName:this.name_,newValue:o,oldValue:i}),this.setNewValue_(o),H.NODE_ENV!=="production"&&s&&hn()}},n.prepareNewValue_=function(o){if(sr(this),Tn(this)){var i=An(this,{object:this,type:Un,newValue:o});if(!i)return Y.UNCHANGED;o=i.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?Y.UNCHANGED:o},n.setNewValue_=function(o){var i=this.value_;this.value_=o,this.reportChanged(),Gn(this)&&Kn(this,{type:Un,object:this,newValue:o,oldValue:i})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Tl(this,o)},n.observe_=function(o,i){return i&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:Un,newValue:this.value_,oldValue:void 0}),Al(this,o)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return N0(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},e}(ko),$n=function(){function t(n){this.dependenciesState_=Ve.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ve.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Za(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Ln.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||ce(31),this.derivation=n.get,this.name_=n.name||(H.NODE_ENV!=="production"?"ComputedValue@"+Zn():"ComputedValue"),n.set&&(this.setter_=li(H.NODE_ENV!=="production"?this.name_+"-setter":"ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Ka.structural:Ka.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var e=t.prototype;return e.onBecomeStale_=function(){dS(this)},e.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},e.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},e.get=function(){if(this.isComputing&&ce(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)qd(this)&&(this.warnAboutUntrackedRead_(),Rn(),this.value_=this.computeValue_(!1),Nn());else if(J0(this),qd(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&uS(this),Y.trackingContext=r}var o=this.value_;if(ja(o))throw o.cause;return o},e.set=function(r){if(this.setter_){this.isRunningSetter&&ce(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else ce(34,this.name_)},e.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===Ve.NOT_TRACKING_,i=this.computeValue_(!0),s=o||ja(r)||ja(i)||!this.equals_(r,i);return s&&(this.value_=i,H.NODE_ENV!=="production"&&At()&&ai({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),s},e.computeValue_=function(r){this.isComputing=!0;var o=np(!1),i;if(r)i=W0(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(s){i=new Za(s)}return rp(o),this.isComputing=!1,i},e.suspend_=function(){this.keepAlive_||(Gd(this),this.value_=void 0,H.NODE_ENV!=="production"&&this.isTracing_!==Ln.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},e.observe_=function(r,o){var i=this,s=!0,l=void 0;return wS(function(){var a=i.get();if(!s||o){var c=vi();r({observableKind:"computed",debugObjectName:i.name_,type:Un,object:i,newValue:a,oldValue:l}),Vr(c)}s=!1,l=a})},e.warnAboutUntrackedRead_=function(){H.NODE_ENV!=="production"&&(this.isTracing_!==Ln.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:Y.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},e.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},e.valueOf=function(){return N0(this.get())},e[Symbol.toPrimitive]=function(){return this.valueOf()},hs(t,[{key:"isComputing",get:function(){return ln(this.flags_,t.isComputingMask_)},set:function(r){this.flags_=an(this.flags_,t.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return ln(this.flags_,t.isRunningSetterMask_)},set:function(r){this.flags_=an(this.flags_,t.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return ln(this.flags_,t.isBeingObservedMask_)},set:function(r){this.flags_=an(this.flags_,t.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return ln(this.flags_,t.isPendingUnobservationMask_)},set:function(r){this.flags_=an(this.flags_,t.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return ln(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=an(this.flags_,t.diffValueMask_,r===1)}}])}();$n.isComputingMask_=1;$n.isRunningSetterMask_=2;$n.isBeingObservedMask_=4;$n.isPendingUnobservationMask_=8;$n.diffValueMask_=16;var $c=bi("ComputedValue",$n),Ve;(function(t){t[t.NOT_TRACKING_=-1]="NOT_TRACKING_",t[t.UP_TO_DATE_=0]="UP_TO_DATE_",t[t.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",t[t.STALE_=2]="STALE_"})(Ve||(Ve={}));var Ln;(function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"})(Ln||(Ln={}));var Za=function(e){this.cause=void 0,this.cause=e};function ja(t){return t instanceof Za}function qd(t){switch(t.dependenciesState_){case Ve.UP_TO_DATE_:return!1;case Ve.NOT_TRACKING_:case Ve.STALE_:return!0;case Ve.POSSIBLY_STALE_:{for(var e=op(!0),n=vi(),r=t.observing_,o=r.length,i=0;i<o;i++){var s=r[i];if($c(s)){if(Y.disableErrorBoundaries)s.get();else try{s.get()}catch{return Vr(n),Us(e),!0}if(t.dependenciesState_===Ve.STALE_)return Vr(n),Us(e),!0}}return q0(t),Vr(n),Us(e),!1}}}function sr(t){if(H.NODE_ENV!=="production"){var e=t.observers_.size>0;!Y.allowStateChanges&&(e||Y.enforceActions==="always")&&console.warn("[MobX] "+(Y.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+t.name_)}}function iS(t){H.NODE_ENV!=="production"&&!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+t.name_+"' being read outside a reactive context.")}function W0(t,e,n){var r=op(!0);q0(t),t.newObserving_=new Array(t.runId_===0?100:t.observing_.length),t.unboundDepsCount_=0,t.runId_=++Y.runId;var o=Y.trackingDerivation;Y.trackingDerivation=t,Y.inBatch++;var i;if(Y.disableErrorBoundaries===!0)i=e.call(n);else try{i=e.call(n)}catch(s){i=new Za(s)}return Y.inBatch--,Y.trackingDerivation=o,lS(t),sS(t),Us(r),i}function sS(t){H.NODE_ENV!=="production"&&t.observing_.length===0&&(typeof t.requiresObservable_=="boolean"?t.requiresObservable_:Y.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+t.name_+"' is created/updated without reading any observable value.")}function lS(t){for(var e=t.observing_,n=t.observing_=t.newObserving_,r=Ve.UP_TO_DATE_,o=0,i=t.unboundDepsCount_,s=0;s<i;s++){var l=n[s];l.diffValue===0&&(l.diffValue=1,o!==s&&(n[o]=l),o++),l.dependenciesState_>r&&(r=l.dependenciesState_)}for(n.length=o,t.newObserving_=null,i=e.length;i--;){var a=e[i];a.diffValue===0&&K0(a,t),a.diffValue=0}for(;o--;){var c=n[o];c.diffValue===1&&(c.diffValue=0,cS(c,t))}r!==Ve.UP_TO_DATE_&&(t.dependenciesState_=r,t.onBecomeStale_())}function Gd(t){var e=t.observing_;t.observing_=[];for(var n=e.length;n--;)K0(e[n],t);t.dependenciesState_=Ve.NOT_TRACKING_}function U0(t){var e=vi();try{return t()}finally{Vr(e)}}function vi(){var t=Y.trackingDerivation;return Y.trackingDerivation=null,t}function Vr(t){Y.trackingDerivation=t}function op(t){var e=Y.allowStateReads;return Y.allowStateReads=t,e}function Us(t){Y.allowStateReads=t}function q0(t){if(t.dependenciesState_!==Ve.UP_TO_DATE_){t.dependenciesState_=Ve.UP_TO_DATE_;for(var e=t.observing_,n=e.length;n--;)e[n].lowestObserverState_=Ve.UP_TO_DATE_}}var Ra=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Na=!0,G0=!1,Y=function(){var t=Mc();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(Na=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==new Ra().version&&(Na=!1),Na?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new Ra):(setTimeout(function(){G0||ce(35)},1),new Ra)}();function aS(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&ce(36),G0=!0,Na){var t=Mc();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),Y=new Ra}}function cS(t,e){t.observers_.add(e),t.lowestObserverState_>e.dependenciesState_&&(t.lowestObserverState_=e.dependenciesState_)}function K0(t,e){t.observers_.delete(e),t.observers_.size===0&&Y0(t)}function Y0(t){t.isPendingUnobservation===!1&&(t.isPendingUnobservation=!0,Y.pendingUnobservations.push(t))}function Rn(){Y.inBatch++}function Nn(){if(--Y.inBatch===0){eb();for(var t=Y.pendingUnobservations,e=0;e<t.length;e++){var n=t[e];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof $n&&n.suspend_())}Y.pendingUnobservations=[]}}function J0(t){iS(t);var e=Y.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved&&Y.trackingContext&&(t.isBeingObserved=!0,t.onBO())),t.isBeingObserved):(t.observers_.size===0&&Y.inBatch>0&&Y0(t),!1)}function Z0(t){t.lowestObserverState_!==Ve.STALE_&&(t.lowestObserverState_=Ve.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===Ve.UP_TO_DATE_&&(H.NODE_ENV!=="production"&&e.isTracing_!==Ln.NONE&&X0(e,t),e.onBecomeStale_()),e.dependenciesState_=Ve.STALE_}))}function uS(t){t.lowestObserverState_!==Ve.STALE_&&(t.lowestObserverState_=Ve.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===Ve.POSSIBLY_STALE_?(e.dependenciesState_=Ve.STALE_,H.NODE_ENV!=="production"&&e.isTracing_!==Ln.NONE&&X0(e,t)):e.dependenciesState_===Ve.UP_TO_DATE_&&(t.lowestObserverState_=Ve.UP_TO_DATE_)}))}function dS(t){t.lowestObserverState_===Ve.UP_TO_DATE_&&(t.lowestObserverState_=Ve.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===Ve.UP_TO_DATE_&&(e.dependenciesState_=Ve.POSSIBLY_STALE_,e.onBecomeStale_())}))}function X0(t,e){if(console.log("[mobx.trace] '"+t.name_+"' is invalidated due to a change in: '"+e.name_+"'"),t.isTracing_===Ln.BREAK){var n=[];Q0(ib(t),n,1),new Function(`debugger;
98
- /*
99
- Tracing '`+t.name_+`'
100
-
101
- You are entering this break point because derivation '`+t.name_+"' is being traced and '"+e.name_+`' is now forcing it to update.
102
- Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
103
- The stackframe you are looking for is at least ~6-8 stack-frames up.
104
-
105
- `+(t instanceof $n?t.derivation.toString().replace(/[*]\//g,"/"):"")+`
106
-
107
- The dependencies for this derivation are:
108
-
109
- `+n.join(`
110
- `)+`
111
- */
112
- `)()}}function Q0(t,e,n){if(e.length>=1e3){e.push("(and many more)");return}e.push(""+" ".repeat(n-1)+t.name),t.dependencies&&t.dependencies.forEach(function(r){return Q0(r,e,n+1)})}var Br=function(){function t(n,r,o,i){n===void 0&&(n=H.NODE_ENV!=="production"?"Reaction@"+Zn():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ve.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Ln.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=i}var e=t.prototype;return e.onBecomeStale_=function(){this.schedule_()},e.schedule_=function(){this.isScheduled||(this.isScheduled=!0,Y.pendingReactions.push(this),eb())},e.runReaction_=function(){if(!this.isDisposed){Rn(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,qd(this)){this.isTrackPending=!0;try{this.onInvalidate_(),H.NODE_ENV!=="production"&&this.isTrackPending&&At()&&ai({name:this.name_,type:"scheduled-reaction"})}catch(o){this.reportExceptionInDerivation_(o)}}Y.trackingContext=r,Nn()}},e.track=function(r){if(!this.isDisposed){Rn();var o=At(),i;H.NODE_ENV!=="production"&&o&&(i=Date.now(),pn({name:this.name_,type:"reaction"})),this.isRunning=!0;var s=Y.trackingContext;Y.trackingContext=this;var l=W0(this,r,void 0);Y.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Gd(this),ja(l)&&this.reportExceptionInDerivation_(l.cause),H.NODE_ENV!=="production"&&o&&hn({time:Date.now()-i}),Nn()}},e.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i=H.NODE_ENV!=="production"?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";Y.suppressReactionErrors?H.NODE_ENV!=="production"&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),H.NODE_ENV!=="production"&&At()&&ai({type:"error",name:this.name_,message:i,error:""+r}),Y.globalReactionErrorHandlers.forEach(function(s){return s(r,o)})},e.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Rn(),Gd(this),Nn()))},e.getDisposer_=function(r){var o=this,i=function s(){o.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[xe]=this,i},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(r){r===void 0&&(r=!1),DS(this,r)},hs(t,[{key:"isDisposed",get:function(){return ln(this.flags_,t.isDisposedMask_)},set:function(r){this.flags_=an(this.flags_,t.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return ln(this.flags_,t.isScheduledMask_)},set:function(r){this.flags_=an(this.flags_,t.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return ln(this.flags_,t.isTrackPendingMask_)},set:function(r){this.flags_=an(this.flags_,t.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return ln(this.flags_,t.isRunningMask_)},set:function(r){this.flags_=an(this.flags_,t.isRunningMask_,r)}},{key:"diffValue",get:function(){return ln(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=an(this.flags_,t.diffValueMask_,r===1)}}])}();Br.isDisposedMask_=1;Br.isScheduledMask_=2;Br.isTrackPendingMask_=4;Br.isRunningMask_=8;Br.diffValueMask_=16;var Hh=100,Kd=function(e){return e()};function eb(){Y.inBatch>0||Y.isRunningReactions||Kd(fS)}function fS(){Y.isRunningReactions=!0;for(var t=Y.pendingReactions,e=0;t.length>0;){++e===Hh&&(console.error(H.NODE_ENV!=="production"?"Reaction doesn't converge to a stable state after "+Hh+" iterations."+(" Probably there is a cycle in the reactive function: "+t[0]):"[mobx] cycle in reaction: "+t[0]),t.splice(0));for(var n=t.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction_()}Y.isRunningReactions=!1}var Xa=bi("Reaction",Br);function pS(t){var e=Kd;Kd=function(r){return t(function(){return e(r)})}}function At(){return H.NODE_ENV!=="production"&&!!Y.spyListeners.length}function ai(t){if(H.NODE_ENV!=="production"&&Y.spyListeners.length)for(var e=Y.spyListeners,n=0,r=e.length;n<r;n++)e[n](t)}function pn(t){if(H.NODE_ENV!=="production"){var e=Hr({},t,{spyReportStart:!0});ai(e)}}var hS={type:"report-end",spyReportEnd:!0};function hn(t){H.NODE_ENV!=="production"&&ai(t?Hr({},t,{type:"report-end",spyReportEnd:!0}):hS)}function gS(t){return H.NODE_ENV==="production"?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(Y.spyListeners.push(t),Qf(function(){Y.spyListeners=Y.spyListeners.filter(function(e){return e!==t})}))}var ip="action",mS="action.bound",tb="autoAction",bS="autoAction.bound",vS="<unnamed action>",Yd=kl(ip),yS=kl(mS,{bound:!0}),Jd=kl(tb,{autoAction:!0}),xS=kl(bS,{autoAction:!0,bound:!0});function nb(t){var e=function(r,o){if(yt(r))return li(r.name||vS,r,t);if(yt(o))return li(r,o,t);if(_l(o))return(t?Jd:Yd).decorate_20223_(r,o);if(ii(o))return Ol(r,o,t?Jd:Yd);if(ii(r))return ur(kl(t?tb:ip,{name:r,autoAction:t}));H.NODE_ENV!=="production"&&ce("Invalid arguments for `action`")};return e}var Di=nb(!1);Object.assign(Di,Yd);var ll=nb(!0);Object.assign(ll,Jd);Di.bound=ur(yS);ll.bound=ur(xS);function Ji(t){return yt(t)&&t.isMobxAction===!0}function wS(t,e){var n,r,o,i;e===void 0&&(e=T0),H.NODE_ENV!=="production"&&(yt(t)||ce("Autorun expects a function as first argument"),Ji(t)&&ce("Autorun does not accept actions since actions are untrackable"));var s=(n=(r=e)==null?void 0:r.name)!=null?n:H.NODE_ENV!=="production"?t.name||"Autorun@"+Zn():"Autorun",l=!e.scheduler&&!e.delay,a;if(l)a=new Br(s,function(){this.track(d)},e.onError,e.requiresObservable);else{var c=CS(e),u=!1;a=new Br(s,function(){u||(u=!0,c(function(){u=!1,a.isDisposed||a.track(d)}))},e.onError,e.requiresObservable)}function d(){t(a)}return(o=e)!=null&&(o=o.signal)!=null&&o.aborted||a.schedule_(),a.getDisposer_((i=e)==null?void 0:i.signal)}var SS=function(e){return e()};function CS(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:SS}var ES="onBO",OS="onBUO";function _S(t,e,n){return ob(ES,t,e,n)}function rb(t,e,n){return ob(OS,t,e,n)}function ob(t,e,n,r){var o=Xi(e),i=yt(r)?r:n,s=t+"L";return o[s]?o[s].add(i):o[s]=new Set([i]),function(){var l=o[s];l&&(l.delete(i),l.size===0&&delete o[s])}}var kS="never",Jl="always",TS="observed";function AS(t){t.isolateGlobalState===!0&&aS();var e=t.useProxies,n=t.enforceActions;if(e!==void 0&&(Y.useProxies=e===Jl?!0:e===kS?!1:typeof Proxy<"u"),e==="ifavailable"&&(Y.verifyProxies=!0),n!==void 0){var r=n===Jl?Jl:n===TS;Y.enforceActions=r,Y.allowStateChanges=!(r===!0||r===Jl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in t&&(Y[o]=!!t[o])}),Y.allowStateReads=!Y.observableRequiresReaction,H.NODE_ENV!=="production"&&Y.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),t.reactionScheduler&&pS(t.reactionScheduler)}function MS(t,e,n,r){H.NODE_ENV!=="production"&&(arguments.length>4&&ce("'extendObservable' expected 2-4 arguments"),typeof t!="object"&&ce("'extendObservable' expects an object as first argument"),To(t)&&ce("'extendObservable' should not be used on maps, use map.merge instead"),hr(e)||ce("'extendObservable' only accepts plain objects as second argument"),(cl(e)||cl(n))&&ce("Extending an object with another observable (object) is not supported"));var o=sw(e);return yi(function(){var i=gs(t,r)[xe];Pc(o).forEach(function(s){i.extend_(s,o[s],n&&s in n?n[s]:!0)})}),t}function ib(t,e){return sb(Xi(t,e))}function sb(t){var e={name:t.name_};return t.observing_&&t.observing_.length>0&&(e.dependencies=jS(t.observing_).map(sb)),e}function jS(t){return Array.from(new Set(t))}var RS=0;function lb(){this.message="FLOW_CANCELLED"}lb.prototype=Object.create(Error.prototype);var wu=V0("flow"),NS=V0("flow.bound",{bound:!0}),Zi=Object.assign(function(e,n){if(_l(n))return wu.decorate_20223_(e,n);if(ii(n))return Ol(e,n,wu);H.NODE_ENV!=="production"&&arguments.length!==1&&ce("Flow expects single argument with generator function");var r=e,o=r.name||"<unnamed flow>",i=function(){var l=this,a=arguments,c=++RS,u=Di(o+" - runid: "+c+" - init",r).apply(l,a),d,f=void 0,p=new Promise(function(g,b){var v=0;d=b;function y(C){f=void 0;var x;try{x=Di(o+" - runid: "+c+" - yield "+v++,u.next).call(u,C)}catch(E){return b(E)}S(x)}function w(C){f=void 0;var x;try{x=Di(o+" - runid: "+c+" - yield "+v++,u.throw).call(u,C)}catch(E){return b(E)}S(x)}function S(C){if(yt(C==null?void 0:C.then)){C.then(S,b);return}return C.done?g(C.value):(f=Promise.resolve(C.value),f.then(y,w))}y(void 0)});return p.cancel=Di(o+" - runid: "+c+" - cancel",function(){try{f&&Bh(f);var g=u.return(void 0),b=Promise.resolve(g.value);b.then(Ni,Ni),Bh(b),d(new lb)}catch(v){d(v)}}),p};return i.isMobXFlow=!0,i},wu);Zi.bound=ur(NS);function Bh(t){yt(t.cancel)&&t.cancel()}function al(t){return(t==null?void 0:t.isMobXFlow)===!0}function PS(t,e){return t?Ml(t)||!!t[xe]||ep(t)||Xa(t)||$c(t):!1}function cl(t){return H.NODE_ENV!=="production"&&arguments.length!==1&&ce("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),PS(t)}function DS(){if(H.NODE_ENV!=="production"){for(var t=!1,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];typeof n[n.length-1]=="boolean"&&(t=n.pop());var o=LS(n);if(!o)return ce("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");o.isTracing_===Ln.NONE&&console.log("[mobx.trace] '"+o.name_+"' tracing enabled"),o.isTracing_=t?Ln.BREAK:Ln.LOG}}function LS(t){switch(t.length){case 0:return Y.trackingDerivation;case 1:return Xi(t[0]);case 2:return Xi(t[0],t[1])}}function Pr(t,e){e===void 0&&(e=void 0),Rn();try{return t.apply(e)}finally{Nn()}}function Lo(t){return t[xe]}var VS={has:function(e,n){return H.NODE_ENV!=="production"&&Y.trackingDerivation&&As("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Lo(e).has_(n)},get:function(e,n){return Lo(e).get_(n)},set:function(e,n,r){var o;return ii(n)?(H.NODE_ENV!=="production"&&!Lo(e).values_.has(n)&&As("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(o=Lo(e).set_(n,r,!0))!=null?o:!0):!1},deleteProperty:function(e,n){var r;return H.NODE_ENV!=="production"&&As("delete properties from an observable object. Use 'remove' from 'mobx' instead."),ii(n)?(r=Lo(e).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(e,n,r){var o;return H.NODE_ENV!=="production"&&As("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(o=Lo(e).defineProperty_(n,r))!=null?o:!0},ownKeys:function(e){return H.NODE_ENV!=="production"&&Y.trackingDerivation&&As("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Lo(e).ownKeys_()},preventExtensions:function(e){ce(13)}};function IS(t,e){var n,r;return A0(),t=gs(t,e),(r=(n=t[xe]).proxy_)!=null?r:n.proxy_=new Proxy(t,VS)}function Tn(t){return t.interceptors_!==void 0&&t.interceptors_.length>0}function Tl(t,e){var n=t.interceptors_||(t.interceptors_=[]);return n.push(e),Qf(function(){var r=n.indexOf(e);r!==-1&&n.splice(r,1)})}function An(t,e){var n=vi();try{for(var r=[].concat(t.interceptors_||[]),o=0,i=r.length;o<i&&(e=r[o](e),e&&!e.type&&ce(14),!!e);o++);return e}finally{Vr(n)}}function Gn(t){return t.changeListeners_!==void 0&&t.changeListeners_.length>0}function Al(t,e){var n=t.changeListeners_||(t.changeListeners_=[]);return n.push(e),Qf(function(){var r=n.indexOf(e);r!==-1&&n.splice(r,1)})}function Kn(t,e){var n=vi(),r=t.changeListeners_;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](e);Vr(n)}}function $S(t,e,n){return yi(function(){var r,o=gs(t,n)[xe];H.NODE_ENV!=="production"&&e&&t[Kt]&&ce("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(r=e)!=null||(e=fw(t)),Pc(e).forEach(function(i){return o.make_(i,e[i])})}),t}var zh="splice",Un="update",HS=1e4,BS={get:function(e,n){var r=e[xe];return n===xe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):Dn(Qa,n)?Qa[n]:e[n]},set:function(e,n,r){var o=e[xe];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?e[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){ce(15)}},sp=function(){function t(n,r,o,i){n===void 0&&(n=H.NODE_ENV!=="production"?"ObservableArray@"+Zn():"ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=o,this.legacyMode_=i,this.atom_=new ko(n),this.enhancer_=function(s,l){return r(s,l,H.NODE_ENV!=="production"?n+"[..]":"ObservableArray[..]")}}var e=t.prototype;return e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},e.intercept_=function(r){return Tl(this,r)},e.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Al(this,r)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&ce("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var i=new Array(r-o),s=0;s<r-o;s++)i[s]=void 0;this.spliceWithArray_(o,0,i)}else this.spliceWithArray_(r,o-r)},e.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&ce(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&pb(r+o+1)},e.spliceWithArray_=function(r,o,i){var s=this;sr(this.atom_);var l=this.values_.length;if(r===void 0?r=0:r>l?r=l:r<0&&(r=Math.max(0,l+r)),arguments.length===1?o=l-r:o==null?o=0:o=Math.max(0,Math.min(o,l-r)),i===void 0&&(i=Ga),Tn(this)){var a=An(this,{object:this.proxy_,type:zh,index:r,removedCount:o,added:i});if(!a)return Ga;o=a.removedCount,i=a.added}if(i=i.length===0?i:i.map(function(d){return s.enhancer_(d,void 0)}),this.legacyMode_||H.NODE_ENV!=="production"){var c=i.length-o;this.updateArrayLength_(l,c)}var u=this.spliceItemsIntoValues_(r,o,i);return(o!==0||i.length!==0)&&this.notifyArraySplice_(r,i,u),this.dehanceValues_(u)},e.spliceItemsIntoValues_=function(r,o,i){if(i.length<HS){var s;return(s=this.values_).splice.apply(s,[r,o].concat(i))}else{var l=this.values_.slice(r,r+o),a=this.values_.slice(r+o);this.values_.length+=i.length-o;for(var c=0;c<i.length;c++)this.values_[r+c]=i[c];for(var u=0;u<a.length;u++)this.values_[r+i.length+u]=a[u];return l}},e.notifyArrayChildUpdate_=function(r,o,i){var s=!this.owned_&&At(),l=Gn(this),a=l||s?{observableKind:"array",object:this.proxy_,type:Un,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:i}:null;H.NODE_ENV!=="production"&&s&&pn(a),this.atom_.reportChanged(),l&&Kn(this,a),H.NODE_ENV!=="production"&&s&&hn()},e.notifyArraySplice_=function(r,o,i){var s=!this.owned_&&At(),l=Gn(this),a=l||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:zh,index:r,removed:i,added:o,removedCount:i.length,addedCount:o.length}:null;H.NODE_ENV!=="production"&&s&&pn(a),this.atom_.reportChanged(),l&&Kn(this,a),H.NODE_ENV!=="production"&&s&&hn()},e.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn(H.NODE_ENV!=="production"?"[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},e.set_=function(r,o){var i=this.values_;if(this.legacyMode_&&r>i.length&&ce(17,r,i.length),r<i.length){sr(this.atom_);var s=i[r];if(Tn(this)){var l=An(this,{type:Un,object:this.proxy_,index:r,newValue:o});if(!l)return;o=l.newValue}o=this.enhancer_(o,s);var a=o!==s;a&&(i[r]=o,this.notifyArrayChildUpdate_(r,o,s))}else{for(var c=new Array(r+1-i.length),u=0;u<c.length-1;u++)c[u]=void 0;c[c.length-1]=o,this.spliceWithArray_(i.length,0,c)}},t}();function zS(t,e,n,r){return n===void 0&&(n=H.NODE_ENV!=="production"?"ObservableArray@"+Zn():"ObservableArray"),r===void 0&&(r=!1),A0(),yi(function(){var o=new sp(n,e,r,!1);j0(o.values_,xe,o);var i=new Proxy(o.values_,BS);return o.proxy_=i,t&&t.length&&o.spliceWithArray_(0,0,t),i})}var Qa={clear:function(){return this.splice(0)},replace:function(e){var n=this[xe];return n.spliceWithArray_(0,n.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var s=this[xe];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,n)}return s.spliceWithArray_(e,n,o)},spliceWithArray:function(e,n,r){return this[xe].spliceWithArray_(e,n,r)},push:function(){for(var e=this[xe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[xe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[xe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return Y.trackingDerivation&&ce(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&ce(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var n=this[xe],r=n.dehanceValues_(n.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ze("at",vn);Ze("concat",vn);Ze("flat",vn);Ze("includes",vn);Ze("indexOf",vn);Ze("join",vn);Ze("lastIndexOf",vn);Ze("slice",vn);Ze("toString",vn);Ze("toLocaleString",vn);Ze("toSorted",vn);Ze("toSpliced",vn);Ze("with",vn);Ze("every",Xn);Ze("filter",Xn);Ze("find",Xn);Ze("findIndex",Xn);Ze("findLast",Xn);Ze("findLastIndex",Xn);Ze("flatMap",Xn);Ze("forEach",Xn);Ze("map",Xn);Ze("some",Xn);Ze("toReversed",Xn);Ze("reduce",ab);Ze("reduceRight",ab);function Ze(t,e){typeof Array.prototype[t]=="function"&&(Qa[t]=e(t))}function vn(t){return function(){var e=this[xe];e.atom_.reportObserved();var n=e.dehanceValues_(e.values_);return n[t].apply(n,arguments)}}function Xn(t){return function(e,n){var r=this,o=this[xe];o.atom_.reportObserved();var i=o.dehanceValues_(o.values_);return i[t](function(s,l){return e.call(n,s,l,r)})}}function ab(t){return function(){var e=this,n=this[xe];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(i,s,l){return o(i,s,l,e)},r[t].apply(r,arguments)}}var FS=bi("ObservableArrayAdministration",sp);function Hc(t){return Rc(t)&&FS(t[xe])}var WS={},ao="add",ec="delete",cb=function(){function t(n,r,o){var i=this;r===void 0&&(r=si),o===void 0&&(o=H.NODE_ENV!=="production"?"ObservableMap@"+Zn():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[xe]=WS,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=o,yt(Map)||ce(18),yi(function(){i.keysAtom_=D0(H.NODE_ENV!=="production"?i.name_+".keys()":"ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,n&&i.merge(n)})}var e=t.prototype;return e.has_=function(r){return this.data_.has(r)},e.has=function(r){var o=this;if(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var s=i=new Yo(this.has_(r),Lc,H.NODE_ENV!=="production"?this.name_+"."+zd(r)+"?":"ObservableMap.key?",!1);this.hasMap_.set(r,s),rb(s,function(){return o.hasMap_.delete(r)})}return i.get()},e.set=function(r,o){var i=this.has_(r);if(Tn(this)){var s=An(this,{type:i?Un:ao,object:this,newValue:o,name:r});if(!s)return this;o=s.newValue}return i?this.updateValue_(r,o):this.addValue_(r,o),this},e.delete=function(r){var o=this;if(sr(this.keysAtom_),Tn(this)){var i=An(this,{type:ec,object:this,name:r});if(!i)return!1}if(this.has_(r)){var s=At(),l=Gn(this),a=l||s?{observableKind:"map",debugObjectName:this.name_,type:ec,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return H.NODE_ENV!=="production"&&s&&pn(a),Pr(function(){var c;o.keysAtom_.reportChanged(),(c=o.hasMap_.get(r))==null||c.setNewValue_(!1);var u=o.data_.get(r);u.setNewValue_(void 0),o.data_.delete(r)}),l&&Kn(this,a),H.NODE_ENV!=="production"&&s&&hn(),!0}return!1},e.updateValue_=function(r,o){var i=this.data_.get(r);if(o=i.prepareNewValue_(o),o!==Y.UNCHANGED){var s=At(),l=Gn(this),a=l||s?{observableKind:"map",debugObjectName:this.name_,type:Un,object:this,oldValue:i.value_,name:r,newValue:o}:null;H.NODE_ENV!=="production"&&s&&pn(a),i.setNewValue_(o),l&&Kn(this,a),H.NODE_ENV!=="production"&&s&&hn()}},e.addValue_=function(r,o){var i=this;sr(this.keysAtom_),Pr(function(){var c,u=new Yo(o,i.enhancer_,H.NODE_ENV!=="production"?i.name_+"."+zd(r):"ObservableMap.key",!1);i.data_.set(r,u),o=u.value_,(c=i.hasMap_.get(r))==null||c.setNewValue_(!0),i.keysAtom_.reportChanged()});var s=At(),l=Gn(this),a=l||s?{observableKind:"map",debugObjectName:this.name_,type:ao,object:this,name:r,newValue:o}:null;H.NODE_ENV!=="production"&&s&&pn(a),l&&Kn(this,a),H.NODE_ENV!=="production"&&s&&hn()},e.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},e.values=function(){var r=this,o=this.keys();return Fh({next:function(){var s=o.next(),l=s.done,a=s.value;return{done:l,value:l?void 0:r.get(a)}}})},e.entries=function(){var r=this,o=this.keys();return Fh({next:function(){var s=o.next(),l=s.done,a=s.value;return{done:l,value:l?void 0:[a,r.get(a)]}}})},e[Symbol.iterator]=function(){return this.entries()},e.forEach=function(r,o){for(var i=Pi(this),s;!(s=i()).done;){var l=s.value,a=l[0],c=l[1];r.call(o,c,a,this)}},e.merge=function(r){var o=this;return To(r)&&(r=new Map(r)),Pr(function(){hr(r)?iw(r).forEach(function(i){return o.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var s=i[0],l=i[1];return o.set(s,l)}):ps(r)?(ow(r)||ce(19,r),r.forEach(function(i,s){return o.set(s,i)})):r!=null&&ce(20,r)}),this},e.clear=function(){var r=this;Pr(function(){U0(function(){for(var o=Pi(r.keys()),i;!(i=o()).done;){var s=i.value;r.delete(s)}})})},e.replace=function(r){var o=this;return Pr(function(){for(var i=US(r),s=new Map,l=!1,a=Pi(o.data_.keys()),c;!(c=a()).done;){var u=c.value;if(!i.has(u)){var d=o.delete(u);if(d)l=!0;else{var f=o.data_.get(u);s.set(u,f)}}}for(var p=Pi(i.entries()),g;!(g=p()).done;){var b=g.value,v=b[0],y=b[1],w=o.data_.has(v);if(o.set(v,y),o.data_.has(v)){var S=o.data_.get(v);s.set(v,S),w||(l=!0)}}if(!l)if(o.data_.size!==s.size)o.keysAtom_.reportChanged();else for(var C=o.data_.keys(),x=s.keys(),E=C.next(),_=x.next();!E.done;){if(E.value!==_.value){o.keysAtom_.reportChanged();break}E=C.next(),_=x.next()}o.data_=s}),this},e.toString=function(){return"[object ObservableMap]"},e.toJSON=function(){return Array.from(this)},e.observe_=function(r,o){return H.NODE_ENV!=="production"&&o===!0&&ce("`observe` doesn't support fireImmediately=true in combination with maps."),Al(this,r)},e.intercept_=function(r){return Tl(this,r)},hs(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),To=bi("ObservableMap",cb);function Fh(t){return t[Symbol.toStringTag]="MapIterator",cp(t)}function US(t){if(ps(t)||To(t))return t;if(Array.isArray(t))return new Map(t);if(hr(t)){var e=new Map;for(var n in t)e.set(n,t[n]);return e}else return ce(21,t)}var qS={},ub=function(){function t(n,r,o){var i=this;r===void 0&&(r=si),o===void 0&&(o=H.NODE_ENV!=="production"?"ObservableSet@"+Zn():"ObservableSet"),this.name_=void 0,this[xe]=qS,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=o,yt(Set)||ce(22),this.enhancer_=function(s,l){return r(s,l,o)},yi(function(){i.atom_=D0(i.name_),n&&i.replace(n)})}var e=t.prototype;return e.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},e.clear=function(){var r=this;Pr(function(){U0(function(){for(var o=Pi(r.data_.values()),i;!(i=o()).done;){var s=i.value;r.delete(s)}})})},e.forEach=function(r,o){for(var i=Pi(this),s;!(s=i()).done;){var l=s.value;r.call(o,l,l,this)}},e.add=function(r){var o=this;if(sr(this.atom_),Tn(this)){var i=An(this,{type:ao,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Pr(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var s=H.NODE_ENV!=="production"&&At(),l=Gn(this),a=l||s?{observableKind:"set",debugObjectName:this.name_,type:ao,object:this,newValue:r}:null;s&&H.NODE_ENV!=="production"&&pn(a),l&&Kn(this,a),s&&H.NODE_ENV!=="production"&&hn()}return this},e.delete=function(r){var o=this;if(Tn(this)){var i=An(this,{type:ec,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var s=H.NODE_ENV!=="production"&&At(),l=Gn(this),a=l||s?{observableKind:"set",debugObjectName:this.name_,type:ec,object:this,oldValue:r}:null;return s&&H.NODE_ENV!=="production"&&pn(a),Pr(function(){o.atom_.reportChanged(),o.data_.delete(r)}),l&&Kn(this,a),s&&H.NODE_ENV!=="production"&&hn(),!0}return!1},e.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},e.entries=function(){var r=0,o=Array.from(this.keys()),i=Array.from(this.values());return Wh({next:function(){var l=r;return r+=1,l<i.length?{value:[o[l],i[l]],done:!1}:{value:void 0,done:!0}}})},e.keys=function(){return this.values()},e.values=function(){this.atom_.reportObserved();var r=this,o=0,i=Array.from(this.data_.values());return Wh({next:function(){return o<i.length?{value:r.dehanceValue_(i[o++]),done:!1}:{value:void 0,done:!0}}})},e.intersection=function(r){if(Nr(r)&&!or(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},e.union=function(r){if(Nr(r)&&!or(r))return r.union(this);var o=new Set(this);return o.union(r)},e.difference=function(r){return new Set(this).difference(r)},e.symmetricDifference=function(r){if(Nr(r)&&!or(r))return r.symmetricDifference(this);var o=new Set(this);return o.symmetricDifference(r)},e.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},e.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},e.isDisjointFrom=function(r){if(Nr(r)&&!or(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},e.replace=function(r){var o=this;return or(r)&&(r=new Set(r)),Pr(function(){Array.isArray(r)?(o.clear(),r.forEach(function(i){return o.add(i)})):Nr(r)?(o.clear(),r.forEach(function(i){return o.add(i)})):r!=null&&ce("Cannot initialize set from "+r)}),this},e.observe_=function(r,o){return H.NODE_ENV!=="production"&&o===!0&&ce("`observe` doesn't support fireImmediately=true in combination with sets."),Al(this,r)},e.intercept_=function(r){return Tl(this,r)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Symbol.iterator]=function(){return this.values()},hs(t,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),or=bi("ObservableSet",ub);function Wh(t){return t[Symbol.toStringTag]="SetIterator",cp(t)}var Uh=Object.create(null),qh="remove",Zd=function(){function t(n,r,o,i){r===void 0&&(r=new Map),i===void 0&&(i=Vw),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=o,this.defaultAnnotation_=i,this.keysAtom_=new ko(H.NODE_ENV!=="production"?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=hr(this.target_),H.NODE_ENV!=="production"&&!gb(this.defaultAnnotation_)&&ce("defaultAnnotation must be valid annotation"),H.NODE_ENV!=="production"&&(this.appliedAnnotations_={})}var e=t.prototype;return e.getObservablePropValue_=function(r){return this.values_.get(r).get()},e.setObservablePropValue_=function(r,o){var i=this.values_.get(r);if(i instanceof $n)return i.set(o),!0;if(Tn(this)){var s=An(this,{type:Un,object:this.proxy_||this.target_,name:r,newValue:o});if(!s)return null;o=s.newValue}if(o=i.prepareNewValue_(o),o!==Y.UNCHANGED){var l=Gn(this),a=H.NODE_ENV!=="production"&&At(),c=l||a?{type:Un,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:o}:null;H.NODE_ENV!=="production"&&a&&pn(c),i.setNewValue_(o),l&&Kn(this,c),H.NODE_ENV!=="production"&&a&&hn()}return!0},e.get_=function(r){return Y.trackingDerivation&&!Dn(this.target_,r)&&this.has_(r),this.target_[r]},e.set_=function(r,o,i){return i===void 0&&(i=!1),Dn(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):i?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},e.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Yo(r in this.target_,Lc,H.NODE_ENV!=="production"?this.name_+"."+zd(r)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},e.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(Yh(this,o,r),!(r in this.target_)){var i;if((i=this.target_[Kt])!=null&&i[r])return;ce(1,o.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==jc;){var l=qa(s,r);if(l){var a=o.make_(this,r,l,s);if(a===0)return;if(a===1)break}s=Object.getPrototypeOf(s)}Kh(this,o,r)}},e.extend_=function(r,o,i,s){if(s===void 0&&(s=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,o,s);Yh(this,i,r);var l=i.extend_(this,r,o,s);return l&&Kh(this,i,r),l},e.defineProperty_=function(r,o,i){i===void 0&&(i=!1),sr(this.keysAtom_);try{Rn();var s=this.delete_(r);if(!s)return s;if(Tn(this)){var l=An(this,{object:this.proxy_||this.target_,name:r,type:ao,newValue:o.value});if(!l)return null;var a=l.newValue;o.value!==a&&(o=Hr({},o,{value:a}))}if(i){if(!Reflect.defineProperty(this.target_,r,o))return!1}else cr(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{Nn()}return!0},e.defineObservableProperty_=function(r,o,i,s){s===void 0&&(s=!1),sr(this.keysAtom_);try{Rn();var l=this.delete_(r);if(!l)return l;if(Tn(this)){var a=An(this,{object:this.proxy_||this.target_,name:r,type:ao,newValue:o});if(!a)return null;o=a.newValue}var c=Gh(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else cr(this.target_,r,u);var d=new Yo(o,i,H.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,d),this.notifyPropertyAddition_(r,d.value_)}finally{Nn()}return!0},e.defineComputedProperty_=function(r,o,i){i===void 0&&(i=!1),sr(this.keysAtom_);try{Rn();var s=this.delete_(r);if(!s)return s;if(Tn(this)){var l=An(this,{object:this.proxy_||this.target_,name:r,type:ao,newValue:void 0});if(!l)return null}o.name||(o.name=H.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var a=Gh(r),c={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:a.get,set:a.set};if(i){if(!Reflect.defineProperty(this.target_,r,c))return!1}else cr(this.target_,r,c);this.values_.set(r,new $n(o)),this.notifyPropertyAddition_(r,void 0)}finally{Nn()}return!0},e.delete_=function(r,o){if(o===void 0&&(o=!1),sr(this.keysAtom_),!Dn(this.target_,r))return!0;if(Tn(this)){var i=An(this,{object:this.proxy_||this.target_,name:r,type:qh});if(!i)return null}try{var s;Rn();var l=Gn(this),a=H.NODE_ENV!=="production"&&At(),c=this.values_.get(r),u=void 0;if(!c&&(l||a)){var d;u=(d=qa(this.target_,r))==null?void 0:d.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(H.NODE_ENV!=="production"&&delete this.appliedAnnotations_[r],c&&(this.values_.delete(r),c instanceof Yo&&(u=c.value_),Z0(c)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),l||a){var f={type:qh,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:u,name:r};H.NODE_ENV!=="production"&&a&&pn(f),l&&Kn(this,f),H.NODE_ENV!=="production"&&a&&hn()}}finally{Nn()}return!0},e.observe_=function(r,o){return H.NODE_ENV!=="production"&&o===!0&&ce("`observe` doesn't support the fire immediately property for observable objects."),Al(this,r)},e.intercept_=function(r){return Tl(this,r)},e.notifyPropertyAddition_=function(r,o){var i,s=Gn(this),l=H.NODE_ENV!=="production"&&At();if(s||l){var a=s||l?{type:ao,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;H.NODE_ENV!=="production"&&l&&pn(a),s&&Kn(this,a),H.NODE_ENV!=="production"&&l&&hn()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),Pc(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},t}();function gs(t,e){var n;if(H.NODE_ENV!=="production"&&e&&Ml(t)&&ce("Options can't be provided for already observable objects."),Dn(t,xe))return H.NODE_ENV!=="production"&&!(hb(t)instanceof Zd)&&ce("Cannot convert '"+tc(t)+`' into observable object:
113
- The target is already observable of different type.
114
- Extending builtins is not supported.`),t;H.NODE_ENV!=="production"&&!Object.isExtensible(t)&&ce("Cannot make the designated object observable; it is not extensible");var r=(n=e==null?void 0:e.name)!=null?n:H.NODE_ENV!=="production"?(hr(t)?"ObservableObject":t.constructor.name)+"@"+Zn():"ObservableObject",o=new Zd(t,new Map,String(r),Kw(e));return Nc(t,xe,o),t}var GS=bi("ObservableObjectAdministration",Zd);function Gh(t){return Uh[t]||(Uh[t]={get:function(){return this[xe].getObservablePropValue_(t)},set:function(n){return this[xe].setObservablePropValue_(t,n)}})}function Ml(t){return Rc(t)?GS(t[xe]):!1}function Kh(t,e,n){var r;H.NODE_ENV!=="production"&&(t.appliedAnnotations_[n]=e),(r=t.target_[Kt])==null||delete r[n]}function Yh(t,e,n){if(H.NODE_ENV!=="production"&&!gb(e)&&ce("Cannot annotate '"+t.name_+"."+n.toString()+"': Invalid annotation."),H.NODE_ENV!=="production"&&!Ya(e)&&Dn(t.appliedAnnotations_,n)){var r=t.name_+"."+n.toString(),o=t.appliedAnnotations_[n].annotationType_,i=e.annotationType_;ce("Cannot apply '"+i+"' to '"+r+"':"+(`
115
- The field is already annotated with '`+o+"'.")+`
116
- Re-annotating fields is not allowed.
117
- Use 'override' annotation for methods overridden by subclass.`)}}var KS=fb(0),YS=function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,t===!1}(),Su=0,db=function(){};function JS(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):t.prototype.__proto__!==void 0?t.prototype.__proto__=e:t.prototype=e}JS(db,Array.prototype);var lp=function(t){function e(r,o,i,s){var l;return i===void 0&&(i=H.NODE_ENV!=="production"?"ObservableArray@"+Zn():"ObservableArray"),s===void 0&&(s=!1),l=t.call(this)||this,yi(function(){var a=new sp(i,o,s,!0);a.proxy_=l,j0(l,xe,a),r&&r.length&&l.spliceWithArray(0,0,r),YS&&Object.defineProperty(l,"0",KS)}),l}P0(e,t);var n=e.prototype;return n.concat=function(){this[xe].atom_.reportObserved();for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),i.map(function(l){return Hc(l)?l.slice():l}))},n[Symbol.iterator]=function(){var r=this,o=0;return cp({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},hs(e,[{key:"length",get:function(){return this[xe].getArrayLength_()},set:function(o){this[xe].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(db);Object.entries(Qa).forEach(function(t){var e=t[0],n=t[1];e!=="concat"&&Nc(lp.prototype,e,n)});function fb(t){return{enumerable:!1,configurable:!0,get:function(){return this[xe].get_(t)},set:function(n){this[xe].set_(t,n)}}}function ZS(t){cr(lp.prototype,""+t,fb(t))}function pb(t){if(t>Su){for(var e=Su;e<t+100;e++)ZS(e);Su=t}}pb(1e3);function XS(t,e,n){return new lp(t,e,n)}function Xi(t,e){if(typeof t=="object"&&t!==null){if(Hc(t))return e!==void 0&&ce(23),t[xe].atom_;if(or(t))return t.atom_;if(To(t)){if(e===void 0)return t.keysAtom_;var n=t.data_.get(e)||t.hasMap_.get(e);return n||ce(25,e,tc(t)),n}if(Ml(t)){if(!e)return ce(26);var r=t[xe].values_.get(e);return r||ce(27,e,tc(t)),r}if(ep(t)||$c(t)||Xa(t))return t}else if(yt(t)&&Xa(t[xe]))return t[xe];ce(28)}function hb(t,e){if(t||ce(29),ep(t)||$c(t)||Xa(t)||To(t)||or(t))return t;if(t[xe])return t[xe];ce(24,t)}function tc(t,e){var n;if(e!==void 0)n=Xi(t,e);else{if(Ji(t))return t.name;Ml(t)||To(t)||or(t)?n=hb(t):n=Xi(t)}return n.name_}function yi(t){var e=vi(),n=np(!0);Rn();try{return t()}finally{Nn(),rp(n),Vr(e)}}var Jh=jc.toString;function ap(t,e,n){return n===void 0&&(n=-1),Xd(t,e,n)}function Xd(t,e,n,r,o){if(t===e)return t!==0||1/t===1/e;if(t==null||e==null)return!1;if(t!==t)return e!==e;var i=typeof t;if(i!=="function"&&i!=="object"&&typeof e!="object")return!1;var s=Jh.call(t);if(s!==Jh.call(e))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:+t==0?1/+t===1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(t)===Symbol.valueOf.call(e);case"[object Map]":case"[object Set]":n>=0&&n++;break}t=Zh(t),e=Zh(e);var l=s==="[object Array]";if(!l){if(typeof t!="object"||typeof e!="object")return!1;var a=t.constructor,c=e.constructor;if(a!==c&&!(yt(a)&&a instanceof a&&yt(c)&&c instanceof c)&&"constructor"in t&&"constructor"in e)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],o=o||[];for(var u=r.length;u--;)if(r[u]===t)return o[u]===e;if(r.push(t),o.push(e),l){if(u=t.length,u!==e.length)return!1;for(;u--;)if(!Xd(t[u],e[u],n-1,r,o))return!1}else{var d=Object.keys(t),f;if(u=d.length,Object.keys(e).length!==u)return!1;for(;u--;)if(f=d[u],!(Dn(e,f)&&Xd(t[f],e[f],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function Zh(t){return Hc(t)?t.slice():ps(t)||To(t)||Nr(t)||or(t)?Array.from(t.entries()):t}var Xh,QS=((Xh=Mc().Iterator)==null?void 0:Xh.prototype)||{};function cp(t){return t[Symbol.iterator]=eC,Object.assign(Object.create(QS),t)}function eC(){return this}function gb(t){return t instanceof Object&&typeof t.annotationType_=="string"&&yt(t.make_)&&yt(t.extend_)}["Symbol","Map","Set"].forEach(function(t){var e=Mc();typeof e[t]>"u"&&ce("MobX requires global '"+t+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:gS,extras:{getDebugName:tc},$mobx:xe});if(!m.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!$S)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var tC={};function nC(t){t()}function rC(t){t||(t=nC,tC.NODE_ENV!=="production"&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),AS({reactionScheduler:t})}function oC(t){return ib(t)}var iC=1e4,sC=1e4,lC=function(){function t(e){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=iC),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var o=Date.now();n.registrations.forEach(function(i,s){o-i.registeredAt>=r&&(n.finalize(i.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(t.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(t.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(t.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,sC))}}),t}(),aC=typeof FinalizationRegistry<"u"?FinalizationRegistry:lC,Qd=new aC(function(t){var e;(e=t.reaction)===null||e===void 0||e.dispose(),t.reaction=null}),ef={exports:{}},Cu={};/**
118
- * @license React
119
- * use-sync-external-store-shim.production.min.js
120
- *
121
- * Copyright (c) Facebook, Inc. and its affiliates.
122
- *
123
- * This source code is licensed under the MIT license found in the
124
- * LICENSE file in the root directory of this source tree.
125
- */var Qh;function cC(){if(Qh)return Cu;Qh=1;var t=m;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function l(d,f){var p=f(),g=r({inst:{value:p,getSnapshot:f}}),b=g[0].inst,v=g[1];return i(function(){b.value=p,b.getSnapshot=f,a(b)&&v({inst:b})},[d,p,f]),o(function(){return a(b)&&v({inst:b}),d(function(){a(b)&&v({inst:b})})},[d]),s(p),p}function a(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Cu.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Cu}var Eu={},eg;function uC(){if(eg)return Eu;eg=1;var t={};/**
126
- * @license React
127
- * use-sync-external-store-shim.development.js
128
- *
129
- * Copyright (c) Facebook, Inc. and its affiliates.
130
- *
131
- * This source code is licensed under the MIT license found in the
132
- * LICENSE file in the root directory of this source tree.
133
- */return t.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=m,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(C){{for(var x=arguments.length,E=new Array(x>1?x-1:0),_=1;_<x;_++)E[_-1]=arguments[_];o("error",C,E)}}function o(C,x,E){{var _=n.ReactDebugCurrentFrame,M=_.getStackAddendum();M!==""&&(x+="%s",E=E.concat([M]));var k=E.map(function(j){return String(j)});k.unshift("Warning: "+x),Function.prototype.apply.call(console[C],console,k)}}function i(C,x){return C===x&&(C!==0||1/C===1/x)||C!==C&&x!==x}var s=typeof Object.is=="function"?Object.is:i,l=e.useState,a=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue,d=!1,f=!1;function p(C,x,E){d||e.startTransition!==void 0&&(d=!0,r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var _=x();if(!f){var M=x();s(_,M)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var k=l({inst:{value:_,getSnapshot:x}}),j=k[0].inst,N=k[1];return c(function(){j.value=_,j.getSnapshot=x,g(j)&&N({inst:j})},[C,_,x]),a(function(){g(j)&&N({inst:j});var P=function(){g(j)&&N({inst:j})};return C(P)},[C]),u(_),_}function g(C){var x=C.getSnapshot,E=C.value;try{var _=x();return!s(E,_)}catch{return!0}}function b(C,x,E){return x()}var v=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y=!v,w=y?b:p,S=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:w;Eu.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),Eu}var dC={};dC.NODE_ENV==="production"?ef.exports=cC():ef.exports=uC();var fC=ef.exports;function tg(t){t.reaction=new Br("observer".concat(t.name),function(){var e;t.stateVersion=Symbol(),(e=t.onStoreChange)===null||e===void 0||e.call(t)})}function pC(t,e){e===void 0&&(e="observed");var n=m.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe:function(l){return Qd.unregister(r),r.onStoreChange=l,r.reaction||(tg(r),r.stateVersion=Symbol()),function(){var a;r.onStoreChange=null,(a=r.reaction)===null||a===void 0||a.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var o=n.current;o.reaction||(tg(o),Qd.register(n,o,o)),m.useDebugValue(o.reaction,oC),fC.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot);var i,s;if(o.reaction.track(function(){try{i=t()}catch(l){s=l}}),s)throw s;return i}var ng={},Ou,_u,rg=!0,mb=typeof Symbol=="function"&&Symbol.for,hC=(_u=(Ou=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Ou===void 0?void 0:Ou.configurable)!==null&&_u!==void 0?_u:!1,og=mb?Symbol.for("react.forward_ref"):typeof m.forwardRef=="function"&&m.forwardRef(function(t){return null}).$$typeof,ig=mb?Symbol.for("react.memo"):typeof m.memo=="function"&&m.memo(function(t){return null}).$$typeof;function ms(t,e){var n;if(ng.NODE_ENV!=="production"&&rg&&e&&(rg=!1,console.warn("[mobx-react-lite] `observer(fn, { forwardRef: true })` is deprecated, use `observer(React.forwardRef(fn))`")),ig&&t.$$typeof===ig)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,o=t,i=t.displayName||t.name;if(og&&t.$$typeof===og&&(r=!0,o=t.render,typeof o!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(l,a){return pC(function(){return o(l,a)},i)};return s.displayName=t.displayName,hC&&Object.defineProperty(s,"name",{value:t.name,writable:!0,configurable:!0}),t.contextTypes&&(s.contextTypes=t.contextTypes),r&&(s=m.forwardRef(s)),s=m.memo(s),mC(t,s),ng.NODE_ENV!=="production"&&Object.defineProperty(s,"contextTypes",{set:function(){var l,a;throw new Error("[mobx-react-lite] `".concat(this.displayName||((l=this.type)===null||l===void 0?void 0:l.displayName)||((a=this.type)===null||a===void 0?void 0:a.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),s}var gC={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function mC(t,e){Object.keys(t).forEach(function(n){gC[n]||Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}var ku;rC(ir.unstable_batchedUpdates);ku=Qd.finalizeAllImmediately;const Re=B;function B(...t){return(Array.isArray(t[0])?t[0]:[...t]).filter(Boolean).flatMap(o=>typeof o=="string"?o.split(" ").map(i=>{if(i=i.replace(/gjs-/g,"gs-utl-"),!i.includes("gs-utl-")&&!i.startsWith("gs-")){const s=i.split(":"),l=s.pop(),a=s.join(":"),c=l==null?void 0:l.startsWith("!"),d=`gs-utl-${c?l==null?void 0:l.slice(1):l}`,f=c?`!${d}`:d;return a?`${a}:${f}`:f}return i}):o).join(" ")}var bC="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M11 7H13V13H11V7M11 15H13V17H11V15Z",vC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",yC="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",xC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",wC="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z",SC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",CC="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",EC="M20 13.5C20 17.09 17.09 20 13.5 20H6V18H13.5C16 18 18 16 18 13.5S16 9 13.5 9H7.83L10.91 12.09L9.5 13.5L4 8L9.5 2.5L10.92 3.91L7.83 7H13.5C17.09 7 20 9.91 20 13.5Z",OC="M10.5 18H18V20H10.5C6.91 20 4 17.09 4 13.5S6.91 7 10.5 7H16.17L13.08 3.91L14.5 2.5L20 8L14.5 13.5L13.09 12.09L16.17 9H10.5C8 9 6 11 6 13.5S8 18 10.5 18Z",_C="M3,21V3H21V21H3M5,5V19H19V5H5Z",kC="M3 16C3 18.8 5.2 21 8 21H10V19H8C6.3 19 5 17.7 5 16V14H3V16M21 8C21 5.2 18.8 3 16 3H14V5H16C17.7 5 19 6.3 19 8V10H21V8M16 21C18.8 21 21 18.8 21 16V14H19V16C19 17.7 17.7 19 16 19H14V21H16M8 3C5.2 3 3 5.2 3 8V10H5V8C5 6.3 6.3 5 8 5H10V3H8Z",TC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",AC="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z",MC="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",jC="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",RC="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",NC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",PC="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",DC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",LC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",VC="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",IC="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",$C="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",HC="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",BC="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",zC="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",FC="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",WC="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",UC="M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z",qC="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",GC="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",KC="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z",YC="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z",JC="M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z",ZC="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",XC="M7,11H1V13H7V11M9.17,7.76L7.05,5.64L5.64,7.05L7.76,9.17L9.17,7.76M13,1H11V7H13V1M18.36,7.05L16.95,5.64L14.83,7.76L16.24,9.17L18.36,7.05M17,11V13H23V11H17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M14.83,16.24L16.95,18.36L18.36,16.95L16.24,14.83L14.83,16.24M5.64,16.95L7.05,18.36L9.17,16.24L7.76,14.83L5.64,16.95M11,23H13V17H11V23Z",QC="M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5.5L18.5,3H17V9A1,1 0 0,1 16,10H8A1,1 0 0,1 7,9V3H5M12,4V9H15V4H12M7,12H17A1,1 0 0,1 18,13V19H6V13A1,1 0 0,1 7,12Z",eE="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",tE="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",nE="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",rE="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",oE="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",iE="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",sE="M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z",lE="M12,16L19.36,10.27L21,9L12,2L3,9L4.63,10.27M12,18.54L4.62,12.81L3,14.07L12,21.07L21,14.07L19.37,12.8L12,18.54Z",aE="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",cE="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",uE="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",dE="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z",fE="M7,10L12,15L17,10H7Z",pE="M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z",hE="M2.53,19.65L3.87,20.21V11.18L1.44,17.04C1.03,18.06 1.5,19.23 2.53,19.65M22.03,15.95L17.07,4C16.76,3.23 16.03,2.77 15.26,2.75C15,2.75 14.73,2.79 14.47,2.9L7.1,5.95C6.35,6.26 5.89,7 5.87,7.75C5.86,8 5.91,8.29 6,8.55L11,20.5C11.29,21.28 12.03,21.74 12.81,21.75C13.07,21.75 13.33,21.7 13.58,21.6L20.94,18.55C21.96,18.13 22.45,16.96 22.03,15.95M7.88,8.75A1,1 0 0,1 6.88,7.75A1,1 0 0,1 7.88,6.75C8.43,6.75 8.88,7.2 8.88,7.75C8.88,8.3 8.43,8.75 7.88,8.75M5.88,19.75A2,2 0 0,0 7.88,21.75H9.33L5.88,13.41V19.75Z",gE="M12,2.5L8,7H16L12,2.5M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M8,17L12,21.5L16,17H8Z",mE="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",bE="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",vE="M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",yE="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",xE="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",wE="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L20 12L12 20L4 12Z",SE="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",CE="M11,2V4.07C7.38,4.53 4.53,7.38 4.07,11H2V13H4.07C4.53,16.62 7.38,19.47 11,19.93V22H13V19.93C16.62,19.47 19.47,16.62 19.93,13H22V11H19.93C19.47,7.38 16.62,4.53 13,4.07V2M11,6.08V8H13V6.09C15.5,6.5 17.5,8.5 17.92,11H16V13H17.91C17.5,15.5 15.5,17.5 13,17.92V16H11V17.91C8.5,17.5 6.5,15.5 6.08,13H8V11H6.09C6.5,8.5 8.5,6.5 11,6.08M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11Z",EE="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",OE="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",_E="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z",kE="M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z",TE="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z",AE="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z",ME="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",jE="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",RE="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const fe=m.forwardRef(function({as:e,children:n,className:r,col:o,revert:i,full:s,nowrap:l,space:a,justify:c,items:u,...d},f){const p=e||"div";return h.jsx(p,{ref:f,className:B(["gs-utl-flex",r,o&&!i&&"gs-utl-flex-col",o&&i&&"gs-utl-flex-col-reverse",!o&&i&&"gs-utl-flex-row-reverse",s&&!o&&"gs-utl-w-full",s&&o&&"gs-utl-h-full",l?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",a==="x2s"&&(o?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),a==="xs"&&(o?"gs-utl-space-y-1":"gs-utl-space-x-1"),a==="s"&&(o?"gs-utl-space-y-2":"gs-utl-space-x-2"),a==="m"&&(o?"gs-utl-space-y-4":"gs-utl-space-x-4"),a==="l"&&(o?"gs-utl-space-y-6":"gs-utl-space-x-6"),a==="xl"&&(o?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="start"&&"gs-utl-items-start",u==="end"&&"gs-utl-items-end",u==="center"&&"gs-utl-items-center",c==="start"&&"gs-utl-justify-start",c==="end"&&"gs-utl-justify-end",c==="center"&&"gs-utl-justify-center",c==="between"&&"gs-utl-justify-between"]),...d,children:n})}),U=m.forwardRef(function({children:e,className:n,grow:r,...o},i){return h.jsx("div",{ref:i,className:B([n,r&&"flex-1"]),...o,children:e})});var Zl={exports:{}},Xl={exports:{}},He={};/** @license React v16.13.1
134
- * react-is.production.min.js
135
- *
136
- * Copyright (c) Facebook, Inc. and its affiliates.
137
- *
138
- * This source code is licensed under the MIT license found in the
139
- * LICENSE file in the root directory of this source tree.
140
- */var sg;function NE(){if(sg)return He;sg=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,a=t?Symbol.for("react.async_mode"):60111,c=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,d=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,b=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,w=t?Symbol.for("react.scope"):60119;function S(x){if(typeof x=="object"&&x!==null){var E=x.$$typeof;switch(E){case e:switch(x=x.type,x){case a:case c:case r:case i:case o:case d:return x;default:switch(x=x&&x.$$typeof,x){case l:case u:case g:case p:case s:return x;default:return E}}case n:return E}}}function C(x){return S(x)===c}return He.AsyncMode=a,He.ConcurrentMode=c,He.ContextConsumer=l,He.ContextProvider=s,He.Element=e,He.ForwardRef=u,He.Fragment=r,He.Lazy=g,He.Memo=p,He.Portal=n,He.Profiler=i,He.StrictMode=o,He.Suspense=d,He.isAsyncMode=function(x){return C(x)||S(x)===a},He.isConcurrentMode=C,He.isContextConsumer=function(x){return S(x)===l},He.isContextProvider=function(x){return S(x)===s},He.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===e},He.isForwardRef=function(x){return S(x)===u},He.isFragment=function(x){return S(x)===r},He.isLazy=function(x){return S(x)===g},He.isMemo=function(x){return S(x)===p},He.isPortal=function(x){return S(x)===n},He.isProfiler=function(x){return S(x)===i},He.isStrictMode=function(x){return S(x)===o},He.isSuspense=function(x){return S(x)===d},He.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===c||x===i||x===o||x===d||x===f||typeof x=="object"&&x!==null&&(x.$$typeof===g||x.$$typeof===p||x.$$typeof===s||x.$$typeof===l||x.$$typeof===u||x.$$typeof===v||x.$$typeof===y||x.$$typeof===w||x.$$typeof===b)},He.typeOf=S,He}var Be={},lg;function PE(){if(lg)return Be;lg=1;var t={};/** @license React v16.13.1
141
- * react-is.development.js
142
- *
143
- * Copyright (c) Facebook, Inc. and its affiliates.
144
- *
145
- * This source code is licensed under the MIT license found in the
146
- * LICENSE file in the root directory of this source tree.
147
- */return t.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,S=e?Symbol.for("react.scope"):60119;function C(X){return typeof X=="string"||typeof X=="function"||X===o||X===u||X===s||X===i||X===f||X===p||typeof X=="object"&&X!==null&&(X.$$typeof===b||X.$$typeof===g||X.$$typeof===l||X.$$typeof===a||X.$$typeof===d||X.$$typeof===y||X.$$typeof===w||X.$$typeof===S||X.$$typeof===v)}function x(X){if(typeof X=="object"&&X!==null){var qe=X.$$typeof;switch(qe){case n:var Qe=X.type;switch(Qe){case c:case u:case o:case s:case i:case f:return Qe;default:var at=Qe&&Qe.$$typeof;switch(at){case a:case d:case b:case g:case l:return at;default:return qe}}case r:return qe}}}var E=c,_=u,M=a,k=l,j=n,N=d,P=o,z=b,W=g,F=r,$=s,J=i,ee=f,L=!1;function I(X){return L||(L=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),A(X)||x(X)===c}function A(X){return x(X)===u}function R(X){return x(X)===a}function q(X){return x(X)===l}function D(X){return typeof X=="object"&&X!==null&&X.$$typeof===n}function V(X){return x(X)===d}function te(X){return x(X)===o}function G(X){return x(X)===b}function Q(X){return x(X)===g}function se(X){return x(X)===r}function be(X){return x(X)===s}function de(X){return x(X)===i}function Pe(X){return x(X)===f}Be.AsyncMode=E,Be.ConcurrentMode=_,Be.ContextConsumer=M,Be.ContextProvider=k,Be.Element=j,Be.ForwardRef=N,Be.Fragment=P,Be.Lazy=z,Be.Memo=W,Be.Portal=F,Be.Profiler=$,Be.StrictMode=J,Be.Suspense=ee,Be.isAsyncMode=I,Be.isConcurrentMode=A,Be.isContextConsumer=R,Be.isContextProvider=q,Be.isElement=D,Be.isForwardRef=V,Be.isFragment=te,Be.isLazy=G,Be.isMemo=Q,Be.isPortal=se,Be.isProfiler=be,Be.isStrictMode=de,Be.isSuspense=Pe,Be.isValidElementType=C,Be.typeOf=x}(),Be}var ag;function bb(){if(ag)return Xl.exports;ag=1;var t={};return t.NODE_ENV==="production"?Xl.exports=NE():Xl.exports=PE(),Xl.exports}/*
148
- object-assign
149
- (c) Sindre Sorhus
150
- @license MIT
151
- */var Tu,cg;function DE(){if(cg)return Tu;cg=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var a=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(a.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Tu=o()?Object.assign:function(i,s){for(var l,a=r(i),c,u=1;u<arguments.length;u++){l=Object(arguments[u]);for(var d in l)e.call(l,d)&&(a[d]=l[d]);if(t){c=t(l);for(var f=0;f<c.length;f++)n.call(l,c[f])&&(a[c[f]]=l[c[f]])}}return a},Tu}var Au,ug;function up(){if(ug)return Au;ug=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Au=t,Au}var Mu,dg;function vb(){return dg||(dg=1,Mu=Function.call.bind(Object.prototype.hasOwnProperty)),Mu}var ju,fg;function LE(){if(fg)return ju;fg=1;var t={},e=function(){};if(t.NODE_ENV!=="production"){var n=up(),r={},o=vb();e=function(s){var l="Warning: "+s;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function i(s,l,a,c,u){if(t.NODE_ENV!=="production"){for(var d in s)if(o(s,d)){var f;try{if(typeof s[d]!="function"){var p=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=s[d](l,d,c,a,null,n)}catch(b){f=b}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in r)){r[f.message]=!0;var g=u?u():"";e("Failed "+a+" type: "+f.message+(g??""))}}}}return i.resetWarningCache=function(){t.NODE_ENV!=="production"&&(r={})},ju=i,ju}var Ru,pg;function VE(){if(pg)return Ru;pg=1;var t={},e=bb(),n=DE(),r=up(),o=vb(),i=LE(),s=function(){};t.NODE_ENV!=="production"&&(s=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function l(){return null}return Ru=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(A){var R=A&&(u&&A[u]||A[d]);if(typeof R=="function")return R}var p="<<anonymous>>",g={array:w("array"),bigint:w("bigint"),bool:w("boolean"),func:w("function"),number:w("number"),object:w("object"),string:w("string"),symbol:w("symbol"),any:S(),arrayOf:C,element:x(),elementType:E(),instanceOf:_,node:N(),objectOf:k,oneOf:M,oneOfType:j,shape:z,exact:W};function b(A,R){return A===R?A!==0||1/A===1/R:A!==A&&R!==R}function v(A,R){this.message=A,this.data=R&&typeof R=="object"?R:{},this.stack=""}v.prototype=Error.prototype;function y(A){if(t.NODE_ENV!=="production")var R={},q=0;function D(te,G,Q,se,be,de,Pe){if(se=se||p,de=de||Q,Pe!==r){if(c){var X=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw X.name="Invariant Violation",X}else if(t.NODE_ENV!=="production"&&typeof console<"u"){var qe=se+":"+Q;!R[qe]&&q<3&&(s("You are manually calling a React.PropTypes validation function for the `"+de+"` prop on `"+se+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[qe]=!0,q++)}}return G[Q]==null?te?G[Q]===null?new v("The "+be+" `"+de+"` is marked as required "+("in `"+se+"`, but its value is `null`.")):new v("The "+be+" `"+de+"` is marked as required in "+("`"+se+"`, but its value is `undefined`.")):null:A(G,Q,se,be,de)}var V=D.bind(null,!1);return V.isRequired=D.bind(null,!0),V}function w(A){function R(q,D,V,te,G,Q){var se=q[D],be=J(se);if(be!==A){var de=ee(se);return new v("Invalid "+te+" `"+G+"` of type "+("`"+de+"` supplied to `"+V+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return y(R)}function S(){return y(l)}function C(A){function R(q,D,V,te,G){if(typeof A!="function")return new v("Property `"+G+"` of component `"+V+"` has invalid PropType notation inside arrayOf.");var Q=q[D];if(!Array.isArray(Q)){var se=J(Q);return new v("Invalid "+te+" `"+G+"` of type "+("`"+se+"` supplied to `"+V+"`, expected an array."))}for(var be=0;be<Q.length;be++){var de=A(Q,be,V,te,G+"["+be+"]",r);if(de instanceof Error)return de}return null}return y(R)}function x(){function A(R,q,D,V,te){var G=R[q];if(!a(G)){var Q=J(G);return new v("Invalid "+V+" `"+te+"` of type "+("`"+Q+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return y(A)}function E(){function A(R,q,D,V,te){var G=R[q];if(!e.isValidElementType(G)){var Q=J(G);return new v("Invalid "+V+" `"+te+"` of type "+("`"+Q+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return y(A)}function _(A){function R(q,D,V,te,G){if(!(q[D]instanceof A)){var Q=A.name||p,se=I(q[D]);return new v("Invalid "+te+" `"+G+"` of type "+("`"+se+"` supplied to `"+V+"`, expected ")+("instance of `"+Q+"`."))}return null}return y(R)}function M(A){if(!Array.isArray(A))return t.NODE_ENV!=="production"&&(arguments.length>1?s("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):s("Invalid argument supplied to oneOf, expected an array.")),l;function R(q,D,V,te,G){for(var Q=q[D],se=0;se<A.length;se++)if(b(Q,A[se]))return null;var be=JSON.stringify(A,function(Pe,X){var qe=ee(X);return qe==="symbol"?String(X):X});return new v("Invalid "+te+" `"+G+"` of value `"+String(Q)+"` "+("supplied to `"+V+"`, expected one of "+be+"."))}return y(R)}function k(A){function R(q,D,V,te,G){if(typeof A!="function")return new v("Property `"+G+"` of component `"+V+"` has invalid PropType notation inside objectOf.");var Q=q[D],se=J(Q);if(se!=="object")return new v("Invalid "+te+" `"+G+"` of type "+("`"+se+"` supplied to `"+V+"`, expected an object."));for(var be in Q)if(o(Q,be)){var de=A(Q,be,V,te,G+"."+be,r);if(de instanceof Error)return de}return null}return y(R)}function j(A){if(!Array.isArray(A))return t.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var R=0;R<A.length;R++){var q=A[R];if(typeof q!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+L(q)+" at index "+R+"."),l}function D(V,te,G,Q,se){for(var be=[],de=0;de<A.length;de++){var Pe=A[de],X=Pe(V,te,G,Q,se,r);if(X==null)return null;X.data&&o(X.data,"expectedType")&&be.push(X.data.expectedType)}var qe=be.length>0?", expected one of type ["+be.join(", ")+"]":"";return new v("Invalid "+Q+" `"+se+"` supplied to "+("`"+G+"`"+qe+"."))}return y(D)}function N(){function A(R,q,D,V,te){return F(R[q])?null:new v("Invalid "+V+" `"+te+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return y(A)}function P(A,R,q,D,V){return new v((A||"React class")+": "+R+" type `"+q+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+V+"`.")}function z(A){function R(q,D,V,te,G){var Q=q[D],se=J(Q);if(se!=="object")return new v("Invalid "+te+" `"+G+"` of type `"+se+"` "+("supplied to `"+V+"`, expected `object`."));for(var be in A){var de=A[be];if(typeof de!="function")return P(V,te,G,be,ee(de));var Pe=de(Q,be,V,te,G+"."+be,r);if(Pe)return Pe}return null}return y(R)}function W(A){function R(q,D,V,te,G){var Q=q[D],se=J(Q);if(se!=="object")return new v("Invalid "+te+" `"+G+"` of type `"+se+"` "+("supplied to `"+V+"`, expected `object`."));var be=n({},q[D],A);for(var de in be){var Pe=A[de];if(o(A,de)&&typeof Pe!="function")return P(V,te,G,de,ee(Pe));if(!Pe)return new v("Invalid "+te+" `"+G+"` key `"+de+"` supplied to `"+V+"`.\nBad object: "+JSON.stringify(q[D],null," ")+`
152
- Valid keys: `+JSON.stringify(Object.keys(A),null," "));var X=Pe(Q,de,V,te,G+"."+de,r);if(X)return X}return null}return y(R)}function F(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(F);if(A===null||a(A))return!0;var R=f(A);if(R){var q=R.call(A),D;if(R!==A.entries){for(;!(D=q.next()).done;)if(!F(D.value))return!1}else for(;!(D=q.next()).done;){var V=D.value;if(V&&!F(V[1]))return!1}}else return!1;return!0;default:return!1}}function $(A,R){return A==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function J(A){var R=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":$(R,A)?"symbol":R}function ee(A){if(typeof A>"u"||A===null)return""+A;var R=J(A);if(R==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return R}function L(A){var R=ee(A);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function I(A){return!A.constructor||!A.constructor.name?p:A.constructor.name}return g.checkPropTypes=i,g.resetWarningCache=i.resetWarningCache,g.PropTypes=g,g},Ru}var Nu,hg;function IE(){if(hg)return Nu;hg=1;var t=up();function e(){}function n(){}return n.resetWarningCache=e,Nu=function(){function r(s,l,a,c,u,d){if(d!==t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:e};return i.PropTypes=i,i},Nu}var gg;function $E(){if(gg)return Zl.exports;gg=1;var t={};if(t.NODE_ENV!=="production"){var e=bb(),n=!0;Zl.exports=VE()(e.isElement,n)}else Zl.exports=IE()();return Zl.exports}var HE=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(r,o,i){n.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:i})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,o){if(1&o&&(r=n(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var s in r)n.d(i,s,(function(l){return r[l]}).bind(null,s));return i},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},n.p="",n(n.s=2)}([function(t,e){t.exports=$E()},function(t,e){t.exports=m},function(t,e,n){n.r(e);var r=n(1),o=n(0),i=function(){return(i=Object.assign||function(g){for(var b,v=1,y=arguments.length;v<y;v++)for(var w in b=arguments[v])Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w]);return g}).apply(this,arguments)},s=function(g,b){var v={};for(var y in g)Object.prototype.hasOwnProperty.call(g,y)&&b.indexOf(y)<0&&(v[y]=g[y]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(y=Object.getOwnPropertySymbols(g);w<y.length;w++)b.indexOf(y[w])<0&&Object.prototype.propertyIsEnumerable.call(g,y[w])&&(v[y[w]]=g[y[w]])}return v},l=0,a=r.forwardRef(function(g,b){var v=g.title,y=v===void 0?null:v,w=g.description,S=w===void 0?null:w,C=g.size,x=C===void 0?null:C,E=g.color,_=E===void 0?"currentColor":E,M=g.horizontal,k=M===void 0?null:M,j=g.vertical,N=j===void 0?null:j,P=g.rotate,z=P===void 0?null:P,W=g.spin,F=W===void 0?null:W,$=g.style,J=$===void 0?{}:$,ee=g.children,L=s(g,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);l++;var I,A=F!==null&&F,R=r.Children.map(ee,function(te){var G=te;A!==!0&&(A=(F===null?G.props.spin:F)===!0);var Q=G.props.size;typeof x=="number"&&typeof G.props.size=="number"&&(Q=G.props.size/x);var se={size:Q,color:_===null?G.props.color:_,horizontal:k===null?G.props.horizontal:k,vertical:N===null?G.props.vertical:N,rotate:z===null?G.props.rotate:z,spin:F===null?G.props.spin:F,inStack:!0};return r.cloneElement(G,se)});x!==null&&(J.width=typeof x=="string"?x:1.5*x+"rem");var q,D="stack_labelledby_"+l,V="stack_describedby_"+l;if(y)I=S?D+" "+V:D;else if(q="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",i({ref:b,viewBox:"0 0 24 24",style:J,role:q,"aria-labelledby":I},L),y&&r.createElement("title",{id:D},y),S&&r.createElement("desc",{id:V},S),A&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),R)});a.displayName="Stack",a.propTypes={size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),children:o.oneOfType([o.arrayOf(o.node),o.node]).isRequired,className:o.string,style:o.object},a.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var c=a;n.d(e,"Icon",function(){return p}),n.d(e,"Stack",function(){return c});var u=function(){return(u=Object.assign||function(g){for(var b,v=1,y=arguments.length;v<y;v++)for(var w in b=arguments[v])Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w]);return g}).apply(this,arguments)},d=function(g,b){var v={};for(var y in g)Object.prototype.hasOwnProperty.call(g,y)&&b.indexOf(y)<0&&(v[y]=g[y]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(y=Object.getOwnPropertySymbols(g);w<y.length;w++)b.indexOf(y[w])<0&&Object.prototype.propertyIsEnumerable.call(g,y[w])&&(v[y[w]]=g[y[w]])}return v},f=0,p=r.forwardRef(function(g,b){var v=g.path,y=g.id,w=y===void 0?++f:y,S=g.title,C=S===void 0?null:S,x=g.description,E=x===void 0?null:x,_=g.size,M=_===void 0?null:_,k=g.color,j=k===void 0?"currentColor":k,N=g.horizontal,P=N!==void 0&&N,z=g.vertical,W=z!==void 0&&z,F=g.rotate,$=F===void 0?0:F,J=g.spin,ee=J!==void 0&&J,L=g.style,I=L===void 0?{}:L,A=g.inStack,R=A!==void 0&&A,q=d(g,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),D={},V=[];M!==null&&(R?V.push("scale("+M+")"):(I.width=typeof M=="string"?M:1.5*M+"rem",I.height=I.width)),P&&V.push("scaleX(-1)"),W&&V.push("scaleY(-1)"),$!==0&&V.push("rotate("+$+"deg)"),j!==null&&(D.fill=j);var te=r.createElement("path",u({d:v,style:D},R?q:{})),G=te;V.length>0&&(I.transform=V.join(" "),I.transformOrigin="center",R&&(G=r.createElement("g",{style:I},te,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var Q,se=G,be=ee===!0||typeof ee!="number"?2:ee,de=!R&&(P||W);if(be<0&&(de=!de),ee&&(se=r.createElement("g",{style:{animation:"spin"+(de?"-inverse":"")+" linear "+Math.abs(be)+"s infinite",transformOrigin:"center"}},G,!(P||W||$!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),R)return se;var Pe,X="icon_labelledby_"+w,qe="icon_describedby_"+w;if(C)Q=E?X+" "+qe:X;else if(Pe="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",u({ref:b,viewBox:"0 0 24 24",style:I,role:Pe,"aria-labelledby":Q},q),C&&r.createElement("title",{id:X},C),E&&r.createElement("desc",{id:qe},E),!R&&ee&&(de?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),se)});p.displayName="Icon",p.propTypes={path:o.string.isRequired,size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),style:o.object,inStack:o.bool,className:o.string},p.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},e.default=p}]);const BE=Xf(HE);var yb={exports:{}};/*!
153
- Copyright (c) 2018 Jed Watson.
154
- Licensed under the MIT License (MIT), see
155
- http://jedwatson.github.io/classnames
156
- */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var l=arguments[s];l&&(i=o(i,r(l)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var l in i)e.call(i,l)&&i[l]&&(s=o(s,l));return s}function o(i,s){return s?i?i+" "+s:i+s:i}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(yb);var zE=yb.exports;const tt=Xf(zE);function xb(t,e,n){let r,o,i,s,l;const a=e;function c(){const d=Date.now()-s;d<a&&d>=0?r=setTimeout(c,a-d):(r=null,l=t.apply(i,o),i=o=null)}const u=function(){return i=this,o=arguments,s=Date.now(),r||(r=setTimeout(c,a)),l};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(l=t.apply(i,o),i=o=null,clearTimeout(r),r=null)},u}const mg=new Map,FE=m.forwardRef(function({svg:e,iconSize:n,...r},o){let i=mg.get(e);return i||(i=x2(e,n),mg.set(e,i)),h.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:i}})}),WE=150,he={bgTr:"gs-utl-bg-transparent",txt:"gs-theme-cl-txt gs-utl-text-gray-900 dark:gs-utl-text-gray-400",txtLowEmphasis:"gs-utl-text-neutral-500 dark:gs-utl-text-neutral-500",txtHighEmphasis:"gs-utl-text-black dark:gs-utl-text-gray-200",txtHighEmphasisH:"hover:gs-utl-text-black hover:dark:gs-utl-text-gray-200",tA:"gs-theme-cl-tA gs-utl-text-violet-400",tAo:"gs-theme-cl-tAo gs-utl-text-violet-800 dark:gs-utl-text-violet-400",hTAo:"gs-theme-cl-hTAo hover:gs-utl-text-violet-800 hover:dark:gs-utl-text-violet-400",grouphTAo:"gs-theme-cl-grouphTAo group-hover:gs-utl-text-violet-800 group-hover:dark:gs-utl-text-violet-400",bA:"gs-theme-cl-bA gs-utl-border-violet-400",bgA:"gs-theme-cl-bgA gs-utl-bg-violet-400 gs-utl-text-white dark:gs-utl-bg-violet-500",bgA2:"gs-theme-cl-bgA2 gs-utl-bg-violet-500 gs-utl-text-white",bgO:"gs-theme-cl-bg0 gs-utl-bg-violet-50 gs-utl-text-violet-900 dark:gs-utl-bg-zinc-800 dark:gs-utl-text-violet-400",bg:"gs-theme-cl-bg gs-utl-bg-white dark:gs-utl-bg-zinc-900",bgBlur:"gs-utl-bg-white/50 dark:gs-utl-bg-zinc-900/50 gs-utl-backdrop-blur-sm",bgH:"gs-theme-cl-bgH gs-utl-bg-gray-100 dark:gs-utl-bg-zinc-700",bgH75:"gs-utl-bg-gray-100/75 dark:gs-utl-bg-zinc-700/75",hBgH:"gs-theme-cl-hBgH hover:gs-utl-bg-gray-50 hover:dark:gs-utl-bg-zinc-800",bgH2:"gs-theme-cl-bgH2 gs-utl-bg-gray-25 dark:gs-utl-bg-zinc-800",hBgH2:"gs-theme-cl-hBgH2 hover:gs-utl-bg-gray-25 hover:dark:gs-utl-bg-zinc-800",hBgAct:"gs-theme-cl-hBgAct hover:gs-utl-bg-violet-800 hover:dark:gs-utl-bg-violet-400",hBgA2:"gs-theme-cl-hBgA2 hover:gs-utl-bg-violet-500 hover:dark:gs-utl-bg-violet-600",hBgDark:"hover:gs-utl-bg-black/10",sel:"gs-theme-cl-sel gs-utl-bg-pink-200 gs-utl-text-pink-900",selBr:"gs-theme-cl-selBr gs-utl-border-pink-900",cmp:"gs-theme-cl-cmp gs-utl-bg-blue-450 gs-utl-text-white",cmpSymbol:"gs-theme-cl-cmpSymbol gs-utl-bg-[#7b61ff] gs-utl-text-white",cmpBgSoft:"gs-theme-cl-cmpBgSoft gs-utl-bg-blue-100 dark:gs-utl-bg-sky-800",cmpBgSymbolSoft:"gs-theme-cl-cmpBgSymbolSoft gs-utl-bg-violet-200 dark:gs-utl-bg-violet-800",cmpBgSoftX:"gs-theme-cl-cmpBgSoftX gs-utl-bg-blue-50 dark:gs-utl-bg-gray-800",cmpBgSymbolSoftX:"gs-theme-cl-cmpBgSymbolSoftX gs-utl-bg-[#edebff] dark:gs-utl-bg-[#2d1b4b]",cmpTxtActive:"gs-theme-cl-cmpTxtActive dark:gs-utl-text-gray-300",cmpBr:"gs-theme-cl-cmpBr gs-utl-border-blue-450",cmpSymbolBr:"gs-theme-cl-cmpSymbolBr gs-utl-border-[#7b61ff]",cmpTargetBg:"gs-utl-bg-amber-500 gs-utl-text-white",cmpTargetBgOpac:"gs-utl-bg-amber-500/5",cmpTargetBr:"gs-utl-border-amber-500",tW:"gs-utl-text-amber-500",bgW:"gs-utl-bg-amber-500",bgRed:"gs-utl-bg-red-500",hBgRed:"hover:gs-utl-bg-red-600",hBgW:"hover:gs-utl-bg-amber-600",br:"gs-theme-cl-br gs-utl-border-gray-300 dark:gs-utl-border-zinc-700",brRed:"gs-utl-border-red-500",brLight:"gs-utl-border-white/25"},wb={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-scale-95 gs-utl-opacity-0",enterTo:"gs-utl-opacity-100",leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-scale-100 gs-utl-opacity-100",leaveTo:"gs-utl-scale-95 gs-utl-opacity-0"},UE={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},qE={leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"},GE={...UE,...qE},dr={xy:"gs-utl-px-4 gs-utl-py-2",xyS:"gs-utl-px-2 gs-utl-py-1",xyS2:"gs-utl-px-2 gs-utl-py-0.5",x:"gs-utl-px-4",xS:"gs-utl-px-2",y:"gs-utl-py-2",s:"gs-utl-p-2"},Sb={bg:he.bg,bgH:he.bgH},bg={bg:"gs-utl-bg-zinc-700",txt:"gs-utl-text-white",block:"gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-rounded gs-utl-px-2 gs-utl-py-1"},we={rnd:"gs-utl-rounded",pill:"gs-utl-rounded-full",b:"gs-utl-border",bT:"gs-utl-border-transparent",bS:"gs-utl-border-2",bt:"gs-utl-border-t",bb:"gs-utl-border-b",br:"gs-utl-border-r",bl:"gs-utl-border-l",bA:"gs-theme-cl-bA gs-utl-border-violet-400 dark:gs-utl-border-violet-500"},nc={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},We={s3x:"13px",s2x:"14px",sx:"16px",s:"18px"},So={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",noFocusOut:"focus:gs-utl-outline-none",spin:"gs-utl-animate-spin-fast"},Cb={link:B(he.tAo),inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},KE=t=>t.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),vg=(t,e,n="html")=>{const{Pages:r}=t,o=rc({page:e,key:"slug"});return`${r.getMain()===e?"index":_2(o||e.getName())}.${n}`},YE="custom-html-body",yg="data-custom-html-body",ht={title:({cmp:t})=>t.tagName==="title",favicon:({cmp:t})=>{var e;return t.tagName==="link"&&((e=t.attributes.attributes)==null?void 0:e.rel)==="icon"},description:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.name)==="description"},keywords:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.name)==="keywords"},socialTitle:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.property)==="og:title"},socialImage:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.property)==="og:image"},socialDescription:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.property)==="og:description"},charset:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.charset)},viewport:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.name)==="viewport"},robots:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.name)==="robots"},generator:({cmp:t})=>{var e;return t.tagName==="meta"&&((e=t.attributes.attributes)==null?void 0:e.name)==="generator"}},JE=t=>{for(const e in ht){const n=e;if(ht[n]({cmp:t}))return n}},ZE=(t,e,n)=>{const r=[];let o=n;return t.getMainComponent().findType(YE).forEach(i=>{r.push(i),o=(o||"")+i.getInnerHTML()}),{components:r,html:o,changed:o!==e}},XE=t=>{const e={...t.get("settings")??{}},n=t.getMainComponent(),{head:r}=n;if(r){const o=[];r.components().forEach(i=>{const{content:s,href:l}=i.getAttributes({noClass:!0,noStyle:!0});ht.title({cmp:i})?e.title=i.getInnerHTML():ht.favicon({cmp:i})?e.favicon=l:ht.description({cmp:i})?e.description=s:ht.keywords({cmp:i})?e.keywords=s:ht.socialTitle({cmp:i})?e.socialTitle=s:ht.socialDescription({cmp:i})?e.socialDescription=s:ht.socialImage({cmp:i})?e.socialImage=s:JE(i)||o.push(i.toHTML())}),o.length&&(e.customCodeHead=o.join(`
157
- `))}return e.customCodeBody=ZE(t,e.customCodeBody).html,e},Eb=t=>t.getModel().get("customData")??{},QE=t=>(t==null?void 0:t.projectDataCustom.globalPageSettings)??{},rc=t=>{const{page:e,key:n,appEditorStore:r,def:o="",defPage:i=""}=t;return(e?XE(e)[n]??i:QE(r)[n])??o},Vo=(t,e)=>{const n=t.em.getEditor(),o=Eb(n).globalPageSettings||{};return rc({page:t,key:e})||o[e]},eO=()=>$l().contextMenu,dp=()=>$l().i18nStore,xg="gs-custom-layout",tO=m.forwardRef(function({className:e,component:n,noWrapper:r,id:o,render:i,...s},l){const{editor:a}=Hl(),c=m.useRef(null),u=n,d=u&&a?h.jsx(u,{editor:a}):null,f=tt(xg,o&&`${xg}__${o}`,e),p=c.current,g=r&&!i;return m.useImperativeHandle(l,()=>c.current,[]),m.useEffect(()=>{if(!i||!p)return;const b=w=>p.appendChild(w),v=w=>p.removeChild(w),y=i({editor:a,addEl:b,removeEl:v});if(w0(y))p.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{v(y)};if(xo(y))return()=>{y()}}},[i,a,p]),g?d:h.jsx("div",{className:f,ref:c,...s,children:d})});ms(tO);var Ob=(t=>(t.gjs="gjs",t.gjsStudio="gjs-studio",t))(Ob||{});const jl=t=>typeof t<"u";var tf=(t=>(t.web="web",t.email="email",t))(tf||{});const nO=()=>$l().localSettingsStore,rO=()=>$l().modalStore;function oO(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Sg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wg(Object(n),!0).forEach(function(r){oO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iO(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function sO(t,e){if(t==null)return{};var n=iO(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function lO(t,e){return aO(t)||cO(t,e)||uO(t,e)||dO()}function aO(t){if(Array.isArray(t))return t}function cO(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,o=!1,i=void 0;try{for(var s=t[Symbol.iterator](),l;!(r=(l=s.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(a){o=!0,i=a}finally{try{!r&&s.return!=null&&s.return()}finally{if(o)throw i}}return n}}function uO(t,e){if(t){if(typeof t=="string")return Cg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cg(t,e)}}function Cg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function dO(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
158
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fO(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Eg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Og(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Eg(Object(n),!0).forEach(function(r){fO(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Eg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pO(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return e.reduceRight(function(o,i){return i(o)},r)}}function Bs(t){return function e(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=t.length?t.apply(this,o):function(){for(var s=arguments.length,l=new Array(s),a=0;a<s;a++)l[a]=arguments[a];return e.apply(n,[].concat(o,l))}}}function oc(t){return{}.toString.call(t).includes("Object")}function hO(t){return!Object.keys(t).length}function ul(t){return typeof t=="function"}function gO(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mO(t,e){return oc(e)||go("changeType"),Object.keys(e).some(function(n){return!gO(t,n)})&&go("changeField"),e}function bO(t){ul(t)||go("selectorType")}function vO(t){ul(t)||oc(t)||go("handlerType"),oc(t)&&Object.values(t).some(function(e){return!ul(e)})&&go("handlersType")}function yO(t){t||go("initialIsRequired"),oc(t)||go("initialType"),hO(t)&&go("initialContent")}function xO(t,e){throw new Error(t[e]||t.default)}var wO={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},go=Bs(xO)(wO),Ql={changes:mO,selector:bO,handler:vO,initial:yO};function SO(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ql.initial(t),Ql.handler(e);var n={current:t},r=Bs(OO)(n,e),o=Bs(EO)(n),i=Bs(Ql.changes)(t),s=Bs(CO)(n);function l(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Ql.selector(c),c(n.current)}function a(c){pO(r,o,i,s)(c)}return[l,a]}function CO(t,e){return ul(e)?e(t.current):e}function EO(t,e){return t.current=Og(Og({},t.current),e),e}function OO(t,e,n){return ul(e)?e(t.current):Object.keys(n).forEach(function(r){var o;return(o=e[r])===null||o===void 0?void 0:o.call(e,t.current[r])}),n}var _O={create:SO},kO={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function TO(t){return function e(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=t.length?t.apply(this,o):function(){for(var s=arguments.length,l=new Array(s),a=0;a<s;a++)l[a]=arguments[a];return e.apply(n,[].concat(o,l))}}}function AO(t){return{}.toString.call(t).includes("Object")}function MO(t){return t||_g("configIsRequired"),AO(t)||_g("configType"),t.urls?(jO(),{paths:{vs:t.urls.monacoBase}}):t}function jO(){console.warn(_b.deprecation)}function RO(t,e){throw new Error(t[e]||t.default)}var _b={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
159
- You are using deprecated way of configuration.
160
-
161
- Instead of using
162
- monaco.config({ urls: { monacoBase: '...' } })
163
- use
164
- monaco.config({ paths: { vs: '...' } })
165
-
166
- For more please check the link https://github.com/suren-atoyan/monaco-loader#config
167
- `},_g=TO(RO)(_b),NO={config:MO},PO=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,s){return s(i)},o)}};function kb(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],kb(t[n],e[n]))}),Sg(Sg({},t),e)}var DO={type:"cancelation",msg:"operation is manually canceled"};function Pu(t){var e=!1,n=new Promise(function(r,o){t.then(function(i){return e?o(DO):r(i)}),t.catch(o)});return n.cancel=function(){return e=!0},n}var LO=_O.create({config:kO,isInitialized:!1,resolve:null,reject:null,monaco:null}),Tb=lO(LO,2),Rl=Tb[0],Bc=Tb[1];function VO(t){var e=NO.config(t),n=e.monaco,r=sO(e,["monaco"]);Bc(function(o){return{config:kb(o.config,r),monaco:n}})}function IO(){var t=Rl(function(e){var n=e.monaco,r=e.isInitialized,o=e.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!t.isInitialized){if(Bc({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Pu(Du);if(window.monaco&&window.monaco.editor)return Ab(window.monaco),t.resolve(window.monaco),Pu(Du);PO($O,BO)(zO)}return Pu(Du)}function $O(t){return document.body.appendChild(t)}function HO(t){var e=document.createElement("script");return t&&(e.src=t),e}function BO(t){var e=Rl(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=HO("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function zO(){var t=Rl(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){Ab(n),t.resolve(n)},function(n){t.reject(n)})}function Ab(t){Rl().monaco||Bc({monaco:t})}function FO(){return Rl(function(t){var e=t.monaco;return e})}var Du=new Promise(function(t,e){return Bc({resolve:t,reject:e})}),Mb={config:VO,init:IO,__getMonacoInstance:FO},WO={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Lu=WO,UO={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},qO=UO;function GO({children:t}){return m.createElement("div",{style:qO.container},t)}var KO=GO,YO=KO;function JO({width:t,height:e,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:s}){return m.createElement("section",{style:{...Lu.wrapper,width:t,height:e},...s},!n&&m.createElement(YO,null,r),m.createElement("div",{ref:o,style:{...Lu.fullWidth,...!n&&Lu.hide},className:i}))}var ZO=JO,jb=m.memo(ZO);function XO(t){m.useEffect(t,[])}var Rb=XO;function QO(t,e,n=!0){let r=m.useRef(!0);m.useEffect(r.current||!n?()=>{r.current=!1}:t,e)}var sn=QO;function qs(){}function Li(t,e,n,r){return e5(t,r)||t5(t,e,n,r)}function e5(t,e){return t.editor.getModel(Nb(t,e))}function t5(t,e,n,r){return t.editor.createModel(e,n,r?Nb(t,r):void 0)}function Nb(t,e){return t.Uri.parse(e)}function n5({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:a=!1,theme:c="light",loading:u="Loading...",options:d={},height:f="100%",width:p="100%",className:g,wrapperProps:b={},beforeMount:v=qs,onMount:y=qs}){let[w,S]=m.useState(!1),[C,x]=m.useState(!0),E=m.useRef(null),_=m.useRef(null),M=m.useRef(null),k=m.useRef(y),j=m.useRef(v),N=m.useRef(!1);Rb(()=>{let F=Mb.init();return F.then($=>(_.current=$)&&x(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>E.current?W():F.cancel()}),sn(()=>{if(E.current&&_.current){let F=E.current.getOriginalEditor(),$=Li(_.current,t||"",r||n||"text",i||"");$!==F.getModel()&&F.setModel($)}},[i],w),sn(()=>{if(E.current&&_.current){let F=E.current.getModifiedEditor(),$=Li(_.current,e||"",o||n||"text",s||"");$!==F.getModel()&&F.setModel($)}},[s],w),sn(()=>{let F=E.current.getModifiedEditor();F.getOption(_.current.editor.EditorOption.readOnly)?F.setValue(e||""):e!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[e],w),sn(()=>{var F,$;($=(F=E.current)==null?void 0:F.getModel())==null||$.original.setValue(t||"")},[t],w),sn(()=>{let{original:F,modified:$}=E.current.getModel();_.current.editor.setModelLanguage(F,r||n||"text"),_.current.editor.setModelLanguage($,o||n||"text")},[n,r,o],w),sn(()=>{var F;(F=_.current)==null||F.editor.setTheme(c)},[c],w),sn(()=>{var F;(F=E.current)==null||F.updateOptions(d)},[d],w);let P=m.useCallback(()=>{var J;if(!_.current)return;j.current(_.current);let F=Li(_.current,t||"",r||n||"text",i||""),$=Li(_.current,e||"",o||n||"text",s||"");(J=E.current)==null||J.setModel({original:F,modified:$})},[n,e,o,t,r,i,s]),z=m.useCallback(()=>{var F;!N.current&&M.current&&(E.current=_.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...d}),P(),(F=_.current)==null||F.editor.setTheme(c),S(!0),N.current=!0)},[d,c,P]);m.useEffect(()=>{w&&k.current(E.current,_.current)},[w]),m.useEffect(()=>{!C&&!w&&z()},[C,w,z]);function W(){var $,J,ee,L;let F=($=E.current)==null?void 0:$.getModel();l||((J=F==null?void 0:F.original)==null||J.dispose()),a||((ee=F==null?void 0:F.modified)==null||ee.dispose()),(L=E.current)==null||L.dispose()}return m.createElement(jb,{width:p,height:f,isEditorReady:w,loading:u,_ref:M,className:g,wrapperProps:b})}var r5=n5;m.memo(r5);function o5(t){let e=m.useRef();return m.useEffect(()=>{e.current=t},[t]),e.current}var i5=o5,ea=new Map;function s5({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:o,path:i,theme:s="light",line:l,loading:a="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p="100%",height:g="100%",className:b,wrapperProps:v={},beforeMount:y=qs,onMount:w=qs,onChange:S,onValidate:C=qs}){let[x,E]=m.useState(!1),[_,M]=m.useState(!0),k=m.useRef(null),j=m.useRef(null),N=m.useRef(null),P=m.useRef(w),z=m.useRef(y),W=m.useRef(),F=m.useRef(r),$=i5(i),J=m.useRef(!1),ee=m.useRef(!1);Rb(()=>{let A=Mb.init();return A.then(R=>(k.current=R)&&M(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>j.current?I():A.cancel()}),sn(()=>{var R,q,D,V;let A=Li(k.current,t||r||"",e||o||"",i||n||"");A!==((R=j.current)==null?void 0:R.getModel())&&(d&&ea.set($,(q=j.current)==null?void 0:q.saveViewState()),(D=j.current)==null||D.setModel(A),d&&((V=j.current)==null||V.restoreViewState(ea.get(i))))},[i],x),sn(()=>{var A;(A=j.current)==null||A.updateOptions(c)},[c],x),sn(()=>{!j.current||r===void 0||(j.current.getOption(k.current.editor.EditorOption.readOnly)?j.current.setValue(r):r!==j.current.getValue()&&(ee.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),j.current.pushUndoStop(),ee.current=!1))},[r],x),sn(()=>{var R,q;let A=(R=j.current)==null?void 0:R.getModel();A&&o&&((q=k.current)==null||q.editor.setModelLanguage(A,o))},[o],x),sn(()=>{var A;l!==void 0&&((A=j.current)==null||A.revealLine(l))},[l],x),sn(()=>{var A;(A=k.current)==null||A.editor.setTheme(s)},[s],x);let L=m.useCallback(()=>{var A;if(!(!N.current||!k.current)&&!J.current){z.current(k.current);let R=i||n,q=Li(k.current,r||t||"",e||o||"",R||"");j.current=(A=k.current)==null?void 0:A.editor.create(N.current,{model:q,automaticLayout:!0,...c},u),d&&j.current.restoreViewState(ea.get(R)),k.current.editor.setTheme(s),l!==void 0&&j.current.revealLine(l),E(!0),J.current=!0}},[t,e,n,r,o,i,c,u,d,s,l]);m.useEffect(()=>{x&&P.current(j.current,k.current)},[x]),m.useEffect(()=>{!_&&!x&&L()},[_,x,L]),F.current=r,m.useEffect(()=>{var A,R;x&&S&&((A=W.current)==null||A.dispose(),W.current=(R=j.current)==null?void 0:R.onDidChangeModelContent(q=>{ee.current||S(j.current.getValue(),q)}))},[x,S]),m.useEffect(()=>{if(x){let A=k.current.editor.onDidChangeMarkers(R=>{var D;let q=(D=j.current.getModel())==null?void 0:D.uri;if(q&&R.find(V=>V.path===q.path)){let V=k.current.editor.getModelMarkers({resource:q});C==null||C(V)}});return()=>{A==null||A.dispose()}}return()=>{}},[x,C]);function I(){var A,R;(A=W.current)==null||A.dispose(),f?d&&ea.set(i,j.current.saveViewState()):(R=j.current.getModel())==null||R.dispose(),j.current.dispose()}return m.createElement(jb,{width:p,height:g,isEditorReady:x,loading:a,_ref:N,className:b,wrapperProps:v})}var l5=s5,a5=m.memo(l5),c5=a5,u5=Object.defineProperty,d5=(t,e,n)=>e in t?u5(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vu=(t,e,n)=>(d5(t,typeof e!="symbol"?e+"":e,n),n);let f5=class{constructor(){Vu(this,"current",this.detect()),Vu(this,"handoffState","pending"),Vu(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Ir=new f5,bt=(t,e)=>{Ir.isServer?m.useEffect(t,e):m.useLayoutEffect(t,e)};function Xt(t){let e=m.useRef(t);return bt(()=>{e.current=t},[t]),e}function Pb(t,e){let[n,r]=m.useState(t),o=Xt(t);return bt(()=>r(o.current),[o,r,...e]),n}let ae=function(t){let e=Xt(t);return m.useCallback((...n)=>e.current(...n),[e])};function fp(t,e,n){let[r,o]=m.useState(n),i=t!==void 0,s=m.useRef(i),l=m.useRef(!1),a=m.useRef(!1);return i&&!s.current&&!l.current?(l.current=!0,s.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&s.current&&!a.current&&(a.current=!0,s.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?t:r,ae(c=>(i||o(c),e==null?void 0:e(c)))]}function Db(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function Co(){let t=[],e={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),e.add(()=>n.removeEventListener(r,o,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return e.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return e.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Db(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Co();return n(r),this.add(()=>r.dispose())},add(n){return t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let o of t.splice(r,1))o()}},dispose(){for(let n of t.splice(0))n()}};return e}function Eo(){let[t]=m.useState(Co);return m.useEffect(()=>()=>t.dispose(),[t]),t}function p5(){let t=typeof document>"u";return"useSyncExternalStore"in kn?(e=>e.useSyncExternalStore)(kn)(()=>()=>{},()=>!1,()=>!t):!1}function zc(){let t=p5(),[e,n]=kn.useState(Ir.isHandoffComplete);return e&&Ir.isHandoffComplete===!1&&n(!1),kn.useEffect(()=>{e!==!0&&n(!0)},[e]),kn.useEffect(()=>Ir.handoff(),[]),t?!1:e}var kg;let Mt=(kg=m.useId)!=null?kg:function(){let t=zc(),[e,n]=m.useState(t?()=>Ir.nextId():null);return bt(()=>{e===null&&n(Ir.nextId())},[e]),e!=null?""+e:void 0};function Ue(t,e,...n){if(t in e){let o=e[t];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ue),r}function xi(t){return Ir.isServer?null:t instanceof Node?t.ownerDocument:t!=null&&t.hasOwnProperty("current")&&t.current instanceof Node?t.current.ownerDocument:document}let nf=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(t=>`${t}:not([tabindex='-1'])`).join(",");var dn=(t=>(t[t.First=1]="First",t[t.Previous=2]="Previous",t[t.Next=4]="Next",t[t.Last=8]="Last",t[t.WrapAround=16]="WrapAround",t[t.NoScroll=32]="NoScroll",t))(dn||{}),Qi=(t=>(t[t.Error=0]="Error",t[t.Overflow=1]="Overflow",t[t.Success=2]="Success",t[t.Underflow=3]="Underflow",t))(Qi||{}),h5=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(h5||{});function Fc(t=document.body){return t==null?[]:Array.from(t.querySelectorAll(nf)).sort((e,n)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Wc=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(Wc||{});function pp(t,e=0){var n;return t===((n=xi(t))==null?void 0:n.body)?!1:Ue(e,{0(){return t.matches(nf)},1(){let r=t;for(;r!==null;){if(r.matches(nf))return!0;r=r.parentElement}return!1}})}var g5=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(g5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",t=>{t.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:t.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let m5=["textarea","input"].join(",");function b5(t){var e,n;return(n=(e=t==null?void 0:t.matches)==null?void 0:e.call(t,m5))!=null?n:!1}function hp(t,e=n=>n){return t.slice().sort((n,r)=>{let o=e(n),i=e(r);if(o===null||i===null)return 0;let s=o.compareDocumentPosition(i);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Dr(t,e,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(t)?t.length>0?t[0].ownerDocument:document:t.ownerDocument,s=Array.isArray(t)?n?hp(t):t:Fc(t);o.length>0&&s.length>1&&(s=s.filter(p=>!o.includes(p))),r=r??i.activeElement;let l=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,s.indexOf(r))-1;if(e&4)return Math.max(0,s.indexOf(r))+1;if(e&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=e&32?{preventScroll:!0}:{},u=0,d=s.length,f;do{if(u>=d||u+d<=0)return 0;let p=a+u;if(e&16)p=(p+d)%d;else{if(p<0)return 3;if(p>=d)return 1}f=s[p],f==null||f.focus(c),u+=l}while(f!==i.activeElement);return e&6&&b5(f)&&f.select(),2}function v5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function y5(){return/Android/gi.test(window.navigator.userAgent)}function x5(){return v5()||y5()}function ta(t,e,n){let r=Xt(e);m.useEffect(()=>{function o(i){r.current(i)}return document.addEventListener(t,o,n),()=>document.removeEventListener(t,o,n)},[t,n])}function Lb(t,e,n){let r=Xt(e);m.useEffect(()=>{function o(i){r.current(i)}return window.addEventListener(t,o,n),()=>window.removeEventListener(t,o,n)},[t,n])}function Vb(t,e,n=!0){let r=m.useRef(!1);m.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(s,l){if(!r.current||s.defaultPrevented)return;let a=l(s);if(a===null||!a.getRootNode().contains(a)||!a.isConnected)return;let c=function u(d){return typeof d=="function"?u(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let u of c){if(u===null)continue;let d=u instanceof HTMLElement?u:u.current;if(d!=null&&d.contains(a)||s.composed&&s.composedPath().includes(d))return}return!pp(a,Wc.Loose)&&a.tabIndex!==-1&&s.preventDefault(),e(s,a)}let i=m.useRef(null);ta("pointerdown",s=>{var l,a;r.current&&(i.current=((a=(l=s.composedPath)==null?void 0:l.call(s))==null?void 0:a[0])||s.target)},!0),ta("mousedown",s=>{var l,a;r.current&&(i.current=((a=(l=s.composedPath)==null?void 0:l.call(s))==null?void 0:a[0])||s.target)},!0),ta("click",s=>{x5()||i.current&&(o(s,()=>i.current),i.current=null)},!0),ta("touchend",s=>o(s,()=>s.target instanceof HTMLElement?s.target:null),!0),Lb("blur",s=>o(s,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function bs(...t){return m.useMemo(()=>xi(...t),[...t])}function Tg(t){var e;if(t.type)return t.type;let n=(e=t.as)!=null?e:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Uc(t,e){let[n,r]=m.useState(()=>Tg(t));return bt(()=>{r(Tg(t))},[t.type,t.as]),bt(()=>{n||e.current&&e.current instanceof HTMLButtonElement&&!e.current.hasAttribute("type")&&r("button")},[n,e]),n}let Ib=Symbol();function gp(t,e=!0){return Object.assign(t,{[Ib]:e})}function lt(...t){let e=m.useRef(t);m.useEffect(()=>{e.current=t},[t]);let n=ae(r=>{for(let o of e.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return t.every(r=>r==null||(r==null?void 0:r[Ib]))?void 0:n}function Ag(t){return[t.screenX,t.screenY]}function w5(){let t=m.useRef([-1,-1]);return{wasMoved(e){let n=Ag(e);return t.current[0]===n[0]&&t.current[1]===n[1]?!1:(t.current=n,!0)},update(e){t.current=Ag(e)}}}function S5({container:t,accept:e,walk:n,enabled:r=!0}){let o=m.useRef(e),i=m.useRef(n);m.useEffect(()=>{o.current=e,i.current=n},[e,n]),bt(()=>{if(!t||!r)return;let s=xi(t);if(!s)return;let l=o.current,a=i.current,c=Object.assign(d=>l(d),{acceptNode:l}),u=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)a(u.currentNode)},[t,r,o,i])}function ic(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}var gr=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(gr||{}),co=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(co||{});function nt({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:o,visible:i=!0,name:s,mergeRefs:l}){l=l??C5;let a=$b(e,t);if(i)return na(a,n,r,s,l);let c=o??0;if(c&2){let{static:u=!1,...d}=a;if(u)return na(d,n,r,s,l)}if(c&1){let{unmount:u=!0,...d}=a;return Ue(u?0:1,{0(){return null},1(){return na({...d,hidden:!0,style:{display:"none"}},n,r,s,l)}})}return na(a,n,r,s,l)}function na(t,e={},n,r,o){let{as:i=n,children:s,refName:l="ref",...a}=Iu(t,["unmount","static"]),c=t.ref!==void 0?{[l]:t.ref}:{},u=typeof s=="function"?s(e):s;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(e));let d={};if(e){let f=!1,p=[];for(let[g,b]of Object.entries(e))typeof b=="boolean"&&(f=!0),b===!0&&p.push(g);f&&(d["data-headlessui-state"]=p.join(" "))}if(i===m.Fragment&&Object.keys(dl(a)).length>0){if(!m.isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(a).map(b=>` - ${b}`).join(`
168
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
169
- `)].join(`
170
- `));let f=u.props,p=typeof(f==null?void 0:f.className)=="function"?(...b)=>ic(f==null?void 0:f.className(...b),a.className):ic(f==null?void 0:f.className,a.className),g=p?{className:p}:{};return m.cloneElement(u,Object.assign({},$b(u.props,dl(Iu(a,["ref"]))),d,c,{ref:o(u.ref,c.ref)},g))}return m.createElement(i,Object.assign({},Iu(a,["ref"]),i!==m.Fragment&&c,i!==m.Fragment&&d),u)}function mp(){let t=m.useRef([]),e=m.useCallback(n=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return t.current=n,e}}function C5(...t){return t.every(e=>e==null)?void 0:e=>{for(let n of t)n!=null&&(typeof n=="function"?n(e):n.current=e)}}function $b(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):e[o]=r[o];if(e.disabled||e["aria-disabled"])return Object.assign(e,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(e,{[r](o,...i){let s=n[r];for(let l of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...i)}}});return e}function rt(t){var e;return Object.assign(m.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function dl(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function Iu(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}let E5="div";var zr=(t=>(t[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t))(zr||{});function O5(t,e){var n;let{features:r=1,...o}=t,i={ref:e,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return nt({ourProps:i,theirProps:o,slot:{},defaultTag:E5,name:"Hidden"})}let Oo=rt(O5),bp=m.createContext(null);bp.displayName="OpenClosedContext";var st=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(st||{});function vs(){return m.useContext(bp)}function qc({value:t,children:e}){return m.createElement(bp.Provider,{value:t},e)}function ci(t){let e=t.parentElement,n=null;for(;e&&!(e instanceof HTMLFieldSetElement);)e instanceof HTMLLegendElement&&(n=e),e=e.parentElement;let r=(e==null?void 0:e.getAttribute("disabled"))==="";return r&&_5(n)?!1:r}function _5(t){if(!t)return!1;let e=t.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}function k5(t){throw new Error("Unexpected object: "+t)}var Yt=(t=>(t[t.First=0]="First",t[t.Previous=1]="Previous",t[t.Next=2]="Next",t[t.Last=3]="Last",t[t.Specific=4]="Specific",t[t.Nothing=5]="Nothing",t))(Yt||{});function T5(t,e){let n=e.resolveItems();if(n.length<=0)return null;let r=e.resolveActiveIndex(),o=r??-1;switch(t.focus){case 0:{for(let i=0;i<n.length;++i)if(!e.resolveDisabled(n[i],i,n))return i;return r}case 1:{for(let i=o-1;i>=0;--i)if(!e.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!e.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!e.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(e.resolveId(n[i],i,n)===t.id)return i;return r}case 5:return null;default:k5(t)}}function vp(t={},e=null,n=[]){for(let[r,o]of Object.entries(t))Bb(n,Hb(e,r),o);return n}function Hb(t,e){return t?t+"["+e+"]":e}function Bb(t,e,n){if(Array.isArray(n))for(let[r,o]of n.entries())Bb(t,Hb(e,r.toString()),o);else n instanceof Date?t.push([e,n.toISOString()]):typeof n=="boolean"?t.push([e,n?"1":"0"]):typeof n=="string"?t.push([e,n]):typeof n=="number"?t.push([e,`${n}`]):n==null?t.push([e,""]):vp(n,e,t)}function zb(t){var e,n;let r=(e=t==null?void 0:t.form)!=null?e:t.closest("form");if(r){for(let o of r.elements)if(o!==t&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}var Oe=(t=>(t.Space=" ",t.Enter="Enter",t.Escape="Escape",t.Backspace="Backspace",t.Delete="Delete",t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Home="Home",t.End="End",t.PageUp="PageUp",t.PageDown="PageDown",t.Tab="Tab",t))(Oe||{});function A5(t,e,n,r){let o=Xt(n);m.useEffect(()=>{t=t??window;function i(s){o.current(s)}return t.addEventListener(e,i,r),()=>t.removeEventListener(e,i,r)},[t,e,r])}function yp(){let t=m.useRef(!1);return bt(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function M5(t){let e=ae(t),n=m.useRef(!1);m.useEffect(()=>(n.current=!1,()=>{n.current=!0,Db(()=>{n.current&&e()})}),[e])}var Lr=(t=>(t[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t))(Lr||{});function Fb(){let t=m.useRef(0);return Lb("keydown",e=>{e.key==="Tab"&&(t.current=e.shiftKey?1:0)},!0),t}let j5=m.createContext(!1);function R5(){return m.useContext(j5)}function N5(t){let e=R5(),n=m.useContext(Wb),r=bs(t),[o,i]=m.useState(()=>{if(!e&&n!==null||Ir.isServer)return null;let s=r==null?void 0:r.getElementById("headlessui-portal-root");if(s)return s;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return m.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),m.useEffect(()=>{e||n!==null&&i(n.current)},[n,i,e]),o}let P5=m.Fragment;function D5(t,e){let n=t,r=m.useRef(null),o=lt(gp(u=>{r.current=u}),e),i=bs(r),s=N5(r),[l]=m.useState(()=>{var u;return Ir.isServer?null:(u=i==null?void 0:i.createElement("div"))!=null?u:null}),a=m.useContext(rf),c=zc();return bt(()=>{!s||!l||s.contains(l)||(l.setAttribute("data-headlessui-portal",""),s.appendChild(l))},[s,l]),bt(()=>{if(l&&a)return a.register(l)},[a,l]),M5(()=>{var u;!s||!l||(l instanceof Node&&s.contains(l)&&s.removeChild(l),s.childNodes.length<=0&&((u=s.parentElement)==null||u.removeChild(s)))}),c?!s||!l?null:ir.createPortal(nt({ourProps:{ref:o},theirProps:n,defaultTag:P5,name:"Portal"}),l):null}let L5=m.Fragment,Wb=m.createContext(null);function V5(t,e){let{target:n,...r}=t,o={ref:lt(e)};return m.createElement(Wb.Provider,{value:n},nt({ourProps:o,theirProps:r,defaultTag:L5,name:"Popover.Group"}))}let rf=m.createContext(null);function I5(){let t=m.useContext(rf),e=m.useRef([]),n=ae(i=>(e.current.push(i),t&&t.register(i),()=>r(i))),r=ae(i=>{let s=e.current.indexOf(i);s!==-1&&e.current.splice(s,1),t&&t.unregister(i)}),o=m.useMemo(()=>({register:n,unregister:r,portals:e}),[n,r,e]);return[e,m.useMemo(()=>function({children:i}){return m.createElement(rf.Provider,{value:o},i)},[o])]}let $5=rt(D5),H5=rt(V5);Object.assign($5,{Group:H5});function B5({defaultContainers:t=[],portals:e,mainTreeNodeRef:n}={}){var r;let o=m.useRef((r=n==null?void 0:n.current)!=null?r:null),i=bs(o),s=ae(()=>{var l,a,c;let u=[];for(let d of t)d!==null&&(d instanceof HTMLElement?u.push(d):"current"in d&&d.current instanceof HTMLElement&&u.push(d.current));if(e!=null&&e.current)for(let d of e.current)u.push(d);for(let d of(l=i==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?l:[])d!==document.body&&d!==document.head&&d instanceof HTMLElement&&d.id!=="headlessui-portal-root"&&(d.contains(o.current)||d.contains((c=(a=o.current)==null?void 0:a.getRootNode())==null?void 0:c.host)||u.some(f=>d.contains(f))||u.push(d));return u});return{resolveContainers:s,contains:ae(l=>s().some(a=>a.contains(l))),mainTreeNodeRef:o,MainTreeNode:m.useMemo(()=>function(){return n!=null?null:m.createElement(Oo,{features:zr.Hidden,ref:o})},[o,n])}}function z5(){let t=m.useRef(null);return{mainTreeNodeRef:t,MainTreeNode:m.useMemo(()=>function(){return m.createElement(Oo,{features:zr.Hidden,ref:t})},[t])}}let Ub=m.createContext(null);function qb(){let t=m.useContext(Ub);if(t===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,qb),e}return t}function xp(){let[t,e]=m.useState([]);return[t.length>0?t.join(" "):void 0,m.useMemo(()=>function(n){let r=ae(i=>(e(s=>[...s,i]),()=>e(s=>{let l=s.slice(),a=l.indexOf(i);return a!==-1&&l.splice(a,1),l}))),o=m.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return m.createElement(Ub.Provider,{value:o},n.children)},[e])]}let F5="p";function W5(t,e){let n=Mt(),{id:r=`headlessui-description-${n}`,...o}=t,i=qb(),s=lt(e);bt(()=>i.register(r),[r,i.register]);let l={ref:s,...i.props,id:r};return nt({ourProps:l,theirProps:o,slot:i.slot||{},defaultTag:F5,name:i.name||"Description"})}let U5=rt(W5),Gb=Object.assign(U5,{});var Mg;let q5=(Mg=m.startTransition)!=null?Mg:function(t){t()};var G5=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(G5||{}),K5=(t=>(t[t.ToggleDisclosure=0]="ToggleDisclosure",t[t.CloseDisclosure=1]="CloseDisclosure",t[t.SetButtonId=2]="SetButtonId",t[t.SetPanelId=3]="SetPanelId",t[t.LinkPanel=4]="LinkPanel",t[t.UnlinkPanel=5]="UnlinkPanel",t))(K5||{});let Y5={0:t=>({...t,disclosureState:Ue(t.disclosureState,{0:1,1:0})}),1:t=>t.disclosureState===1?t:{...t,disclosureState:1},4(t){return t.linkedPanel===!0?t:{...t,linkedPanel:!0}},5(t){return t.linkedPanel===!1?t:{...t,linkedPanel:!1}},2(t,e){return t.buttonId===e.buttonId?t:{...t,buttonId:e.buttonId}},3(t,e){return t.panelId===e.panelId?t:{...t,panelId:e.panelId}}},wp=m.createContext(null);wp.displayName="DisclosureContext";function Sp(t){let e=m.useContext(wp);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Sp),n}return e}let Cp=m.createContext(null);Cp.displayName="DisclosureAPIContext";function Kb(t){let e=m.useContext(Cp);if(e===null){let n=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Kb),n}return e}let Ep=m.createContext(null);Ep.displayName="DisclosurePanelContext";function J5(){return m.useContext(Ep)}function Z5(t,e){return Ue(e.type,Y5,t,e)}let X5=m.Fragment;function Q5(t,e){let{defaultOpen:n=!1,...r}=t,o=m.useRef(null),i=lt(e,gp(v=>{o.current=v},t.as===void 0||t.as===m.Fragment)),s=m.useRef(null),l=m.useRef(null),a=m.useReducer(Z5,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:l,panelRef:s,buttonId:null,panelId:null}),[{disclosureState:c,buttonId:u},d]=a,f=ae(v=>{d({type:1});let y=xi(o);if(!y||!u)return;let w=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:y.getElementById(u):y.getElementById(u);w==null||w.focus()}),p=m.useMemo(()=>({close:f}),[f]),g=m.useMemo(()=>({open:c===0,close:f}),[c,f]),b={ref:i};return m.createElement(wp.Provider,{value:a},m.createElement(Cp.Provider,{value:p},m.createElement(qc,{value:Ue(c,{0:st.Open,1:st.Closed})},nt({ourProps:b,theirProps:r,slot:g,defaultTag:X5,name:"Disclosure"}))))}let e_="button";function t_(t,e){let n=Mt(),{id:r=`headlessui-disclosure-button-${n}`,...o}=t,[i,s]=Sp("Disclosure.Button"),l=J5(),a=l===null?!1:l===i.panelId,c=m.useRef(null),u=lt(c,e,a?null:i.buttonRef),d=mp();m.useEffect(()=>{if(!a)return s({type:2,buttonId:r}),()=>{s({type:2,buttonId:null})}},[r,s,a]);let f=ae(w=>{var S;if(a){if(i.disclosureState===1)return;switch(w.key){case Oe.Space:case Oe.Enter:w.preventDefault(),w.stopPropagation(),s({type:0}),(S=i.buttonRef.current)==null||S.focus();break}}else switch(w.key){case Oe.Space:case Oe.Enter:w.preventDefault(),w.stopPropagation(),s({type:0});break}}),p=ae(w=>{switch(w.key){case Oe.Space:w.preventDefault();break}}),g=ae(w=>{var S;ci(w.currentTarget)||t.disabled||(a?(s({type:0}),(S=i.buttonRef.current)==null||S.focus()):s({type:0}))}),b=m.useMemo(()=>({open:i.disclosureState===0}),[i]),v=Uc(t,c),y=a?{ref:u,type:v,onKeyDown:f,onClick:g}:{ref:u,id:r,type:v,"aria-expanded":i.disclosureState===0,"aria-controls":i.linkedPanel?i.panelId:void 0,onKeyDown:f,onKeyUp:p,onClick:g};return nt({mergeRefs:d,ourProps:y,theirProps:o,slot:b,defaultTag:e_,name:"Disclosure.Button"})}let n_="div",r_=gr.RenderStrategy|gr.Static;function o_(t,e){let n=Mt(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=t,[i,s]=Sp("Disclosure.Panel"),{close:l}=Kb("Disclosure.Panel"),a=mp(),c=lt(e,i.panelRef,g=>{q5(()=>s({type:g?4:5}))});m.useEffect(()=>(s({type:3,panelId:r}),()=>{s({type:3,panelId:null})}),[r,s]);let u=vs(),d=u!==null?(u&st.Open)===st.Open:i.disclosureState===0,f=m.useMemo(()=>({open:i.disclosureState===0,close:l}),[i,l]),p={ref:c,id:r};return m.createElement(Ep.Provider,{value:i.panelId},nt({mergeRefs:a,ourProps:p,theirProps:o,slot:f,defaultTag:n_,features:r_,visible:d,name:"Disclosure.Panel"}))}let i_=rt(Q5),s_=rt(t_),l_=rt(o_),$u=Object.assign(i_,{Button:s_,Panel:l_}),jg=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Rg(t){var e,n;let r=(e=t.innerText)!=null?e:"",o=t.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let i=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),i=!0;let s=i?(n=o.innerText)!=null?n:"":r;return jg.test(s)&&(s=s.replace(jg,"")),s}function a_(t){let e=t.getAttribute("aria-label");if(typeof e=="string")return e.trim();let n=t.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let i=document.getElementById(o);if(i){let s=i.getAttribute("aria-label");return typeof s=="string"?s.trim():Rg(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Rg(t).trim()}function c_(t){let e=m.useRef(""),n=m.useRef("");return ae(()=>{let r=t.current;if(!r)return"";let o=r.innerText;if(e.current===o)return n.current;let i=a_(r).trim().toLowerCase();return e.current=o,n.current=i,i})}var u_=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(u_||{}),d_=(t=>(t[t.Single=0]="Single",t[t.Multi=1]="Multi",t))(d_||{}),f_=(t=>(t[t.Pointer=0]="Pointer",t[t.Other=1]="Other",t))(f_||{}),p_=(t=>(t[t.OpenListbox=0]="OpenListbox",t[t.CloseListbox=1]="CloseListbox",t[t.GoToOption=2]="GoToOption",t[t.Search=3]="Search",t[t.ClearSearch=4]="ClearSearch",t[t.RegisterOption=5]="RegisterOption",t[t.UnregisterOption=6]="UnregisterOption",t[t.RegisterLabel=7]="RegisterLabel",t))(p_||{});function Hu(t,e=n=>n){let n=t.activeOptionIndex!==null?t.options[t.activeOptionIndex]:null,r=hp(e(t.options.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let h_={1(t){return t.dataRef.current.disabled||t.listboxState===1?t:{...t,activeOptionIndex:null,listboxState:1}},0(t){if(t.dataRef.current.disabled||t.listboxState===0)return t;let e=t.activeOptionIndex,{isSelected:n}=t.dataRef.current,r=t.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(e=r),{...t,listboxState:0,activeOptionIndex:e}},2(t,e){var n;if(t.dataRef.current.disabled||t.listboxState===1)return t;let r=Hu(t),o=T5(e,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled});return{...t,...r,searchQuery:"",activeOptionIndex:o,activationTrigger:(n=e.trigger)!=null?n:1}},3:(t,e)=>{if(t.dataRef.current.disabled||t.listboxState===1)return t;let n=t.searchQuery!==""?0:1,r=t.searchQuery+e.value.toLowerCase(),o=(t.activeOptionIndex!==null?t.options.slice(t.activeOptionIndex+n).concat(t.options.slice(0,t.activeOptionIndex+n)):t.options).find(s=>{var l;return!s.dataRef.current.disabled&&((l=s.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),i=o?t.options.indexOf(o):-1;return i===-1||i===t.activeOptionIndex?{...t,searchQuery:r}:{...t,searchQuery:r,activeOptionIndex:i,activationTrigger:1}},4(t){return t.dataRef.current.disabled||t.listboxState===1||t.searchQuery===""?t:{...t,searchQuery:""}},5:(t,e)=>{let n={id:e.id,dataRef:e.dataRef},r=Hu(t,o=>[...o,n]);return t.activeOptionIndex===null&&t.dataRef.current.isSelected(e.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...t,...r}},6:(t,e)=>{let n=Hu(t,r=>{let o=r.findIndex(i=>i.id===e.id);return o!==-1&&r.splice(o,1),r});return{...t,...n,activationTrigger:1}},7:(t,e)=>({...t,labelId:e.id})},Op=m.createContext(null);Op.displayName="ListboxActionsContext";function Nl(t){let e=m.useContext(Op);if(e===null){let n=new Error(`<${t} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nl),n}return e}let _p=m.createContext(null);_p.displayName="ListboxDataContext";function Pl(t){let e=m.useContext(_p);if(e===null){let n=new Error(`<${t} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Pl),n}return e}function g_(t,e){return Ue(e.type,h_,t,e)}let m_=m.Fragment;function b_(t,e){let{value:n,defaultValue:r,form:o,name:i,onChange:s,by:l=(D,V)=>D===V,disabled:a=!1,horizontal:c=!1,multiple:u=!1,...d}=t;const f=c?"horizontal":"vertical";let p=lt(e),[g=u?[]:void 0,b]=fp(n,s,r),[v,y]=m.useReducer(g_,{dataRef:m.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),w=m.useRef({static:!1,hold:!1}),S=m.useRef(null),C=m.useRef(null),x=m.useRef(null),E=ae(typeof l=="string"?(D,V)=>{let te=l;return(D==null?void 0:D[te])===(V==null?void 0:V[te])}:l),_=m.useCallback(D=>Ue(M.mode,{1:()=>g.some(V=>E(V,D)),0:()=>E(g,D)}),[g]),M=m.useMemo(()=>({...v,value:g,disabled:a,mode:u?1:0,orientation:f,compare:E,isSelected:_,optionsPropsRef:w,labelRef:S,buttonRef:C,optionsRef:x}),[g,a,u,v]);bt(()=>{v.dataRef.current=M},[M]),Vb([M.buttonRef,M.optionsRef],(D,V)=>{var te;y({type:1}),pp(V,Wc.Loose)||(D.preventDefault(),(te=M.buttonRef.current)==null||te.focus())},M.listboxState===0);let k=m.useMemo(()=>({open:M.listboxState===0,disabled:a,value:g}),[M,a,g]),j=ae(D=>{let V=M.options.find(te=>te.id===D);V&&J(V.dataRef.current.value)}),N=ae(()=>{if(M.activeOptionIndex!==null){let{dataRef:D,id:V}=M.options[M.activeOptionIndex];J(D.current.value),y({type:2,focus:Yt.Specific,id:V})}}),P=ae(()=>y({type:0})),z=ae(()=>y({type:1})),W=ae((D,V,te)=>D===Yt.Specific?y({type:2,focus:Yt.Specific,id:V,trigger:te}):y({type:2,focus:D,trigger:te})),F=ae((D,V)=>(y({type:5,id:D,dataRef:V}),()=>y({type:6,id:D}))),$=ae(D=>(y({type:7,id:D}),()=>y({type:7,id:null}))),J=ae(D=>Ue(M.mode,{0(){return b==null?void 0:b(D)},1(){let V=M.value.slice(),te=V.findIndex(G=>E(G,D));return te===-1?V.push(D):V.splice(te,1),b==null?void 0:b(V)}})),ee=ae(D=>y({type:3,value:D})),L=ae(()=>y({type:4})),I=m.useMemo(()=>({onChange:J,registerOption:F,registerLabel:$,goToOption:W,closeListbox:z,openListbox:P,selectActiveOption:N,selectOption:j,search:ee,clearSearch:L}),[]),A={ref:p},R=m.useRef(null),q=Eo();return m.useEffect(()=>{R.current&&r!==void 0&&q.addEventListener(R.current,"reset",()=>{b==null||b(r)})},[R,b]),m.createElement(Op.Provider,{value:I},m.createElement(_p.Provider,{value:M},m.createElement(qc,{value:Ue(M.listboxState,{0:st.Open,1:st.Closed})},i!=null&&g!=null&&vp({[i]:g}).map(([D,V],te)=>m.createElement(Oo,{features:zr.Hidden,ref:te===0?G=>{var Q;R.current=(Q=G==null?void 0:G.closest("form"))!=null?Q:null}:void 0,...dl({key:D,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:a,name:D,value:V})})),nt({ourProps:A,theirProps:d,slot:k,defaultTag:m_,name:"Listbox"}))))}let v_="button";function y_(t,e){var n;let r=Mt(),{id:o=`headlessui-listbox-button-${r}`,...i}=t,s=Pl("Listbox.Button"),l=Nl("Listbox.Button"),a=lt(s.buttonRef,e),c=Eo(),u=ae(v=>{switch(v.key){case Oe.Space:case Oe.Enter:case Oe.ArrowDown:v.preventDefault(),l.openListbox(),c.nextFrame(()=>{s.value||l.goToOption(Yt.First)});break;case Oe.ArrowUp:v.preventDefault(),l.openListbox(),c.nextFrame(()=>{s.value||l.goToOption(Yt.Last)});break}}),d=ae(v=>{switch(v.key){case Oe.Space:v.preventDefault();break}}),f=ae(v=>{if(ci(v.currentTarget))return v.preventDefault();s.listboxState===0?(l.closeListbox(),c.nextFrame(()=>{var y;return(y=s.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})})):(v.preventDefault(),l.openListbox())}),p=Pb(()=>{if(s.labelId)return[s.labelId,o].join(" ")},[s.labelId,o]),g=m.useMemo(()=>({open:s.listboxState===0,disabled:s.disabled,value:s.value}),[s]),b={ref:a,id:o,type:Uc(t,s.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.listboxState===0,"aria-labelledby":p,disabled:s.disabled,onKeyDown:u,onKeyUp:d,onClick:f};return nt({ourProps:b,theirProps:i,slot:g,defaultTag:v_,name:"Listbox.Button"})}let x_="label";function w_(t,e){let n=Mt(),{id:r=`headlessui-listbox-label-${n}`,...o}=t,i=Pl("Listbox.Label"),s=Nl("Listbox.Label"),l=lt(i.labelRef,e);bt(()=>s.registerLabel(r),[r]);let a=ae(()=>{var u;return(u=i.buttonRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled}),[i]);return nt({ourProps:{ref:l,id:r,onClick:a},theirProps:o,slot:c,defaultTag:x_,name:"Listbox.Label"})}let S_="ul",C_=gr.RenderStrategy|gr.Static;function E_(t,e){var n;let r=Mt(),{id:o=`headlessui-listbox-options-${r}`,...i}=t,s=Pl("Listbox.Options"),l=Nl("Listbox.Options"),a=lt(s.optionsRef,e),c=Eo(),u=Eo(),d=vs(),f=d!==null?(d&st.Open)===st.Open:s.listboxState===0;m.useEffect(()=>{var y;let w=s.optionsRef.current;w&&s.listboxState===0&&w!==((y=xi(w))==null?void 0:y.activeElement)&&w.focus({preventScroll:!0})},[s.listboxState,s.optionsRef]);let p=ae(y=>{switch(u.dispose(),y.key){case Oe.Space:if(s.searchQuery!=="")return y.preventDefault(),y.stopPropagation(),l.search(y.key);case Oe.Enter:if(y.preventDefault(),y.stopPropagation(),s.activeOptionIndex!==null){let{dataRef:w}=s.options[s.activeOptionIndex];l.onChange(w.current.value)}s.mode===0&&(l.closeListbox(),Co().nextFrame(()=>{var w;return(w=s.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})}));break;case Ue(s.orientation,{vertical:Oe.ArrowDown,horizontal:Oe.ArrowRight}):return y.preventDefault(),y.stopPropagation(),l.goToOption(Yt.Next);case Ue(s.orientation,{vertical:Oe.ArrowUp,horizontal:Oe.ArrowLeft}):return y.preventDefault(),y.stopPropagation(),l.goToOption(Yt.Previous);case Oe.Home:case Oe.PageUp:return y.preventDefault(),y.stopPropagation(),l.goToOption(Yt.First);case Oe.End:case Oe.PageDown:return y.preventDefault(),y.stopPropagation(),l.goToOption(Yt.Last);case Oe.Escape:return y.preventDefault(),y.stopPropagation(),l.closeListbox(),c.nextFrame(()=>{var w;return(w=s.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})});case Oe.Tab:y.preventDefault(),y.stopPropagation();break;default:y.key.length===1&&(l.search(y.key),u.setTimeout(()=>l.clearSearch(),350));break}}),g=Pb(()=>{var y;return(y=s.buttonRef.current)==null?void 0:y.id},[s.buttonRef.current]),b=m.useMemo(()=>({open:s.listboxState===0}),[s]),v={"aria-activedescendant":s.activeOptionIndex===null||(n=s.options[s.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":s.mode===1?!0:void 0,"aria-labelledby":g,"aria-orientation":s.orientation,id:o,onKeyDown:p,role:"listbox",tabIndex:0,ref:a};return nt({ourProps:v,theirProps:i,slot:b,defaultTag:S_,features:C_,visible:f,name:"Listbox.Options"})}let O_="li";function __(t,e){let n=Mt(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...s}=t,l=Pl("Listbox.Option"),a=Nl("Listbox.Option"),c=l.activeOptionIndex!==null?l.options[l.activeOptionIndex].id===r:!1,u=l.isSelected(i),d=m.useRef(null),f=c_(d),p=Xt({disabled:o,value:i,domRef:d,get textValue(){return f()}}),g=lt(e,d);bt(()=>{if(l.listboxState!==0||!c||l.activationTrigger===0)return;let E=Co();return E.requestAnimationFrame(()=>{var _,M;(M=(_=d.current)==null?void 0:_.scrollIntoView)==null||M.call(_,{block:"nearest"})}),E.dispose},[d,c,l.listboxState,l.activationTrigger,l.activeOptionIndex]),bt(()=>a.registerOption(r,p),[p,r]);let b=ae(E=>{if(o)return E.preventDefault();a.onChange(i),l.mode===0&&(a.closeListbox(),Co().nextFrame(()=>{var _;return(_=l.buttonRef.current)==null?void 0:_.focus({preventScroll:!0})}))}),v=ae(()=>{if(o)return a.goToOption(Yt.Nothing);a.goToOption(Yt.Specific,r)}),y=w5(),w=ae(E=>y.update(E)),S=ae(E=>{y.wasMoved(E)&&(o||c||a.goToOption(Yt.Specific,r,0))}),C=ae(E=>{y.wasMoved(E)&&(o||c&&a.goToOption(Yt.Nothing))}),x=m.useMemo(()=>({active:c,selected:u,disabled:o}),[c,u,o]);return nt({ourProps:{id:r,ref:g,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":u,disabled:void 0,onClick:b,onFocus:v,onPointerEnter:w,onMouseEnter:w,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:s,slot:x,defaultTag:O_,name:"Listbox.Option"})}let k_=rt(b_),T_=rt(y_),A_=rt(w_),M_=rt(E_),j_=rt(__),Ms=Object.assign(k_,{Button:T_,Label:A_,Options:M_,Option:j_});var R_=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(R_||{}),N_=(t=>(t[t.TogglePopover=0]="TogglePopover",t[t.ClosePopover=1]="ClosePopover",t[t.SetButton=2]="SetButton",t[t.SetButtonId=3]="SetButtonId",t[t.SetPanel=4]="SetPanel",t[t.SetPanelId=5]="SetPanelId",t))(N_||{});let P_={0:t=>{let e={...t,popoverState:Ue(t.popoverState,{0:1,1:0})};return e.popoverState===0&&(e.__demoMode=!1),e},1(t){return t.popoverState===1?t:{...t,popoverState:1}},2(t,e){return t.button===e.button?t:{...t,button:e.button}},3(t,e){return t.buttonId===e.buttonId?t:{...t,buttonId:e.buttonId}},4(t,e){return t.panel===e.panel?t:{...t,panel:e.panel}},5(t,e){return t.panelId===e.panelId?t:{...t,panelId:e.panelId}}},kp=m.createContext(null);kp.displayName="PopoverContext";function Gc(t){let e=m.useContext(kp);if(e===null){let n=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gc),n}return e}let Tp=m.createContext(null);Tp.displayName="PopoverAPIContext";function Ap(t){let e=m.useContext(Tp);if(e===null){let n=new Error(`<${t} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ap),n}return e}let Mp=m.createContext(null);Mp.displayName="PopoverGroupContext";function Yb(){return m.useContext(Mp)}let Kc=m.createContext(null);Kc.displayName="PopoverPanelContext";function D_(){return m.useContext(Kc)}function L_(t,e){return Ue(e.type,P_,t,e)}let V_="div";function I_(t,e){var n;let{__demoMode:r=!1,...o}=t,i=m.useRef(null),s=lt(e,gp($=>{i.current=$})),l=m.useRef([]),a=m.useReducer(L_,{__demoMode:r,popoverState:r?0:1,buttons:l,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:m.createRef(),afterPanelSentinel:m.createRef()}),[{popoverState:c,button:u,buttonId:d,panel:f,panelId:p,beforePanelSentinel:g,afterPanelSentinel:b},v]=a,y=bs((n=i.current)!=null?n:u),w=m.useMemo(()=>{if(!u||!f)return!1;for(let R of document.querySelectorAll("body > *"))if(Number(R==null?void 0:R.contains(u))^Number(R==null?void 0:R.contains(f)))return!0;let $=Fc(),J=$.indexOf(u),ee=(J+$.length-1)%$.length,L=(J+1)%$.length,I=$[ee],A=$[L];return!f.contains(I)&&!f.contains(A)},[u,f]),S=Xt(d),C=Xt(p),x=m.useMemo(()=>({buttonId:S,panelId:C,close:()=>v({type:1})}),[S,C,v]),E=Yb(),_=E==null?void 0:E.registerPopover,M=ae(()=>{var $;return($=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?$:(y==null?void 0:y.activeElement)&&((u==null?void 0:u.contains(y.activeElement))||(f==null?void 0:f.contains(y.activeElement)))});m.useEffect(()=>_==null?void 0:_(x),[_,x]);let[k,j]=I5(),N=B5({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:k,defaultContainers:[u,f]});A5(y==null?void 0:y.defaultView,"focus",$=>{var J,ee,L,I;$.target!==window&&$.target instanceof HTMLElement&&c===0&&(M()||u&&f&&(N.contains($.target)||(ee=(J=g.current)==null?void 0:J.contains)!=null&&ee.call(J,$.target)||(I=(L=b.current)==null?void 0:L.contains)!=null&&I.call(L,$.target)||v({type:1})))},!0),Vb(N.resolveContainers,($,J)=>{v({type:1}),pp(J,Wc.Loose)||($.preventDefault(),u==null||u.focus())},c===0);let P=ae($=>{v({type:1});let J=$?$ instanceof HTMLElement?$:"current"in $&&$.current instanceof HTMLElement?$.current:u:u;J==null||J.focus()}),z=m.useMemo(()=>({close:P,isPortalled:w}),[P,w]),W=m.useMemo(()=>({open:c===0,close:P}),[c,P]),F={ref:s};return m.createElement(Kc.Provider,{value:null},m.createElement(kp.Provider,{value:a},m.createElement(Tp.Provider,{value:z},m.createElement(qc,{value:Ue(c,{0:st.Open,1:st.Closed})},m.createElement(j,null,nt({ourProps:F,theirProps:o,slot:W,defaultTag:V_,name:"Popover"}),m.createElement(N.MainTreeNode,null))))))}let $_="button";function H_(t,e){let n=Mt(),{id:r=`headlessui-popover-button-${n}`,...o}=t,[i,s]=Gc("Popover.Button"),{isPortalled:l}=Ap("Popover.Button"),a=m.useRef(null),c=`headlessui-focus-sentinel-${Mt()}`,u=Yb(),d=u==null?void 0:u.closeOthers,f=D_()!==null;m.useEffect(()=>{if(!f)return s({type:3,buttonId:r}),()=>{s({type:3,buttonId:null})}},[f,r,s]);let[p]=m.useState(()=>Symbol()),g=lt(a,e,f?null:N=>{if(N)i.buttons.current.push(p);else{let P=i.buttons.current.indexOf(p);P!==-1&&i.buttons.current.splice(P,1)}i.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),N&&s({type:2,button:N})}),b=lt(a,e),v=bs(a),y=ae(N=>{var P,z,W;if(f){if(i.popoverState===1)return;switch(N.key){case Oe.Space:case Oe.Enter:N.preventDefault(),(z=(P=N.target).click)==null||z.call(P),s({type:1}),(W=i.button)==null||W.focus();break}}else switch(N.key){case Oe.Space:case Oe.Enter:N.preventDefault(),N.stopPropagation(),i.popoverState===1&&(d==null||d(i.buttonId)),s({type:0});break;case Oe.Escape:if(i.popoverState!==0)return d==null?void 0:d(i.buttonId);if(!a.current||v!=null&&v.activeElement&&!a.current.contains(v.activeElement))return;N.preventDefault(),N.stopPropagation(),s({type:1});break}}),w=ae(N=>{f||N.key===Oe.Space&&N.preventDefault()}),S=ae(N=>{var P,z;ci(N.currentTarget)||t.disabled||(f?(s({type:1}),(P=i.button)==null||P.focus()):(N.preventDefault(),N.stopPropagation(),i.popoverState===1&&(d==null||d(i.buttonId)),s({type:0}),(z=i.button)==null||z.focus()))}),C=ae(N=>{N.preventDefault(),N.stopPropagation()}),x=i.popoverState===0,E=m.useMemo(()=>({open:x}),[x]),_=Uc(t,a),M=f?{ref:b,type:_,onKeyDown:y,onClick:S}:{ref:g,id:i.buttonId,type:_,"aria-expanded":i.popoverState===0,"aria-controls":i.panel?i.panelId:void 0,onKeyDown:y,onKeyUp:w,onClick:S,onMouseDown:C},k=Fb(),j=ae(()=>{let N=i.panel;if(!N)return;function P(){Ue(k.current,{[Lr.Forwards]:()=>Dr(N,dn.First),[Lr.Backwards]:()=>Dr(N,dn.Last)})===Qi.Error&&Dr(Fc().filter(z=>z.dataset.headlessuiFocusGuard!=="true"),Ue(k.current,{[Lr.Forwards]:dn.Next,[Lr.Backwards]:dn.Previous}),{relativeTo:i.button})}P()});return m.createElement(m.Fragment,null,nt({ourProps:M,theirProps:o,slot:E,defaultTag:$_,name:"Popover.Button"}),x&&!f&&l&&m.createElement(Oo,{id:c,features:zr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}))}let B_="div",z_=gr.RenderStrategy|gr.Static;function F_(t,e){let n=Mt(),{id:r=`headlessui-popover-overlay-${n}`,...o}=t,[{popoverState:i},s]=Gc("Popover.Overlay"),l=lt(e),a=vs(),c=a!==null?(a&st.Open)===st.Open:i===0,u=ae(f=>{if(ci(f.currentTarget))return f.preventDefault();s({type:1})}),d=m.useMemo(()=>({open:i===0}),[i]);return nt({ourProps:{ref:l,id:r,"aria-hidden":!0,onClick:u},theirProps:o,slot:d,defaultTag:B_,features:z_,visible:c,name:"Popover.Overlay"})}let W_="div",U_=gr.RenderStrategy|gr.Static;function q_(t,e){let n=Mt(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...i}=t,[s,l]=Gc("Popover.Panel"),{close:a,isPortalled:c}=Ap("Popover.Panel"),u=`headlessui-focus-sentinel-before-${Mt()}`,d=`headlessui-focus-sentinel-after-${Mt()}`,f=m.useRef(null),p=lt(f,e,M=>{l({type:4,panel:M})}),g=bs(f),b=mp();bt(()=>(l({type:5,panelId:r}),()=>{l({type:5,panelId:null})}),[r,l]);let v=vs(),y=v!==null?(v&st.Open)===st.Open:s.popoverState===0,w=ae(M=>{var k;switch(M.key){case Oe.Escape:if(s.popoverState!==0||!f.current||g!=null&&g.activeElement&&!f.current.contains(g.activeElement))return;M.preventDefault(),M.stopPropagation(),l({type:1}),(k=s.button)==null||k.focus();break}});m.useEffect(()=>{var M;t.static||s.popoverState===1&&((M=t.unmount)==null||M)&&l({type:4,panel:null})},[s.popoverState,t.unmount,t.static,l]),m.useEffect(()=>{if(s.__demoMode||!o||s.popoverState!==0||!f.current)return;let M=g==null?void 0:g.activeElement;f.current.contains(M)||Dr(f.current,dn.First)},[s.__demoMode,o,f,s.popoverState]);let S=m.useMemo(()=>({open:s.popoverState===0,close:a}),[s,a]),C={ref:p,id:r,onKeyDown:w,onBlur:o&&s.popoverState===0?M=>{var k,j,N,P,z;let W=M.relatedTarget;W&&f.current&&((k=f.current)!=null&&k.contains(W)||(l({type:1}),((N=(j=s.beforePanelSentinel.current)==null?void 0:j.contains)!=null&&N.call(j,W)||(z=(P=s.afterPanelSentinel.current)==null?void 0:P.contains)!=null&&z.call(P,W))&&W.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=Fb(),E=ae(()=>{let M=f.current;if(!M)return;function k(){Ue(x.current,{[Lr.Forwards]:()=>{var j;Dr(M,dn.First)===Qi.Error&&((j=s.afterPanelSentinel.current)==null||j.focus())},[Lr.Backwards]:()=>{var j;(j=s.button)==null||j.focus({preventScroll:!0})}})}k()}),_=ae(()=>{let M=f.current;if(!M)return;function k(){Ue(x.current,{[Lr.Forwards]:()=>{var j;if(!s.button)return;let N=Fc(),P=N.indexOf(s.button),z=N.slice(0,P+1),W=[...N.slice(P+1),...z];for(let F of W.slice())if(F.dataset.headlessuiFocusGuard==="true"||(j=s.panel)!=null&&j.contains(F)){let $=W.indexOf(F);$!==-1&&W.splice($,1)}Dr(W,dn.First,{sorted:!1})},[Lr.Backwards]:()=>{var j;Dr(M,dn.Previous)===Qi.Error&&((j=s.button)==null||j.focus())}})}k()});return m.createElement(Kc.Provider,{value:r},y&&c&&m.createElement(Oo,{id:u,ref:s.beforePanelSentinel,features:zr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),nt({mergeRefs:b,ourProps:C,theirProps:i,slot:S,defaultTag:W_,features:U_,visible:y,name:"Popover.Panel"}),y&&c&&m.createElement(Oo,{id:d,ref:s.afterPanelSentinel,features:zr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:_}))}let G_="div";function K_(t,e){let n=m.useRef(null),r=lt(n,e),[o,i]=m.useState([]),s=z5(),l=ae(b=>{i(v=>{let y=v.indexOf(b);if(y!==-1){let w=v.slice();return w.splice(y,1),w}return v})}),a=ae(b=>(i(v=>[...v,b]),()=>l(b))),c=ae(()=>{var b;let v=xi(n);if(!v)return!1;let y=v.activeElement;return(b=n.current)!=null&&b.contains(y)?!0:o.some(w=>{var S,C;return((S=v.getElementById(w.buttonId.current))==null?void 0:S.contains(y))||((C=v.getElementById(w.panelId.current))==null?void 0:C.contains(y))})}),u=ae(b=>{for(let v of o)v.buttonId.current!==b&&v.close()}),d=m.useMemo(()=>({registerPopover:a,unregisterPopover:l,isFocusWithinPopoverGroup:c,closeOthers:u,mainTreeNodeRef:s.mainTreeNodeRef}),[a,l,c,u,s.mainTreeNodeRef]),f=m.useMemo(()=>({}),[]),p=t,g={ref:r};return m.createElement(Mp.Provider,{value:d},nt({ourProps:g,theirProps:p,slot:f,defaultTag:G_,name:"Popover.Group"}),m.createElement(s.MainTreeNode,null))}let Y_=rt(I_),J_=rt(H_),Z_=rt(F_),X_=rt(q_),Q_=rt(K_),Bu=Object.assign(Y_,{Button:J_,Overlay:Z_,Panel:X_,Group:Q_}),Jb=m.createContext(null);function Zb(){let t=m.useContext(Jb);if(t===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Zb),e}return t}function jp(){let[t,e]=m.useState([]);return[t.length>0?t.join(" "):void 0,m.useMemo(()=>function(n){let r=ae(i=>(e(s=>[...s,i]),()=>e(s=>{let l=s.slice(),a=l.indexOf(i);return a!==-1&&l.splice(a,1),l}))),o=m.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return m.createElement(Jb.Provider,{value:o},n.children)},[e])]}let ek="label";function tk(t,e){let n=Mt(),{id:r=`headlessui-label-${n}`,passive:o=!1,...i}=t,s=Zb(),l=lt(e);bt(()=>s.register(r),[r,s.register]);let a={ref:l,...s.props,id:r};return o&&("onClick"in a&&(delete a.htmlFor,delete a.onClick),"onClick"in i&&delete i.onClick),nt({ourProps:a,theirProps:i,slot:s.slot||{},defaultTag:ek,name:s.name||"Label"})}let nk=rt(tk),Xb=Object.assign(nk,{});function Qb(t=0){let[e,n]=m.useState(t),r=yp(),o=m.useCallback(a=>{r.current&&n(c=>c|a)},[e,r]),i=m.useCallback(a=>!!(e&a),[e]),s=m.useCallback(a=>{r.current&&n(c=>c&~a)},[n,r]),l=m.useCallback(a=>{r.current&&n(c=>c^a)},[n]);return{flags:e,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:l}}var rk=(t=>(t[t.RegisterOption=0]="RegisterOption",t[t.UnregisterOption=1]="UnregisterOption",t))(rk||{});let ok={0(t,e){let n=[...t.options,{id:e.id,element:e.element,propsRef:e.propsRef}];return{...t,options:hp(n,r=>r.element.current)}},1(t,e){let n=t.options.slice(),r=t.options.findIndex(o=>o.id===e.id);return r===-1?t:(n.splice(r,1),{...t,options:n})}},Rp=m.createContext(null);Rp.displayName="RadioGroupDataContext";function ev(t){let e=m.useContext(Rp);if(e===null){let n=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ev),n}return e}let Np=m.createContext(null);Np.displayName="RadioGroupActionsContext";function tv(t){let e=m.useContext(Np);if(e===null){let n=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,tv),n}return e}function ik(t,e){return Ue(e.type,ok,t,e)}let sk="div";function lk(t,e){let n=Mt(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:i,form:s,name:l,onChange:a,by:c=(L,I)=>L===I,disabled:u=!1,...d}=t,f=ae(typeof c=="string"?(L,I)=>{let A=c;return(L==null?void 0:L[A])===(I==null?void 0:I[A])}:c),[p,g]=m.useReducer(ik,{options:[]}),b=p.options,[v,y]=jp(),[w,S]=xp(),C=m.useRef(null),x=lt(C,e),[E,_]=fp(o,a,i),M=m.useMemo(()=>b.find(L=>!L.propsRef.current.disabled),[b]),k=m.useMemo(()=>b.some(L=>f(L.propsRef.current.value,E)),[b,E]),j=ae(L=>{var I;if(u||f(L,E))return!1;let A=(I=b.find(R=>f(R.propsRef.current.value,L)))==null?void 0:I.propsRef.current;return A!=null&&A.disabled?!1:(_==null||_(L),!0)});S5({container:C.current,accept(L){return L.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let N=ae(L=>{let I=C.current;if(!I)return;let A=xi(I),R=b.filter(q=>q.propsRef.current.disabled===!1).map(q=>q.element.current);switch(L.key){case Oe.Enter:zb(L.currentTarget);break;case Oe.ArrowLeft:case Oe.ArrowUp:if(L.preventDefault(),L.stopPropagation(),Dr(R,dn.Previous|dn.WrapAround)===Qi.Success){let q=b.find(D=>D.element.current===(A==null?void 0:A.activeElement));q&&j(q.propsRef.current.value)}break;case Oe.ArrowRight:case Oe.ArrowDown:if(L.preventDefault(),L.stopPropagation(),Dr(R,dn.Next|dn.WrapAround)===Qi.Success){let q=b.find(D=>D.element.current===(A==null?void 0:A.activeElement));q&&j(q.propsRef.current.value)}break;case Oe.Space:{L.preventDefault(),L.stopPropagation();let q=b.find(D=>D.element.current===(A==null?void 0:A.activeElement));q&&j(q.propsRef.current.value)}break}}),P=ae(L=>(g({type:0,...L}),()=>g({type:1,id:L.id}))),z=m.useMemo(()=>({value:E,firstOption:M,containsCheckedOption:k,disabled:u,compare:f,...p}),[E,M,k,u,f,p]),W=m.useMemo(()=>({registerOption:P,change:j}),[P,j]),F={ref:x,id:r,role:"radiogroup","aria-labelledby":v,"aria-describedby":w,onKeyDown:N},$=m.useMemo(()=>({value:E}),[E]),J=m.useRef(null),ee=Eo();return m.useEffect(()=>{J.current&&i!==void 0&&ee.addEventListener(J.current,"reset",()=>{j(i)})},[J,j]),m.createElement(S,{name:"RadioGroup.Description"},m.createElement(y,{name:"RadioGroup.Label"},m.createElement(Np.Provider,{value:W},m.createElement(Rp.Provider,{value:z},l!=null&&E!=null&&vp({[l]:E}).map(([L,I],A)=>m.createElement(Oo,{features:zr.Hidden,ref:A===0?R=>{var q;J.current=(q=R==null?void 0:R.closest("form"))!=null?q:null}:void 0,...dl({key:L,as:"input",type:"radio",checked:I!=null,hidden:!0,readOnly:!0,form:s,disabled:u,name:L,value:I})})),nt({ourProps:F,theirProps:d,slot:$,defaultTag:sk,name:"RadioGroup"})))))}var ak=(t=>(t[t.Empty=1]="Empty",t[t.Active=2]="Active",t))(ak||{});let ck="div";function uk(t,e){var n;let r=Mt(),{id:o=`headlessui-radiogroup-option-${r}`,value:i,disabled:s=!1,...l}=t,a=m.useRef(null),c=lt(a,e),[u,d]=jp(),[f,p]=xp(),{addFlag:g,removeFlag:b,hasFlag:v}=Qb(1),y=Xt({value:i,disabled:s}),w=ev("RadioGroup.Option"),S=tv("RadioGroup.Option");bt(()=>S.registerOption({id:o,element:a,propsRef:y}),[o,S,a,y]);let C=ae(P=>{var z;if(ci(P.currentTarget))return P.preventDefault();S.change(i)&&(g(2),(z=a.current)==null||z.focus())}),x=ae(P=>{if(ci(P.currentTarget))return P.preventDefault();g(2)}),E=ae(()=>b(2)),_=((n=w.firstOption)==null?void 0:n.id)===o,M=w.disabled||s,k=w.compare(w.value,i),j={ref:c,id:o,role:"radio","aria-checked":k?"true":"false","aria-labelledby":u,"aria-describedby":f,"aria-disabled":M?!0:void 0,tabIndex:M?-1:k||!w.containsCheckedOption&&_?0:-1,onClick:M?void 0:C,onFocus:M?void 0:x,onBlur:M?void 0:E},N=m.useMemo(()=>({checked:k,disabled:M,active:v(2)}),[k,M,v]);return m.createElement(p,{name:"RadioGroup.Description"},m.createElement(d,{name:"RadioGroup.Label"},nt({ourProps:j,theirProps:l,slot:N,defaultTag:ck,name:"RadioGroup.Option"})))}let dk=rt(lk),fk=rt(uk),Ng=Object.assign(dk,{Option:fk,Label:Xb,Description:Gb}),Pp=m.createContext(null);Pp.displayName="GroupContext";let pk=m.Fragment;function hk(t){var e;let[n,r]=m.useState(null),[o,i]=jp(),[s,l]=xp(),a=m.useMemo(()=>({switch:n,setSwitch:r,labelledby:o,describedby:s}),[n,r,o,s]),c={},u=t;return m.createElement(l,{name:"Switch.Description"},m.createElement(i,{name:"Switch.Label",props:{htmlFor:(e=a.switch)==null?void 0:e.id,onClick(d){n&&(d.currentTarget.tagName==="LABEL"&&d.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},m.createElement(Pp.Provider,{value:a},nt({ourProps:c,theirProps:u,defaultTag:pk,name:"Switch.Group"}))))}let gk="button";function mk(t,e){var n;let r=Mt(),{id:o=`headlessui-switch-${r}`,checked:i,defaultChecked:s=!1,onChange:l,disabled:a=!1,name:c,value:u,form:d,...f}=t,p=m.useContext(Pp),g=m.useRef(null),b=lt(g,e,p===null?null:p.setSwitch),[v,y]=fp(i,l,s),w=ae(()=>y==null?void 0:y(!v)),S=ae(k=>{if(ci(k.currentTarget))return k.preventDefault();k.preventDefault(),w()}),C=ae(k=>{k.key===Oe.Space?(k.preventDefault(),w()):k.key===Oe.Enter&&zb(k.currentTarget)}),x=ae(k=>k.preventDefault()),E=m.useMemo(()=>({checked:v}),[v]),_={id:o,ref:b,role:"switch",type:Uc(t,g),tabIndex:t.tabIndex===-1?0:(n=t.tabIndex)!=null?n:0,"aria-checked":v,"aria-labelledby":p==null?void 0:p.labelledby,"aria-describedby":p==null?void 0:p.describedby,disabled:a,onClick:S,onKeyUp:C,onKeyPress:x},M=Eo();return m.useEffect(()=>{var k;let j=(k=g.current)==null?void 0:k.closest("form");j&&s!==void 0&&M.addEventListener(j,"reset",()=>{y(s)})},[g,y]),m.createElement(m.Fragment,null,c!=null&&v&&m.createElement(Oo,{features:zr.Hidden,...dl({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:a,form:d,checked:v,name:c,value:u})}),nt({ourProps:_,theirProps:f,slot:E,defaultTag:gk,name:"Switch"}))}let bk=rt(mk),vk=hk,zu=Object.assign(bk,{Group:vk,Label:Xb,Description:Gb});function yk(t){let e={called:!1};return(...n)=>{if(!e.called)return e.called=!0,t(...n)}}function Fu(t,...e){t&&e.length>0&&t.classList.add(...e)}function Wu(t,...e){t&&e.length>0&&t.classList.remove(...e)}function xk(t,e){let n=Co();if(!t)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(t),[i,s]=[r,o].map(a=>{let[c=0]=a.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,d)=>d-u);return c}),l=i+s;if(l!==0){n.group(c=>{c.setTimeout(()=>{e(),c.dispose()},l),c.addEventListener(t,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let a=n.addEventListener(t,"transitionend",c=>{c.target===c.currentTarget&&(e(),a())})}else e();return n.add(()=>e()),n.dispose}function wk(t,e,n,r){let o=n?"enter":"leave",i=Co(),s=r!==void 0?yk(r):()=>{};o==="enter"&&(t.removeAttribute("hidden"),t.style.display="");let l=Ue(o,{enter:()=>e.enter,leave:()=>e.leave}),a=Ue(o,{enter:()=>e.enterTo,leave:()=>e.leaveTo}),c=Ue(o,{enter:()=>e.enterFrom,leave:()=>e.leaveFrom});return Wu(t,...e.base,...e.enter,...e.enterTo,...e.enterFrom,...e.leave,...e.leaveFrom,...e.leaveTo,...e.entered),Fu(t,...e.base,...l,...c),i.nextFrame(()=>{Wu(t,...e.base,...l,...c),Fu(t,...e.base,...l,...a),xk(t,()=>(Wu(t,...e.base,...l),Fu(t,...e.base,...e.entered),s()))}),i.dispose}function Sk({immediate:t,container:e,direction:n,classes:r,onStart:o,onStop:i}){let s=yp(),l=Eo(),a=Xt(n);bt(()=>{t&&(a.current="enter")},[t]),bt(()=>{let c=Co();l.add(c.dispose);let u=e.current;if(u&&a.current!=="idle"&&s.current)return c.dispose(),o.current(a.current),c.add(wk(u,r.current,a.current==="enter",()=>{c.dispose(),i.current(a.current)})),c.dispose},[n])}function Zr(t=""){return t.split(/\s+/).filter(e=>e.length>1)}let Yc=m.createContext(null);Yc.displayName="TransitionContext";var Ck=(t=>(t.Visible="visible",t.Hidden="hidden",t))(Ck||{});function Ek(){let t=m.useContext(Yc);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function Ok(){let t=m.useContext(Jc);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let Jc=m.createContext(null);Jc.displayName="NestingContext";function Zc(t){return"children"in t?Zc(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function nv(t,e){let n=Xt(t),r=m.useRef([]),o=yp(),i=Eo(),s=ae((p,g=co.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===p);b!==-1&&(Ue(g,{[co.Unmount](){r.current.splice(b,1)},[co.Hidden](){r.current[b].state="hidden"}}),i.microTask(()=>{var v;!Zc(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),l=ae(p=>{let g=r.current.find(({el:b})=>b===p);return g?g.state!=="visible"&&(g.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,co.Unmount)}),a=m.useRef([]),c=m.useRef(Promise.resolve()),u=m.useRef({enter:[],leave:[],idle:[]}),d=ae((p,g,b)=>{a.current.splice(0),e&&(e.chains.current[g]=e.chains.current[g].filter(([v])=>v!==p)),e==null||e.chains.current[g].push([p,new Promise(v=>{a.current.push(v)})]),e==null||e.chains.current[g].push([p,new Promise(v=>{Promise.all(u.current[g].map(([y,w])=>w)).then(()=>v())})]),g==="enter"?c.current=c.current.then(()=>e==null?void 0:e.wait.current).then(()=>b(g)):b(g)}),f=ae((p,g,b)=>{Promise.all(u.current[g].splice(0).map(([v,y])=>y)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>b(g))});return m.useMemo(()=>({children:r,register:l,unregister:s,onStart:d,onStop:f,wait:c,chains:u}),[l,s,r,d,f,u,c])}function _k(){}let kk=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Pg(t){var e;let n={};for(let r of kk)n[r]=(e=t[r])!=null?e:_k;return n}function Tk(t){let e=m.useRef(Pg(t));return m.useEffect(()=>{e.current=Pg(t)},[t]),e}let Ak="div",rv=gr.RenderStrategy;function Mk(t,e){var n,r;let{beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:l,enter:a,enterFrom:c,enterTo:u,entered:d,leave:f,leaveFrom:p,leaveTo:g,...b}=t,v=m.useRef(null),y=lt(v,e),w=(n=b.unmount)==null||n?co.Unmount:co.Hidden,{show:S,appear:C,initial:x}=Ek(),[E,_]=m.useState(S?"visible":"hidden"),M=Ok(),{register:k,unregister:j}=M;m.useEffect(()=>k(v),[k,v]),m.useEffect(()=>{if(w===co.Hidden&&v.current){if(S&&E!=="visible"){_("visible");return}return Ue(E,{hidden:()=>j(v),visible:()=>k(v)})}},[E,v,k,j,S,w]);let N=Xt({base:Zr(b.className),enter:Zr(a),enterFrom:Zr(c),enterTo:Zr(u),entered:Zr(d),leave:Zr(f),leaveFrom:Zr(p),leaveTo:Zr(g)}),P=Tk({beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:l}),z=zc();m.useEffect(()=>{if(z&&E==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,E,z]);let W=x&&!C,F=C&&S&&x,$=!z||W?"idle":S?"enter":"leave",J=Qb(0),ee=ae(D=>Ue(D,{enter:()=>{J.addFlag(st.Opening),P.current.beforeEnter()},leave:()=>{J.addFlag(st.Closing),P.current.beforeLeave()},idle:()=>{}})),L=ae(D=>Ue(D,{enter:()=>{J.removeFlag(st.Opening),P.current.afterEnter()},leave:()=>{J.removeFlag(st.Closing),P.current.afterLeave()},idle:()=>{}})),I=nv(()=>{_("hidden"),j(v)},M),A=m.useRef(!1);Sk({immediate:F,container:v,classes:N,direction:$,onStart:Xt(D=>{A.current=!0,I.onStart(v,D,ee)}),onStop:Xt(D=>{A.current=!1,I.onStop(v,D,L),D==="leave"&&!Zc(I)&&(_("hidden"),j(v))})});let R=b,q={ref:y};return F?R={...R,className:ic(b.className,...N.current.enter,...N.current.enterFrom)}:A.current&&(R.className=ic(b.className,(r=v.current)==null?void 0:r.className),R.className===""&&delete R.className),m.createElement(Jc.Provider,{value:I},m.createElement(qc,{value:Ue(E,{visible:st.Open,hidden:st.Closed})|J.flags},nt({ourProps:q,theirProps:R,defaultTag:Ak,features:rv,visible:E==="visible",name:"Transition.Child"})))}function jk(t,e){let{show:n,appear:r=!1,unmount:o=!0,...i}=t,s=m.useRef(null),l=lt(s,e);zc();let a=vs();if(n===void 0&&a!==null&&(n=(a&st.Open)===st.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=m.useState(n?"visible":"hidden"),d=nv(()=>{u("hidden")}),[f,p]=m.useState(!0),g=m.useRef([n]);bt(()=>{f!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),p(!1))},[g,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);m.useEffect(()=>{if(n)u("visible");else if(!Zc(d))u("hidden");else{let S=s.current;if(!S)return;let C=S.getBoundingClientRect();C.x===0&&C.y===0&&C.width===0&&C.height===0&&u("hidden")}},[n,d]);let v={unmount:o},y=ae(()=>{var S;f&&p(!1),(S=t.beforeEnter)==null||S.call(t)}),w=ae(()=>{var S;f&&p(!1),(S=t.beforeLeave)==null||S.call(t)});return m.createElement(Jc.Provider,{value:d},m.createElement(Yc.Provider,{value:b},nt({ourProps:{...v,as:m.Fragment,children:m.createElement(ov,{ref:l,...v,...i,beforeEnter:y,beforeLeave:w})},theirProps:{},defaultTag:m.Fragment,features:rv,visible:c==="visible",name:"Transition"})))}function Rk(t,e){let n=m.useContext(Yc)!==null,r=vs()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(of,{ref:e,...t}):m.createElement(ov,{ref:e,...t}))}let of=rt(jk),ov=rt(Mk),Nk=rt(Rk),Dp=Object.assign(of,{Child:Nk,Root:of});var Dg=function(e){return e.reduce(function(n,r){var o=r[0],i=r[1];return n[o]=i,n},{})},Lg=typeof window<"u"&&window.document&&window.document.createElement?kn.useLayoutEffect:kn.useEffect,Qt="top",Hn="bottom",Bn="right",en="left",Lp="auto",Dl=[Qt,Hn,Bn,en],es="start",fl="end",Pk="clippingParents",iv="viewport",js="popper",Dk="reference",Vg=Dl.reduce(function(t,e){return t.concat([e+"-"+es,e+"-"+fl])},[]),sv=[].concat(Dl,[Lp]).reduce(function(t,e){return t.concat([e,e+"-"+es,e+"-"+fl])},[]),Lk="beforeRead",Vk="read",Ik="afterRead",$k="beforeMain",Hk="main",Bk="afterMain",zk="beforeWrite",Fk="write",Wk="afterWrite",Uk=[Lk,Vk,Ik,$k,Hk,Bk,zk,Fk,Wk];function mr(t){return t?(t.nodeName||"").toLowerCase():null}function bn(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function ui(t){var e=bn(t).Element;return t instanceof e||t instanceof Element}function Vn(t){var e=bn(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Vp(t){if(typeof ShadowRoot>"u")return!1;var e=bn(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function qk(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!Vn(i)||!mr(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var l=o[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function Gk(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),l=s.reduce(function(a,c){return a[c]="",a},{});!Vn(o)||!mr(o)||(Object.assign(o.style,l),Object.keys(i).forEach(function(a){o.removeAttribute(a)}))})}}const Kk={name:"applyStyles",enabled:!0,phase:"write",fn:qk,effect:Gk,requires:["computeStyles"]};function fr(t){return t.split("-")[0]}var Jo=Math.max,sc=Math.min,ts=Math.round;function sf(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function lv(){return!/^((?!chrome|android).)*safari/i.test(sf())}function ns(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,i=1;e&&Vn(t)&&(o=t.offsetWidth>0&&ts(r.width)/t.offsetWidth||1,i=t.offsetHeight>0&&ts(r.height)/t.offsetHeight||1);var s=ui(t)?bn(t):window,l=s.visualViewport,a=!lv()&&n,c=(r.left+(a&&l?l.offsetLeft:0))/o,u=(r.top+(a&&l?l.offsetTop:0))/i,d=r.width/o,f=r.height/i;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c,x:c,y:u}}function Ip(t){var e=ns(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function av(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Vp(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Fr(t){return bn(t).getComputedStyle(t)}function Yk(t){return["table","td","th"].indexOf(mr(t))>=0}function Ao(t){return((ui(t)?t.ownerDocument:t.document)||window.document).documentElement}function Xc(t){return mr(t)==="html"?t:t.assignedSlot||t.parentNode||(Vp(t)?t.host:null)||Ao(t)}function Ig(t){return!Vn(t)||Fr(t).position==="fixed"?null:t.offsetParent}function Jk(t){var e=/firefox/i.test(sf()),n=/Trident/i.test(sf());if(n&&Vn(t)){var r=Fr(t);if(r.position==="fixed")return null}var o=Xc(t);for(Vp(o)&&(o=o.host);Vn(o)&&["html","body"].indexOf(mr(o))<0;){var i=Fr(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function Ll(t){for(var e=bn(t),n=Ig(t);n&&Yk(n)&&Fr(n).position==="static";)n=Ig(n);return n&&(mr(n)==="html"||mr(n)==="body"&&Fr(n).position==="static")?e:n||Jk(t)||e}function $p(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Gs(t,e,n){return Jo(t,sc(e,n))}function Zk(t,e,n){var r=Gs(t,e,n);return r>n?n:r}function cv(){return{top:0,right:0,bottom:0,left:0}}function uv(t){return Object.assign({},cv(),t)}function dv(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Xk=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,uv(typeof e!="number"?e:dv(e,Dl))};function Qk(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,l=fr(n.placement),a=$p(l),c=[en,Bn].indexOf(l)>=0,u=c?"height":"width";if(!(!i||!s)){var d=Xk(o.padding,n),f=Ip(i),p=a==="y"?Qt:en,g=a==="y"?Hn:Bn,b=n.rects.reference[u]+n.rects.reference[a]-s[a]-n.rects.popper[u],v=s[a]-n.rects.reference[a],y=Ll(i),w=y?a==="y"?y.clientHeight||0:y.clientWidth||0:0,S=b/2-v/2,C=d[p],x=w-f[u]-d[g],E=w/2-f[u]/2+S,_=Gs(C,E,x),M=a;n.modifiersData[r]=(e={},e[M]=_,e.centerOffset=_-E,e)}}function eT(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||av(e.elements.popper,o)&&(e.elements.arrow=o))}const tT={name:"arrow",enabled:!0,phase:"main",fn:Qk,effect:eT,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function rs(t){return t.split("-")[1]}var nT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function rT(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:ts(n*o)/o||0,y:ts(r*o)/o||0}}function $g(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,s=t.offsets,l=t.position,a=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,f=s.x,p=f===void 0?0:f,g=s.y,b=g===void 0?0:g,v=typeof u=="function"?u({x:p,y:b}):{x:p,y:b};p=v.x,b=v.y;var y=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),S=en,C=Qt,x=window;if(c){var E=Ll(n),_="clientHeight",M="clientWidth";if(E===bn(n)&&(E=Ao(n),Fr(E).position!=="static"&&l==="absolute"&&(_="scrollHeight",M="scrollWidth")),E=E,o===Qt||(o===en||o===Bn)&&i===fl){C=Hn;var k=d&&E===x&&x.visualViewport?x.visualViewport.height:E[_];b-=k-r.height,b*=a?1:-1}if(o===en||(o===Qt||o===Hn)&&i===fl){S=Bn;var j=d&&E===x&&x.visualViewport?x.visualViewport.width:E[M];p-=j-r.width,p*=a?1:-1}}var N=Object.assign({position:l},c&&nT),P=u===!0?rT({x:p,y:b},bn(n)):{x:p,y:b};if(p=P.x,b=P.y,a){var z;return Object.assign({},N,(z={},z[C]=w?"0":"",z[S]=y?"0":"",z.transform=(x.devicePixelRatio||1)<=1?"translate("+p+"px, "+b+"px)":"translate3d("+p+"px, "+b+"px, 0)",z))}return Object.assign({},N,(e={},e[C]=w?b+"px":"",e[S]=y?p+"px":"",e.transform="",e))}function oT(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,s=i===void 0?!0:i,l=n.roundOffsets,a=l===void 0?!0:l,c={placement:fr(e.placement),variation:rs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,$g(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,$g(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const iT={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:oT,data:{}};var ra={passive:!0};function sT(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,l=s===void 0?!0:s,a=bn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ra)}),l&&a.addEventListener("resize",n.update,ra),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ra)}),l&&a.removeEventListener("resize",n.update,ra)}}const lT={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:sT,data:{}};var aT={left:"right",right:"left",bottom:"top",top:"bottom"};function Pa(t){return t.replace(/left|right|bottom|top/g,function(e){return aT[e]})}var cT={start:"end",end:"start"};function Hg(t){return t.replace(/start|end/g,function(e){return cT[e]})}function Hp(t){var e=bn(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Bp(t){return ns(Ao(t)).left+Hp(t).scrollLeft}function uT(t,e){var n=bn(t),r=Ao(t),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,l=0,a=0;if(o){i=o.width,s=o.height;var c=lv();(c||!c&&e==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:i,height:s,x:l+Bp(t),y:a}}function dT(t){var e,n=Ao(t),r=Hp(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=Jo(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=Jo(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+Bp(t),a=-r.scrollTop;return Fr(o||n).direction==="rtl"&&(l+=Jo(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function zp(t){var e=Fr(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function fv(t){return["html","body","#document"].indexOf(mr(t))>=0?t.ownerDocument.body:Vn(t)&&zp(t)?t:fv(Xc(t))}function Ks(t,e){var n;e===void 0&&(e=[]);var r=fv(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=bn(r),s=o?[i].concat(i.visualViewport||[],zp(r)?r:[]):r,l=e.concat(s);return o?l:l.concat(Ks(Xc(s)))}function lf(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function fT(t,e){var n=ns(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Bg(t,e,n){return e===iv?lf(uT(t,n)):ui(e)?fT(e,n):lf(dT(Ao(t)))}function pT(t){var e=Ks(Xc(t)),n=["absolute","fixed"].indexOf(Fr(t).position)>=0,r=n&&Vn(t)?Ll(t):t;return ui(r)?e.filter(function(o){return ui(o)&&av(o,r)&&mr(o)!=="body"}):[]}function hT(t,e,n,r){var o=e==="clippingParents"?pT(t):[].concat(e),i=[].concat(o,[n]),s=i[0],l=i.reduce(function(a,c){var u=Bg(t,c,r);return a.top=Jo(u.top,a.top),a.right=sc(u.right,a.right),a.bottom=sc(u.bottom,a.bottom),a.left=Jo(u.left,a.left),a},Bg(t,s,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function pv(t){var e=t.reference,n=t.element,r=t.placement,o=r?fr(r):null,i=r?rs(r):null,s=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,a;switch(o){case Qt:a={x:s,y:e.y-n.height};break;case Hn:a={x:s,y:e.y+e.height};break;case Bn:a={x:e.x+e.width,y:l};break;case en:a={x:e.x-n.width,y:l};break;default:a={x:e.x,y:e.y}}var c=o?$p(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case es:a[c]=a[c]-(e[u]/2-n[u]/2);break;case fl:a[c]=a[c]+(e[u]/2-n[u]/2);break}}return a}function pl(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.strategy,s=i===void 0?t.strategy:i,l=n.boundary,a=l===void 0?Pk:l,c=n.rootBoundary,u=c===void 0?iv:c,d=n.elementContext,f=d===void 0?js:d,p=n.altBoundary,g=p===void 0?!1:p,b=n.padding,v=b===void 0?0:b,y=uv(typeof v!="number"?v:dv(v,Dl)),w=f===js?Dk:js,S=t.rects.popper,C=t.elements[g?w:f],x=hT(ui(C)?C:C.contextElement||Ao(t.elements.popper),a,u,s),E=ns(t.elements.reference),_=pv({reference:E,element:S,strategy:"absolute",placement:o}),M=lf(Object.assign({},S,_)),k=f===js?M:E,j={top:x.top-k.top+y.top,bottom:k.bottom-x.bottom+y.bottom,left:x.left-k.left+y.left,right:k.right-x.right+y.right},N=t.modifiersData.offset;if(f===js&&N){var P=N[o];Object.keys(j).forEach(function(z){var W=[Bn,Hn].indexOf(z)>=0?1:-1,F=[Qt,Hn].indexOf(z)>=0?"y":"x";j[z]+=P[F]*W})}return j}function gT(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,l=n.flipVariations,a=n.allowedAutoPlacements,c=a===void 0?sv:a,u=rs(r),d=u?l?Vg:Vg.filter(function(g){return rs(g)===u}):Dl,f=d.filter(function(g){return c.indexOf(g)>=0});f.length===0&&(f=d);var p=f.reduce(function(g,b){return g[b]=pl(t,{placement:b,boundary:o,rootBoundary:i,padding:s})[fr(b)],g},{});return Object.keys(p).sort(function(g,b){return p[g]-p[b]})}function mT(t){if(fr(t)===Lp)return[];var e=Pa(t);return[Hg(t),e,Hg(e)]}function bT(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,l=s===void 0?!0:s,a=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,g=p===void 0?!0:p,b=n.allowedAutoPlacements,v=e.options.placement,y=fr(v),w=y===v,S=a||(w||!g?[Pa(v)]:mT(v)),C=[v].concat(S).reduce(function(D,V){return D.concat(fr(V)===Lp?gT(e,{placement:V,boundary:u,rootBoundary:d,padding:c,flipVariations:g,allowedAutoPlacements:b}):V)},[]),x=e.rects.reference,E=e.rects.popper,_=new Map,M=!0,k=C[0],j=0;j<C.length;j++){var N=C[j],P=fr(N),z=rs(N)===es,W=[Qt,Hn].indexOf(P)>=0,F=W?"width":"height",$=pl(e,{placement:N,boundary:u,rootBoundary:d,altBoundary:f,padding:c}),J=W?z?Bn:en:z?Hn:Qt;x[F]>E[F]&&(J=Pa(J));var ee=Pa(J),L=[];if(i&&L.push($[P]<=0),l&&L.push($[J]<=0,$[ee]<=0),L.every(function(D){return D})){k=N,M=!1;break}_.set(N,L)}if(M)for(var I=g?3:1,A=function(V){var te=C.find(function(G){var Q=_.get(G);if(Q)return Q.slice(0,V).every(function(se){return se})});if(te)return k=te,"break"},R=I;R>0;R--){var q=A(R);if(q==="break")break}e.placement!==k&&(e.modifiersData[r]._skip=!0,e.placement=k,e.reset=!0)}}const vT={name:"flip",enabled:!0,phase:"main",fn:bT,requiresIfExists:["offset"],data:{_skip:!1}};function zg(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Fg(t){return[Qt,Bn,Hn,en].some(function(e){return t[e]>=0})}function yT(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=pl(e,{elementContext:"reference"}),l=pl(e,{altBoundary:!0}),a=zg(s,r),c=zg(l,o,i),u=Fg(a),d=Fg(c);e.modifiersData[n]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const xT={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:yT};function wT(t,e,n){var r=fr(t),o=[en,Qt].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],l=i[1];return s=s||0,l=(l||0)*o,[en,Bn].indexOf(r)>=0?{x:l,y:s}:{x:s,y:l}}function ST(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,s=sv.reduce(function(u,d){return u[d]=wT(d,e.rects,i),u},{}),l=s[e.placement],a=l.x,c=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const CT={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ST};function ET(t){var e=t.state,n=t.name;e.modifiersData[n]=pv({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const OT={name:"popperOffsets",enabled:!0,phase:"read",fn:ET,data:{}};function _T(t){return t==="x"?"y":"x"}function kT(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,l=s===void 0?!1:s,a=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0?!0:f,g=n.tetherOffset,b=g===void 0?0:g,v=pl(e,{boundary:a,rootBoundary:c,padding:d,altBoundary:u}),y=fr(e.placement),w=rs(e.placement),S=!w,C=$p(y),x=_T(C),E=e.modifiersData.popperOffsets,_=e.rects.reference,M=e.rects.popper,k=typeof b=="function"?b(Object.assign({},e.rects,{placement:e.placement})):b,j=typeof k=="number"?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),N=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,P={x:0,y:0};if(E){if(i){var z,W=C==="y"?Qt:en,F=C==="y"?Hn:Bn,$=C==="y"?"height":"width",J=E[C],ee=J+v[W],L=J-v[F],I=p?-M[$]/2:0,A=w===es?_[$]:M[$],R=w===es?-M[$]:-_[$],q=e.elements.arrow,D=p&&q?Ip(q):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:cv(),te=V[W],G=V[F],Q=Gs(0,_[$],D[$]),se=S?_[$]/2-I-Q-te-j.mainAxis:A-Q-te-j.mainAxis,be=S?-_[$]/2+I+Q+G+j.mainAxis:R+Q+G+j.mainAxis,de=e.elements.arrow&&Ll(e.elements.arrow),Pe=de?C==="y"?de.clientTop||0:de.clientLeft||0:0,X=(z=N==null?void 0:N[C])!=null?z:0,qe=J+se-X-Pe,Qe=J+be-X,at=Gs(p?sc(ee,qe):ee,J,p?Jo(L,Qe):L);E[C]=at,P[C]=at-J}if(l){var xt,wt=C==="x"?Qt:en,rn=C==="x"?Hn:Bn,Le=E[x],ot=x==="y"?"height":"width",T=Le+v[wt],re=Le-v[rn],ie=[Qt,en].indexOf(y)!==-1,Ce=(xt=N==null?void 0:N[x])!=null?xt:0,Xe=ie?T:Le-_[ot]-M[ot]-Ce+j.altAxis,Te=ie?Le+_[ot]+M[ot]-Ce-j.altAxis:re,me=p&&ie?Zk(Xe,Le,Te):Gs(p?Xe:T,Le,p?Te:re);E[x]=me,P[x]=me-Le}e.modifiersData[r]=P}}const TT={name:"preventOverflow",enabled:!0,phase:"main",fn:kT,requiresIfExists:["offset"]};function AT(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function MT(t){return t===bn(t)||!Vn(t)?Hp(t):AT(t)}function jT(t){var e=t.getBoundingClientRect(),n=ts(e.width)/t.offsetWidth||1,r=ts(e.height)/t.offsetHeight||1;return n!==1||r!==1}function RT(t,e,n){n===void 0&&(n=!1);var r=Vn(e),o=Vn(e)&&jT(e),i=Ao(e),s=ns(t,o,n),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(r||!r&&!n)&&((mr(e)!=="body"||zp(i))&&(l=MT(e)),Vn(e)?(a=ns(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=Bp(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function NT(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i)});function o(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!n.has(l)){var a=e.get(l);a&&o(a)}}),r.push(i)}return t.forEach(function(i){n.has(i.name)||o(i)}),r}function PT(t){var e=NT(t);return Uk.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function DT(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function LT(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Wg={placement:"bottom",modifiers:[],strategy:"absolute"};function Ug(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function VT(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Wg:o;return function(l,a,c){c===void 0&&(c=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Wg,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},d=[],f=!1,p={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;b(),u.options=Object.assign({},i,u.options,w),u.scrollParents={reference:ui(l)?Ks(l):l.contextElement?Ks(l.contextElement):[],popper:Ks(a)};var S=PT(LT([].concat(r,u.options.modifiers)));return u.orderedModifiers=S.filter(function(C){return C.enabled}),g(),p.update()},forceUpdate:function(){if(!f){var y=u.elements,w=y.reference,S=y.popper;if(Ug(w,S)){u.rects={reference:RT(w,Ll(S),u.options.strategy==="fixed"),popper:Ip(S)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(j){return u.modifiersData[j.name]=Object.assign({},j.data)});for(var C=0;C<u.orderedModifiers.length;C++){if(u.reset===!0){u.reset=!1,C=-1;continue}var x=u.orderedModifiers[C],E=x.fn,_=x.options,M=_===void 0?{}:_,k=x.name;typeof E=="function"&&(u=E({state:u,options:M,name:k,instance:p})||u)}}}},update:DT(function(){return new Promise(function(v){p.forceUpdate(),v(u)})}),destroy:function(){b(),f=!0}};if(!Ug(l,a))return p;p.setOptions(c).then(function(v){!f&&c.onFirstUpdate&&c.onFirstUpdate(v)});function g(){u.orderedModifiers.forEach(function(v){var y=v.name,w=v.options,S=w===void 0?{}:w,C=v.effect;if(typeof C=="function"){var x=C({state:u,name:y,instance:p,options:S}),E=function(){};d.push(x||E)}})}function b(){d.forEach(function(v){return v()}),d=[]}return p}}var IT=[lT,OT,iT,Kk,CT,vT,TT,tT,xT],$T=VT({defaultModifiers:IT}),HT=typeof Element<"u",BT=typeof Map=="function",zT=typeof Set=="function",FT=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Da(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Da(t[r],e[r]))return!1;return!0}var i;if(BT&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(i=t.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;for(i=t.entries();!(r=i.next()).done;)if(!Da(r.value[1],e.get(r.value[0])))return!1;return!0}if(zT&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(i=t.entries();!(r=i.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(FT&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;if(HT&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&t.$$typeof)&&!Da(t[o[r]],e[o[r]]))return!1;return!0}return t!==t&&e!==e}var WT=function(e,n){try{return Da(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const UT=Xf(WT);var qT=[],Qc=function(e,n,r){r===void 0&&(r={});var o=kn.useRef(null),i={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||qT},s=kn.useState({styles:{popper:{position:i.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),l=s[0],a=s[1],c=kn.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(p){var g=p.state,b=Object.keys(g.elements);b2.flushSync(function(){a({styles:Dg(b.map(function(v){return[v,g.styles[v]||{}]})),attributes:Dg(b.map(function(v){return[v,g.attributes[v]]}))})})},requires:["computeStyles"]}},[]),u=kn.useMemo(function(){var f={onFirstUpdate:i.onFirstUpdate,placement:i.placement,strategy:i.strategy,modifiers:[].concat(i.modifiers,[c,{name:"applyStyles",enabled:!1}])};return UT(o.current,f)?o.current||f:(o.current=f,f)},[i.onFirstUpdate,i.placement,i.strategy,i.modifiers,c]),d=kn.useRef();return Lg(function(){d.current&&d.current.setOptions(u)},[u]),Lg(function(){if(!(e==null||n==null)){var f=r.createPopper||$T,p=f(e,n,u);return d.current=p,function(){p.destroy(),d.current=null}}},[e,n,r.createPopper]),{state:d.current?d.current.state:null,styles:l.styles,attributes:l.attributes,update:d.current?d.current.update:null,forceUpdate:d.current?d.current.forceUpdate:null}};const is=m.forwardRef(function({children:e,title:n,onClose:r,icon:o,shadow:i=!0,padding:s=!0,border:l=!0,round:a=!0,className:c,classNameBody:u,size:d="m",titleClass:f=B("gs-utl-mb-2 gs-utl-mt-0.5"),style:p,bg:g,...b},v){return h.jsxs("div",{...b,ref:v,style:p,className:B([c,g||Sb.bg,we.b,a&&we.rnd,l?he.br:we.bT,"gs-utl-card gs-utl-overflow-auto",i&&"gs-utl-shadow-md",s&&d==="l"&&"gs-utl-p-5",s&&d==="m"&&"gs-utl-px-4 gs-utl-py-2",s&&d==="s"&&"gs-utl-px-2 gs-utl-py-1",s&&d==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",s&&d==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&h.jsxs(fe,{className:B("gs-utl-card-title",f),items:"center",children:[h.jsx(U,{className:B("truncate"),grow:!0,children:n}),(r||o)&&h.jsx(U,{onClick:r,className:B("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:h.jsx(ge,{icon:o||_e.close,size:"18px"})})]}),h.jsx("div",{className:B("gs-utl-card-body",u),children:e})]})});var GT={},Uu=ir;GT.NODE_ENV==="production"?(Uu.createRoot,Uu.hydrateRoot):Uu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function KT(t,e){m.useEffect(()=>{const n="pointerdown",{current:r}=t;if(!r||!e.enabled)return;function o(i){const s=i.target;r&&s&&!r.contains(s)&&e.onTrigger(s)}return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}},[t.current,e.enabled])}const YT="gs-cmp-popover";function hv({children:t,handler:e,title:n,size:r,padding:o=!0,overlay:i,clickAway:s,topIcon:l,placement:a="auto",offset:c,open:u,onClose:d,buttonAs:f,className:p,classNameBody:g,buttonProps:b={}}){const[v,y]=m.useState(!!u),[w,S]=m.useState(v),[C,x]=m.useState(null),[E,_]=m.useState(null),M=Qc(C,E,{...Fp({offset:c}),placement:a}),k=()=>{S(!1),d==null||d()};KT({current:E},{onTrigger:k,enabled:s&&v}),m.useEffect(()=>{S(!!u)},[u]),m.useEffect(()=>{var P;v&&((P=M.update)==null||P.call(M))},[v,M.update]),m.useEffect(()=>{const P=setTimeout(()=>y(w),10);return()=>clearTimeout(P)},[w]);const j=B("w-full transition-colors",...Jv({border:!1,size:"",...b})),N=B(["fixed z-20",l&&"gjs-mt-5",r==="s"&&"w-full max-w-64",r==="sm"&&"w-full max-w-sm",r==="md"&&"w-full max-w-md"]);return h.jsxs(Bu,{className:B(YT,"relative flex",p),children:[h.jsx(Bu.Button,{ref:x,as:f,className:j,children:h.jsx("div",{onClick:()=>!jl(u)&&S(!v),children:e})}),v&&i&&h.jsx("div",{onClick:k,className:B("z-10 fixed inset-0")}),w&&h.jsx(Bu.Panel,{static:!0,className:N,ref:_,style:M.styles.popper,...M.attributes.popper,children:h.jsx(Dp,{as:m.Fragment,show:v,unmount:!1,...wb,children:h.jsx(is,{title:n,onClose:k,padding:o,classNameBody:g,children:typeof t=="function"?t({close:k}):t})})})]})}function JT({action:t,icon:e,label:n,className:r,items:o,...i}){const s=m.useRef(null),[l,a]=m.useState(),c=s.current,u=B([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",he.br,dr.xy,we.bb,i.disabled&&So.disabled,...t?[he.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),d=p=>xo(t)&&t({event:p});m.useEffect(()=>{if(!c)return;const p=setTimeout(()=>a(c.getBoundingClientRect()),i.active?0:WE);return()=>clearTimeout(p)},[c,i.active]);const f=()=>{var p;return(p=i.onActive)==null?void 0:p.call(i)};return h.jsxs(fe,{ref:s,items:"center",nowrap:!0,className:u,onClick:d,onPointerEnter:f,children:[e&&h.jsx(U,{children:h.jsx(ge,{icon:e,size:We.s})}),h.jsx(U,{className:B(i.classNameLabel,So.txtEllips),grow:!0,children:n}),!!(o!=null&&o.length)&&h.jsxs(h.Fragment,{children:[h.jsx(U,{children:h.jsx(ge,{icon:_e.chevronRight,size:We.s,className:B("-gs-utl-mr-2")})}),l&&i.active&&h.jsx(rA,{items:o,x:l.left,y:l.top,w:l.width,h:l.height,open:!0})]})]})}const ZT=(t,e)=>t.filter(n=>n.id===e)[0]||null,XT=(t,e)=>(t==null?void 0:t.id)===(e==null?void 0:e.id),QT=(t,e)=>t.label.toLowerCase().indexOf(e.toLowerCase())>=0,eA=B("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),gv={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},tA="gs-select-field";function Je({value:t,onChange:e,onBlur:n,onFocus:r,handlerSelected:o,label:i,options:s,includeEmpty:l,className:a,search:c,fixed:u,open:d,caret:f=_e.chevronDown,size:p="m",width:g="",border:b,style:v,pos:y,emptyState:w="- Select an option -",name:S,required:C,disabled:x,tip:E,classNameContainer:_,autoFocus:M}){const[k,j]=m.useState(null),[N,P]=m.useState(null),[z,W]=m.useState(""),{styles:F,attributes:$}=Qc(k,N,gv),J=typeof c=="object"?c.onChange:void 0,ee=[...s].filter(G=>c?J||QT(G,z):G),L=c&&(typeof c=="object"&&c.value||z),I=L&&ee.length?ee[0]:ZT(ee,t),A=G=>e(G.id),R={id:null,label:w},q=I?o?o(I):I.content||I.label:o?o(R):w;l&&ee.unshift(R);const D=G=>{const{value:Q}=G.target,se=Q.trim();switch(G.key){case"Escape":e(null);break;case"Enter":e((ee.length?ee[0].id:se)||null);break;case" ":Dd(G);break}},V=tt("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",we.rnd,nc.focus),te=()=>{n==null||n()};return h.jsx(Ms,{value:I,onChange:A,children:({open:G})=>h.jsxs("div",{className:tt(tA,_,"gs-utl-relative gs-utl-w-full gs-utl-text-sm"),style:v,children:[i&&h.jsx(Ms.Label,{children:h.jsx(gn,{as:"span",size:p,tip:E,children:i})}),S&&h.jsx("input",{type:"input",name:S,value:(I==null?void 0:I.id)??"",onChange:()=>{},className:B("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:C,disabled:x}),h.jsx(Ms.Button,{ref:j,className:V,tabIndex:c?-1:void 0,children:c?h.jsx("input",{autoFocus:M,value:typeof c=="object"&&c.value||z,className:tt([a,"gs-utl-w-full",we.rnd,nc.focus,dr.xyS]),onChange:Q=>{W(Q.target.value),J==null||J(Q.target.value)},onKeyDown:D,onClick:Dd,onBlur:te,onFocus:r}):h.jsx(is,{border:b,size:p,title:q,icon:f,shadow:!1,className:B(a),titleClass:""})}),h.jsx(Ms.Options,{static:d,className:eA,ref:P,style:F.popper,...$.popper,children:h.jsxs(is,{padding:!1,className:B("h-full"),style:{minWidth:`${k==null?void 0:k.offsetWidth}px`,maxHeight:200},children:[!ee.length&&c&&c!==!0&&h.jsx("div",{className:B(dr.xy),children:c.empty}),ee.map((Q,se)=>h.jsx(Ms.Option,{value:Q,children:({active:be,selected:de})=>h.jsxs(fe,{items:"center",className:B([Q.className,dr.xy,be&&Sb.bgH]),children:[h.jsx(U,{className:B("truncate"),grow:!0,children:Q.content||Q.label}),h.jsx(U,{className:B("gjs-pl-2"),children:XT(Q,I)&&!L&&h.jsx(ge,{className:B(he.tA),icon:_e.check,size:We.s})})]})},se))]})})]})})}const qg=Zf()&&document.body,Fp=(t={})=>({...gv,placement:"right-start",modifiers:[{name:"offset",options:{offset:t.offset||[0,5]}},{name:"flip",options:{boundary:t.boundary??qg}},{name:"preventOverflow",options:{boundary:t.boundary??qg}}]}),nA=Fp(),oa="gs-ctx-menu-list",rA=ms(function({open:e,items:n,x:r,y:o,w:i,h:s}){const l=eO(),[a,c]=m.useState(),[u,d]=m.useState(null),f=m.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,o,i,s)}),[r,o,i,s,e]),{styles:p,attributes:g}=Qc(f,u,nA),b=tt(`${oa}-wrp gs-utl-z-20`),v=tt(`${oa} gs-utl-z-20`),y=tt(`${oa}-body gs-utl-max-w-56`),w=tt(`${oa}-item`),S="gs-utl-max-w-40",C=x=>{const{action:E,onClick:_}=x;if(E||_)return M=>{const k={editor:l.store.appEditorStore.editor,...M};xo(E)?(E(k),l.hide()):xo(_)&&(_(k),l.hide())}};return h.jsx("div",{className:b,ref:d,style:p.popper,...g.popper,children:h.jsx(Dp,{show:!!e,...GE,unmount:!1,children:h.jsx(is,{padding:!1,className:v,classNameBody:y,children:n.map((x,E)=>m.createElement(JT,{...x,key:x.id??E,className:w,classNameLabel:S,action:C(x),onActive:()=>c(x),active:a===x}))})})})}),qu="gs-cmp-tooltip";function mo({className:t,classNameWrp:e,classNameContent:n,children:r,title:o,onClick:i,inline:s,size:l}){const[a,c]=m.useState(!1),[u,d]=m.useState(!1),f=jl(l),[p,g]=m.useState(null),[b,v]=m.useState(null),y=Qc(p,b,{...Fp(),placement:"bottom"}),w=B(`${qu}-target`,!s&&"block",t,!i&&"cursor-auto"),S=B(`${qu}-content`,n,"fixed z-30 text-sm",!f&&!n&&"whitespace-nowrap",l==="s"&&"w-60");return m.useEffect(()=>{var C;a&&((C=y.update)==null||C.call(y))},[a,y.update]),m.useEffect(()=>{const C=setTimeout(()=>c(u),10);return()=>clearTimeout(C)},[u]),h.jsxs("div",{className:B(qu,"relative",e),children:[h.jsx("span",{ref:g,className:w,onMouseEnter:()=>o&&d(!0),onMouseLeave:()=>d(!1),children:h.jsx("div",{className:B(s&&"inline-block"),onClick:()=>{d(!1),i==null||i()},children:r})}),!!u&&h.jsx("div",{className:S,ref:v,style:y.styles.popper,...y.attributes.popper,children:h.jsx(Dp,{show:!!a,unmount:!1,...wb,children:h.jsx(is,{className:B(bg.txt),bg:bg.bg,size:"s",border:!1,children:o})})})]})}function gn({className:t,as:e="label",bold:n,m:r="gjs-mb-1",size:o="m",capitalize:i=!0,children:s,tip:l,...a}){const c=e;return h.jsxs(c,{className:B(t,r,l?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"block",i&&"capitalize",n&&"font-semibold",o==="s"&&"text-sm"),...a,children:[!!l&&h.jsx(mo,{classNameWrp:"gs-utl-normal-case",classNameContent:"gs-utl-max-w-60",title:l,children:h.jsx(ge,{icon:_e.information,size:We.s2x})}),s]})}const oA=t=>{var e;(e=t.getAction("editor.action.formatDocument"))==null||e.run()},iA="gs-field-code",sA={minimap:{enabled:!1},lineNumbers:"off",scrollBeyondLastLine:!1,contextmenu:!1,fixedOverflowWidgets:!0,showFoldingControls:"always",suggestOnTriggerCharacters:!1,lineDecorationsWidth:0,renderLineHighlight:"none",wordWrapOverride1:"off",tabSize:2,scrollbar:{verticalScrollbarSize:8,horizontal:"hidden",alwaysConsumeMouseWheel:!1}};function lA({size:t,value:e,label:n,language:r,onChange:o,clean:i,padding:s,isDarkTheme:l,className:a,containerClassName:c,noMinHeight:u,onMount:d,readOnly:f,description:p}){const g=typeof e=="string"?e:JSON.stringify(e,null,2);return h.jsxs("div",{className:Re(iA,"flex flex-col w-full h-full",c),children:[!!n&&h.jsx(gn,{children:n}),!!p&&h.jsx(gn,{as:"span",size:t,className:Re(he.txtLowEmphasis),capitalize:!1,children:p}),h.jsx("div",{className:Re("flex-grow","w-full","h-full",!u&&"gs-utl-min-h-48"),style:{position:"relative",width:"100%",height:"100%"},children:h.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:h.jsx(c5,{defaultLanguage:r,defaultValue:g,theme:l?"vs-dark":"light",className:Re(we.b,we.rnd,he.br,a),options:{...sA,readOnly:f,...i&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Wa(s)&&{lineDecorationsWidth:s*2,padding:{top:s,bottom:s}}},onChange:o,onMount:(b,v)=>{let y=!1;const w=()=>oA(b);b.onDidChangeModelLanguageConfiguration(w),b.onDidScrollChange(()=>{y||(y=!0,w())}),setTimeout(w,10),d==null||d(b,v)}})})})]})}const aA=t=>t.Assets.getAll().reduce((r,o)=>{const i=o.getSrc(),s=i.match(/^data:([^;]+);/);if(s){const l=i.split(",")[1],a=KE(o.get("name"));r[i]={mime:s[1],name:a,base64:l}}return r},{}),cA=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Gg=(t,e,n={})=>{let r=t;const o=n.pathPfx||"";for(const i in e)if(r.includes(i)){const s=e[i];r=r.replace(new RegExp(cA(i),"g"),`${o}${s.name}`),s.found=!0}return r},uA=(t,e)=>`${e||""}${t||""}`,dA=(t,e)=>{const n=t?`<div ${yg}>${t}</div>`:"",r=e?`<div ${yg} data-gjs-global>${e}</div>`:"";return`${n}${r}`},fA=async(t,e={})=>{const{page:n,skipProject:r,assetsFolder:o="assets",filenameCss:i="style.css",styles:s,isMJML:l}=e,a=[],c=n?[n]:t.Pages.getAll(),u=aA(t),d=`${o}/`,f=t.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent()})||"",p=Gg(f,u,{pathPfx:d}),g=s==="inline",b=s==="skip",v=Eb(t).globalPageSettings||{},y=c.map(w=>{var xt,wt,rn;const S=w.getName(),C=Vo(w,"title")||S,x=Vo(w,"favicon"),E=Vo(w,"description"),_=Vo(w,"keywords"),M=Vo(w,"socialTitle"),k=Vo(w,"socialDescription"),j=Vo(w,"socialImage"),N=rc({page:w,key:"customCodeHead"}),P=uA(N,v.customCodeHead),z=rc({page:w,key:"customCodeBody"}),W=dA(z,v.customCodeBody),F=w.getMainComponent(),$=t.getJs({component:F}),J=$?`<script>${$}<\/script>`:"",ee=[],L=[],I=F.toHTML({asDocument:!1}).replace("</body>",`${W}${J}</body>`),A=F.head;let R=C&&`<title>${C}</title>`,q=x&&`<link rel="icon" href="${x}"/>`,D=E&&`<meta name="description" content="${E}"/>`,V=_&&`<meta name="keywords" content="${_}"/>`,te=M&&`<meta property="og:title" content="${M}"/>`,G=k&&`<meta property="og:description" content="${k}"/>`,Q=j&&`<meta property="og:image" content="${j}"/>`,se='<meta charset="utf-8">',be='<meta name="viewport" content="width=device-width,initial-scale=1">',de='<meta name="robots" content="index,follow">',Pe='<meta name="generator" content="GrapesJS Studio">';A.components().forEach(Le=>{const ot=Le.toHTML();ht.title({cmp:Le})?R=ot:ht.favicon({cmp:Le})?q=ot:ht.description({cmp:Le})?D=ot:ht.keywords({cmp:Le})?V=ot:ht.socialTitle({cmp:Le})?te=ot:ht.socialDescription({cmp:Le})?G=ot:ht.socialImage({cmp:Le})?Q=ot:ht.charset({cmp:Le})?se=ot:ht.viewport({cmp:Le})?be=ot:ht.robots({cmp:Le})?de=ot:ht.generator({cmp:Le})&&(Pe=ot)}),R&&ee.push(R),se&&ee.push(se),be&&ee.push(be),de&&ee.push(de),Pe&&ee.push(Pe),D&&ee.push(D),V&&ee.push(V),te&&ee.push(te),G&&ee.push(G),Q&&ee.push(Q),q&&ee.push(q),L.length&&ee.push(...L),P&&ee.push(P),p&&!b&&ee.push(g?`<style>${p}</style>`:`<link rel="stylesheet" href="./${i}">`);const X=F.doctype||"<!DOCTYPE html>",qe=(wt=(xt=F.docEl).__attrToString)==null?void 0:wt.call(xt),Qe=(rn=A.__attrToString)==null?void 0:rn.call(A),at=l?t.runCommand("mjml-code-to-html").html:`${X}
171
- <html${qe?` ${qe}`:""}>
172
- <head${Qe?` ${Qe}`:""}>
173
- ${ee.join(`
174
- `)}
175
- </head>
176
- ${I}
177
- </html>
178
- `;return{filename:vg(t,w),content:Gg(at,u,{pathPfx:d}),mimeType:"text/html"}});a.push(...y),l&&c.forEach(w=>{a.push({filename:vg(t,w,"mjml"),content:w.getMainComponent().toHTML(),mimeType:"text/mjml"})});for(const w in u){const S=u[w];S.found&&a.push({path:o,filename:S.name,content:atob(S.base64),mimeType:S.mime})}return p&&!g&&!b&&a.push({filename:i,content:p,mimeType:"text/css"}),r||a.push({filename:"gjs-project.grapesjs",content:JSON.stringify(t.getProjectData()),mimeType:"application/json"}),a};ms(function({buttonProps:e,content:n,code:r,onAction:o}){const i=rO(),s=dp(),l=Hl(),{isProjectTypeEmail:a}=l,c=l.editor,{isDarkTheme:u}=nO(),[d,f]=m.useState(),p=()=>{const b=(d||"").trim();o?o(b):c.setComponents(b),i.close()};m.useEffect(()=>{r?f(r):(async()=>{if(a)f(c.getHtml());else{const y=(await fA(c,{page:c.Pages.getSelected(),skipProject:!0,styles:"inline"})).find(w=>w.mimeType==="text/html");y&&f(y.content)}})()},[]);const g=(e==null?void 0:e.children)||s.t("actions.importCode.button");return h.jsxs(fe,{col:!0,space:"m",children:[h.jsx(U,{children:n??s.t("actions.importCode.content")}),h.jsx(U,{className:B("h-96"),children:d!==void 0&&h.jsx(lA,{value:d,onChange:b=>f(b||""),isDarkTheme:u,language:"html"})}),h.jsx(fe,{justify:"end",children:h.jsx(Cs,{size:"m2",variant:"pr",onClick:p,...e,children:g})})]})});function pA(t){const{Blocks:e}=t,n="Content",r="Layout",o={className:"h-7",full:!0,space:"s",nowrap:!0},i={category:r,full:!0},s="gjs-border-2 gjs-border-current gjs-rounded-sm",l=(a,c)=>{e.add(a,{select:!0,category:n,...c})};l("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
179
- <path fill="currentColor" d="M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z" />
180
- </svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),l("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
181
- <path fill="currentColor" d="M20 20.5C20 21.3 19.3 22 18.5 22H13C12.6 22 12.3 21.9 12 21.6L8 17.4L8.7 16.6C8.9 16.4 9.2 16.3 9.5 16.3H9.7L12 18V9C12 8.4 12.4 8 13 8S14 8.4 14 9V13.5L15.2 13.6L19.1 15.8C19.6 16 20 16.6 20 17.1V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.1 2.9 14 4 14H8V12H4V4H20V12H18V14H20C21.1 14 22 13.1 22 12V4C22 2.9 21.1 2 20 2Z" />
182
- </svg>`,content:"<mj-button>Button</mj-button>"}),l("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
183
- <path fill="currentColor" d="M21,3H3C2,3 1,4 1,5V19A2,2 0 0,0 3,21H21C22,21 23,20 23,19V5C23,4 22,3 21,3M5,17L8.5,12.5L11,15.5L14.5,11L19,17H5Z" />
184
- </svg>`,content:`<mj-image src="${S2}"/>`,activate:!0}),l("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
185
- <path fill="currentColor" d="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" />
186
- </svg>`,content:"<mj-divider/>"}),l("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
187
- <path fill="currentColor" d="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" />
188
- </svg>`,content:`<mj-social font-size="12px" icon-size="24px" border-radius="12px" mode="horizontal">
189
- <mj-social-element name="facebook"></mj-social-element>
190
- <mj-social-element name="linkedin"></mj-social-element>
191
- <mj-social-element name="twitter"></mj-social-element>
192
- </mj-social>`}),l("mj-social-element",{label:"Social Element",media:`<svg viewBox="0 0 24 24">
193
- <path d="M18 16.08C17.24 16.08 16.56 16.38 16.04 16.85L8.91 12.7C8.96 12.47 9 12.24 9 12S8.96 11.53 8.91 11.3L15.96 7.19C16.5 7.69 17.21 8 18 8C19.66 8 21 6.66 21 5S19.66 2 18 2 15 3.34 15 5C15 5.24 15.04 5.47 15.09 5.7L8.04 9.81C7.5 9.31 6.79 9 6 9C4.34 9 3 10.34 3 12S4.34 15 6 15C6.79 15 7.5 14.69 8.04 14.19L15.16 18.34C15.11 18.55 15.08 18.77 15.08 19C15.08 20.61 16.39 21.91 18 21.91S20.92 20.61 20.92 19C20.92 17.39 19.61 16.08 18 16.08M18 4C18.55 4 19 4.45 19 5S18.55 6 18 6 17 5.55 17 5 17.45 4 18 4M6 13C5.45 13 5 12.55 5 12S5.45 11 6 11 7 11.45 7 12 6.55 13 6 13M18 20C17.45 20 17 19.55 17 19S17.45 18 18 18 19 18.45 19 19 18.55 20 18 20Z" />
194
- </svg>`,content:'<mj-social-element name="facebook">Facebook</mj-social-element>'}),l("mj-spacer",{label:"Spacer",media:`<svg viewBox="0 0 24 24">
195
- <path fill="currentColor" d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
196
- </svg>`,content:"<mj-spacer/>"}),l("mj-navbar",{label:"Navbar",media:`<svg viewBox="0 0 24 24">
197
- <path fill="currentColor" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" />
198
- </svg>`,content:`<mj-navbar>
199
- <mj-navbar-link>HOME</mj-navbar-link>
200
- <mj-navbar-link>ABOUT</mj-navbar-link>
201
- <mj-navbar-link>CONTACT</mj-navbar-link>
202
- <mj-navbar-link>BLOG</mj-navbar-link>
203
- </mj-navbar>`}),l("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
204
- <path fill="currentColor" d="M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4M6,9H18V11H6V9M6,13H16V15H6V13Z" />
205
- </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${x0({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
206
- <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
207
- Heading title
208
- </mj-text>
209
- <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center">
210
- Place here your hero content text
211
- </mj-text>
212
- <mj-button href="https://mjml.io/" align="center">
213
- Call to action!
214
- </mj-button>
215
- </mj-hero>`}),l("mj-raw",{label:"HTML block",activate:!0,media:`<svg viewBox="0 0 24 24">
216
- <path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" />
217
- </svg>`,content:`<mj-raw>
218
- <span>Insert here you custom HTML</span>
219
- </mj-raw>`}),l("mj-1-column",{...i,label:"1 Column",mediaReact:h.jsx(fe,{...o,children:h.jsx(U,{className:s,grow:!0})}),content:`<mj-section>
220
- <mj-column></mj-column>
221
- </mj-section>`}),l("mj-2-columns-50-50",{...i,label:"2 Columns 50/50",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0})]}),content:`<mj-section>
222
- <mj-column></mj-column>
223
- <mj-column></mj-column>
224
- </mj-section>`}),l("mj-2-columns-25-75",{...i,label:"2 Columns 25/75",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-3/4")})]}),content:`<mj-section>
225
- <mj-column width="25%"></mj-column>
226
- <mj-column width="75%"></mj-column>
227
- </mj-section>`}),l("mj-2-columns-33-67",{...i,label:"2 Columns 33/67",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-1/3")}),h.jsx(U,{className:Re(s,"gs-utl-basis-2/3")})]}),content:`<mj-section>
228
- <mj-column width="33%"></mj-column>
229
- <mj-column width="67%"></mj-column>
230
- </mj-section>`}),l("mj-2-columns-67-33",{...i,label:"2 Columns 67/33",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-2/3")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/3")})]}),content:`<mj-section>
231
- <mj-column width="67%"></mj-column>
232
- <mj-column width="33%"></mj-column>
233
- </mj-section>`}),l("mj-2-columns-75-25",{...i,label:"2 Columns 75/25",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-3/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
234
- <mj-column width="75%"></mj-column>
235
- <mj-column width="25%"></mj-column>
236
- </mj-section>`}),l("mj-3-columns",{...i,label:"3 Columns",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0})]}),content:`<mj-section>
237
- <mj-column></mj-column>
238
- <mj-column></mj-column>
239
- <mj-column></mj-column>
240
- </mj-section>`}),l("mj-3-columns-25-25-50",{...i,label:"3 Columns 25/25/50",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-2/4")})]}),content:`<mj-section>
241
- <mj-column width="25%"></mj-column>
242
- <mj-column width="25%"></mj-column>
243
- <mj-column width="50%"></mj-column>
244
- </mj-section>`}),l("mj-3-columns-25-50-25",{...i,label:"3 Columns 25/50/25",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-2/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
245
- <mj-column width="25%"></mj-column>
246
- <mj-column width="50%"></mj-column>
247
- <mj-column width="25%"></mj-column>
248
- </mj-section>`}),l("mj-3-columns-50-25-25",{...i,label:"3 Columns 50/25/25",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:Re(s,"gs-utl-basis-2/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")}),h.jsx(U,{className:Re(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
249
- <mj-column width="50%"></mj-column>
250
- <mj-column width="25%"></mj-column>
251
- <mj-column width="25%"></mj-column>
252
- </mj-section>`}),l("mj-4-columns",{...i,label:"4 Columns",mediaReact:h.jsxs(fe,{...o,children:[h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0}),h.jsx(U,{className:s,grow:!0})]}),content:`<mj-section>
253
- <mj-column></mj-column>
254
- <mj-column></mj-column>
255
- <mj-column></mj-column>
256
- <mj-column></mj-column>
257
- </mj-section>`})}tf.email+"",tf.web+"";const hA=/\s(?![^(]*\))/,Kg=/^-?[0-9]+[a-zA-Z%]{0,}$/;function Yg(t){const e=t.split(hA),n=e.indexOf("inset")>=0,r=e.filter(u=>u!=="inset"),o=r.filter(u=>!Kg.test(u))[0]||"currentColor",i=r.filter(u=>Kg.test(u)),[s="0",l="0",a="0",c="0"]=i;return{x:s,y:l,blur:a,spread:c,inset:n,color:o}}function eu(t){const e=t.indexOf("(")+1,n=t.lastIndexOf(")");return{name:t.substring(0,e-1).trim(),value:String.prototype.substring.apply(t,[e,n>=0?n:void 0]).trim()}}var af={exports:{}},Rs={};/**
258
- * @license React
259
- * react-jsx-runtime.production.js
260
- *
261
- * Copyright (c) Meta Platforms, Inc. and affiliates.
262
- *
263
- * This source code is licensed under the MIT license found in the
264
- * LICENSE file in the root directory of this source tree.
265
- */var Jg;function gA(){if(Jg)return Rs;Jg=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:t,type:r,key:s,ref:o!==void 0?o:null,props:i}}return Rs.Fragment=e,Rs.jsx=n,Rs.jsxs=n,Rs}var Ns={},Zg;function mA(){if(Zg)return Ns;Zg=1;var t={};/**
266
- * @license React
267
- * react-jsx-runtime.development.js
268
- *
269
- * Copyright (c) Meta Platforms, Inc. and affiliates.
270
- *
271
- * This source code is licensed under the MIT license found in the
272
- * LICENSE file in the root directory of this source tree.
273
- */return t.NODE_ENV!=="production"&&function(){function e(T){if(T==null)return null;if(typeof T=="function")return T.$$typeof===L?null:T.displayName||T.name||null;if(typeof T=="string")return T;switch(T){case _:return"Fragment";case E:return"Portal";case k:return"Profiler";case M:return"StrictMode";case z:return"Suspense";case W:return"SuspenseList"}if(typeof T=="object")switch(typeof T.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),T.$$typeof){case N:return(T.displayName||"Context")+".Provider";case j:return(T._context.displayName||"Context")+".Consumer";case P:var re=T.render;return T=T.displayName,T||(T=re.displayName||re.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case F:return re=T.displayName||null,re!==null?re:e(T.type)||"Memo";case $:re=T._payload,T=T._init;try{return e(T(re))}catch{}}return null}function n(T){return""+T}function r(T){try{n(T);var re=!1}catch{re=!0}if(re){re=console;var ie=re.error,Ce=typeof Symbol=="function"&&Symbol.toStringTag&&T[Symbol.toStringTag]||T.constructor.name||"Object";return ie.call(re,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Ce),n(T)}}function o(){}function i(){if(V===0){te=console.log,G=console.info,Q=console.warn,se=console.error,be=console.group,de=console.groupCollapsed,Pe=console.groupEnd;var T={configurable:!0,enumerable:!0,value:o,writable:!0};Object.defineProperties(console,{info:T,log:T,warn:T,error:T,group:T,groupCollapsed:T,groupEnd:T})}V++}function s(){if(V--,V===0){var T={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},T,{value:te}),info:R({},T,{value:G}),warn:R({},T,{value:Q}),error:R({},T,{value:se}),group:R({},T,{value:be}),groupCollapsed:R({},T,{value:de}),groupEnd:R({},T,{value:Pe})})}0>V&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function l(T){if(X===void 0)try{throw Error()}catch(ie){var re=ie.stack.trim().match(/\n( *(at )?)/);X=re&&re[1]||"",qe=-1<ie.stack.indexOf(`
274
- at`)?" (<anonymous>)":-1<ie.stack.indexOf("@")?"@unknown:0:0":""}return`
275
- `+X+T+qe}function a(T,re){if(!T||Qe)return"";var ie=at.get(T);if(ie!==void 0)return ie;Qe=!0,ie=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var Ce=null;Ce=I.H,I.H=null,i();try{var Xe={DetermineComponentFrameRoot:function(){try{if(re){var xn=function(){throw Error()};if(Object.defineProperty(xn.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xn,[])}catch(et){var it=et}Reflect.construct(T,[],xn)}else{try{xn.call()}catch(et){it=et}T.call(xn.prototype)}}else{try{throw Error()}catch(et){it=et}(xn=T())&&typeof xn.catch=="function"&&xn.catch(function(){})}}catch(et){if(et&&it&&typeof et.stack=="string")return[et.stack,it.stack]}return[null,null]}};Xe.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var Te=Object.getOwnPropertyDescriptor(Xe.DetermineComponentFrameRoot,"name");Te&&Te.configurable&&Object.defineProperty(Xe.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var me=Xe.DetermineComponentFrameRoot(),on=me[0],yn=me[1];if(on&&yn){var ft=on.split(`
276
- `),Ut=yn.split(`
277
- `);for(me=Te=0;Te<ft.length&&!ft[Te].includes("DetermineComponentFrameRoot");)Te++;for(;me<Ut.length&&!Ut[me].includes("DetermineComponentFrameRoot");)me++;if(Te===ft.length||me===Ut.length)for(Te=ft.length-1,me=Ut.length-1;1<=Te&&0<=me&&ft[Te]!==Ut[me];)me--;for(;1<=Te&&0<=me;Te--,me--)if(ft[Te]!==Ut[me]){if(Te!==1||me!==1)do if(Te--,me--,0>me||ft[Te]!==Ut[me]){var Sr=`
278
- `+ft[Te].replace(" at new "," at ");return T.displayName&&Sr.includes("<anonymous>")&&(Sr=Sr.replace("<anonymous>",T.displayName)),typeof T=="function"&&at.set(T,Sr),Sr}while(1<=Te&&0<=me);break}}}finally{Qe=!1,I.H=Ce,s(),Error.prepareStackTrace=ie}return ft=(ft=T?T.displayName||T.name:"")?l(ft):"",typeof T=="function"&&at.set(T,ft),ft}function c(T){if(T==null)return"";if(typeof T=="function"){var re=T.prototype;return a(T,!(!re||!re.isReactComponent))}if(typeof T=="string")return l(T);switch(T){case z:return l("Suspense");case W:return l("SuspenseList")}if(typeof T=="object")switch(T.$$typeof){case P:return T=a(T.render,!1),T;case F:return c(T.type);case $:re=T._payload,T=T._init;try{return c(T(re))}catch{}}return""}function u(){var T=I.A;return T===null?null:T.getOwner()}function d(T){if(A.call(T,"key")){var re=Object.getOwnPropertyDescriptor(T,"key").get;if(re&&re.isReactWarning)return!1}return T.key!==void 0}function f(T,re){function ie(){wt||(wt=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",re))}ie.isReactWarning=!0,Object.defineProperty(T,"key",{get:ie,configurable:!0})}function p(){var T=e(this.type);return rn[T]||(rn[T]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),T=this.props.ref,T!==void 0?T:null}function g(T,re,ie,Ce,Xe,Te){return ie=Te.ref,T={$$typeof:x,type:T,key:re,props:Te,_owner:Xe},(ie!==void 0?ie:null)!==null?Object.defineProperty(T,"ref",{enumerable:!1,get:p}):Object.defineProperty(T,"ref",{enumerable:!1,value:null}),T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(T,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T}function b(T,re,ie,Ce,Xe,Te){if(typeof T=="string"||typeof T=="function"||T===_||T===k||T===M||T===z||T===W||T===J||typeof T=="object"&&T!==null&&(T.$$typeof===$||T.$$typeof===F||T.$$typeof===N||T.$$typeof===j||T.$$typeof===P||T.$$typeof===q||T.getModuleId!==void 0)){var me=re.children;if(me!==void 0)if(Ce)if(D(me)){for(Ce=0;Ce<me.length;Ce++)v(me[Ce],T);Object.freeze&&Object.freeze(me)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(me,T)}else me="",(T===void 0||typeof T=="object"&&T!==null&&Object.keys(T).length===0)&&(me+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),T===null?Ce="null":D(T)?Ce="array":T!==void 0&&T.$$typeof===x?(Ce="<"+(e(T.type)||"Unknown")+" />",me=" Did you accidentally export a JSX literal instead of a component?"):Ce=typeof T,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ce,me);if(A.call(re,"key")){me=e(T);var on=Object.keys(re).filter(function(ft){return ft!=="key"});Ce=0<on.length?"{key: someKey, "+on.join(": ..., ")+": ...}":"{key: someKey}",Le[me+Ce]||(on=0<on.length?"{"+on.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
279
- let props = %s;
280
- <%s {...props} />
281
- React keys must be passed directly to JSX without using spread:
282
- let props = %s;
283
- <%s key={someKey} {...props} />`,Ce,me,on,me),Le[me+Ce]=!0)}if(me=null,ie!==void 0&&(r(ie),me=""+ie),d(re)&&(r(re.key),me=""+re.key),"key"in re){ie={};for(var yn in re)yn!=="key"&&(ie[yn]=re[yn])}else ie=re;return me&&f(ie,typeof T=="function"?T.displayName||T.name||"Unknown":T),g(T,me,Te,Xe,u(),ie)}function v(T,re){if(typeof T=="object"&&T&&T.$$typeof!==xt){if(D(T))for(var ie=0;ie<T.length;ie++){var Ce=T[ie];y(Ce)&&w(Ce,re)}else if(y(T))T._store&&(T._store.validated=1);else if(T===null||typeof T!="object"?ie=null:(ie=ee&&T[ee]||T["@@iterator"],ie=typeof ie=="function"?ie:null),typeof ie=="function"&&ie!==T.entries&&(ie=ie.call(T),ie!==T))for(;!(T=ie.next()).done;)y(T.value)&&w(T.value,re)}}function y(T){return typeof T=="object"&&T!==null&&T.$$typeof===x}function w(T,re){if(T._store&&!T._store.validated&&T.key==null&&(T._store.validated=1,re=S(re),!ot[re])){ot[re]=!0;var ie="";T&&T._owner!=null&&T._owner!==u()&&(ie=null,typeof T._owner.tag=="number"?ie=e(T._owner.type):typeof T._owner.name=="string"&&(ie=T._owner.name),ie=" It was passed a child from "+ie+".");var Ce=I.getCurrentStack;I.getCurrentStack=function(){var Xe=c(T.type);return Ce&&(Xe+=Ce()||""),Xe},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',re,ie),I.getCurrentStack=Ce}}function S(T){var re="",ie=u();return ie&&(ie=e(ie.type))&&(re=`
284
-
285
- Check the render method of \``+ie+"`."),re||(T=e(T))&&(re=`
286
-
287
- Check the top-level render call using <`+T+">."),re}var C=m,x=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),N=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),J=Symbol.for("react.offscreen"),ee=Symbol.iterator,L=Symbol.for("react.client.reference"),I=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,R=Object.assign,q=Symbol.for("react.client.reference"),D=Array.isArray,V=0,te,G,Q,se,be,de,Pe;o.__reactDisabledLog=!0;var X,qe,Qe=!1,at=new(typeof WeakMap=="function"?WeakMap:Map),xt=Symbol.for("react.client.reference"),wt,rn={},Le={},ot={};Ns.Fragment=_,Ns.jsx=function(T,re,ie,Ce,Xe){return b(T,re,ie,!1,Ce,Xe)},Ns.jsxs=function(T,re,ie,Ce,Xe){return b(T,re,ie,!0,Ce,Xe)}}(),Ns}var bA={};bA.NODE_ENV==="production"?af.exports=gA():af.exports=mA();var ue=af.exports;const mv=m.createContext(null),vA=({children:t})=>{const[e,n]=m.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return ue.jsx(mv.Provider,{value:e,children:t})},Qn=()=>{const t=m.useContext(mv);if(!t)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return t},yA=()=>{const{editor:t}=Qn();if(!t)throw new Error("useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.");return t},bv=m.createContext(null),xA=({children:t})=>{const[e,n]=m.useState(()=>({setRefCanvas(r){n(o=>({...o,refCanvas:r}))},setCustomModal(r){n(o=>({...o,customModal:r}))},setCustomAssets(r){n(o=>({...o,customAssets:r}))},setCustomBlocks(r){n(o=>({...o,customBlocks:r}))},setCustomRte(r){n(o=>({...o,customRte:r}))},setCustomStyles(r){n(o=>({...o,customStyles:r}))},setCustomLayers(r){n(o=>({...o,customLayers:r}))},setCustomSelectors(r){n(o=>({...o,customSelectors:r}))},setCustomTraits(r){n(o=>({...o,customTraits:r}))},setReady(r){n(o=>({...o,ready:r}))}}));return ue.jsx(bv.Provider,{value:e,children:t})},Gr=()=>{const t=m.useContext(bv);if(!t)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return t};function wA(...t){return(Array.isArray(t[0])?t[0]:[...t]).filter(Boolean).join(" ")}function Mo(t){return typeof t=="function"}function Yn(){}const vv=t=>typeof t=="string",SA=async t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)},yv=t=>{const e=vv(t)?{id:t,src:t}:t;return new Promise((n,r)=>{const o=document.createElement("script");if(document.querySelector(`script[src="${e.src}"]`))return n(e.id);o.src=e.src,o.onload=()=>n(e.id),o.onerror=()=>r(e.id),document.head.appendChild(o)})},CA=t=>{const e=t.map(n=>yv(n));return Promise.allSettled(e)},Xg=t=>function(){const e=m.useRef(null);return m.useEffect(()=>{const{current:n}=e;n&&(vv(t)?n.innerHTML=t:n.appendChild(t))},[e.current]),ue.jsx("div",{ref:e})},Qg=new WeakMap;function ys(t){if(!t)return()=>ue.jsx(ue.Fragment,{});const e=Qg.get(t);if(e)return e;const n=function({children:r}){return ir.createPortal(m.createElement("div",null,r),t)};return Qg.set(t,n),n}m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(!1),[i,s]=m.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>ue.jsx(ue.Fragment,{})});return m.useEffect(()=>{if(!e)return;const l=e.Assets.events.custom,a=({open:c,assets:u,types:d,select:f,close:p,container:g})=>{c&&s({assets:u,types:d,select:f,close:p,Container:ys(g)}),o(c)};return e.on(l,a),()=>{e.off(l,a)}},[e]),m.useEffect(()=>n.setCustomAssets(!0),[]),e?Mo(t)?t({open:r,...i}):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(()=>({blocks:[],dragStart:Yn,dragStop:Yn,mapCategoryBlocks:new Map,Container:()=>ue.jsx(ue.Fragment,{})}));return m.useEffect(()=>{if(!e)return;const i=e.Blocks.events.custom,s=({blocks:l,container:a,dragStart:c,dragStop:u})=>{const d=l.reduce((f,p)=>{const g=p.getCategoryLabel(),b=f.get(g);return b?b.push(p):f.set(g,[p]),f},new Map);o({blocks:l,dragStart:c,dragStop:u,mapCategoryBlocks:d,Container:ys(a)})};return e.on(i,s),e.Blocks.__trgCustom(),()=>{e.off(i,s)}},[e]),m.useEffect(()=>n.setCustomBlocks(!0),[]),e?Mo(t)?t(r):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),[n,r]=m.useState(()=>({devices:[],selected:"",select:Yn}));return m.useEffect(()=>{if(!e)return;const{Devices:o}=e,i=o.events.all,s=()=>{var l;r({devices:o.getDevices(),selected:(l=o.getSelected())==null?void 0:l.id,select:a=>o.select(a)})};return e.on(i,s),s(),()=>{e.off(i,s)}},[e]),e?Mo(t)?t(n):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});const EA=t=>!!(t&&!Array.isArray(t)&&typeof t=="object");async function OA(t){const e=t.map(({id:i,src:s})=>({id:i,src:s})),n=t.reduce((i,s)=>(i[s.id]=s,i),{}),r=[],o=[];return(await CA(e)).forEach(i=>{i.status==="fulfilled"?r.push(n[i.value]):o.push(n[i.reason])}),{loaded:r,failed:o}}const _A=async t=>{const e=[...t],n={};if(e.length){const r={},o=[];if(e.forEach((i,s)=>{EA(i)&&(r[i.id]={index:s},o.push(i))}),o.length){const{loaded:i}=await OA(o);i.forEach(({id:s,options:l})=>{r[s].loaded=!0,n[s]=l||{}})}Object.keys(r).forEach(i=>{const s=r[i];s.loaded?e[s.index]=i:e[s.index]=!1})}return{plugins:e.filter(Boolean),pluginOptions:n}},kA=m.memo(function({children:t,className:e,style:n,options:r={},plugins:o=[],grapesjs:i,grapesjsCss:s,onEditor:l=Yn,onReady:a,onUpdate:c,waitReady:u,...d}){const{setEditor:f}=Qn(),p=Gr(),[g,b]=m.useState(!1),v=m.useRef(null);m.useEffect(()=>{if(!p.ready||!v.current)return;const _=v.current,M=p.refCanvas;let k,j={},N=[];const P=z=>{const W={height:"100%",...r,plugins:[...N,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...j},modal:{custom:!!p.customModal,...r.modal},assetManager:{custom:!!p.customAssets,...r.assetManager},styleManager:{custom:!!p.customStyles,...r.styleManager},blockManager:{custom:!!p.customBlocks,...r.blockManager},richTextEditor:{custom:!!p.customRte,...r.richTextEditor},layerManager:{custom:!!p.customLayers,...r.layerManager},traitManager:{custom:!!p.customTraits,...r.traitManager},selectorManager:{custom:!!p.customSelectors,...r.selectorManager},container:M||_,customUI:!!M,...M?{panels:{defaults:[]}}:{}};k=z.init(W),f(k),l(k),c&&k.on("update",()=>{c(k.getProjectData(),k)}),k.onReady(()=>{b(!0),a==null||a(k)})};return(async()=>{s&&await SA(s);const z=await _A(o);N=z.plugins,j=z.pluginOptions,typeof i=="string"?(await yv(i),P(window.grapesjs)):P(i)})(),()=>k==null?void 0:k.destroy()},[p.ready]);const y=r.height??"100%",w=r.width??"100%",S=wA("gjs-editor-wrapper",e),C=u&&!g,x=m.useMemo(()=>({...n,height:y,width:w}),[y,w,n]),E=m.useMemo(()=>({...x,...C?{opacity:0,width:0,height:0}:{}}),[x,C]);return ue.jsxs(ue.Fragment,{children:[u&&!g?ue.jsx("div",{className:S,style:x,children:u}):null,ue.jsx("div",{...d,ref:v,className:S,style:E,children:t})]})}),TA=m.memo(function(){const t=Gr();return m.useEffect(()=>t.setReady(!0),[]),ue.jsx(ue.Fragment,{})});m.memo(function({children:t,...e}){return ue.jsx(vA,{children:ue.jsx(xA,{children:ue.jsxs(kA,{...e,children:[t,ue.jsx(TA,{})]})})})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(()=>({root:void 0,Container:()=>ue.jsx(ue.Fragment,{})}));return m.useEffect(()=>{if(!e)return;const{Layers:i}=e,s=i.events.custom,l=({container:a})=>{o({root:i.getRoot(),Container:ys(a)})};return e.on(s,l),i.__trgCustom({}),()=>{e.off(s,l)}},[e]),m.useEffect(()=>n.setCustomLayers(!0),[]),e?Mo(t)?t(r):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(!1),[i,s]=m.useState({title:ue.jsx(ue.Fragment,{}),content:ue.jsx(ue.Fragment,{}),attributes:{},close:Yn});return m.useEffect(()=>{if(!e)return;const l="modal",a=({open:c,title:u,content:d,close:f,attributes:p})=>{c&&s({title:m.createElement(Xg(u)),content:m.createElement(Xg(d)),attributes:p,close:f}),o(c)};return e.on(l,a),()=>{e.off(l,a)}},[e]),m.useEffect(()=>n.setCustomModal(!0),[]),e?typeof t=="function"?t({open:r,...i}):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),[n,r]=m.useState(()=>({pages:[],selected:void 0,select:Yn,add:Yn,remove:Yn}));return m.useEffect(()=>{if(!e)return;const{Pages:o}=e,i=o.events.all,s=()=>{r({pages:o.getAll(),selected:o.getSelected(),select:(...l)=>o.select(...l),add:(...l)=>o.add(...l),remove:(...l)=>o.remove(...l)})};return e.on(i,s),s(),()=>{e.off(i,s)}},[e]),e?Mo(t)?t(n):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:Yn,removeSelector:Yn,setState:Yn,Container:()=>ue.jsx(ue.Fragment,{})}));return m.useEffect(()=>{if(!e)return;const{Selectors:i}=e,s=i.events.custom,l=({container:a})=>{o({selectors:i.getSelected(),states:i.getStates(),selectedState:i.getState(),targets:i.getSelectedTargets().map(c=>c.getSelectorsString()),addSelector:(...c)=>i.addSelected(...c),removeSelector:(...c)=>i.removeSelected(...c),setState:(...c)=>i.setState(...c),Container:ys(a)})};return e.on(s,l),()=>{e.off(s,l)}},[e]),m.useEffect(()=>n.setCustomSelectors(!0),[]),e?Mo(t)?t(r):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(()=>({sectors:[],Container:()=>ue.jsx(ue.Fragment,{})}));return m.useEffect(()=>{if(!e)return;const{Styles:i}=e,s=i.events.custom,l=({container:a})=>{o({sectors:i.getSectors({visible:!0}),Container:ys(a)})};return e.on(s,l),()=>{e.off(s,l)}},[e]),m.useEffect(()=>n.setCustomStyles(!0),[]),e?Mo(t)?t(r):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});m.memo(function({children:t}){const{editor:e}=Qn(),n=Gr(),[r,o]=m.useState(()=>({traits:[],Container:()=>ue.jsx(ue.Fragment,{})}));return m.useEffect(()=>{if(!e)return;const{Traits:i}=e,s=i.events.custom,l=({container:a})=>{o({traits:i.getCurrent(),Container:ys(a)})};return e.on(s,l),i.__trgCustom(),()=>{e.off(s,l)}},[e]),m.useEffect(()=>n.setCustomTraits(!0),[]),e?Mo(t)?t(r):ue.jsx(ue.Fragment,{}):ue.jsx(ue.Fragment,{})});const Wp="gs-cmp-accordion",cf=`${Wp}-handler`,ia=`${cf}__content`,AA=`${Wp}-content`;function MA({className:t,classNameWrap:e,classNameContent:n,style:r,handler:o,handlerIcon:i,children:s,inverted:l,disabled:a,sticky:c,onChange:u,open:d}){return h.jsx($u,{as:"div",defaultOpen:d,className:B(Wp,e,"relative"),children:({open:f})=>h.jsxs(h.Fragment,{children:[h.jsx($u.Button,{as:a?"div":"button",disabled:a,style:r,onClick:p=>u==null?void 0:u({event:p,open:!f}),className:({open:p})=>tt(cf,xo(t)?t(p):t,c&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:p})=>h.jsxs(fe,{items:"center",className:B("gap-2"),full:!0,children:[h.jsx(U,{className:B(ia,"text-left"),grow:!0,children:xo(o)?o(p):h.jsxs(fe,{items:"center",className:B(`${ia}-wrp`,"gap-3"),nowrap:!0,children:[!!i&&h.jsx(ge,{className:B(`${ia}-icon`),icon:i,size:We.s2x}),h.jsx(U,{className:B(`${ia}-label gs-utl-w-full`),children:o})]})}),h.jsx(U,{className:B(`${cf}-toggle`,l&&"-order-1",a&&"gs-utl-hidden"),children:h.jsx(ge,{icon:_e.chevronDown,className:B("w-5 h-5 transition-transform",p&&"rotate-180")})})]})}),h.jsx($u.Panel,{className:B(AA,n),children:s})]})})}function oe({label:t,property:e,hasValue:n,empty:r,onClear:o,children:i,shallow:s,row:l,tooltip:a,className:c,...u}){const d=t||(e==null?void 0:e.getLabel()),f=e==null?void 0:e.getParentTarget(),p=n||!r&&(e==null?void 0:e.hasValue({noParent:!0})),g=!p&&(e==null?void 0:e.hasValue())&&f,b=f==null?void 0:f.getDevice(),v=f==null?void 0:f.getState(),y=f==null?void 0:f.getComponent(),w=()=>o?o():e==null?void 0:e.clear(),S={className:B(c,"text-sm w-full"),col:!l,items:l?"center":void 0,...u};return e&&!e.isVisible()?null:h.jsx(h.Fragment,{children:h.jsxs(fe,{...S,children:[h.jsx(U,{grow:!0,children:h.jsxs(fe,{as:"label",items:"center",space:"xs",className:B("block",!l&&"gjs-mb-1",p&&!s&&he.tAo),children:[a&&h.jsx(U,{children:h.jsx(mo,{title:a,children:h.jsx(ge,{icon:_e.information,size:We.sx})})}),h.jsx(U,{children:r?h.jsx("span",{children:" "}):d}),!!g&&!s&&h.jsx(mo,{title:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:B("gjs-mb-1"),children:"Value inherited from"}),!!b&&h.jsxs(fe,{space:"s",children:[h.jsx(U,{children:h.jsx(ge,{icon:_e.cellphoneLink,size:We.sx})}),h.jsx(U,{children:h.jsx("b",{children:b.getName()})})]}),h.jsxs(fe,{space:"s",children:[h.jsx(U,{children:h.jsx(ge,{icon:y?_e.targetVariant:_e.tag,size:We.sx})}),h.jsxs(U,{children:[h.jsx("b",{children:y?"Components":"Selectors"}),h.jsxs("span",{className:B("text-xs opacity-75"),children:[" ",f==null?void 0:f.selectorsToString({skipState:1})]})]})]}),!!v&&h.jsxs(fe,{space:"s",children:[h.jsx(U,{children:h.jsx(ge,{icon:_e.flare,size:We.sx})}),h.jsx(U,{children:h.jsx("b",{children:v.getLabel()})})]})]}),children:h.jsx("div",{className:B("gs-utl-w-[6px] gs-utl-h-[6px] gjs-rounded-full",he.bgW)})}),p&&!s&&h.jsx(mo,{title:"Clear value",onClick:w,children:h.jsx(ge,{className:B(So.click),icon:_e.close,size:We.s2x})})]})}),h.jsx(U,{grow:!0,className:B("max-w-full"),children:i})]})})}function Mn({className:t,options:e,label:n,name:r,value:o,size:i="m",required:s,disabled:l,style:a,onChange:c}){const u=f=>{const p=e.filter(g=>g.id===f)[0];return e.indexOf(p)===e.length-1},d=(f,p)=>B("cursor-pointer",i==="m"&&dr.xy,i==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",i==="xs"&&"gs-utl-p-1 text-sm",he.br,f&&he.bgO,!u(p)&&we.br);return h.jsxs(Ng,{value:o,onChange:c,className:B("gs-field-buttons w-full"),disabled:l,style:a,children:[!!n&&h.jsx(gn,{size:i,children:n}),r&&h.jsx("input",{type:"hidden",name:r,value:o,required:s}),h.jsx(fe,{className:B(t,we.b,we.rnd,he.br,"cursor-pointer"),items:"center",full:!0,nowrap:!0,children:e.map(({id:f,label:p,title:g,icon:b})=>h.jsx(mo,{title:g,className:B("w-full"),classNameWrp:B("flex-1"),children:h.jsx(Ng.Option,{value:f,className:({checked:v})=>d(v,f),children:h.jsxs(fe,{justify:"center",space:"s",full:!0,children:[!!b&&h.jsx(ge,{icon:b,size:We.s}),p&&h.jsx(U,{children:p})]})})},f))})]})}var jA={grad:.9,turn:360,rad:360/(2*Math.PI)},Or=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},St=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},Pn=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},xv=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},em=function(t){return{r:Pn(t.r,0,255),g:Pn(t.g,0,255),b:Pn(t.b,0,255),a:Pn(t.a)}},Gu=function(t){return{r:St(t.r),g:St(t.g),b:St(t.b),a:St(t.a,3)}},RA=/^#([0-9a-f]{3,8})$/i,sa=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},wv=function(t){var e=t.r,n=t.g,r=t.b,o=t.a,i=Math.max(e,n,r),s=i-Math.min(e,n,r),l=s?i===e?(n-r)/s:i===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(l<0?l+6:l),s:i?s/i*100:0,v:i/255*100,a:o}},Sv=function(t){var e=t.h,n=t.s,r=t.v,o=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),s=r*(1-n),l=r*(1-(e-i)*n),a=r*(1-(1-e+i)*n),c=i%6;return{r:255*[r,l,s,s,a,r][c],g:255*[a,r,r,l,s,s][c],b:255*[s,s,a,r,r,l][c],a:o}},tm=function(t){return{h:xv(t.h),s:Pn(t.s,0,100),l:Pn(t.l,0,100),a:Pn(t.a)}},nm=function(t){return{h:St(t.h),s:St(t.s),l:St(t.l),a:St(t.a,3)}},rm=function(t){return Sv((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},Ys=function(t){return{h:(e=wv(t)).h,s:(o=(200-(n=e.s))*(r=e.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:e.a};var e,n,r,o},NA=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,PA=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DA=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,LA=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uf={string:[[function(t){var e=RA.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?St(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?St(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=DA.exec(t)||LA.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:em({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=NA.exec(t)||PA.exec(t);if(!e)return null;var n,r,o=tm({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(jA[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return rm(o)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,o=t.a,i=o===void 0?1:o;return Or(e)&&Or(n)&&Or(r)?em({r:Number(e),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,o=t.a,i=o===void 0?1:o;if(!Or(e)||!Or(n)||!Or(r))return null;var s=tm({h:Number(e),s:Number(n),l:Number(r),a:Number(i)});return rm(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,o=t.a,i=o===void 0?1:o;if(!Or(e)||!Or(n)||!Or(r))return null;var s=function(l){return{h:xv(l.h),s:Pn(l.s,0,100),v:Pn(l.v,0,100),a:Pn(l.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(i)});return Sv(s)},"hsv"]]},om=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},VA=function(t){return typeof t=="string"?om(t.trim(),uf.string):typeof t=="object"&&t!==null?om(t,uf.object):[null,void 0]},Ku=function(t,e){var n=Ys(t);return{h:n.h,s:Pn(n.s+100*e,0,100),l:n.l,a:n.a}},Yu=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},im=function(t,e){var n=Ys(t);return{h:n.h,s:n.s,l:Pn(n.l+100*e,0,100),a:n.a}},df=function(){function t(e){this.parsed=VA(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return St(Yu(this.rgba),2)},t.prototype.isDark=function(){return Yu(this.rgba)<.5},t.prototype.isLight=function(){return Yu(this.rgba)>=.5},t.prototype.toHex=function(){return e=Gu(this.rgba),n=e.r,r=e.g,o=e.b,s=(i=e.a)<1?sa(St(255*i)):"","#"+sa(n)+sa(r)+sa(o)+s;var e,n,r,o,i,s},t.prototype.toRgb=function(){return Gu(this.rgba)},t.prototype.toRgbString=function(){return e=Gu(this.rgba),n=e.r,r=e.g,o=e.b,(i=e.a)<1?"rgba("+n+", "+r+", "+o+", "+i+")":"rgb("+n+", "+r+", "+o+")";var e,n,r,o,i},t.prototype.toHsl=function(){return nm(Ys(this.rgba))},t.prototype.toHslString=function(){return e=nm(Ys(this.rgba)),n=e.h,r=e.s,o=e.l,(i=e.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+i+")":"hsl("+n+", "+r+"%, "+o+"%)";var e,n,r,o,i},t.prototype.toHsv=function(){return e=wv(this.rgba),{h:St(e.h),s:St(e.s),v:St(e.v),a:St(e.a,3)};var e},t.prototype.invert=function(){return er({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),er(Ku(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),er(Ku(this.rgba,-e))},t.prototype.grayscale=function(){return er(Ku(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),er(im(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),er(im(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?er({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):St(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=Ys(this.rgba);return typeof e=="number"?er({h:e,s:n.s,l:n.l,a:n.a}):St(n.h)},t.prototype.isEqual=function(e){return this.toHex()===er(e).toHex()},t}(),er=function(t){return t instanceof df?t:new df(t)},sm=[],IA=function(t){t.forEach(function(e){sm.indexOf(e)<0&&(e(df,uf),sm.push(e))})};function $A(t,e){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var o in n)r[n[o]]=o;var i={};t.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var l,a,c=r[this.toHex()];if(c)return c;if(s!=null&&s.closest){var u=this.toRgb(),d=1/0,f="black";if(!i.length)for(var p in n)i[p]=new t(n[p]).toRgb();for(var g in n){var b=(l=u,a=i[g],Math.pow(l.r-a.r,2)+Math.pow(l.g-a.g,2)+Math.pow(l.b-a.b,2));b<d&&(d=b,f=g)}return f}},e.string.push([function(s){var l=s.toLowerCase(),a=l==="transparent"?"#0000":n[l];return a?new t(a).toRgb():null},"name"])}function tu(){return(tu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Cv(t,e){if(t==null)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}function ff(t){var e=m.useRef(t),n=m.useRef(function(r){e.current&&e.current(r)});return e.current=t,n.current}var ss=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Js=function(t){return"touches"in t},pf=function(t){return t&&t.ownerDocument.defaultView||self},lm=function(t,e,n){var r=t.getBoundingClientRect(),o=Js(e)?function(i,s){for(var l=0;l<i.length;l++)if(i[l].identifier===s)return i[l];return i[0]}(e.touches,n):e;return{left:ss((o.pageX-(r.left+pf(t).pageXOffset))/r.width),top:ss((o.pageY-(r.top+pf(t).pageYOffset))/r.height)}},am=function(t){!Js(t)&&t.preventDefault()},Up=m.memo(function(t){var e=t.onMove,n=t.onKey,r=Cv(t,["onMove","onKey"]),o=m.useRef(null),i=ff(e),s=ff(n),l=m.useRef(null),a=m.useRef(!1),c=m.useMemo(function(){var p=function(v){am(v),(Js(v)?v.touches.length>0:v.buttons>0)&&o.current?i(lm(o.current,v,l.current)):b(!1)},g=function(){return b(!1)};function b(v){var y=a.current,w=pf(o.current),S=v?w.addEventListener:w.removeEventListener;S(y?"touchmove":"mousemove",p),S(y?"touchend":"mouseup",g)}return[function(v){var y=v.nativeEvent,w=o.current;if(w&&(am(y),!function(C,x){return x&&!Js(C)}(y,a.current)&&w)){if(Js(y)){a.current=!0;var S=y.changedTouches||[];S.length&&(l.current=S[0].identifier)}w.focus(),i(lm(w,y,l.current)),b(!0)}},function(v){var y=v.which||v.keyCode;y<37||y>40||(v.preventDefault(),s({left:y===39?.05:y===37?-.05:0,top:y===40?.05:y===38?-.05:0}))},b]},[s,i]),u=c[0],d=c[1],f=c[2];return m.useEffect(function(){return f},[f]),m.createElement("div",tu({},r,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:o,onKeyDown:d,tabIndex:0,role:"slider"}))}),nu=function(t){return t.filter(Boolean).join(" ")},qp=function(t){var e=t.color,n=t.left,r=t.top,o=r===void 0?.5:r,i=nu(["react-colorful__pointer",t.className]);return m.createElement("div",{className:i,style:{top:100*o+"%",left:100*n+"%"}},m.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Bt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},Ev=function(t){var e=t.s,n=t.v,r=t.a,o=(200-e)*n/100;return{h:Bt(t.h),s:Bt(o>0&&o<200?e*n/100/(o<=100?o:200-o)*100:0),l:Bt(o/2),a:Bt(r,2)}},hf=function(t){var e=Ev(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Ju=function(t){var e=Ev(t);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},HA=function(t){var e=t.h,n=t.s,r=t.v,o=t.a;e=e/360*6,n/=100,r/=100;var i=Math.floor(e),s=r*(1-n),l=r*(1-(e-i)*n),a=r*(1-(1-e+i)*n),c=i%6;return{r:Bt(255*[r,l,s,s,a,r][c]),g:Bt(255*[a,r,r,l,s,s][c]),b:Bt(255*[s,s,a,r,r,l][c]),a:Bt(o,2)}},BA=function(t){var e=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(t);return e?zA({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):{h:0,s:0,v:0,a:1}},zA=function(t){var e=t.r,n=t.g,r=t.b,o=t.a,i=Math.max(e,n,r),s=i-Math.min(e,n,r),l=s?i===e?(n-r)/s:i===n?2+(r-e)/s:4+(e-n)/s:0;return{h:Bt(60*(l<0?l+6:l)),s:Bt(i?s/i*100:0),v:Bt(i/255*100),a:o}},FA=m.memo(function(t){var e=t.hue,n=t.onChange,r=nu(["react-colorful__hue",t.className]);return m.createElement("div",{className:r},m.createElement(Up,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:ss(e+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Bt(e),"aria-valuemax":"360","aria-valuemin":"0"},m.createElement(qp,{className:"react-colorful__hue-pointer",left:e/360,color:hf({h:e,s:100,v:100,a:1})})))}),WA=m.memo(function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:hf({h:e.h,s:100,v:100,a:1})};return m.createElement("div",{className:"react-colorful__saturation",style:r},m.createElement(Up,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:ss(e.s+100*o.left,0,100),v:ss(e.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Bt(e.s)+"%, Brightness "+Bt(e.v)+"%"},m.createElement(qp,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:hf(e)})))}),UA=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},qA=function(t,e){return t.replace(/\s/g,"")===e.replace(/\s/g,"")};function GA(t,e,n){var r=ff(n),o=m.useState(function(){return t.toHsva(e)}),i=o[0],s=o[1],l=m.useRef({color:e,hsva:i});m.useEffect(function(){if(!t.equal(e,l.current.color)){var c=t.toHsva(e);l.current={hsva:c,color:e},s(c)}},[e,t]),m.useEffect(function(){var c;UA(i,l.current.hsva)||t.equal(c=t.fromHsva(i),l.current.color)||(l.current={hsva:i,color:c},r(c))},[i,t,r]);var a=m.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[i,a]}var KA=typeof window<"u"?m.useLayoutEffect:m.useEffect,YA=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},cm=new Map,JA=function(t){KA(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!cm.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,cm.set(e,n);var r=YA();r&&n.setAttribute("nonce",r),e.head.appendChild(n)}},[])},ZA=function(t){var e=t.className,n=t.hsva,r=t.onChange,o={backgroundImage:"linear-gradient(90deg, "+Ju(Object.assign({},n,{a:0}))+", "+Ju(Object.assign({},n,{a:1}))+")"},i=nu(["react-colorful__alpha",e]),s=Bt(100*n.a);return m.createElement("div",{className:i},m.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),m.createElement(Up,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:ss(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":s+"%","aria-valuenow":s,"aria-valuemin":"0","aria-valuemax":"100"},m.createElement(qp,{className:"react-colorful__alpha-pointer",left:n.a,color:Ju(n)})))},XA=function(t){var e=t.className,n=t.colorModel,r=t.color,o=r===void 0?n.defaultColor:r,i=t.onChange,s=Cv(t,["className","colorModel","color","onChange"]),l=m.useRef(null);JA(l);var a=GA(n,o,i),c=a[0],u=a[1],d=nu(["react-colorful",e]);return m.createElement("div",tu({},s,{ref:l,className:d}),m.createElement(WA,{hsva:c,onChange:u}),m.createElement(FA,{hue:c.h,onChange:u}),m.createElement(ZA,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},QA={defaultColor:"rgba(0, 0, 0, 1)",toHsva:BA,fromHsva:function(t){var e=HA(t);return"rgba("+e.r+", "+e.g+", "+e.b+", "+e.a+")"},equal:qA},eM=function(t){return m.createElement(XA,tu({},t,{colorModel:QA}))};const um=t=>jl(t)?t:"",tM=(t={})=>B("w-full placeholder:italic",he.bgTr,Cb.inputText,t.disabled&&he.txtLowEmphasis),nM="gs-input-field",Gp=m.forwardRef(function(e,n){const{className:r,value:o,label:i,size:s="m",type:l,placeholder:a,required:c,disabled:u,readOnly:d,description:f,name:p,style:g,tip:b,onInput:v,onChange:y,onBlur:w}=e,[S,C]=m.useState(um(o)),x=tM(e),E=m.useRef(null);m.useImperativeHandle(n,()=>E.current,[]),m.useEffect(()=>{C(um(o))},[o]);const _=(N,P)=>{y==null||y(N,P)},M=N=>{const{key:P}=N;switch(P){case"Escape":return C(o);case"Enter":return _(S)}},k=()=>{_(S),w==null||w()},j=N=>{const P=N.target.value;C(P),v==null||v(P)};return h.jsxs("div",{className:B(nM,r),style:g,ref:E,children:[!!i&&h.jsx(gn,{size:s,children:i}),!!f&&h.jsx(gn,{size:s,tip:b,as:"span",className:B(he.txtLowEmphasis),capitalize:!1,children:f}),h.jsx(fe,{className:B(he.bg,we.b,we.rnd,he.br,s==="m"&&dr.xy,s==="s"&&"gjs-px-3 gjs-py-1"),items:"center",space:"x2s",children:h.jsx(U,{grow:!0,children:h.jsx("input",{className:x,name:p,value:S,onChange:j,placeholder:a,required:c,onBlur:k,onKeyDown:M,readOnly:d,disabled:u,type:l})})})]})});IA([$A]);const rM="gs-cmp-color-picker",oM={backgroundSize:"10px"},iM=[0,15],sM=t=>t.startsWith("rgba")?t:er(t).toRgbString();function Ov({className:t,value:e,onChange:n}){const r=sM(e||""),[o,i]=m.useState(!1),s=Zf()&&!!window.EyeDropper,l=tt(`${rM}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,t,we.b,we.rnd,he.br),a=p=>{n==null||n(p,!0)},c=()=>{s&&new window.EyeDropper().open().then(g=>a(g.sRGBHex))},u=()=>{i(!0)},d=()=>{n==null||n(r,!1),i(!1)},f=h.jsxs("div",{style:oM,className:l,children:[o&&h.jsx("div",{onPointerUp:d,className:tt("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing")}),h.jsx("div",{className:tt("gs-utl-w-4 gs-utl-h-4"),style:{backgroundColor:e}})]});return h.jsxs(hv,{handler:f,title:"Color",size:"s",placement:"left-end",offset:iM,clickAway:!0,children:[h.jsx(eM,{className:"color-picker",color:r,onChange:a,onPointerDown:u,onPointerUp:d}),h.jsxs(fe,{className:tt("gs-utl-mt-3"),space:"s",children:[h.jsx(U,{grow:!0,children:h.jsx(Gp,{size:"s",value:r,onChange:a})}),s&&h.jsx(Cs,{type:"button",onClick:c,children:h.jsx(ge,{icon:_e.eyedropperVariant,size:We.s})})]})]})}const dm=t=>jl(t)?t:"",lM="gs-cmp-color-field";function di({className:t,value:e,label:n,size:r="m",placeholder:o,preventSubmitOnEnter:i=!1,onChange:s}){const[l,a]=m.useState(dm(e));m.useEffect(()=>{a(dm(e))},[e]);const c=(f,p)=>{s==null||s(f,p)},u=f=>{switch(f.key){case"Escape":return a(e);case"Enter":c(l),i&&(f.preventDefault(),f.stopPropagation())}},d=()=>{c(l)};return h.jsxs("div",{className:B(lM,t),children:[!!n&&h.jsx(gn,{size:r,children:n}),h.jsxs(fe,{className:B(he.bg,he.br,we.b,we.rnd,r==="m"&&dr.xy,r==="s"&&"gjs-px-3 gjs-py-1"),items:"center",space:"s",children:[h.jsx(U,{children:h.jsx(Ov,{value:e,onChange:s})}),h.jsx(U,{grow:!0,children:h.jsx("input",{className:B("w-full focus:gs-utl-outline-none",he.bgTr),value:l,onChange:f=>a(f.target.value),placeholder:o,onBlur:d,onKeyDown:u})})]})]})}const _v=({value:t,step:e})=>{const n=parseFloat(`${t}`);let r=0;if(Math.floor(n)!==n&&e){const o=`${e}`.split(".")[1];r=(o==null?void 0:o.length)||0}return r?parseFloat(n.toFixed(r)):n},aM=({value:t,key:e,shiftKey:n,min:r,max:o,step:i=1})=>{const s=e==="ArrowUp",l=e==="ArrowDown";let a=null;if(s||l){a=Number(t);const c=parseFloat(`${i}`);s&&(a+=(n?10:1)*c),l&&(a-=(n?10:1)*c),a=`${ru({min:r,max:o,value:a})}`,a=_v({value:a,step:i})}return a},ru=({min:t,max:e,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Wa(t)&&(o=Math.max(o,parseFloat(`${t}`)||0)),Wa(e)&&(o=Math.min(o,parseFloat(`${e}`)||0)),`${`${r}`!=`${n}`?n:o}`},cM=(t,e,n,r={})=>{const o=parseInt(`${t}`,10)||0,{min:i,max:s,step:l=1}=r;let a=o;const c=d=>{const f=d.clientY-e,p=o-f*parseFloat(`${l}`);a=_v({value:ru({min:i,max:s,value:p}),step:l}),n(a,!0)},u=()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),n(a)};window.addEventListener("mousemove",c),window.addEventListener("mouseup",u)},uM=(t,e,n={})=>{const{partial:r}=n,o=(i,s)=>i===s||r&&i.startsWith(s);return e.some(i=>o(typeof i=="string"?i:i.id,t))},fm=t=>jl(t)?t:"",dM="gs-cmp-number-field";function Me({className:t,value:e,units:n,valueUnit:r,label:o,size:i="m",pan:s=!0,min:l,max:a,step:c,tip:u,placeholder:d,onChange:f,onChangeUnit:p}){const[g,b]=m.useState(fm(e)),[v,y]=m.useState(!1),w=(n==null?void 0:n.map(M=>({id:M,label:M})))||[],S={min:l,max:a,step:c};m.useEffect(()=>{b(fm(e))},[e,r]);const C=(M,k)=>{f==null||f(ru({min:l,max:a,value:M}),k)},x=M=>{y(!0);const k=(j,N)=>{C(j,!!N),!N&&y(!1)};cM(g,M.clientY,k,S)},E=M=>{const{key:k,shiftKey:j}=M;switch(k){case"Escape":return b(e);case"Enter":return C(g)}const N=aM({step:c,value:e,key:k,shiftKey:j});N!==null&&(M.preventDefault(),C(N))},_=()=>{C(g)};return h.jsxs("div",{className:B(dM,t),children:[v&&h.jsx("div",{className:B("fixed inset-0 z-50 cursor-ns")}),!!o&&h.jsx(gn,{size:i,tip:u,children:o}),h.jsxs(fe,{className:B(he.bg,he.br,we.b,we.rnd,i==="m"&&dr.xy,i==="s"&&"gjs-px-3 gjs-py-1"),items:"center",space:"x2s",children:[!!s&&h.jsx(U,{onMouseDown:x,className:B("opacity-50 cursor-ns",i==="m"&&"-gjs-ml-3",i==="s"&&"-gjs-ml-2",s!==!0&&"gjs-mr-0.5 -gjs-ml-1"),children:s===!0?h.jsx(ge,{icon:_e.panVertical,size:We.s2x}):s}),h.jsx(U,{grow:!0,children:h.jsx("input",{className:B("w-full",he.bgTr,Cb.inputText),value:g,onChange:M=>b(M.target.value),placeholder:d,onBlur:_,onKeyDown:E})}),!!w.length&&h.jsx(U,{className:B(w.length===1&&"opacity-50 pointer-events-none"),children:h.jsx(Je,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:r,onChange:M=>p==null?void 0:p(M),options:w})})]})]})}function fM(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.useMemo(()=>r=>{e.forEach(o=>o(r))},e)}const ou=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xs(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Kp(t){return"nodeType"in t}function jo(t){var e,n;return t?xs(t)?t:Kp(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Yp(t){const{Document:e}=jo(t);return t instanceof e}function ws(t){return xs(t)?!1:t instanceof jo(t).HTMLElement}function kv(t){return t instanceof jo(t).SVGElement}function Ss(t){return t?xs(t)?t.document:Kp(t)?Yp(t)?t:ws(t)||kv(t)?t.ownerDocument:document:document:document}const fi=ou?m.useLayoutEffect:m.useEffect;function pM(t){const e=m.useRef(t);return fi(()=>{e.current=t}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function hM(){const t=m.useRef(null),e=m.useCallback((r,o)=>{t.current=setInterval(r,o)},[]),n=m.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Vl(t,e){const n=m.useRef();return m.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Jp(t){const e=pM(t),n=m.useRef(null),r=m.useCallback(o=>{o!==n.current&&(e==null||e(o,n.current)),n.current=o},[]);return[n,r]}let Zu={};function Il(t,e){return m.useMemo(()=>{if(e)return e;const n=Zu[t]==null?0:Zu[t]+1;return Zu[t]=n,t+"-"+n},[t,e])}function Tv(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const l=Object.entries(s);for(const[a,c]of l){const u=i[a];u!=null&&(i[a]=u+t*c)}return i},{...e})}}const hl=Tv(1),Av=Tv(-1);function gM(t){return"clientX"in t&&"clientY"in t}function mM(t){if(!t)return!1;const{KeyboardEvent:e}=jo(t.target);return e&&t instanceof e}function bM(t){if(!t)return!1;const{TouchEvent:e}=jo(t.target);return e&&t instanceof e}function gf(t){if(bM(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return gM(t)?{x:t.clientX,y:t.clientY}:null}const gl=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[gl.Translate.toString(t),gl.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),vM={display:"none"};function yM(t){let{id:e,value:n}=t;return m.createElement("div",{id:e,style:vM},n)}function xM(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return m.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function wM(){const[t,e]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const SM={draggable:`
288
- To pick up a draggable item, press the space bar.
289
- While dragging, use the arrow keys to move the item.
290
- Press space again to drop the item in its new position, or press escape to cancel.
291
- `},CM={onDragStart(t){return`Picked up draggable item ${t}.`},onDragOver(t,e){return e?`Draggable item ${t} was moved over droppable area ${e}.`:`Draggable item ${t} is no longer over a droppable area.`},onDragEnd(t,e){return e?`Draggable item ${t} was dropped over droppable area ${e}`:`Draggable item ${t} was dropped.`},onDragCancel(t){return`Dragging was cancelled. Draggable item ${t} was dropped.`}};var Ke;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ke||(Ke={}));function Xu(...t){}class Zs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const iu=m.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:Xu,draggableNodes:{},droppableRects:new Map,droppableContainers:new Zs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xu},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:Xu,windowRect:null,willRecomputeLayouts:!1});function EM(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new Zs}}}function OM(t,e){switch(e.type){case Ke.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ke.DragMove:return t.draggable.active?{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}}:t;case Ke.DragEnd:case Ke.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ke.RegisterDroppable:{const{element:n}=e,{id:r}=n,o=new Zs(t.droppable.containers);return o.set(r,n),{...t,droppable:{...t.droppable,containers:o}}}case Ke.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new Zs(t.droppable.containers);return s.set(n,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:s}}}case Ke.UnregisterDroppable:{const{id:n,key:r}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const i=new Zs(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}const Mv=m.createContext({type:null,event:null});function _M({onDragStart:t,onDragMove:e,onDragOver:n,onDragEnd:r,onDragCancel:o}){const i=m.useContext(Mv),s=m.useRef(i);m.useEffect(()=>{if(i!==s.current){const{type:l,event:a}=i;switch(l){case Ke.DragStart:t==null||t(a);break;case Ke.DragMove:e==null||e(a);break;case Ke.DragOver:n==null||n(a);break;case Ke.DragCancel:o==null||o(a);break;case Ke.DragEnd:r==null||r(a);break}s.current=i}},[i,t,e,n,r,o])}function kM({announcements:t=CM,hiddenTextDescribedById:e,screenReaderInstructions:n}){const{announce:r,announcement:o}=wM(),i=Il("DndLiveRegion"),[s,l]=m.useState(!1);return m.useEffect(()=>{l(!0)},[]),_M(m.useMemo(()=>({onDragStart({active:a}){r(t.onDragStart(a.id))},onDragMove({active:a,over:c}){t.onDragMove&&r(t.onDragMove(a.id,c==null?void 0:c.id))},onDragOver({active:a,over:c}){r(t.onDragOver(a.id,c==null?void 0:c.id))},onDragEnd({active:a,over:c}){r(t.onDragEnd(a.id,c==null?void 0:c.id))},onDragCancel({active:a}){r(t.onDragCancel(a.id))}}),[r,t])),s?ir.createPortal(m.createElement(m.Fragment,null,m.createElement(yM,{id:e,value:n.draggable}),m.createElement(xM,{id:i,announcement:o})),document.body):null}const Wr=Object.freeze({x:0,y:0});function jv(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function pm(t,e=t.offsetLeft,n=t.offsetTop){return{x:e+t.width*.5,y:n+t.height*.5}}const TM=({collisionRect:t,droppableContainers:e})=>{const n=pm(t,t.left,t.top);let r=1/0,o=null;for(const i of e){const{rect:{current:s}}=i;if(s){const l=jv(pm(s),n);l<r&&(r=l,o=i.id)}}return o};function AM(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function MM(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Wr}function jM(t){return function(n,...r){return r.reduce((o,i)=>({...o,top:o.top+t*i.y,bottom:o.bottom+t*i.y,left:o.left+t*i.x,right:o.right+t*i.x,offsetLeft:o.offsetLeft+t*i.x,offsetTop:o.offsetTop+t*i.y}),{...n})}}const hm=jM(1);function RM(t,e=window.getComputedStyle(t)){return e.position==="fixed"}function NM(t,e=window.getComputedStyle(t)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(o=>{const i=e[o];return typeof i=="string"?n.test(i):!1})!=null}function Zp(t){const e=[];function n(r){if(!r)return e;if(Yp(r)&&r.scrollingElement!=null&&!e.includes(r.scrollingElement))return e.push(r.scrollingElement),e;if(!ws(r)||kv(r)||e.includes(r))return e;const o=window.getComputedStyle(r);return NM(r,o)&&e.push(r),RM(r,o)?e:n(r.parentNode)}return t?n(t.parentNode):e}function Qu(t){return!ou||!t?null:xs(t)?t:Kp(t)?Yp(t)||t===Ss(t).scrollingElement?window:ws(t)?t:null:null}function mf(t){return xs(t)?{x:t.scrollX,y:t.scrollY}:{x:t.scrollLeft,y:t.scrollTop}}var Vi;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Vi||(Vi={}));function Rv(t){const e={x:0,y:0},n={x:t.scrollWidth-t.clientWidth,y:t.scrollHeight-t.clientHeight},r=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,i=t.scrollTop>=n.y,s=t.scrollLeft>=n.x;return{isTop:r,isLeft:o,isBottom:i,isRight:s,maxScroll:n,minScroll:e}}function PM(t){return!ou||!t?!1:t===document.scrollingElement}const DM={x:.2,y:.2};function LM(t,e,{top:n,left:r,right:o,bottom:i},s=10,l=DM){const{clientHeight:a,clientWidth:c}=t,u=PM(t)?{top:0,left:0,right:c,bottom:a,width:c,height:a}:e,{isTop:d,isBottom:f,isLeft:p,isRight:g}=Rv(t),b={x:0,y:0},v={x:0,y:0},y={height:u.height*l.y,width:u.width*l.x};return!d&&n<=u.top+y.height?(b.y=Vi.Backward,v.y=s*Math.abs((u.top+y.height-n)/y.height)):!f&&i>=u.bottom-y.height&&(b.y=Vi.Forward,v.y=s*Math.abs((u.bottom-y.height-i)/y.height)),!g&&o>=u.right-y.width?(b.x=Vi.Forward,v.x=s*Math.abs((u.right-y.width-o)/y.width)):!p&&r<=u.left+y.width&&(b.x=Vi.Backward,v.x=s*Math.abs((u.left+y.width-r)/y.width)),{direction:b,speed:v}}function VM(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:e,left:n,right:r,bottom:o}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:o,width:t.clientWidth,height:t.clientHeight}}function Nv(t){return t.reduce((e,n)=>hl(e,mf(n)),Wr)}function Pv(t,e,n=Wr){if(!t||!ws(t))return n;const r={x:n.x+t.offsetLeft,y:n.y+t.offsetTop};return t.offsetParent===e?r:Pv(t.offsetParent,e,r)}function su(t){const{offsetWidth:e,offsetHeight:n}=t,{x:r,y:o}=Pv(t,null);return{width:e,height:n,offsetTop:o,offsetLeft:r}}function lu(t){if(xs(t)){const c=window.innerWidth,u=window.innerHeight;return{top:0,left:0,right:c,bottom:u,width:c,height:u,offsetTop:0,offsetLeft:0}}const{offsetTop:e,offsetLeft:n}=su(t),{width:r,height:o,top:i,bottom:s,left:l,right:a}=t.getBoundingClientRect();return{width:r,height:o,top:i,bottom:s,right:a,left:l,offsetTop:e,offsetLeft:n}}function bf(t){const{width:e,height:n,offsetTop:r,offsetLeft:o}=su(t),i=Zp(t),s=Nv(i),l=r-s.y,a=o-s.x;return{width:e,height:n,top:l,bottom:l+n,right:a+e,left:a,offsetTop:r,offsetLeft:o}}function gm(t){return"top"in t}function mm(t,e=t.offsetLeft,n=t.offsetTop){return[{x:e,y:n},{x:e+t.width,y:n},{x:e,y:n+t.height},{x:e+t.width,y:n+t.height}]}const IM=({collisionRect:t,droppableContainers:e})=>{let n=1/0,r=null;const o=mm(t,t.left,t.top);for(const i of e){const{rect:{current:s}}=i;if(s){const l=mm(s,gm(s)?s.left:void 0,gm(s)?s.top:void 0),a=o.reduce((u,d,f)=>u+jv(l[f],d),0),c=Number((a/4).toFixed(4));c<n&&(n=c,r=i.id)}}return r};function $M(t,e){const n=Math.max(e.top,t.offsetTop),r=Math.max(e.left,t.offsetLeft),o=Math.min(e.left+e.width,t.offsetLeft+t.width),i=Math.min(e.top+e.height,t.offsetTop+t.height),s=o-r,l=i-n;if(r<o&&n<i){const a=e.width*e.height,c=t.width*t.height,u=s*l,d=u/(a+c-u);return Number(d.toFixed(4))}return 0}const HM=({collisionRect:t,droppableContainers:e})=>{let n=0,r=null;for(const o of e){const{rect:{current:i}}=o;if(i){const s=$M(i,t);s>n&&(n=s,r=o.id)}}return r};var Xs;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Xs||(Xs={}));var lc;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(lc||(lc={}));function BM({acceleration:t,activator:e=Xs.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:i=5,order:s=lc.TreeOrder,pointerCoordinates:l,scrollableAncestors:a,scrollableAncestorRects:c,threshold:u}){const[d,f]=hM(),p=m.useRef({x:1,y:1}),g=m.useMemo(()=>{switch(e){case Xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xs.DraggableRect:return r}return null},[e,r,l]),b=m.useRef(Wr),v=m.useRef(null),y=m.useCallback(()=>{const S=v.current;if(!S)return;const C=p.current.x*b.current.x,x=p.current.y*b.current.y;S.scrollBy(C,x)},[]),w=m.useMemo(()=>s===lc.TreeOrder?[...a].reverse():a,[s,a]);m.useEffect(()=>{if(!o||!a.length||!g){f();return}for(const S of w){if((n==null?void 0:n(S))===!1)continue;const C=a.indexOf(S),x=c[C];if(!x)continue;const{direction:E,speed:_}=LM(S,x,g,t,u);if(_.x>0||_.y>0){f(),v.current=S,d(y,i),p.current=_,b.current=E;return}}p.current={x:0,y:0},b.current={x:0,y:0},f()},[t,y,n,f,o,i,JSON.stringify(g),d,a,w,c,JSON.stringify(u)])}function zM(t,e){const n=e!==null?t[e]:void 0,r=n?n.node.current:null;return Vl(o=>{var i;return e===null?null:(i=r??o)!=null?i:null},[r,e])}function FM(t,e){return m.useMemo(()=>t.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:e(s.handler,r)}));return[...n,...i]},[]),[t,e])}function Dv(t){const e=m.useRef(t);return fi(()=>{e.current!==t&&(e.current=t)},[t]),e}var ml;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ml||(ml={}));var vf;(function(t){t.Optimized="optimized"})(vf||(vf={}));const bm=new Map,WM={measure:su,strategy:ml.WhileDragging,frequency:vf.Optimized};function UM(t,{dragging:e,dependencies:n,config:r}){const[o,i]=m.useState(!1),{frequency:s,measure:l,strategy:a}={...WM,...r},c=m.useRef(t),u=m.useCallback(()=>i(!0),[]),d=m.useRef(null),f=g(),p=Vl(b=>{if(f&&!e)return bm;if(!b||b===bm||c.current!==t||o){for(let v of t)v&&(v.rect.current=v.node.current?l(v.node.current):null);return qM(t)}return b},[t,e,f,l,o]);return m.useEffect(()=>{c.current=t},[t]),m.useEffect(()=>{o&&i(!1)},[o]),m.useEffect(function(){f||requestAnimationFrame(u)},[e,f]),m.useEffect(function(){f||typeof s!="number"||d.current!==null||(d.current=setTimeout(()=>{u(),d.current=null},s))},[s,f,u,...n]),{layoutRectMap:p,recomputeLayouts:u,willRecomputeLayouts:o};function g(){switch(a){case ml.Always:return!1;case ml.BeforeDragging:return e;default:return!e}}}function qM(t){const e=new Map;if(t)for(const n of t){if(!n)continue;const{id:r,rect:o}=n;o.current!=null&&e.set(r,o.current)}return e}function GM(t){const[e,n]=m.useState(null),r=m.useRef(t),o=m.useCallback(i=>{const s=Qu(i.target);s&&n(l=>l?(l.set(s,mf(s)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(t!==i){s(i);const l=t.map(a=>{const c=Qu(a);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,mf(c)]):null}).filter(a=>a!=null);n(l.length?new Map(l):null),r.current=t}return()=>{s(t),s(i)};function s(l){l.forEach(a=>{const c=Qu(a);c==null||c.removeEventListener("scroll",o)})}},[o,t]),m.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,s)=>hl(i,s),Wr):Nv(t):Wr,[t,e])}const KM=[];function YM(t){const e=m.useRef(t),n=Vl(r=>t?r&&t&&e.current&&t.parentNode===e.current.parentNode?r:Zp(t):KM,[t]);return m.useEffect(()=>{e.current=t},[t]),n}function JM(t){m.useEffect(()=>{if(!ou)return;const e=t.map(({sensor:n})=>n.setup==null?void 0:n.setup());return()=>{for(const n of e)n==null||n()}},t.map(({sensor:e})=>e))}function ZM(t,e){return m.useMemo(()=>t.reduce((n,{eventName:r,handler:o})=>(n[r]=i=>{o(i,e)},n),{}),[t,e])}const ed=Vv(lu),XM=QM(lu);function Lv(t,e,n){const r=m.useRef(t);return Vl(o=>t?n||!o&&t||t!==r.current?ws(t)&&t.parentNode==null?null:e(t):o??null:null,[t,n,e])}function Vv(t){return(e,n)=>Lv(e,t,n)}function QM(t){const e=[];return function(r,o){const i=m.useRef(r);return Vl(s=>r.length?o||!s&&r.length||r!==i.current?r.map(l=>t(l)):s??e:e,[r,o])}}function e3(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ws(e)?e:t}function t3(t){const{width:e,height:n,offsetLeft:r,offsetTop:o}=su(t);return{top:o,bottom:o+n,left:r,right:r+e,width:e,height:n,offsetTop:o,offsetLeft:r}}const n3=Vv(t3);function r3({disabled:t,forceRecompute:e}){const[n,r]=Jp(),o=n3(t?null:e3(n.current),e);return m.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function vm(t,e){return m.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function o3(...t){return m.useMemo(()=>[...t].filter(e=>e!=null),[...t])}class Qs{constructor(e){this.target=e,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})}}add(e,n,r){var o;(o=this.target)==null||o.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function i3(t){const{EventTarget:e}=jo(t);return t instanceof e?t:Ss(t)}function td(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var On;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(On||(On={}));function ym(t){t.preventDefault()}function s3(t){t.stopPropagation()}var Ne;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter"})(Ne||(Ne={}));const Iv={start:[Ne.Space,Ne.Enter],cancel:[Ne.Esc],end:[Ne.Space,Ne.Enter]},l3=(t,{currentCoordinates:e})=>{switch(t.code){case Ne.Right:return{...e,x:e.x+25};case Ne.Left:return{...e,x:e.x-25};case Ne.Down:return{...e,y:e.y+25};case Ne.Up:return{...e,y:e.y-25}}};class Xp{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=Wr;const{event:{target:n}}=e;this.props=e,this.listeners=new Qs(Ss(n)),this.windowListeners=new Qs(jo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(On.Resize,this.handleCancel),this.windowListeners.add(On.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(On.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const r=lu(e.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(e){if(mM(e)){const{coordinates:n}=this,{active:r,context:o,options:i}=this.props,{keyboardCodes:s=Iv,coordinateGetter:l=l3,scrollBehavior:a="smooth"}=i,{code:c}=e;if(s.end.includes(c)){this.handleEnd(e);return}if(s.cancel.includes(c)){this.handleCancel(e);return}const u=l(e,{active:r,context:o.current,currentCoordinates:n});if(u){const d={x:0,y:0},{scrollableAncestors:f}=o.current;for(const p of f){const g=e.code,b=Av(u,n),{isTop:v,isRight:y,isLeft:w,isBottom:S,maxScroll:C,minScroll:x}=Rv(p),E=VM(p),_={x:Math.min(g===Ne.Right?E.right-E.width/2:E.right,Math.max(g===Ne.Right?E.left:E.left+E.width/2,u.x)),y:Math.min(g===Ne.Down?E.bottom-E.height/2:E.bottom,Math.max(g===Ne.Down?E.top:E.top+E.height/2,u.y))},M=g===Ne.Right&&!y||g===Ne.Left&&!w,k=g===Ne.Down&&!S||g===Ne.Up&&!v;if(M&&_.x!==u.x){if(g===Ne.Right&&p.scrollLeft+b.x<=C.x||g===Ne.Left&&p.scrollLeft+b.x>=x.x){p.scrollBy({left:b.x,behavior:a});return}d.x=g===Ne.Right?p.scrollLeft-C.x:p.scrollLeft-x.x,p.scrollBy({left:-d.x,behavior:a});break}else if(k&&_.y!==u.y){if(g===Ne.Down&&p.scrollTop+b.y<=C.y||g===Ne.Up&&p.scrollTop+b.y>=x.y){p.scrollBy({top:b.y,behavior:a});return}d.y=g===Ne.Down?p.scrollTop-C.y:p.scrollTop-x.y,p.scrollBy({top:-d.y,behavior:a});break}}this.handleMove(e,hl(u,d))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n),this.coordinates=n}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Xp.activators=[{eventName:"onKeyDown",handler:(t,{keyboardCodes:e=Iv,onActivation:n})=>{const{code:r}=t.nativeEvent;return e.start.includes(r)?(t.preventDefault(),n==null||n({event:t.nativeEvent}),!0):!1}}];function xm(t){return!!(t&&"distance"in t)}function wm(t){return!!(t&&"delay"in t)}class Qp{constructor(e,n,r=i3(e.event.target)){this.props=e,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:o}=e,{target:i}=o;this.props=e,this.events=n,this.document=Ss(i),this.documentListeners=new Qs(this.document),this.listeners=new Qs(r),this.windowListeners=new Qs(jo(i)),this.initialCoordinates=gf(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(On.Resize,this.handleCancel),this.windowListeners.add(On.DragStart,ym),this.windowListeners.add(On.VisibilityChange,this.handleCancel),this.windowListeners.add(On.ContextMenu,ym),this.documentListeners.add(On.Keydown,this.handleKeydown),n){if(xm(n))return;if(wm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(On.Click,s3,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(On.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:s}}=o;if(!r)return;const l=gf(e),a=Av(r,l);if(!n&&s){if(wm(s))return td(a,s.tolerance)?this.handleCancel():void 0;if(xm(s))return s.tolerance!=null&&td(a,s.tolerance)?this.handleCancel():td(a,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Ne.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const a3={move:{name:"pointermove"},end:{name:"pointerup"}};class eh extends Qp{constructor(e){const{event:n}=e,r=Ss(n.target);super(e,a3,r)}}eh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:t},{onActivation:e})=>!t.isPrimary||t.button!==0?!1:(e==null||e({event:t}),!0)}];const c3={move:{name:"mousemove"},end:{name:"mouseup"}};var yf;(function(t){t[t.RightClick=2]="RightClick"})(yf||(yf={}));class u3 extends Qp{constructor(e){super(e,c3,Ss(e.event.target))}}u3.activators=[{eventName:"onMouseDown",handler:({nativeEvent:t},{onActivation:e})=>t.button===yf.RightClick?!1:(e==null||e({event:t}),!0)}];const nd={move:{name:"touchmove"},end:{name:"touchend"}};class d3 extends Qp{constructor(e){super(e,nd)}static setup(){return window.addEventListener(nd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(nd.move.name,e)};function e(){}}}d3.activators=[{eventName:"onTouchStart",handler:({nativeEvent:t},{onActivation:e})=>{const{touches:n}=t;return n.length>1?!1:(e==null||e({event:t}),!0)}}];function f3(t,{transform:e,...n}){return t!=null&&t.length?t.reduce((r,o)=>o({transform:r,...n}),e):e}const p3=[{sensor:eh,options:{}},{sensor:Xp,options:{}}],h3={current:{}},$v=m.createContext({...Wr,scaleX:1,scaleY:1}),g3=m.memo(function({id:e,autoScroll:n=!0,announcements:r,children:o,sensors:i=p3,collisionDetection:s=HM,measuring:l,modifiers:a,screenReaderInstructions:c=SM,...u}){var d,f,p,g,b;const v=m.useReducer(OM,void 0,EM),[y,w]=v,[S,C]=m.useState(()=>({type:null,event:null})),[x,E]=m.useState(!1),{draggable:{active:_,nodes:M,translate:k},droppable:{containers:j}}=y,N=_?M[_]:null,P=m.useRef({initial:null,translated:null}),z=m.useMemo(()=>{var it;return _!=null?{id:_,data:(it=N==null?void 0:N.data)!=null?it:h3,rect:P}:null},[_,N]),W=m.useRef(null),[F,$]=m.useState(null),[J,ee]=m.useState(null),L=m.useRef(u),I=Il("DndDescribedBy",e),A=m.useMemo(()=>j.getEnabled(),[j]),{layoutRectMap:R,recomputeLayouts:q,willRecomputeLayouts:D}=UM(A,{dragging:x,dependencies:[k.x,k.y],config:l==null?void 0:l.droppable}),V=zM(M,_),te=J?gf(J):null,G=Lv(V,(d=l==null||(f=l.draggable)==null?void 0:f.measure)!=null?d:bf),Q=ed(V),se=m.useRef(null),be=se.current,de=m.useRef({active:null,activeNode:V,collisionRect:null,droppableRects:R,draggableNodes:M,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Pe=j.getNodeFor((p=de.current.over)==null?void 0:p.id),X=ed(V?V.ownerDocument.defaultView:null),qe=ed(V?V.parentElement:null),Qe=YM(_?Pe??V:null),at=XM(Qe),xt=r3({disabled:_==null,forceRecompute:D}),wt=(g=xt.rect)!=null?g:G,rn=wt===G?MM(G,be):Wr,Le=f3(a,{transform:{x:k.x-rn.x,y:k.y-rn.y,scaleX:1,scaleY:1},activatorEvent:J,active:z,activeNodeRect:Q,containerNodeRect:qe,draggingNodeRect:wt,over:de.current.over,overlayNodeRect:xt.rect,scrollableAncestors:Qe,scrollableAncestorRects:at,windowRect:X}),ot=te?hl(te,k):null,T=GM(Qe),re=hl(Le,T),ie=wt?hm(wt,Le):null,Ce=ie?hm(ie,T):null,Xe=z&&Ce?s({active:z,collisionRect:Ce,droppableContainers:A}):null,[Te,me]=m.useState(null),on=AM(Le,(b=Te==null?void 0:Te.rect)!=null?b:null,G),yn=m.useCallback((it,{sensor:et,options:Rt})=>{if(!W.current)return;const wn=M[W.current];if(!wn)return;const qt=new et({active:W.current,activeNode:wn,event:it.nativeEvent,options:Rt,context:de,onStart(Vt){const Sn=W.current;if(!Sn)return;const Er=M[Sn];if(!Er)return;const{onDragStart:Kr}=L.current,Yr={active:{id:Sn,data:Er.data,rect:P}};ir.unstable_batchedUpdates(()=>{w({type:Ke.DragStart,initialCoordinates:Vt,active:Sn}),C({type:Ke.DragStart,event:Yr})}),Kr==null||Kr(Yr)},onMove(Vt){w({type:Ke.DragMove,coordinates:Vt})},onEnd:Cr(Ke.DragEnd),onCancel:Cr(Ke.DragCancel)});ir.unstable_batchedUpdates(()=>{$(qt),ee(it.nativeEvent)});function Cr(Vt){return async function(){const{active:Er,over:Kr,scrollAdjustedTranslate:Yr}=de.current;let Jr=null;if(Er&&Yr){const{cancelDrop:Po}=L.current;Jr={active:Er,delta:Yr,over:Kr},Vt===Ke.DragEnd&&typeof Po=="function"&&await Promise.resolve(Po(Jr))&&(Vt=Ke.DragCancel)}if(W.current=null,ir.unstable_batchedUpdates(()=>{w({type:Vt}),me(null),E(!1),$(null),ee(null),Jr&&C({type:Vt,event:Jr})}),Jr){const{onDragCancel:Po,onDragEnd:Gl}=L.current,_s=Vt===Ke.DragEnd?Gl:Po;_s==null||_s(Jr)}}}},[w,M]),ft=m.useCallback((it,et)=>(Rt,wn)=>{const qt=Rt.nativeEvent;W.current!==null||qt.dndKit||qt.defaultPrevented||it(Rt,et.options)===!0&&(qt.dndKit={capturedBy:et.sensor},W.current=wn,yn(Rt,et))},[yn]),Ut=FM(i,ft);JM(i),fi(()=>{L.current=u},Object.values(u)),m.useEffect(()=>{_!=null&&E(!0)},[_]),m.useEffect(()=>{z||(se.current=null),z&&G&&!se.current&&(se.current=G)},[G,z]),m.useEffect(()=>{const{onDragMove:it}=L.current,{active:et,over:Rt}=de.current;if(!et)return;const wn={active:et,delta:{x:re.x,y:re.y},over:Rt};C({type:Ke.DragMove,event:wn}),it==null||it(wn)},[re.x,re.y]),m.useEffect(()=>{const{active:it,droppableContainers:et,scrollAdjustedTranslate:Rt}=de.current;if(!it||!W.current||!Rt)return;const{onDragOver:wn}=L.current,qt=et.get(Xe),Cr=qt&&qt.rect.current?{id:qt.id,rect:qt.rect.current,data:qt.data,disabled:qt.disabled}:null,Vt={active:it,delta:{x:Rt.x,y:Rt.y},over:Cr};ir.unstable_batchedUpdates(()=>{me(Cr),C({type:Ke.DragOver,event:Vt}),wn==null||wn(Vt)})},[Xe]),fi(()=>{de.current={active:z,activeNode:V,collisionRect:Ce,droppableRects:R,draggableNodes:M,draggingNodeRect:wt,droppableContainers:j,over:Te,scrollableAncestors:Qe,scrollAdjustedTranslate:re,translatedRect:ie},P.current={initial:wt,translated:ie}},[z,V,Ce,M,wt,R,j,Te,Qe,re,ie]),BM({...xn(),draggingRect:ie,pointerCoordinates:ot,scrollableAncestors:Qe,scrollableAncestorRects:at});const Sr=m.useMemo(()=>({active:z,activeNode:V,activeNodeRect:G,activeNodeClientRect:Q,activatorEvent:J,activators:Ut,ariaDescribedById:{draggable:I},containerNodeRect:qe,dispatch:w,dragOverlay:xt,draggableNodes:M,droppableContainers:j,droppableRects:R,over:Te,recomputeLayouts:q,scrollableAncestors:Qe,scrollableAncestorRects:at,willRecomputeLayouts:D,windowRect:X}),[z,V,Q,G,J,Ut,qe,xt,w,M,I,j,R,Te,q,Qe,at,D,X]);return m.createElement(Mv.Provider,{value:S},m.createElement(iu.Provider,{value:Sr},m.createElement($v.Provider,{value:on},o)),m.createElement(kM,{announcements:r,hiddenTextDescribedById:I,screenReaderInstructions:c}));function xn(){const it=(F==null?void 0:F.autoScrollEnabled)===!1,et=typeof n=="object"?n.enabled===!1:n===!1,Rt=!it&&!et;return typeof n=="object"?{...n,enabled:Rt}:{enabled:Rt}}}),m3=m.createContext(null),Sm="button",b3="Droppable";function v3({id:t,data:e,disabled:n=!1,attributes:r}){const o=Il(b3),{active:i,activeNodeRect:s,activatorEvent:l,ariaDescribedById:a,draggableNodes:c,droppableRects:u,activators:d,over:f}=m.useContext(iu),{role:p=Sm,roleDescription:g="draggable",tabIndex:b=0}=r??{},v=(i==null?void 0:i.id)===t,y=m.useContext(v?$v:m3),[w,S]=Jp(),C=ZM(d,t),x=Dv(e);m.useEffect(()=>(c[t]={id:t,key:o,node:w,data:x},()=>{const _=c[t];_&&_.key===o&&delete c[t]}),[c,t]);const E=m.useMemo(()=>({role:p,tabIndex:b,"aria-pressed":v&&p===Sm?!0:void 0,"aria-roledescription":g,"aria-describedby":a.draggable}),[p,b,v,g,a.draggable]);return{active:i,activeNodeRect:s,activatorEvent:l,attributes:E,droppableRects:u,isDragging:v,listeners:n?void 0:C,node:w,over:f,setNodeRef:S,transform:y}}function y3(){return m.useContext(iu)}const x3="Droppable";function w3({data:t,disabled:e=!1,id:n}){const r=Il(x3),{active:o,dispatch:i,over:s}=m.useContext(iu),l=m.useRef(null),[a,c]=Jp(),u=Dv(t);return fi(()=>(i({type:Ke.RegisterDroppable,element:{id:n,key:r,disabled:e,node:a,rect:l,data:u}}),()=>i({type:Ke.UnregisterDroppable,key:r,id:n})),[n]),m.useEffect(()=>{i({type:Ke.SetDroppableDisabled,id:n,key:r,disabled:e})},[e]),{active:o,rect:l,isOver:(s==null?void 0:s.id)===n,node:a,over:s,setNodeRef:c}}function S3(t,e,n){const r={...t};return e.top+t.y<=n.top?r.y=n.top-e.top:e.bottom+t.y>=n.top+n.height&&(r.y=n.top+n.height-e.bottom),e.left+t.x<=n.left?r.x=n.left-e.left:e.right+t.x>=n.left+n.width&&(r.x=n.left+n.width-e.right),r}const C3=({draggingNodeRect:t,transform:e,scrollableAncestorRects:n})=>{const r=n[0];return!t||!r?e:S3(e,t,r)},E3=({transform:t})=>({...t,x:0});function Hv(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function O3(t,e){return t.reduce((n,r,o)=>{const i=e.get(r);return i&&(n[o]=i),n},Array(t.length))}function la(t){return t!==null&&t>=0}const Bv=({layoutRects:t,activeIndex:e,overIndex:n,index:r})=>{const o=Hv(t,n,e),i=t[r],s=o[r];return!s||!i?null:{x:s.offsetLeft-i.offsetLeft,y:s.offsetTop-i.offsetTop,scaleX:s.width/i.width,scaleY:s.height/i.height}},aa={scaleX:1,scaleY:1},_3=({activeIndex:t,activeNodeRect:e,index:n,layoutRects:r,overIndex:o})=>{var i;const s=(i=r[t])!=null?i:e;if(!s)return null;if(n===t){const a=r[o];return a?{x:0,y:t<o?a.offsetTop+a.height-(s.offsetTop+s.height):a.offsetTop-s.offsetTop,...aa}:null}const l=k3(r,n,t);return n>t&&n<=o?{x:0,y:-s.height-l,...aa}:n<t&&n>=o?{x:0,y:s.height+l,...aa}:{x:0,y:0,...aa}};function k3(t,e,n){const r=t[e],o=t[e-1],i=t[e+1];return r?n<e?o?r.offsetTop-(o.offsetTop+o.height):i?i.offsetTop-(r.offsetTop+r.height):0:i?i.offsetTop-(r.offsetTop+r.height):o?r.offsetTop-(o.offsetTop+o.height):0:0}const zv="Sortable",Fv=m.createContext({activeIndex:-1,containerId:zv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bv,wasDragging:{current:!1}});function T3({children:t,id:e,items:n,strategy:r=Bv}){const{active:o,dragOverlay:i,droppableRects:s,over:l,recomputeLayouts:a,willRecomputeLayouts:c}=y3(),u=Il(zv,e),d=i.rect!==null,f=m.useMemo(()=>n.map(_=>typeof _=="string"?_:_.id),[n]),p=o!=null,g=m.useRef(!1),b=o?f.indexOf(o.id):-1,v=b!==-1,y=l?f.indexOf(l.id):-1,w=m.useRef(f),S=O3(f,s),C=!A3(f,w.current),x=y!==-1&&b===-1||C;fi(()=>{C&&v&&!c&&a()},[C,v,a,c]),m.useEffect(()=>{w.current=f},[f]),m.useEffect(()=>{const _=setTimeout(()=>{g.current=p},100);return()=>clearTimeout(_)},[p]);const E=m.useMemo(()=>({activeIndex:b,containerId:u,disableTransforms:x,items:f,overIndex:y,useDragOverlay:d,sortedRects:S,strategy:r,wasDragging:g}),[b,u,x,f,y,S,d,r,g]);return m.createElement(Fv.Provider,{value:E},t)}function A3(t,e){return t.join()===e.join()}const M3=({id:t,items:e,activeIndex:n,overIndex:r})=>Hv(e,n,r).indexOf(t),j3=({containerId:t,isSorting:e,wasDragging:n,index:r,items:o,newIndex:i,previousItems:s,previousContainerId:l,transition:a})=>!a||!n||s!==o&&r===i?!1:e?!0:i!==r&&t===l,R3={duration:200,easing:"ease"},Wv="transform",N3=gl.Transition.toString({property:Wv,duration:0,easing:"linear"}),P3={roleDescription:"sortable"};function D3({disabled:t,index:e,node:n,rect:r}){const[o,i]=m.useState(null),s=m.useRef(e);return fi(()=>{if(!t&&e!==s.current&&n.current){const l=r.current;if(l){const a=lu(n.current),c={x:l.offsetLeft-a.offsetLeft,y:l.offsetTop-a.offsetTop,scaleX:l.width/a.width,scaleY:l.height/a.height};(c.x||c.y)&&i(c)}}e!==s.current&&(s.current=e)},[t,e,n,r]),m.useEffect(()=>{o&&requestAnimationFrame(()=>{i(null)})},[o]),o}function L3({animateLayoutChanges:t=j3,attributes:e,disabled:n,data:r,getNewIndex:o=M3,id:i,strategy:s,transition:l=R3}){const{items:a,containerId:c,activeIndex:u,disableTransforms:d,sortedRects:f,overIndex:p,useDragOverlay:g,strategy:b,wasDragging:v}=m.useContext(Fv),y=a.indexOf(i),w=m.useMemo(()=>({sortable:{containerId:c,index:y,items:a},...r}),[c,r,y,a]),{rect:S,node:C,setNodeRef:x}=w3({id:i,data:w}),{active:E,activeNodeRect:_,activatorEvent:M,attributes:k,setNodeRef:j,listeners:N,isDragging:P,over:z,transform:W}=v3({id:i,data:w,attributes:{...P3,...e},disabled:n}),F=fM(x,j),$=!!E,J=$&&v.current&&!d&&la(u)&&la(p),ee=!g&&P,L=ee&&J?W:null,A=J?L??(s??b)({layoutRects:f,activeNodeRect:_,activeIndex:u,overIndex:p,index:y}):null,R=la(u)&&la(p)?o({id:i,items:a,activeIndex:u,overIndex:p}):y,q=m.useRef(a),D=a!==q.current,V=m.useRef(R),te=m.useRef(c),G=t({active:E,containerId:c,isDragging:P,isSorting:$,id:i,index:y,items:a,newIndex:V.current,previousItems:q.current,previousContainerId:te.current,transition:l,wasDragging:v.current}),Q=D3({disabled:!G,index:y,node:C,rect:S});return m.useEffect(()=>{$&&V.current!==R&&(V.current=R),c!==te.current&&(te.current=c),a!==q.current&&(q.current=a)},[$,R,c,a]),{active:E,attributes:k,activatorEvent:M,rect:S,index:y,isSorting:$,isDragging:P,listeners:N,node:C,overIndex:p,over:z,setNodeRef:F,setDroppableNodeRef:x,setDraggableNodeRef:j,transform:Q??A,transition:se()};function se(){if(Q||D&&V.current===y)return N3;if(!(ee||!l)&&($||G))return gl.Transition.toString({...l,property:Wv})}}const V3=[Ne.Down,Ne.Right,Ne.Up,Ne.Left],I3=(t,{context:{active:e,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(V3.includes(t.code)){if(t.preventDefault(),!e||!r)return;const s=[];n.getEnabled().forEach(a=>{if(!a||a!=null&&a.disabled)return;const c=a==null?void 0:a.node.current;if(!c)return;const u=bf(c),d={...a,rect:{current:u}};switch(t.code){case Ne.Down:r.top+r.height<=u.top&&s.push(d);break;case Ne.Up:r.top>=u.top+u.height&&s.push(d);break;case Ne.Left:r.left>=u.left+u.width&&s.push(d);break;case Ne.Right:r.left+r.width<=u.left&&s.push(d);break}});const l=IM({active:e,collisionRect:r,droppableContainers:s});if(l){var i;const a=(i=n.get(l))==null?void 0:i.node.current;if(a){const u=Zp(a).some((g,b)=>o[b]!==g),d=bf(a),f=u?{x:0,y:0}:{x:r.width-d.width,y:r.height-d.height};return{x:d.left-f.x,y:d.top-f.y}}}}};function $3(t){const{id:e,item:n,className:r,select:o,remove:i,renderItem:s,previewStyle:l}=t,{attributes:a,listeners:c,setNodeRef:u,transform:d,transition:f}=L3({id:e}),p={transform:gl.Transform.toString(d),transition:f},g=()=>o==null?void 0:o(n);return h.jsx("div",{ref:u,style:p,...a,children:h.jsxs(fe,{space:"s",onClick:g,className:r,items:"center",nowrap:!0,children:[h.jsx(U,{className:B(So.hover,"cursor-grab"),...c,children:h.jsx(ge,{icon:_e.dotsVertical,size:We.sx})}),h.jsx(U,{grow:!0,className:B("overflow-hidden"),children:h.jsxs(fe,{children:[h.jsx(U,{grow:!0,className:B("overflow-ellipsis overflow-hidden"),children:s(n)}),!!l&&h.jsx(U,{children:h.jsx("div",{className:B("w-4 h-4 gjs-bg-white",we.b,we.rnd),style:l(n)})})]})}),h.jsx(U,{className:B(So.click),onClick:b=>{Dd(b),i==null||i(n)},children:h.jsx(ge,{icon:_e.close,size:We.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}const ca=t=>t.cid??t.id;function to({className:t,items:e,selected:n,children:r,title:o,titleAdd:i,label:s,select:l,add:a,move:c,remove:u,renderItem:d,previewStyle:f}){const p=o3(vm(eh),vm(Xp,{coordinateGetter:I3}));function g(v){const{active:y,over:w}=v;if(y.id!==(w==null?void 0:w.id)){const S=e.find(x=>ca(x)===y.id),C=e.findIndex(x=>ca(x)===(w==null?void 0:w.id));S&&(c==null||c(S,C))}}const b=B(we.rnd,he.br,e.length&&we.b,e.length&&"gjs-mt-1");return h.jsxs("div",{className:B(t,"w-full"),children:[!!(s||a)&&h.jsxs(fe,{items:"center",children:[h.jsx(U,{grow:!0,children:h.jsx(gn,{size:"s",children:s})}),!!a&&h.jsx(U,{children:h.jsx(mo,{title:i,inline:!0,children:h.jsx(Cs,{onClick:a,size:"s",children:h.jsx(ge,{icon:_e.plus,size:We.s})})})})]}),h.jsx(hv,{placement:"left",size:"s",buttonAs:"div",title:o,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!n,onClose:()=>l==null?void 0:l(null),handler:h.jsx(g3,{sensors:p,collisionDetection:TM,onDragEnd:g,modifiers:[E3,C3],children:h.jsx(T3,{items:e.map(ca),strategy:_3,children:h.jsx("div",{className:b,children:e.map((v,y)=>{const w=ca(v),S=v===n,C=B("gjs-px-2 gjs-py-2 text-xs",he.br,y&&we.bt,!S&&he.hBgH2,S&&he.bgH);return h.jsx($3,{id:w,item:v,className:C,select:l,remove:u,renderItem:d,previewStyle:f},w)})})})}),children:r})]})}function Uv({children:t,title:e,classNameWrp:n,...r}){return h.jsx(mo,{title:e,classNameWrp:n,children:h.jsx(Cs,{...r,children:t})})}const _r="gs-cmp-file-field";function qv({className:t,value:e,label:n,btnLabel:r,nameLabel:o,size:i,isContain:s,clear:l,inputField:a,placeholder:c,description:u,preview:d=50,onChange:f,onOpen:p}){var S;const g=(e||"").replace(/^"|"$/gi,""),b=((S=g.split("/").pop())==null?void 0:S.split("?")[0])||"",v={minWidth:d,minHeight:d},y=g?{...v,backgroundImage:`url("${g}")`}:v,w=tt(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",s?"gs-utl-bg-contain":"gs-utl-bg-cover",we.b,we.rnd,he.br);return h.jsxs(fe,{className:tt(_r,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[!!n&&h.jsx(gn,{className:tt(`${_r}-label`),size:i,m:"",children:n}),!!u&&h.jsx(gn,{className:tt(`${_r}-desc`,he.txtLowEmphasis),size:i,as:"span",m:"",capitalize:!1,children:u}),h.jsxs(fe,{className:tt(`${_r}-content gs-utl-gap-1`,he.bg),items:"center",nowrap:!0,children:[h.jsx(U,{className:tt(`${_r}-preview`),children:h.jsx("div",{className:w,style:y})}),h.jsxs(U,{className:tt(`${_r}-fields gs-utl-overflow-hidden`),grow:!0,children:[b&&o!==!1&&h.jsx(gn,{className:tt(`${_r}-name`,"gs-utl-mb-2",So.txtEllips),as:"div",size:i,capitalize:!1,children:b}),h.jsxs(fe,{className:tt(`${_r}-buttons`),space:"s",nowrap:!0,children:[h.jsx(Cs,{onClick:()=>p==null?void 0:p(e),size:i,type:"button",block:!0,full:!0,children:r||"Select image"}),!!e&&l&&h.jsx(Uv,{onClick:()=>f==null?void 0:f(""),title:l.tooltip,size:i,icon:{icon:_e.close,size:We.s},type:"button",block:!0})]})]})]}),a&&h.jsx(Gp,{className:tt(`${_r}-input`),value:g,onChange:f,size:i,placeholder:c})]})}function ac(t){return t.isFull()||["slider","composite","stack","file"].includes(t.getType())}function H3(t){return["composite","stack"].includes(t.getType())}function cc({property:t}){switch(t.getType()){case"number":case"slider":case"integer":return h.jsx(Me,{...Fe(t)});case"color":return h.jsx(di,{...Ur(t)});case"select":return h.jsx(Je,{...De(t)});case"radio":return h.jsx(Mn,{...De(t)});case"file":return h.jsx(qv,{...i4(t)});case"composite":return h.jsx(Jt,{property:t,corners:t.get("corners"),generic:t.get("generic")});case"stack":return h.jsx(to,{...no(t),children:t.getProperties().map(e=>h.jsx(oe,{property:e,className:Re(ac(e)&&"col-span-full"),children:h.jsx(cc,{property:e})},e.getId()))});default:return h.jsx(Gp,{...Ur(t)})}}function B3({sector:t}){const e=t.getProperties().filter(n=>n.isVisible());return h.jsx("div",{className:Re("grid grid-cols-2 gap-2"),children:e.map(n=>H3(n)?h.jsx("div",{className:Re(ac(n)&&"col-span-full"),children:h.jsx(cc,{property:n})},n.getId()):h.jsx(oe,{property:n,className:Re(ac(n)&&"col-span-full"),children:h.jsx(cc,{property:n})},n.getId()))})}const z3="gs-cmp-sector-row";function pe({className:t,children:e,bottom:n,separator:r,separatorTop:o,property:i,...s}){const l=h.jsx("div",{className:B("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",we.bb,he.br)}),a=B(z3,t,"w-full gs-utl-gap-2",n),c=(Array.isArray(i)?i:[i]).filter(Boolean);return(c.length?c.some(d=>d.isVisible()):!0)?h.jsxs(h.Fragment,{children:[o&&l,h.jsx(fe,{className:a,nowrap:!0,...s,children:e}),r&&l]}):null}function Ps(t,e,n={}){const r=t.getType(),{compact:o=!1}=n,i=t.getParent(),s=t.getDefaultValue();if(r==="select"){const a={property:i.getName()};return h.jsx(Je,{...De(t,a),...e?{value:e.same?t.getValue({noDefault:!0}):"",emptyState:e.same?t.getOptionLabel(s,a)||s:"Custom",onChange:c=>e.all.map(u=>u.upValue(c))}:{}})}else return r==="color"?h.jsx(di,{...Ur(t),...e?{value:e.same?t.getValue({noDefault:!0}):"",placeholder:e.same?s:"Custom",onChange:(l,a)=>e.all.map(c=>c.upValue(l,{partial:a}))}:{}}):h.jsx(Me,{...Fe(t),...o?{pan:t.getLabel()[0]}:{},...e?{value:e.same?t.getValue({noDefault:!0}):"",valueUnit:e.same?t.getUnit():"",placeholder:e.same?s:"Custom",onChange:(l,a)=>e.all.map(c=>c.upValue(l,{partial:a})),onChangeUnit:l=>e.all.map(a=>a.upUnit(l))}:{}})}function Jt({property:t,corners:e,compact:n,generic:r,children:o,options:i}){const s={id:"custom",label:h.jsx(ge,{icon:_e.borderStyle,size:We.s}),title:"Custom"},l=[{id:"all",label:h.jsx(ge,{icon:_e.borderAllVariant,size:We.s}),title:"All"},s],[a,c]=m.useState(null),u=t.isDetached(),d=t.getProperties(),f=d.length,[p,g,b,v]=d,y=p.getFullValue(),S=d.map(W=>W.getFullValue()).every(W=>W===y),C=a!==null?a:S||i?"all":s.id,x=i?[...i,s]:[],E=t.getFullValue(),_=x.some(W=>W.id===E),M=C===s.id||(i?!_:!1)||!!r,k=h.jsx(oe,{property:n?null:p,shallow:!u,children:Ps(p,null,{compact:n})}),j=h.jsx(oe,{property:n?null:g,shallow:!u,children:Ps(g,null,{compact:n})}),N=!!b&&h.jsx(oe,{property:n?null:b,shallow:!u,children:Ps(b,null,{compact:n})}),P=!!v&&h.jsx(oe,{property:n?null:v,shallow:!u,children:Ps(v,null,{compact:n})}),z=n?{label:t.getLabel()}:{property:t};return t!=null&&t.isVisible()?h.jsxs(fe,{className:B("w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[h.jsx(pe,{children:h.jsx(oe,{...z,children:!r&&h.jsx(pe,{bottom:"0",children:o!==void 0?o:i?h.jsx(h.Fragment,{children:h.jsx(U,{grow:!0,children:h.jsx(Mn,{size:"s",options:x,value:M?s.id:E,onChange:W=>{W===s.id?c(W):(t.upValue(W),c(""))}})})}):h.jsxs(h.Fragment,{children:[h.jsx(U,{grow:!0,children:Ps(p,{same:S,all:d})}),h.jsx(U,{grow:!0,children:h.jsx(Mn,{size:"s",options:l,value:C,onChange:c})})]})})})}),M&&h.jsx(pe,{col:!0,className:B("gjs-px-2 gjs-py-1",he.bgH2,we.rnd,we.b,he.br),children:r?h.jsx("div",{className:B("grid grid-cols-2 gap-2"),children:d.map(W=>h.jsx(oe,{property:W,shallow:!u,className:B(ac(W)&&"col-span-full"),children:h.jsx(cc,{property:W})},W.getId()))}):f===2?h.jsx(h.Fragment,{children:h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:k}),h.jsx(U,{grow:!0,children:j})]})}):f===3?h.jsxs(h.Fragment,{children:[h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:k}),h.jsx(U,{grow:!0,children:j})]}),h.jsx(fe,{space:"s",children:h.jsx(U,{grow:!0,children:N})})]}):e?h.jsxs(h.Fragment,{children:[h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:k}),h.jsx(U,{grow:!0,children:j})]}),h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:P}),h.jsx(U,{grow:!0,children:N})]})]}):h.jsxs(h.Fragment,{children:[h.jsx(fe,{className:B("gs-utl-w-1/2 gjs-m-auto"),children:k}),h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:P}),h.jsx(U,{grow:!0,children:j})]}),h.jsx(fe,{className:B("gs-utl-w-1/2 gjs-m-auto"),children:N})]})})]}):null}function F3({sector:t}){const e=t.getProperty("border-radius");return h.jsxs(h.Fragment,{children:[h.jsx(Jt,{property:e,corners:!0}),h.jsx(Jt,{property:t.getProperty("border-width")}),h.jsx(Jt,{property:t.getProperty("border-style")}),h.jsx(Jt,{property:t.getProperty("border-color")})]})}const Io=t=>ru({value:parseFloat(t),min:-3,max:3}),rd=(t,e="filter")=>{const n=t.getProperty(`${e}-value`),r=t.getProperty(`${e}-name`).getOption()||{},o=r.units||[],i=n.getUnit(),s=uM(i,o)?i:o[0];return{...Fe(n),units:o,valueUnit:s,onChange:(l,a)=>{n.upValue(l,{partial:a,units:o,min:r.min,max:r.max})}}},Cm=(t,e)=>{const n=t.getProperty(`${e}-name`),r=t.getProperty(`${e}-value`);return{...De(n),onChange:o=>{n.upValue(o),r.upValue("")}}},W3={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function U3({sector:t}){const e=t.getProperty("box-shadow"),n=t.getProperty("text-shadow"),r=t.getProperty("filter"),o=t.getProperty("backdrop-filter"),i=t.getProperty("transition"),s=t.getProperty("transform"),l=t.getProperty("perspective-origin"),a=t.getProperty("backface-visibility"),c=t.getProperty("perspective"),u=t.getProperty("transform-style"),d=t.getProperty("opacity"),f=t.getProperty("mix-blend-mode"),p=t.getProperty("cursor"),g=v=>{const{boxShadowH:y,boxShadowV:w,boxShadowBlur:S,boxShadowColor:C,boxShadowSpread:x,boxShadowType:E}=v.getValues({camelCase:!0}),_=Io(y),M=Io(w),k=Io(S),j=Io(x),N=`${_}px ${M}px ${k}px ${j}px ${C} ${E}`.trim();return h.jsxs(fe,{space:"s",items:"center",children:[h.jsxs(U,{grow:!0,children:[y," ",w," ",S," ",x]}),h.jsx(U,{children:h.jsx("div",{className:B("w-4 h-4 gjs-bg-white",we.b,we.rnd),style:{boxShadow:N}})})]})},b=v=>{const{textShadowH:y,textShadowV:w,textShadowBlur:S,textShadowColor:C}=v.getValues({camelCase:!0}),x=Io(y),E=Io(w),_=Io(S),M=`${x}px ${E}px ${_}px ${C}`.trim();return h.jsxs(fe,{space:"s",items:"center",children:[h.jsxs(U,{grow:!0,children:[y," ",w," ",S]}),h.jsx(U,{children:h.jsx("div",{className:B("w-4 h-4 gjs-bg-white",we.b,we.rnd),style:{boxShadow:M}})})]})};return h.jsxs(h.Fragment,{children:[h.jsxs(pe,{property:[d,f],children:[h.jsx(oe,{property:d,children:h.jsx(Me,{...Fe(d)})}),h.jsx(oe,{property:f,children:h.jsx(Je,{...De(f)})})]}),h.jsx(pe,{property:p,separator:!0,children:h.jsx(oe,{property:p,children:h.jsx(Je,{...De(p)})})}),h.jsx(pe,{property:e,separator:!0,children:h.jsxs(to,{...no(e),renderItem:g,children:[h.jsx(pe,{children:h.jsx(Mn,{...De(e.getProperty("box-shadow-type"))})}),h.jsxs(pe,{children:[h.jsx(oe,{label:"X offset",children:h.jsx(Me,{...Fe(e.getProperty("box-shadow-h"))})}),h.jsx(oe,{label:"Y offset",children:h.jsx(Me,{...Fe(e.getProperty("box-shadow-v"))})})]}),h.jsxs(pe,{children:[h.jsx(oe,{label:"Blur",children:h.jsx(Me,{...Fe(e.getProperty("box-shadow-blur"))})}),h.jsx(oe,{label:"Spread",children:h.jsx(Me,{...Fe(e.getProperty("box-shadow-spread"))})})]}),h.jsx(pe,{children:h.jsx(oe,{label:"Color",children:h.jsx(di,{...Ur(e.getProperty("box-shadow-color"))})})})]})}),h.jsx(pe,{property:n,separator:!0,children:h.jsxs(to,{...no(n,W3),renderItem:b,children:[h.jsxs(pe,{children:[h.jsx(oe,{label:"X offset",children:h.jsx(Me,{...Fe(n.getProperty("text-shadow-h"))})}),h.jsx(oe,{label:"Y offset",children:h.jsx(Me,{...Fe(n.getProperty("text-shadow-v"))})})]}),h.jsx(pe,{children:h.jsx(oe,{label:"Blur",children:h.jsx(Me,{...Fe(n.getProperty("text-shadow-blur"))})})}),h.jsx(pe,{children:h.jsx(oe,{label:"Color",children:h.jsx(di,{...Ur(n.getProperty("text-shadow-color"))})})})]})}),h.jsx(pe,{property:r,separator:!0,children:h.jsx(to,{...no(r,{"filter-name":"blur","filter-value":"3px"}),children:h.jsxs(pe,{children:[h.jsx(oe,{label:"Type",children:h.jsx(Je,{...Cm(r,"filter")})}),h.jsx(oe,{label:"Value",children:h.jsx(Me,{...rd(r)})})]})})}),h.jsx(pe,{property:o,separator:!0,children:h.jsx(to,{...no(o,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:h.jsxs(pe,{children:[h.jsx(oe,{label:"Type",children:h.jsx(Je,{...De(o.getProperty("backdrop-filter-name"))})}),h.jsx(oe,{label:"Value",children:h.jsx(Me,{...rd(o,"backdrop-filter")})})]})})}),h.jsx(pe,{property:i,separator:!0,children:h.jsxs(to,{...no(i),children:[h.jsx(pe,{children:h.jsx(oe,{label:"Type",children:h.jsx(Je,{...De(i.getProperty("transition-property"))})})}),h.jsx(pe,{children:h.jsx(oe,{label:"Easing",children:h.jsx(Je,{...De(i.getProperty("transition-timing-function"))})})}),h.jsxs(pe,{children:[h.jsx(oe,{label:"Duration",children:h.jsx(Me,{...Fe(i.getProperty("transition-duration"))})}),h.jsx(oe,{label:"Delay",children:h.jsx(Me,{...Fe(i.getProperty("transition-delay"))})})]})]})}),h.jsx(pe,{property:s,separator:!0,children:h.jsx(to,{...no(s),children:h.jsxs(pe,{children:[h.jsx(oe,{label:"Type",children:h.jsx(Je,{...Cm(s,"transform")})}),h.jsx(oe,{label:"Value",children:h.jsx(Me,{...rd(s,"transform")})})]})})}),h.jsx(Jt,{property:t.getProperty("transform-origin")}),h.jsx(Jt,{property:t.getProperty("overflow")}),h.jsx(pe,{property:a,children:h.jsx(oe,{property:a,children:h.jsx(Mn,{...De(a)})})}),h.jsx(pe,{property:[c,u,l],separatorTop:!0,children:"Children transform"}),h.jsxs(pe,{property:[c,u],children:[h.jsx(oe,{property:c,children:h.jsx(Me,{...Fe(c)})}),h.jsx(oe,{property:u,children:h.jsx(Mn,{...De(u)})})]}),h.jsx(Jt,{property:l})]})}function q3(t,e){return t.indexOf(e)>=0}const Ye=We.s,ua="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",da="M6 6v12h13V6H6zm0-1h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm6-5h1v24h-1V0z",fa="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Em="M2 6v12h6V6H2zm0 13v5H1V0h1v5h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H2zM16 6v12h6V6h-6zm6-1V0h1v24h-1v-5h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1h6z",Om="M11 0h1v24h-1V0zM1 6h6v12H1V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H1a1 1 0 01-1-1V6c0-.6.4-1 1-1zm15 1h6v12h-6V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1z",G3="M3 6v12h6V6H3zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H3a1 1 0 01-1-1V6c0-.6.4-1 1-1zM0 0h1v24H0V0zm14 6v12h6V6h-6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm8-5h1v24h-1V0zM11 0h1v24h-1V0z",od="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function K3({sector:t}){const{editor:e}=Hl(),n=dp(),[r,o]=m.useState({}),[i,s]=m.useState({}),l=t.getProperty("display"),a=t.getProperty("flex-direction"),c=t.getProperty("justify-content"),u=t.getProperty("align-items"),d=t.getProperty("flex-wrap"),f=t.getProperty("align-content"),p=t.getProperty("align-self"),g=t.getProperty("order"),b=P=>n.t(`styleManager.layout.${P}`),v=l.getValue(),y=v==="flex",w=(i.display||"").indexOf("flex")>=0,S=a.getValue(),C=S.indexOf("reverse")>=0,x=!q3(["column","column-reverse"],S),E=[{id:"row",label:h.jsx(ge,{icon:_e.arrowRight,size:We.sx}),title:b("direction.title.row")},{id:"row-reverse",label:h.jsx(ge,{icon:_e.arrowRight,size:Ye,horizontal:!0}),title:b("direction.title.row-reverse")},{id:"column",label:h.jsx(ge,{icon:_e.arrowDown,size:We.sx}),title:b("direction.title.column")},{id:"column-reverse",label:h.jsx(ge,{icon:_e.arrowDown,size:Ye,vertical:!0}),title:b("direction.title.column-reverse")}],_=[{id:"flex-start",title:"Start",label:h.jsx(ge,{icon:ua,size:Ye,rotate:x?0:90,horizontal:x&&C,vertical:!x&&C})},{id:"center",title:"Center",label:h.jsx(ge,{icon:da,size:Ye,rotate:x?0:90})},{id:"flex-end",title:"End",label:h.jsx(ge,{icon:fa,size:Ye,rotate:x?0:90,horizontal:x&&C,vertical:!x&&C})},{id:"space-between",title:"Space between",label:h.jsx(ge,{icon:Em,size:Ye,rotate:x?0:90})},{id:"space-around",title:"Space around",label:h.jsx(ge,{icon:Om,size:Ye,rotate:x?0:90})},{id:"space-evenly",title:"Space evenly",label:h.jsx(ge,{icon:G3,size:Ye,rotate:x?0:90})}],M=[{id:"stretch",title:"Stretch",label:h.jsx(ge,{icon:od,size:Ye,rotate:x?0:90})},{id:"flex-start",title:"Start",label:h.jsx(ge,{icon:ua,size:Ye,rotate:x?90:0})},{id:"center",title:"Center",label:h.jsx(ge,{icon:da,size:Ye,rotate:x?90:0})},{id:"flex-end",title:"End",label:h.jsx(ge,{icon:fa,size:Ye,rotate:x?90:0})}],k=[{id:"flex-start",title:"Start",label:h.jsx(ge,{icon:ua,size:Ye,rotate:x?90:0,horizontal:x&&C,vertical:!x&&C})},{id:"center",title:"Center",label:h.jsx(ge,{icon:da,size:Ye,rotate:x?90:0})},{id:"flex-end",title:"End",label:h.jsx(ge,{icon:fa,size:Ye,rotate:x?90:0,horizontal:x&&C,vertical:!x&&C})},{id:"space-between",title:"Space between",label:h.jsx(ge,{icon:Em,size:Ye,rotate:x?90:0})},{id:"space-around",title:"Space around",label:h.jsx(ge,{icon:Om,size:Ye,rotate:x?90:0})},{id:"stretch",title:"Stretch",label:h.jsx(ge,{icon:od,size:Ye,rotate:x?0:90})}],j=[{id:"auto",title:"Auto",label:h.jsx(ge,{icon:_e.close,size:Ye})},{id:"flex-start",title:"Start",label:h.jsx(ge,{icon:ua,size:Ye,rotate:90})},{id:"center",title:"Center",label:h.jsx(ge,{icon:da,size:Ye,rotate:90})},{id:"flex-end",title:"End",label:h.jsx(ge,{icon:fa,size:Ye,rotate:90})},{id:"stretch",title:"Stretch",label:h.jsx(ge,{icon:od,size:Ye,rotate:0})}],N=[{id:"0 0 auto",label:h.jsx(ge,{icon:_e.close,size:Ye}),title:"Auto"},{id:"1 1 0%",label:h.jsx(ge,{icon:_e.unfoldMoreHorizontal,size:Ye,rotate:90}),title:"Fill container"},{id:"0 1 auto",label:h.jsx(ge,{icon:_e.unfoldLessHorizontal,size:Ye,rotate:90}),title:"Hug contents"}];return m.useEffect(()=>{if(!e)return()=>{};const{Styles:P}=e,z=()=>{const F=e.getSelected();let $={},J={};if(F){const ee=F.getEl();if(ee){$=window.getComputedStyle(ee);const L=ee.parentElement;L&&(J=window.getComputedStyle(L))}}o($),s(J)},W=P.events.target;return e.on(W,z),z(),()=>e.off(W,z)},[e]),h.jsxs(h.Fragment,{children:[h.jsx(pe,{children:h.jsx(oe,{property:l,tooltip:b(`display.tips.${v}`),row:!0,children:h.jsx(Je,{...De(l)})})}),y&&h.jsxs(h.Fragment,{children:[h.jsx(pe,{children:h.jsx(oe,{property:a,children:h.jsx(Mn,{...De(a),options:E})})}),h.jsx(pe,{children:h.jsx(oe,{property:c,children:h.jsx(Mn,{...De(c),options:_})})}),h.jsx(pe,{children:h.jsx(oe,{property:u,children:h.jsx(Mn,{...De(u),options:M})})}),h.jsx(pe,{children:h.jsx(Jt,{property:t.getProperty("gap")})}),h.jsx(pe,{children:h.jsx(oe,{property:d,row:!0,children:h.jsx(Je,{...De(d)})})}),d.getValue()!=="nowrap"&&h.jsx(pe,{children:h.jsx(oe,{property:f,children:h.jsx(Mn,{...De(f),options:k})})})]}),w&&h.jsxs(h.Fragment,{children:[h.jsx(pe,{separatorTop:!0,children:b("flexChild")}),h.jsx(pe,{children:h.jsx(Jt,{property:t.getProperty("flex"),options:N})}),h.jsx(pe,{children:h.jsx(oe,{property:p,children:h.jsx(Mn,{...De(p),options:j})})}),h.jsx(pe,{children:h.jsx(oe,{property:g,row:!0,children:h.jsx(Me,{...Fe(g)})})})]})]})}const Y3=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function J3({sector:t}){var f;const e=dp(),n=t.getProperty("position"),r=n.getValue(),o=t.getProperty("top"),i=t.getProperty("right"),s=t.getProperty("bottom"),l=t.getProperty("left"),a=p=>e.t(`styleManager.position.${p}`),c=Y3.map(p=>({id:p,label:a(`presets.options.${p}`)})),u=["absolute","fixed"].includes(r),d=p=>{let g="auto",b="auto",v="auto",y="auto";switch(p){case"topLeft":g="0%",y="0%";break;case"topRight":g="0%",b="0%";break;case"bottomLeft":v="0%",y="0%";break;case"bottomRight":v="0%",b="0%";break;case"left":g="0%",v="0%",y="0%";break;case"right":g="0%",v="0%",b="0%";break;case"bottom":y="0%",v="0%",b="0%";break;case"top":y="0%",g="0%",b="0%";break;case"full":y="0%",g="0%",b="0%",v="0%";break}o.upValue(g),i.upValue(b),s.upValue(v),l.upValue(y)};return h.jsxs(h.Fragment,{children:[h.jsxs(pe,{children:[h.jsx(oe,{property:n,tooltip:a(`tips.${(f=n.getOption())==null?void 0:f.id}`),row:!0,children:h.jsx(Je,{...De(n)})}),u&&h.jsx(U,{children:h.jsx(mo,{title:a("presets.title"),children:h.jsx(Je,{options:c,onChange:d,emptyState:"P",size:"s",caret:"",value:!0})})})]}),r!=="static"&&h.jsxs(h.Fragment,{children:[h.jsxs(pe,{col:!0,children:[h.jsx(fe,{className:B("gs-utl-w-1/2 gjs-m-auto"),children:h.jsx(oe,{property:o,children:h.jsx(Me,{...Fe(o)})})}),h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:h.jsx(oe,{property:l,children:h.jsx(Me,{...Fe(l)})})}),h.jsx(U,{grow:!0,children:h.jsx(oe,{property:i,children:h.jsx(Me,{...Fe(i)})})})]}),h.jsx(fe,{className:B("gs-utl-w-1/2 gjs-m-auto"),children:h.jsx(oe,{property:s,children:h.jsx(Me,{...Fe(s)})})})]}),h.jsx(pe,{children:h.jsx(oe,{property:t.getProperty("z-index"),children:h.jsx(Me,{...Fe(t.getProperty("z-index"))})})})]})]})}function Z3({sector:t}){const e=t.getProperty("width"),n=t.getProperty("min-width"),r=t.getProperty("max-width"),o=t.getProperty("height"),i=t.getProperty("min-height"),s=t.getProperty("max-height");return h.jsxs(h.Fragment,{children:[h.jsxs(pe,{property:[e,o],children:[h.jsx(oe,{property:e,children:h.jsx(Me,{...Fe(e)})}),h.jsx(oe,{property:o,children:h.jsx(Me,{...Fe(o)})})]}),h.jsxs(pe,{property:[n,i],children:[h.jsx(oe,{property:n,children:h.jsx(Me,{...Fe(n)})}),h.jsx(oe,{property:i,children:h.jsx(Me,{...Fe(i)})})]}),h.jsxs(pe,{property:[r,s],children:[h.jsx(oe,{property:r,children:h.jsx(Me,{...Fe(r)})}),h.jsx(oe,{property:s,children:h.jsx(Me,{...Fe(s)})})]})]})}function X3({sector:t}){return h.jsxs(h.Fragment,{children:[h.jsx(Jt,{property:t.getProperty("padding")}),h.jsx(Jt,{property:t.getProperty("margin")})]})}function Q3({sector:t}){const e=t.getProperty("font-family"),n=t.getProperty("color"),r=t.getProperty("font-size"),o=t.getProperty("font-weight"),i=t.getProperty("line-height"),s=t.getProperty("letter-spacing"),l=t.getProperty("text-align"),a=t.getProperty("vertical-align"),c=t.getProperty("text-decoration"),u=t.getProperty("text-transform"),d=t.getProperty("direction"),f=t.getProperty("white-space");return h.jsxs(h.Fragment,{children:[!!e&&h.jsx(pe,{property:e,children:h.jsx(oe,{property:e,children:h.jsx(Je,{...De(e)})})}),!!n&&h.jsx(pe,{property:n,children:h.jsx(oe,{property:n,children:h.jsx(di,{...Ur(n)})})}),h.jsxs(pe,{property:[r,o],children:[!!r&&h.jsx(oe,{property:r,children:h.jsx(Me,{...Fe(r)})}),!!o&&h.jsx(oe,{property:o,children:h.jsx(Je,{...De(o)})})]}),h.jsxs(pe,{property:[i,s],children:[!!i&&h.jsx(oe,{property:i,children:h.jsx(Me,{...Fe(i)})}),!!s&&h.jsx(oe,{property:s,children:h.jsx(Me,{...Fe(s)})})]}),h.jsxs(pe,{property:[l,a],children:[!!l&&h.jsx(oe,{property:l,children:h.jsx(Je,{...De(l)})}),!!a&&h.jsx(oe,{property:a,children:h.jsx(Je,{...De(a)})})]}),h.jsxs(pe,{property:[u,d],children:[!!u&&h.jsx(oe,{property:u,children:h.jsx(Je,{...De(u)})}),!!d&&h.jsx(oe,{property:d,children:h.jsx(Je,{...De(d)})})]}),h.jsxs(pe,{property:[f,c],children:[!!f&&h.jsx(oe,{property:f,children:h.jsx(Je,{...De(f)})}),!!c&&h.jsx(oe,{property:c,children:h.jsx(Je,{...De(c)})})]})]})}const Gv="gs-style-manager",th=`${Gv}-sector`,e4=`${th}-header`,t4=`${th}-content`,n4=(t,e=0,n=!0)=>B(e4,he.bgH2,dr.xyS,he.br,e&&we.bt,(t||n)&&we.bb),r4=(t,e={})=>t.getOptions().map(n=>({id:t.getOptionId(n),label:t.getOptionLabel(t.getOptionId(n),e),title:n.title})),o4=(t,e)=>e.map(n=>({...n,title:t.getOptionLabel(t.getOptionId(n))})),De=(t,e={})=>({size:"s",options:r4(t,e),value:t.getValue(),onChange:n=>t.upValue(n)}),no=(t,e={})=>({title:t.getLabel(),titleAdd:`Add new ${t.getLabel()}`,items:t.getLayers(),selected:t.getSelectedLayer(),renderItem:n=>t.getLayerLabel(n),add:()=>t.addLayer(e,{at:0}),select:n=>t.selectLayer(n),remove:n=>t.removeLayer(n),move:(n,r=0)=>t.moveLayer(n,r),label:h.jsx(oe,{property:t})}),Fe=t=>({size:"s",value:t.getValue({noDefault:!0}),valueUnit:t.getUnit(),units:t.getUnits(),placeholder:t.getDefaultValue(),onChangeUnit:e=>t.upUnit(e),onChange:(e,n)=>t.upValue(e,{partial:n})}),Ur=t=>({size:"s",value:t.getValue({noDefault:!0}),placeholder:t.getDefaultValue(),onChange:(e,n)=>t.upValue(e,{partial:n})}),i4=t=>({...Ur(t),onOpen(){const e=t.em.Assets;e.open({select(n){t.upValue(n.getSrc()),e.close()}})}}),s4=t=>{const e=t.getId();let n=B3;switch(e){case"gs-layout":n=K3;break;case"gs-size":n=Z3;break;case"gs-space":n=X3;break;case"gs-position":n=J3;break;case"gs-borders":n=F3;break;case"gs-effects":n=U3;break;case"gs-typography":n=Q3;break;case"gs-background":n=g4;break}return h.jsx(n,{sector:t})};ms(function({className:e,sectors:n}){const{editor:r}=Hl();if(!r)return null;const{Styles:o}=r,i=o.getSelected(),s=n.length?n:o.getSectors({visible:!0});return i?h.jsx("div",{className:B(Gv,e,"select-none"),children:s.map((l,a)=>h.jsx(MA,{classNameWrap:th,sticky:!0,handler:()=>{const c=l.getProperties({withValue:!0}).length>0,u=l.getProperties({withParentValue:!0}).length>0;return h.jsxs(fe,{space:"xs",items:"center",children:[h.jsx(U,{className:B("gjs-mr-2"),children:l.getName()}),c&&h.jsx(U,{children:h.jsx("div",{className:B(So.dot,he.bgA2)})}),u&&h.jsx(U,{children:h.jsx("div",{className:B(So.dot,he.bgW)})})]})},className:c=>n4(c,a,a===s.length-1),children:h.jsx(fe,{className:B(t4,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:s4(l)})},l.getId()))}):null});function _m({value:t,label:e,border:n,size:r="m",tip:o,disabled:i,onChange:s}){const l=!!t,a=B("relative inline-flex items-center h-6 gjs-rounded-full w-11 transition-colors focus:gs-utl-outline-none",l?he.bgA:he.bgH,nc.focus,n&&`${he.br} ${we.b}`);return h.jsx(zu.Group,{children:h.jsxs(fe,{full:!0,items:"center",children:[!!e&&h.jsx(zu.Label,{className:B("gs-utl-mr-4 gs-utl-flex-1 gs-utl-flex gs-utl-gap-2 gs-utl-items-center"),passive:!0,children:h.jsx(gn,{as:"span",size:r,tip:o,m:"",children:e})}),h.jsx(zu,{checked:l,onChange:s,className:a,disabled:i,children:h.jsx("span",{className:B(he.bg,"inline-block w-4 h-4 transform gjs-rounded-full transition-transform",l?"translate-x-6":"translate-x-1")})})]})})}const l4=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,a4=/,(?![^(]*\))/,id=/\s(?![^(]*\))/,c4=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,sd=/^circle|ellipse/i,nh=t=>{var u;const e=[],{name:n,value:r}=eu(t),[o,...i]=r.split(a4).map(d=>d.trim()).filter(Boolean),s=i.length>1,l=s?o:"",a={type:"none"},c=s?i:[o,...i];if(l4.test(l))a.type="angle",a.value=l;else if(/^to\s/.test(l))a.type="side-or-corner",a.value=l;else if(c4.test(l))a.type="size",a.value=l;else if(sd.test(l)||/^at\s/.test(l)||/\sat\s/.test(l)){a.type="at",a.value=l;const d=((u=l.match(sd))==null?void 0:u[0])||"circle";a.shape=d;const f={x:"0%",y:"0%"},p={x:"0%",y:"0%"},[g,b]=l.replace(sd,"").trim().split("at").map(v=>v.trim());if(g){const[v,y]=g.split(id);f.x=v,f.y=y||v}if(b){const[v,y]=b.split(id);p.x=v,p.y=y||v}a.size=f,a.position=p}return c.forEach(d=>{const[f,p]=d.split(id);e.push({color:f,hint:p?parseFloat(p):null})}),e.forEach((d,f)=>{d.hint===null&&(d.hint=f/(e.length-1)*100)}),{name:n,orientation:a,colorStops:e}},Xr=({stops:t,orientation:e="to right",name:n="linear-gradient"})=>{const o=(t.length===1?[{color:t[0].color,hint:null},{color:t[0].color,hint:null}]:t).map(i=>`${i.color} ${i.hint?`${i.hint}%`:""}`.trim()).join(", ");return o?`${n}(${e}, ${o})`:"none"},u4=t=>t.slice().sort((e,n)=>(e.hint||0)-(n.hint||0)),d4="gs-cmp-grad-picker";function f4({className:t,value:e,onChange:n}){var $,J,ee;const r=nh(e),[o,i]=m.useState(r.colorStops),[s,l]=m.useState(null),a=m.useRef(null),c=B(d4,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",t,we.rnd),u=r.name||"linear-gradient",d=u.indexOf("radial")>=0,f=u.indexOf("repeating")>=0,p=r.orientation.value,g=`${parseFloat(`${p}`)||180}`,b=`${parseFloat(`${($=r.orientation.size)==null?void 0:$.x}`)||0}`,v=`${parseFloat(`${(J=r.orientation.position)==null?void 0:J.x}`)||0}`,y=`${parseFloat(`${(ee=r.orientation.position)==null?void 0:ee.y}`)||0}`,w=0,S=100,C=(L,I=!1)=>{const A=u4(L);i(A),n==null||n(Xr({name:u,orientation:p,stops:A}),I)},x=(L,I=!1)=>{n==null||n(Xr({stops:o,name:u,orientation:`${L}deg`}),I)},E=(L,I=!1)=>{n==null||n(Xr({stops:o,name:u,orientation:`${L}px at ${v}% ${y}%`}),I)},_=(L,I=!1)=>{n==null||n(Xr({stops:o,name:u,orientation:`${b}px at ${L}% ${y}%`}),I)},M=(L,I=!1)=>{n==null||n(Xr({stops:o,name:u,orientation:`${b}px at ${v}% ${L}%`}),I)},k=L=>{const I=`${L?"repeating-":""}${d?"radial":"linear"}-gradient`;n==null||n(Xr({stops:o,orientation:p,name:I}))},j=L=>{const I=`${f?"repeating-":""}${L?"radial":"linear"}-gradient`;n==null||n(Xr({stops:o,orientation:L?"100px at 50% 50%":"90deg",name:I}))};m.useEffect(()=>{if(!s)return;const L=parseFloat(`${s.stop.hint}`),I=R=>{let D=(R.clientX-s.x)*100;D=D/s.w,D=L+D,D=D<w?w:D,D=D>S?S:D,s.stop.hint=parseInt(`${D}`,10),C(o,!0)},A=()=>{l(null),C(o)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",A),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",A),A()}},[s]);const N=(L,I)=>{const A=a.current;l({stop:I,w:(A==null?void 0:A.clientWidth)||0,h:(A==null?void 0:A.clientHeight)||0,x:L.clientX,y:L.clientY})},P=L=>{const I=a.current,A=(I==null?void 0:I.clientWidth)||0,R=(I==null?void 0:I.clientHeight)||0,q=L.nativeEvent.offsetX-((I==null?void 0:I.clientLeft)||0),D=L.nativeEvent.offsetY-((I==null?void 0:I.clientTop)||0),V=q/A*100,te=document.createElement("canvas"),G=te.getContext("2d");if(!G)return;te.width=A,te.height=R;const Q=G.createLinearGradient(0,0,A,R);o.forEach(X=>Q.addColorStop(parseFloat(`${X.hint}`)/100,X.color)),G.fillStyle=Q,G.fillRect(0,0,te.width,te.height),te.style.background="black";const se=G.getImageData(q,D,1,1).data,be=se[3]?(100/255*se[3]/100).toFixed(2):0,de=`rgba(${se[0]}, ${se[1]}, ${se[2]}, ${be})`,Pe=de==="rgba(0, 0, 0, 0)"?"#000":de;C([...o,{color:Pe,hint:V}])},z=L=>{C(o.filter(I=>I!==L))},W=(L,I,A)=>{I&&(L.color=I),C(o,A)},F=L=>(s==null?void 0:s.stop)===L;return h.jsxs(fe,{className:c,col:!0,children:[!!(s!=null&&s.stop)&&h.jsx("div",{className:B("fixed inset-0 z-50 cursor-colr")}),h.jsxs("div",{className:B("relative gjs-mb-6 gjs-mt-3"),children:[h.jsx("div",{className:B("bg-checker h-8",we.rnd),children:h.jsx("div",{ref:a,className:B("w-full h-full cursor-cross",we.b,we.rnd,he.br),style:{backgroundImage:Xr({stops:o})},onClick:P})}),o.map((L,I)=>h.jsxs("div",{className:B("absolute top-0 h-full"),style:{left:`${L.hint}%`},children:[h.jsx("div",{className:B("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>z(L),children:h.jsx(ge,{icon:_e.close,size:We.s3x})}),h.jsx("div",{onPointerDown:A=>N(A,L),className:B("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",we.br,we.bl,F(L)?"gjs-bg-white":"gjs-bg-black")}),h.jsx("div",{className:B("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:h.jsx(Ov,{value:L.color,onChange:(A,R)=>W(L,A,R),className:B("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},I))]}),h.jsxs(fe,{space:"s",items:"center",children:[h.jsx(U,{grow:!0,children:h.jsx(_m,{label:"Repeat",value:f,onChange:k})}),h.jsx(U,{grow:!0,children:h.jsx(_m,{label:"Radial",value:d,onChange:j})})]}),d?h.jsxs(fe,{space:"s",col:!0,children:[h.jsx(U,{children:h.jsx(fe,{space:"s",items:"center",children:h.jsx(U,{grow:!0,children:h.jsx(Me,{pan:"S",size:"s",value:b,onChange:E,valueUnit:"px",units:["px"]})})})}),h.jsx(U,{children:h.jsxs(fe,{space:"s",children:[h.jsx(U,{grow:!0,children:h.jsx(Me,{pan:"X",size:"s",value:v,onChange:_,valueUnit:"%",units:["%"]})}),h.jsx(U,{grow:!0,children:h.jsx(Me,{pan:"Y",size:"s",value:y,onChange:M,valueUnit:"%",units:["%"]})})]})})]}):h.jsx(fe,{space:"s",items:"center",nowrap:!0,children:h.jsx(U,{grow:!0,children:h.jsx(Me,{pan:"A",size:"s",value:g,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}var uo=(t=>(t.Image="image",t.Gradient="gradient",t.Color="color",t))(uo||{});const La="background-image",lr="__background-type",el=La,Kv="https://placehold.co/150/777/white.png?text=IMAGE",xf="50px",p4={[lr]:"image","background-image":`url("${Kv}")`,"background-size":`${xf} ${xf}`,"background-repeat":"repeat","background-position":"0px 0px"},h4=t=>(t.includes("gradient(")?nh(t).colorStops[0].color:t)||"";function g4({sector:t}){var v;const e=yA(),n=t.getProperty("background"),r=n.getProperty(lr),o=n.getProperty("background-image"),i=n.getProperty("background-position"),s=n.getProperty("background-size"),l=t.getProperty("background-color"),a=t.getProperty("background-clip"),c=((v=n.getSelectedLayer())==null?void 0:v.getIndex())||-1,u=r==null?void 0:r.getValue(),d=u==="image",f=o.getValue(),p=()=>{const y=e.Assets;y.open({select(w){const S=w.getSrc();o.upValue(`url("${S}")`),y.close()}})},g=y=>{let w="none",S="100%";y==="image"?(w=`url("${Kv}")`,S=xf):y==="gradient"?w="linear-gradient(90deg, black 10%, white 90%)":y==="color"&&(w="rgba(0, 0, 0, 0.5)"),o.upValue(w),r.upValue(y),i.upValue("0 0"),s.upValue(`${S} ${S}`)},b=o4(r,[{id:"image",label:h.jsx(ge,{icon:_e.image,size:We.s})},{id:"gradient",label:h.jsx(ge,{icon:_e.gradientVertical,size:We.s})},{id:"color",label:h.jsx(ge,{icon:_e.checkboxBlank,size:We.s})}]);return h.jsxs(h.Fragment,{children:[h.jsx(pe,{property:n,separator:!0,children:h.jsxs(to,{...no(n,p4),previewStyle:y=>n.getStyleFromLayer(y,{camelCase:!0}),children:[h.jsx(pe,{children:h.jsx(oe,{label:"Type",children:h.jsx(Mn,{...De(r),options:b,onChange:g})})}),h.jsx(pe,{children:h.jsxs(oe,{children:[d&&h.jsx(qv,{value:eu(f).value,onOpen:p}),u==="color"&&h.jsx(di,{...Ur(o),value:h4(f)}),u==="gradient"&&h.jsx(f4,{value:f,onChange:(y,w)=>o.upValue(y,{partial:w})},c)]})}),d&&h.jsxs(h.Fragment,{children:[h.jsx(pe,{col:!0,children:h.jsx(Jt,{property:i})}),h.jsx(pe,{col:!0,children:h.jsx(Jt,{property:s})}),h.jsxs(pe,{children:[h.jsx(oe,{label:n.getProperty("background-repeat").getLabel(),children:h.jsx(Je,{...De(n.getProperty("background-repeat"))})}),h.jsx(oe,{label:n.getProperty("background-attachment").getLabel(),children:h.jsx(Je,{...De(n.getProperty("background-attachment"))})})]}),h.jsx(pe,{children:h.jsx(oe,{label:n.getProperty("background-origin").getLabel(),children:h.jsx(Je,{...De(n.getProperty("background-origin"))})})})]})]})}),h.jsx(pe,{property:l,children:h.jsx(oe,{property:l,children:h.jsx(di,{...Ur(l)})})}),h.jsx(pe,{property:a,children:h.jsx(oe,{property:a,children:h.jsx(Je,{...De(a)})})})]})}const pa=["%"],ha=["s","ms"],Ds=["deg","rad","grad"],nr=["px","%","em","rem","vw","vh"],km={type:"select",options:["visible","hidden","scroll","auto"].map(t=>({id:t})),default:"visible"},m4=t=>`linear-gradient(${t} 1%, ${t} 100%)`,uc=t=>({id:t,label:t.split("-").map(Ld).join(" ")}),Yv=t=>({property:e,to:n})=>{if(n.value){const r=e.getOption(),o=e.getParent().getProperty(t),i=o.getUnit(),s={units:r.units||[],min:r.min,max:r.max,unit:""};(!i||(s==null?void 0:s.units.indexOf(i))<0)&&(s.unit=(s==null?void 0:s.units[0])||""),o.up(s)}},b4=t=>{const e=`${t}-name`,n=`${t}-value`;return(r,{separatorLayers:o})=>{const i=r[t]||"";return i?i.split(o).map(s=>{const{name:l,value:a}=eu(s);return{[e]:l,[n]:a}}):[]}},Tm=t=>{const e={[el]:t};if(t.indexOf("url(")>-1)e[lr]=uo.Image;else if(t.indexOf("gradient(")>-1){const n=nh(t),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?e[lr]=uo.Color:e[lr]=uo.Gradient}else e[lr]=uo.Color,e[el]=m4(t);return e},Am=(t="filter")=>{const e=`${t}-name`,n=`${t}-value`;return{property:t,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:o}){const i=r[t]||"";return i?i.split(o).map(s=>{const{name:l,value:a}=eu(s);return{[e]:l,[n]:a}}):[]},toStyle(r,{name:o}){return{[o]:`${r[e]}(${r[n]||"0"})`}},properties:[{property:e,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:Yv(n)},{property:n,type:"integer"}]}},ga=(t,{x:e,y:n,mergable:r}={})=>{const o={property:`${t}-x`,type:"integer",units:nr,...e},i={property:`${t}-y`,type:"integer",units:nr,...n};return{property:t,type:"composite",properties:[o,i],...r&&{fromStyle(s,{name:l,separator:a,property:c}){const[u,d]=c.getProperties(),[f,p]=(s[l]||"").split(a);return{[u.getId()]:s[u.getName()]||f||"",[d.getId()]:s[d.getName()]||p||f||""}},toStyle(s,{name:l,property:a}){const[c,u]=a.getProperties(),d=s[c.getId()],f=s[u.getId()];return{[l]:d===f?d:`${d} ${f}`}}}}},v4=(t,e="")=>{const n=`${t}-name`,r=`${t}-value`;return(o,{name:i})=>({[i]:`${o[n]}(${o[r]||e})`})};["top","middle","bottom"].map(uc),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(uc);ga("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(uc),new RegExp("(?<!\\(.*[^)]),(?![^(]*\\))"),uo.Image,uo.Gradient,uo.Color,["background-position-x","background-position-y"].map(t=>({type:"integer",property:t,units:nr,default:"0px"})),["background-size-x","background-size-y"].map(t=>({type:"integer",property:t,units:nr,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(t=>({type:"integer",property:t,default:"0",units:nr})),["border-top-style","border-right-style","border-bottom-style","border-left-style"].map(t=>({type:"select",property:t,default:"none",options:[{id:"none",label:"None"},{id:"solid",label:"Solid"},{id:"dotted",label:"Dotted"},{id:"dashed",label:"Dashed"},{id:"double",label:"Double"},{id:"groove",label:"Groove"},{id:"ridge",label:"Ridge"},{id:"inset",label:"Inset"},{id:"outset",label:"Outset"}]})),["border-top-color","border-right-color","border-bottom-color","border-left-color"].map(t=>({type:"color",property:t,default:"currentColor"})),ga("overflow",{x:km,y:km,mergable:!0}),Am(),Am("backdrop-filter"),["width","height","min-width","min-height","max-width","max-height","padding","margin","color","font-size","line-height","letter-height","border","border-radius","background","opacity","box-shadow","text-shadow","filter","backdrop-filter","transform","all"].map(uc),ha[0],ha[0],b4("transform"),v4("transform","0"),Yv("transform-value"),ga("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),ga("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});Ob.gjsStudio;const y4=m.createContext(void 0),$l=()=>{const t=m.useContext(y4);if(!t)throw new Error("useStore must be used inside of StoreProvider");return t},ma=({icon:t,layout:e,tooltip:n,className:r,forceRemove:o,removeLayouts:i})=>({type:"button",icon:t,tooltip:n,className:r,size:"s",editorEvents:{[`${S0.layoutToggleId}${e.id}`]:({fromEvent:s,setState:l})=>{l({active:s.isOpen})}},onClick:({editor:s})=>{i==null||i.forEach(l=>s.runCommand(vt.layoutRemove,{id:l,force:o})),s.runCommand(vt.layoutToggle,{...e})}}),Mm={type:"static",layoutId:"leftPanelsContainer"},jm={width:240,overflow:"hidden"};ma({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:jm,placer:Mm}}),ma({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:jm,placer:Mm}}),ma({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),ma({icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,10.11C13.03,10.11 13.87,10.95 13.87,12C13.87,13 13.03,13.85 12,13.85C10.97,13.85 10.13,13 10.13,12C10.13,10.95 10.97,10.11 12,10.11M7.37,20C8,20.38 9.38,19.8 10.97,18.3C10.45,17.71 9.94,17.07 9.46,16.4C8.64,16.32 7.83,16.2 7.06,16.04C6.55,18.18 6.74,19.65 7.37,20M8.08,14.26L7.79,13.75C7.68,14.04 7.57,14.33 7.5,14.61C7.77,14.67 8.07,14.72 8.38,14.77C8.28,14.6 8.18,14.43 8.08,14.26M14.62,13.5L15.43,12L14.62,10.5C14.32,9.97 14,9.5 13.71,9.03C13.17,9 12.6,9 12,9C11.4,9 10.83,9 10.29,9.03C10,9.5 9.68,9.97 9.38,10.5L8.57,12L9.38,13.5C9.68,14.03 10,14.5 10.29,14.97C10.83,15 11.4,15 12,15C12.6,15 13.17,15 13.71,14.97C14,14.5 14.32,14.03 14.62,13.5M12,6.78C11.81,7 11.61,7.23 11.41,7.5C11.61,7.5 11.8,7.5 12,7.5C12.2,7.5 12.39,7.5 12.59,7.5C12.39,7.23 12.19,7 12,6.78M12,17.22C12.19,17 12.39,16.77 12.59,16.5C12.39,16.5 12.2,16.5 12,16.5C11.8,16.5 11.61,16.5 11.41,16.5C11.61,16.77 11.81,17 12,17.22M16.62,4C16,3.62 14.62,4.2 13.03,5.7C13.55,6.29 14.06,6.93 14.54,7.6C15.36,7.68 16.17,7.8 16.94,7.96C17.45,5.82 17.26,4.35 16.62,4M15.92,9.74L16.21,10.25C16.32,9.96 16.43,9.67 16.5,9.39C16.23,9.33 15.93,9.28 15.62,9.23C15.72,9.4 15.82,9.57 15.92,9.74M17.37,2.69C18.84,3.53 19,5.74 18.38,8.32C20.92,9.07 22.75,10.31 22.75,12C22.75,13.69 20.92,14.93 18.38,15.68C19,18.26 18.84,20.47 17.37,21.31C15.91,22.15 13.92,21.19 12,19.36C10.08,21.19 8.09,22.15 6.62,21.31C5.16,20.47 5,18.26 5.62,15.68C3.08,14.93 1.25,13.69 1.25,12C1.25,10.31 3.08,9.07 5.62,8.32C5,5.74 5.16,3.53 6.62,2.69C8.09,1.85 10.08,2.81 12,4.64C13.92,2.81 15.91,1.85 17.37,2.69M17.08,12C17.42,12.75 17.72,13.5 17.97,14.26C20.07,13.63 21.25,12.73 21.25,12C21.25,11.27 20.07,10.37 17.97,9.74C17.72,10.5 17.42,11.25 17.08,12M6.92,12C6.58,11.25 6.28,10.5 6.03,9.74C3.93,10.37 2.75,11.27 2.75,12C2.75,12.73 3.93,13.63 6.03,14.26C6.28,13.5 6.58,12.75 6.92,12M15.92,14.26C15.82,14.43 15.72,14.6 15.62,14.77C15.93,14.72 16.23,14.67 16.5,14.61C16.43,14.33 16.32,14.04 16.21,13.75L15.92,14.26M13.03,18.3C14.62,19.8 16,20.38 16.62,20C17.26,19.65 17.45,18.18 16.94,16.04C16.17,16.2 15.36,16.32 14.54,16.4C14.06,17.07 13.55,17.71 13.03,18.3M8.08,9.74C8.18,9.57 8.28,9.4 8.38,9.23C8.07,9.28 7.77,9.33 7.5,9.39C7.57,9.67 7.68,9.96 7.79,10.25L8.08,9.74M10.97,5.7C9.38,4.2 8,3.62 7.37,4C6.74,4.35 6.55,5.82 7.06,7.96C7.83,7.8 8.64,7.68 9.46,7.6C9.94,6.93 10.45,6.29 10.97,5.7Z" /></svg>',tooltip:"Custom Component",className:"gs-utl-mt-auto",layout:{id:"customLayout",layout:{type:"custom",component:()=>h.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const Hl=()=>$l().appEditorStore,x4=()=>{try{return Hl()}catch{}};var _e=(t=>(t.alertRhombus="alertRhombus",t.alignHorizontalCenter="alignHorizontalCenter",t.alignHorizontalLeft="alignHorizontalLeft",t.alignHorizontalRight="alignHorizontalRight",t.applicationBracketsOutline="applicationBracketsOutline",t.arrowDown="arrowDown",t.arrowRight="arrowRight",t.arrowULeftTop="arrowULeftTop",t.arrowURightTop="arrowURightTop",t.borderAllVariant="borderAllVariant",t.borderRadius="borderRadius",t.borderStyle="borderStyle",t.cellphoneLink="cellphoneLink",t.check="check",t.checkBold="checkBold",t.checkboxBlank="checkboxBlank",t.chevronUp="chevronUp",t.chevronDown="chevronDown",t.chevronLeft="chevronLeft",t.chevronRight="chevronRight",t.close="close",t.codeBraces="codeBraces",t.cog="cog",t.contentCopy="contentCopy",t.contentSave="contentSave",t.delete="delete",t.dotsVertical="dotsVertical",t.email="email",t.emailOutline="emailOutline",t.eye="eye",t.eyedropperVariant="eyedropperVariant",t.eyeOff="eyeOff",t.eyeOffOutline="eyeOffOutline",t.eyeOutline="eyeOutline",t.fire="fire",t.flare="flare",t.floppy="floppy",t.folder="folder",t.fullscreen="fullscreen",t.gradientVertical="gradientVertical",t.helpCircle="helpCircle",t.image="image",t.information="information",t.informationVariant="informationVariant",t.layers="layers",t.link="link",t.lock="lock",t.lockOpenVariant="lockOpenVariant",t.menuDown="menuDown",t.newspaperVariantOutline="newspaperVariantOutline",t.paletteSwatch="paletteSwatch",t.panVertical="panVertical",t.phone="phone",t.plus="plus",t.plusBox="plusBox",t.powerPlug="powerPlug",t.refresh="refresh",t.rhombusOutline="rhombusOutline",t.tag="tag",t.target="target",t.targetVariant="targetVariant",t.textBoxMultiple="textBoxMultiple",t.trayArrowDown="trayArrowDown",t.unfoldLessHorizontal="unfoldLessHorizontal",t.unfoldMoreHorizontal="unfoldMoreHorizontal",t.viewDayOutline="viewDayOutline",t.viewGridPlus="viewGridPlus",t.web="web",t.xml="xml",t))(_e||{});const ld={alertRhombus:bC,alignHorizontalCenter:vC,alignHorizontalLeft:yC,alignHorizontalRight:xC,applicationBracketsOutline:wC,arrowDown:SC,arrowRight:CC,arrowULeftTop:EC,arrowURightTop:OC,borderAllVariant:_C,borderRadius:kC,borderStyle:TC,cellphoneLink:AC,check:MC,checkBold:jC,checkboxBlank:RC,chevronUp:LC,chevronDown:NC,chevronLeft:PC,chevronRight:DC,close:VC,codeBraces:IC,cog:$C,contentCopy:HC,contentSave:BC,delete:zC,dotsVertical:FC,email:WC,emailOutline:UC,eye:qC,eyedropperVariant:JC,eyeOff:GC,eyeOffOutline:KC,eyeOutline:YC,fire:ZC,flare:XC,floppy:QC,folder:eE,fullscreen:tE,gradientVertical:nE,helpCircle:rE,image:oE,information:iE,informationVariant:sE,layers:lE,link:aE,lock:uE,lockOpenVariant:dE,menuDown:fE,newspaperVariantOutline:pE,paletteSwatch:hE,panVertical:gE,phone:mE,plus:bE,plusBox:vE,powerPlug:yE,refresh:xE,rhombusOutline:wE,tag:SE,target:CE,targetVariant:EE,textBoxMultiple:OE,trayArrowDown:_E,unfoldLessHorizontal:kE,unfoldMoreHorizontal:TE,viewDayOutline:AE,viewGridPlus:ME,web:jE,xml:RE},w4="gs-cmp-icon",ge=ms(function({className:e,icon:n,size:r,rotate:o,horizontal:i,vertical:s}){var d;const l=(d=x4())==null?void 0:d.sdkCustomIcons,a=(l==null?void 0:l[n])||(ld==null?void 0:ld[n])||n,c=[i&&"scaleX(-1)",s&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(f=>!!f).join(" ");if(!a)return null;const u=tt(w4,e);return a.startsWith("<svg")||a.startsWith("<?xml")?h.jsx(FE,{className:u,style:{transform:c||void 0},svg:a,iconSize:r}):h.jsx(BE,{className:u,path:a,size:r,rotate:o,horizontal:i,vertical:s})}),Jv=({variant:t,size:e="m",className:n,active:r,border:o=!0,rounded:i=!0,disabled:s=!1,withBg:l,block:a,full:c})=>{const u=t==="pr",d=t==="out",f=t==="out-clear",p=t==="warn",g=t==="danger",b=o&&(d||f||!t);return["gs-utl-transition-colors gs-utl-cursor-pointer",a&&"block",e==="s"&&"gjs-p-1 text-sm",e==="m"&&"gjs-p-1 gjs-px-2",e==="m2"&&"gjs-p-1 gjs-px-3",e==="lg"&&"gjs-p-2 gjs-px-4 text-lg",n,i&&we.rnd,b&&`${we.b} ${he.br}`,l&&he.bg,b&&B(we.b,d&&he.bA,d&&he.tAo,!s&&he.hBgH),p&&B(he.bgW,he.hBgW,!s&&he.hBgW,"text-white"),g&&B(he.bgRed,!s&&he.hBgRed,"text-white"),u&&B(he.bgA2,!s&&he.hBgAct),r&&he.bgA,s&&"disabled:gs-utl-opacity-80 cursor-not-allowed",c&&"w-full",nc.focus]};function Cs({children:t,...e}){const{variant:n,size:r,active:o,border:i,rounded:s,block:l,full:a,className:c,icon:u,loading:d,withBg:f,type:p="button",...g}=e,b=d?{icon:cE,size:"18px",className:B("animate-spin-fast")}:w0(u)?{icon:u,size:"18px"}:u;return h.jsx("button",{className:B(Jv(e)),disabled:e.disabled,type:p,...g,children:b?h.jsxs(fe,{className:B("gap-2"),items:"center",nowrap:!0,children:[h.jsx(U,{children:h.jsx(ge,{...b})}),t&&h.jsx(U,{children:t})]}):t})}var Zv=(t=>(t.Info="info",t.Error="error",t.Success="success",t.Warning="warning",t))(Zv||{});const S4={info:he.bgA,error:"bg-red-500",success:"bg-green-500",warning:"bg-orange-400"},C4=m.forwardRef(function(e,n){const r={info:_e.informationVariant,error:_e.fire,success:_e.checkBold,warning:_e.alertRhombus},{children:o,className:i,content:s,id:l,buttons:a=[],variant:c="info",autoHideTimeout:u=3e3}=e,d=m.useRef(null),f=m.useRef(),p=r[c],g=S4[c];m.useImperativeHandle(n,()=>d.current,[]);const b=()=>{var S;return(S=e.onDismiss)==null?void 0:S.call(e,l)},v=()=>{u&&(f.current=setTimeout(b,u))},y=()=>f.current&&clearTimeout(f.current);m.useEffect(()=>(v(),y),[]);const w=s||o;return h.jsx(is,{className:Re(i,"overflow-hidden relative"),ref:d,onPointerEnter:y,onPointerLeave:v,children:h.jsxs(fe,{space:"m",items:"center",className:Re(dr.y),children:[h.jsx(U,{className:Re(g,we.pill,"text-white gjs-p-1"),children:h.jsx(ge,{icon:p,size:We.s})}),h.jsx(U,{grow:!0,className:Re("gjs-pr-3"),children:h.jsxs(fe,{col:!0,space:"xs",children:[h.jsx(U,{className:Re("text-lg font-medium leading-6"),children:e.header}),w&&h.jsx(U,{className:Re(he.txtLowEmphasis),children:w}),!!a.length&&h.jsx(fe,{space:"m",justify:"end",children:a.map(({id:S,...C})=>h.jsx(Cs,{...C},S))})]})}),h.jsx(U,{className:Re("absolute top-1 right-1"),children:h.jsx(Uv,{onClick:b,border:!1,children:h.jsx(ge,{icon:_e.close,size:We.s})})})]})})});ms(m.forwardRef(function({className:e,toasts:n,onDismiss:r,...o},i){const s=X2({});return h.jsx("div",{className:Re(e,"w-80 gs-utl-z-30"),...o,ref:s,children:n.map(l=>h.jsx(C4,{...l,className:Re("gjs-mb-2"),onDismiss:r},l.uuid||l.id))})}));var Xv=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(Xv||{});const E4={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},ad=`<svg viewBox="0 0 24 24">
59
+ `}}}),i.addType(u,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:u,"data-type-role":u},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:p,el:m}=this,g="core:preview",y=p.Commands.events;this.listenTo(p,`${y.runCommand}${g}`,()=>{m.style.display="none"}),this.listenTo(p,`${y.stopCommand}${g}`,()=>{m.style.display=""})}}}),Ae({editor:n,licenseKey:o,plan:ee.startup,pluginName:pc,cleanup:()=>{t.remove(r),i.removeType(r)}})},gc=Me(mc),yc={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},vi=`<svg viewBox="0 0 24 24">
292
60
  <path d="M19 0H9C7.9 0 7 .9 7 2V18C7 19.1 7.9 20 9 20H19C20.1 20 21 19.1 21 18V2C21 .9 20.1 0 19 0M19 18H9V2H19V18M3 4V22C3 23.1 3.9 24 5 24H17V22H5V4H3M14 5L11 10L14 15L17 10L14 5Z" />
293
- </svg>`,Qv="layout-icon-picker",O4="icons-layout-",ey="icons-list-layout",ty="gs-iconify-picker",rh="__iconify_collection",_4="https://api.iconify.design",cd=new Map;let ba;const k4=({collectionId:t})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${t}@latest/icons.json`;async function ny({collectionId:t,editor:e}){try{if(cd.has(t))return cd.get(t);const n=await fetch(k4({collectionId:t}));if(!n.ok)throw new Error(`Failed to fetch collection: ${n.statusText}`);const r=await n.json();return cd.set(t,r),r}catch(n){console.error("Error fetching collection",n),e.runCommand(vt.toastAdd,D4());return}}async function T4({collectionIds:t,editor:e}){try{if(ba)return ba;const n=t?`?prefixes=${t.join(",")}`:"",r=await fetch(`${_4}/collections${n}`);if(!r.ok)throw new Error(`Failed to fetch collections: ${r.statusText}`);return ba=await r.json(),ba}catch(n){console.error("Error fetching collections",n),e.runCommand(vt.toastAdd,ry());return}}function Rm(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(t){var e;(e=t.getSelected())==null||e.trigger("active")}}}async function A4({collectionIds:t,editor:e,component:n}){const r=await T4({collectionIds:t,editor:e});if(!r)return;const o=({icon:a,collectionId:c,iconId:u})=>{n.components(a),n.set({collectionId:c,iconId:u})},i=Object.entries(r).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),s=n.get("collectionId")??i[0].id;e.runCommand(vt.layoutToggle,{id:Qv,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[R4({collectionsList:i,collectionId:s,editor:e,handleClick:o}),{id:ey,type:"column",grow:!0}]}});const l=await ny({collectionId:s,editor:e});l&&wf({editor:e,collection:l,handleClick:o,collectionId:s})}function M4({editor:t,collection:e}){t.em.set(rh,e)}function j4(t){return t.em.get(rh)}function wf(t){const{editor:e}=t,n={id:O4,layout:N4(t),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:ey}};e.runCommand(vt.layoutRemove,{id:n.id,force:!0}),setTimeout(()=>e.runCommand(vt.layoutAdd,n),10)}function R4(t){const{collectionsList:e,collectionId:n,editor:r,handleClick:o}=t,i=e.map(({id:s,name:l,total:a})=>({id:s,label:`${l} (${a})`})).sort((s,l)=>s.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${ty}__header`,children:[{type:"selectField",value:n,options:i,emptyState:"Select an icon collection",onChange:async({setState:s,value:l})=>{const a=await ny({collectionId:l,editor:r});a&&(s({value:l}),M4({editor:r,collection:a}),wf({editor:r,collection:a,handleClick:o,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${rh}`]:({setState:s})=>s({value:""})},onInput:({setState:s,value:l,editor:a})=>{const c=j4(a);if(!c)return;const u=Object.fromEntries(Object.entries(c.icons).filter(([d])=>d.includes(l)));s({value:l}),wf({editor:a,collection:c,handleClick:o,collectionId:l,collectionFiltered:{...c,icons:u}})}}]}}function N4({collection:t,collectionFiltered:e,handleClick:n}){const{height:r=24,width:o=24,icons:i,prefix:s}=e||t,l=Object.entries(i).map(([a,{body:c}])=>({name:a,body:c}),{});return{type:"column",className:`${ty}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>[{type:"custom",render:c=>{const{editor:u,addEl:d,removeEl:f}=c,p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.innerHTML=a.body,p.setAttribute("viewBox",`0 0 ${o} ${r}`);const{cssWidth:g,cssHeight:b}=P4(o,r);p.style.cssText=`width: ${g}px; height: ${b}px; cursor: pointer;`,p.addEventListener("mouseover",()=>{p.style.border="2px solid currentColor",p.style.borderRadius="4px",p.style.padding="4px"}),p.addEventListener("mouseout",()=>{p.style.border="none"});const v=()=>{const y=p.cloneNode(!0);y.removeAttribute("style");const w=y.outerHTML;n({icon:w,collectionId:s,iconId:a.name}),u==null||u.runCommand(vt.layoutRemove,{id:Qv})};return p.addEventListener("click",v),d(p),()=>{p.removeEventListener("click",v),f(p)}}}]}}}function P4(t,e){const n=t/e;let r=48,o=48;return n>1?o=48/n:n<1&&(r=48*n),{cssWidth:r,cssHeight:o}}function ry(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:Zv.Error}}function D4(){return{...ry(),id:"toast-error-getCollection",content:"Error fetching collection"}}const L4="iconifyComponent",V4=function(t,e={}){var p;const{Components:n,Blocks:r}=t,{collections:o,extendIconComponent:i=!0,licenseKey:s,block:l={}}=e,a="icon",c="iconify",u="Iconify",d="data-type-iconify",f={events:()=>({dblclick:"onActive"}),onActive(){A4({collectionIds:o,editor:t,component:this.model})}};if(n.addType(c,{block:l&&{label:u,media:ad,content:{type:c},category:"Extra",activate:!0,...l},isComponent:g=>Ma(g,d),model:{defaults:{name:u,icon:ad,droppable:!1,attributes:{[d]:!0},resizable:E4,components:ad,style:{width:"50px",height:"50px"},traits:[Rm()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(g=>g.set({layerable:!1,locked:!0}))}},view:f}),i){const g=(p=n.getType(a))==null?void 0:p.model,[b,v,...y]=g.getDefaults().traits;n.addType(a,{model:{defaults:{traits:[b,v,Rm(),...y]}},view:f})}wr({editor:t,licenseKey:s,plan:Ht.startup,pluginName:L4,cleanup:()=>{r.remove(c),n.removeType(c)}})},I4=xr(V4);var ve=(t=>(t.table="table",t.tableSettings="tableSettings",t.tableDelete="tableDelete",t.tableHead="tableHead",t.tableFoot="tableFoot",t.tableCellItems="tableCellItems",t.tableCellProperties="tableCellProperties",t.tableCellMerge="tableCellMerge",t.tableCellSplit="tableCellSplit",t.tableRowItems="tableRowItems",t.tableRowInsertBefore="tableRowInsertBefore",t.tableRowInsertAfter="tableRowInsertAfter",t.tableRowDelete="tableRowDelete",t.tableRowProperties="tableRowProperties",t.tableRowCut="tableRowCut",t.tableRowCopy="tableRowCopy",t.tableRowPasteBefore="tableRowPasteBefore",t.tableRowPasteAfter="tableRowPasteAfter",t.tableColumn="tableColumn",t.tableColumnItems="tableColumnItems",t.tableColumnInsertBefore="tableColumnInsertBefore",t.tableColumnInsertAfter="tableColumnInsertAfter",t.tableColumnDelete="tableColumnDelete",t.tableColumnCut="tableColumnCut",t.tableColumnCopy="tableColumnCopy",t.tableColumnPasteBefore="tableColumnPasteBefore",t.tableColumnPasteAfter="tableColumnPasteAfter",t))(ve||{});const Ie={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},pr="table",oy="thead",iy="tfoot",Sf="tbody",nn="row",dt="cell",oh="clipboardTable",$4=[pr,oy,iy,Sf,nn,dt],au=t=>t.em.get(oh)||[],H4=t=>t.every(e=>e.is(dt)),ih=(t,e)=>{const{editor:n,event:r,opts:o}=t,i=r.currentTarget||r.target,{x:s,y:l,width:a,height:c}=i.getBoundingClientRect(),u={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:s,y:l,w:a,h:c},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...e};xo(o.openSettings)?o.openSettings({...t,layoutProps:u}):n.runCommand(vt.layoutToggle,u)},B4=(t,{rows:e=1,cells:n=5,text:r}={})=>({type:t,components:Array.from(Array(e).keys()).map(o=>({type:nn,components:Array.from(Array(n).keys()).map(i=>({type:dt,components:r?{type:"text",content:xo(r)?r({y:o,x:i}):r}:void 0}))}))}),sy="Table settings",ly=t=>{const{component:e}=t;return e.is(pr)?e:e.closestType(pr)},z4=t=>{var e;(e=ly(t))==null||e.remove(t.opts)},F4=t=>{const e=ly(t);e&&(t.editor.select(e),ih(t,{id:"tableSettings",header:{label:sy}}))},ay=t=>[{id:ve.table,icon:Ie[ve.table],label:"Table",items:[{id:ve.tableSettings,label:sy,icon:Ie[ve.tableSettings],onClick:({event:n})=>F4({...t,event:n})},{id:ve.tableDelete,label:"Delete table",icon:Ie[ve.tableDelete],onClick:()=>z4(t)}]}],cy=({editor:t})=>{const e=au(t);return e.length&&H4(e)},Nm=({component:t,editor:e,after:n})=>{if(!t.is(dt))return;const r=t.closestType(pr),o=t.closestType(nn),i=t.index()+(n?1:0);r==null||r.findType(nn).forEach(l=>l.append({type:dt},{at:i}));const s=o==null?void 0:o.components().at(i);s&&e.select(s)},uy=({component:t,opts:e})=>{if(!t.is(dt))return;const n=t.closestType(pr),r=t.index();n==null||n.findType(nn).forEach(o=>{var i;return(i=o.components().at(r))==null?void 0:i.remove(e)})},dy=({component:t,editor:e})=>{if(!t.is(dt))return;const n=t.closestType(pr),r=t.index(),o=(n==null?void 0:n.findType(nn).map(i=>i.components().at(r)))||[];o.length&&e.em.set(oh,o)},Pm=t=>{const{component:e,editor:n,after:r}=t;if(!e.is(dt)||!cy(t))return;const o=au(n),i=e.closestType(pr),s=e.index()+(r?1:0);i==null||i.findType(nn).forEach((l,a)=>{const c=o[a],u=(c==null?void 0:c.clone())||{type:dt};l.append(u,{at:s})})},W4=t=>{const{component:e}=t;e.is(dt)&&(dy(t),uy({...t,opts:{temporary:!0}}))},U4=t=>{const e=cy(t);return[{id:ve.tableColumnItems,icon:Ie[ve.tableColumn],label:"Column",items:[{id:ve.tableColumnInsertBefore,label:"Insert column before",icon:Ie[ve.tableColumnInsertBefore],onClick:()=>Nm(t)},{id:ve.tableColumnInsertAfter,label:"Insert column after",icon:Ie[ve.tableColumnInsertAfter],onClick:()=>Nm({...t,after:!0})},{id:ve.tableColumnDelete,label:"Delete column",icon:Ie[ve.tableColumnDelete],onClick:()=>uy(t)},{id:ve.tableColumnCut,label:"Cut column",icon:Ie[ve.tableColumnCut],onClick:()=>W4(t)},{id:ve.tableColumnCopy,label:"Copy column",icon:Ie[ve.tableColumnCopy],onClick:()=>dy(t)},{id:ve.tableColumnPasteBefore,label:"Paste column before",icon:Ie[ve.tableColumnPasteBefore],disabled:!e,onClick:()=>Pm(t)},{id:ve.tableColumnPasteAfter,label:"Paste column after",icon:Ie[ve.tableColumnPasteAfter],disabled:!e,onClick:()=>Pm({...t,after:!0})}]}]},fy="Row settings",q4=t=>t.every(e=>e.is(nn)),Es=t=>{const{component:e}=t,n=e.is(dt),r=e.is(nn);if(!(!n&&!r))return r?e:e.closestType(nn)},Dm=t=>{const{component:e,editor:n,after:r}=t,o=Es(t);if(!o)return;const i=o.index()+(r?1:0),s=o.components().length,l=Array.from(Array(s).keys()).map(()=>({type:dt})),a=o.parent();if(a){const c=a.append({type:nn,components:l},{at:i})[0];if(e.is(dt)&&c){const u=e.index(),d=c.components().at(u);d&&n.select(d)}}},py=t=>{var e;(e=Es(t))==null||e.remove(t.opts)},hy=t=>{const e=Es(t);e&&t.editor.em.set(oh,[e])},Lm=t=>{var l;const{editor:e,after:n}=t,r=Es(t);if(!r||!gy(t))return;const i=au(e)[0],s=r.index()+(n?1:0);i&&((l=r.parent())==null||l.append(i.clone(),{at:s}))},G4=t=>{Es(t)&&(hy(t),py({...t,opts:{temporary:!0}}))},gy=({editor:t})=>{const e=au(t);return e.length&&q4(e)},K4=t=>{const e=Es(t);e&&(t.editor.select(e),ih(t,{id:"tableRowSettings",header:{label:fy}}))},my=t=>{const e=gy(t);return[{id:ve.tableRowItems,icon:Ie[ve.tableRowProperties],label:"Row",items:[{id:ve.tableRowInsertBefore,label:"Insert row before",icon:Ie[ve.tableRowInsertBefore],onClick:()=>Dm(t)},{id:ve.tableRowInsertAfter,label:"Insert row after",icon:Ie[ve.tableRowInsertAfter],onClick:()=>Dm({...t,after:!0})},{id:ve.tableRowDelete,label:"Delete row",icon:Ie[ve.tableRowDelete],onClick:()=>py(t)},{id:ve.tableRowProperties,label:fy,icon:Ie[ve.tableRowProperties],onClick:({event:r})=>K4({...t,event:r})},{id:ve.tableRowCut,label:"Cut row",icon:Ie[ve.tableRowCut],onClick:()=>G4(t)},{id:ve.tableRowCopy,label:"Copy row",icon:Ie[ve.tableRowCopy],onClick:()=>hy(t)},{id:ve.tableRowPasteBefore,label:"Paste row before",icon:Ie[ve.tableRowPasteBefore],disabled:!e,onClick:()=>Lm(t)},{id:ve.tableRowPasteAfter,label:"Paste row after",icon:Ie[ve.tableRowPasteAfter],disabled:!e,onClick:()=>Lm({...t,after:!0})}]},...ay(t)]},sh=t=>{const e=t.attributes.attributes||{},n=parseInt(`${e.rowspan||1}`,10),r=parseInt(`${e.colspan||1}`,10);return{rowspan:n,colspan:r}};function by(t){const e=[];return t.components().forEach((n,r)=>{n.components().each((o,i)=>{const{rowspan:s,colspan:l}=sh(o);if(e[r])for(;e[r][i];)i++;for(let a=r;a<r+s;a++){e[a]||(e[a]=[]);for(let c=i;c<i+l;c++)e[a][c]={real:a===r&&c===i,cell:o,rowspan:s,colspan:l}}})}),e}function Ii(t,e,n){var r;return(r=t[n])==null?void 0:r[e]}const Cf=t=>t.closestType(nn);function Y4(t,{x:e,y:n,rows:r,cols:o}){var l;let i=Cf(t[n][e].cell),s;for(let a=1;a<=r;a++)if(i=(l=i==null?void 0:i.parent())==null?void 0:l.components().at(i.index()+1),i){for(s=e;s>=0;s--){const{cell:c}=t[n+a][s],u=Cf(c);if(u===i){for(let d=1;d<=o;d++){const f=c.index();u.append({type:dt},{at:f+1})}break}}if(s===-1){const u=i.components().at(0).index();for(let d=1;d<=o;d++)i.append({type:dt},{at:u})}}}function vy(t){for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++){const o=t[e][n].cell;if(o.em.selected.hasComponent(o)){const{rowspan:i,colspan:s}=sh(o);if(s>1||i>1){o.addAttributes({colspan:1,rowspan:1});for(let l=0;l<s-1;l++){const a=o.index();Cf(o).append({type:dt},{at:a+1})}Y4(t,{x:n,y:e,rows:i-1,cols:s})}}}}function J4(t){const e=[];t.components().forEach(n=>{n.components().length||e.push(n)}),e.forEach(n=>n.remove())}const cu=(t,e={})=>{var s;const n=by(t),{em:r}=t;let o,i;for(let l=0;l<n.length;l++)for(let a=0;a<n[l].length;a++){const c=n[l][a];if((s=e.selected)!=null&&s.includes(c.cell)||r.selected.hasComponent(c.cell)){const u={x:a,y:l};o||(o=u),i=u}}return{grid:n,startPos:o,endPos:i}};function Z4(t,e={}){const n=cu(t),{startPos:r,endPos:o}=n;let{grid:i}=n;const{em:s}=t;if(!r||!o)return;const l=r.x,a=r.y,c=o.x,u=o.y,d=Ii(i,l,a),f=Ii(i,c,u);if(d&&f){vy(i),i=by(t);const p=[],g=Ii(i,l,a).cell;g.addAttributes({colspan:c-l+1,rowspan:u-a+1});for(let b=a;b<=u;b++)for(let v=l;v<=c;v++){const y=Ii(i,v,b);if(!y)continue;const{cell:w}=y;w!==g&&p.push(w)}p.forEach(b=>{e.mergeContent&&g.append(b.components().models),b.remove()}),s.setSelected(g),J4(t)}}const yy="Cell settings",X4="Merge cells",Q4="Split cell",ej=t=>t.closestType(nn),ls=t=>{var e;return(e=ej(t))==null?void 0:e.parent()},tj=t=>{const e=t.editor.getSelectedAll(),n=ls(e[0]),r=e[0];if(!n||!(r!=null&&r.is(dt))||e.length>1)return!1;const{rowspan:o,colspan:i}=sh(r);return!(i<2&&o<2)},nj=t=>{const n=t.editor.getSelectedAll()[0],r=ls(n),{grid:o}=cu(r);vy(o)},xy=t=>{const e=t.editor.getSelectedAll(),n=ls(e[0]);if(!n||e.length<2||e.some(l=>!l.is(dt)||ls(l)!==n))return!1;const{grid:r,startPos:o,endPos:i}=cu(n),{em:s}=n;if(!o||!i)return!1;for(let l=o.y;l<=i.y;l++)for(let a=o.x;a<=i.x;a++){const c=Ii(r,a,l);if(!c||!s.selected.hasComponent(c.cell))return!1}return!0},rj=t=>{const{editor:e}=t;if(!xy(t))return;const n=e.getSelectedAll(),r=ls(n[0]);Z4(r,{mergeContent:!0})},oj=t=>{ih(t,{id:"tableCellSettings",header:{label:yy}})},ij=t=>[{id:ve.tableCellItems,icon:Ie[ve.tableCellProperties],label:"Cell",items:[{id:ve.tableCellProperties,label:yy,icon:Ie[ve.tableCellProperties],onClick:({event:n})=>oj({...t,event:n})},{id:ve.tableCellMerge,label:X4,icon:Ie[ve.tableCellMerge],onClick:()=>rj(t),disabled:!xy(t)},{id:ve.tableCellSplit,label:Q4,icon:Ie[ve.tableCellSplit],onClick:()=>nj(t),disabled:!tj(t)}]},...U4(t),...my(t)],sj=t=>{const e=t[0]&&ls(t[0]);if(!e)return;const{grid:n,startPos:r,endPos:o}=cu(e,{selected:t});if(!r||!o)return;const i=[];for(let s=r.y;s<=o.y;s++)for(let l=r.x;l<=o.x;l++){const a=Ii(n,l,s);a&&i.push(a.cell)}i.length&&e.em.setSelected(i,{fromCell:!0})},lj="tableComponent",aj=function(t,e={}){const n={block:{},...e},{Components:r}=t,o={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};r.addType(pr,{block:n.block&&{label:"Table",media:Ie.table,category:"Extra",content:{type:pr,style:{width:"100%"}},select:!0,...n.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:Ie.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:s,value:l,emitUpdate:a}){const c=s.find("caption")[0];l?!c&&s.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),t.refresh({tools:!0})},getValue(s){return!!s.component.find("caption")[0]}}],components:B4(Sf,{rows:5}),contextMenu:({items:s,editor:l,component:a})=>[...ay({editor:l,component:a,opts:n}),...s]}}}),r.addType(oy,{model:{defaults:{icon:Ie.tableHead,...o}}}),r.addType(iy,{model:{defaults:{icon:Ie.tableFoot,...o}}}),r.addType(Sf,{model:{defaults:{icon:Ie.tableRowProperties,...o}}}),r.addType(nn,{model:{defaults:{icon:Ie.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:s,editor:l,component:a})=>[...my({editor:l,component:a,opts:n}),...s]}}}),r.addType(dt,{model:{defaults:{icon:Ie.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:s,editor:l,component:a})=>[...ij({editor:l,component:a,opts:n}),...s]}}});const i=xb((s,l)=>{var d;const a=t.getSelectedAll(),c=!!((d=l==null?void 0:l.event)!=null&&d.shiftKey);if(a.length<2||!c||l.fromCell)return;const u=a.map(f=>f.is(dt)?f:f.closestType(dt)).filter(Boolean);u.length===a.length&&sj(u)},0);t.on("component:select",i),wr({editor:t,plan:Ht.startup,licenseKey:n.licenseKey,pluginName:lj,cleanup:()=>{t.off("component:select",i),t.Blocks.remove(pr),$4.forEach(s=>r.removeType(s))}})},cj=xr(aj),Vm="page://",$o="list-pages",Ci="list-pages-item",Ho="list-pages-link",uj=t=>t.components().reduce((e,n)=>{var s;const r=n.findFirstType(Ho),o=(s=r==null?void 0:r.attributes.attributes)==null?void 0:s.href,i=o!=null&&o.startsWith(Vm)?o.replace(Vm,""):"";if(i&&r){const l=e[i];l?l.push(r):e[i]=[r]}return e},{}),dj="listPagesComponent",Va="data-type-role",fj="page_root",pj=t=>e=>e.is(t),hj=t=>(e,n)=>n.is(t),ud=t=>e=>{var n;return((n=e.getAttribute)==null?void 0:n.call(e,Va))===t},gj=function(t,e={}){const{Blocks:n,Components:r,Pages:o}=t,{licenseKey:i,block:s={}}=e,l="List Pages",a="List Pages Item",c="Link",u=`${Vd}${$o}`,d=`${Vd}${Ho}`,f='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',p='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';r.addType($o,{block:s&&{label:l,media:f,category:"Extra",select:!0,...e.block},isComponent:ud($o),model:{defaults:{tagName:"ul",name:l,[fj]:"",classes:u,attributes:{[Va]:$o},droppable:pj(Ci),styles:`
294
- .${u} {
61
+ </svg>`,Ks="layout-icon-picker",bc="icons-layout-",qs="icons-list-layout",js="gs-iconify-picker",To="__iconify_collection",wc="https://api.iconify.design",xi=new Map;let kn;const Sc=({collectionId:n})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${n}@latest/icons.json`;async function Js({collectionId:n,editor:e}){try{if(xi.has(n))return xi.get(n);const t=await fetch(Sc({collectionId:n}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const i=await t.json();return xi.set(n,i),i}catch(t){console.error("Error fetching collection",t),e.runCommand(Y.toastAdd,Oc());return}}async function vc({collectionIds:n,editor:e}){try{if(kn)return kn;const t=n?`?prefixes=${n.join(",")}`:"",i=await fetch(`${wc}/collections${t}`);if(!i.ok)throw new Error(`Failed to fetch collections: ${i.statusText}`);return kn=await i.json(),kn}catch(t){console.error("Error fetching collections",t),e.runCommand(Y.toastAdd,Gs());return}}function Qo(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(n){var e;(e=n.getSelected())==null||e.trigger("active")}}}async function xc({collectionIds:n,editor:e,component:t}){const i=await vc({collectionIds:n,editor:e});if(!i)return;const o=({icon:a,collectionId:c,iconId:d})=>{t.components(a),t.set({collectionId:c,iconId:d})},r=Object.entries(i).map(([a,c])=>({id:a,...c})).sort((a,c)=>a.name.localeCompare(c.name)),s=t.get("collectionId")??r[0].id;e.runCommand(Y.layoutToggle,{id:Ks,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[Tc({collectionsList:r,collectionId:s,editor:e,handleClick:o}),{id:qs,type:"column",grow:!0}]}});const l=await Js({collectionId:s,editor:e});l&&Ui({editor:e,collection:l,handleClick:o,collectionId:s})}function Cc({editor:n,collection:e}){n.em.set(To,e)}function kc(n){return n.em.get(To)}function Ui(n){const{editor:e}=n,t={id:bc,layout:Mc(n),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:qs}};e.runCommand(Y.layoutRemove,{id:t.id,force:!0}),setTimeout(()=>e.runCommand(Y.layoutAdd,t),10)}function Tc(n){const{collectionsList:e,collectionId:t,editor:i,handleClick:o}=n,r=e.map(({id:s,name:l,total:a})=>({id:s,label:`${l} (${a})`})).sort((s,l)=>s.label.localeCompare(l.label));return{type:"column",style:{gap:10},className:`${js}__header`,children:[{type:"selectField",value:t,options:r,emptyState:"Select an icon collection",onChange:async({setState:s,value:l})=>{const a=await Js({collectionId:l,editor:i});a&&(s({value:l}),Cc({editor:i,collection:a}),Ui({editor:i,collection:a,handleClick:o,collectionId:l}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${To}`]:({setState:s})=>s({value:""})},onInput:({setState:s,value:l,editor:a})=>{const c=kc(a);if(!c)return;const d=Object.fromEntries(Object.entries(c.icons).filter(([h])=>h.includes(l)));s({value:l}),Ui({editor:a,collection:c,handleClick:o,collectionId:l,collectionFiltered:{...c,icons:d}})}}]}}function Mc({collection:n,collectionFiltered:e,handleClick:t}){const{height:i=24,width:o=24,icons:r,prefix:s}=e||n,l=Object.entries(r).map(([a,{body:c}])=>({name:a,body:c}),{});return{type:"column",className:`${js}__content`,style:{height:"100%"},children:{type:"virtualList",items:l,itemLayout:({item:a})=>[{type:"custom",render:c=>{const{editor:d,addEl:h,removeEl:u}=c,f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.innerHTML=a.body,f.setAttribute("viewBox",`0 0 ${o} ${i}`);const{cssWidth:p,cssHeight:m}=Ac(o,i);f.style.cssText=`width: ${p}px; height: ${m}px; cursor: pointer;`,f.addEventListener("mouseover",()=>{f.style.border="2px solid currentColor",f.style.borderRadius="4px",f.style.padding="4px"}),f.addEventListener("mouseout",()=>{f.style.border="none"});const g=()=>{const y=f.cloneNode(!0);y.removeAttribute("style");const x=y.outerHTML;t({icon:x,collectionId:s,iconId:a.name}),d==null||d.runCommand(Y.layoutRemove,{id:Ks})};return f.addEventListener("click",g),h(f),()=>{f.removeEventListener("click",g),u(f)}}}]}}}function Ac(n,e){const t=n/e;let i=48,o=48;return t>1?o=48/t:t<1&&(i=48*t),{cssWidth:i,cssHeight:o}}function Gs(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:Ws.Error}}function Oc(){return{...Gs(),id:"toast-error-getCollection",content:"Error fetching collection"}}const Ec="iconifyComponent",Nc=function(n,e={}){var f;const{Components:t,Blocks:i}=n,{collections:o,extendIconComponent:r=!0,licenseKey:s,block:l={}}=e,a="icon",c="iconify",d="Iconify",h="data-type-iconify",u={events:()=>({dblclick:"onActive"}),onActive(){xc({collectionIds:o,editor:n,component:this.model})}};if(t.addType(c,{block:l&&{label:d,media:vi,content:{type:c},category:"Extra",activate:!0,...l},isComponent:p=>zn(p,h),model:{defaults:{name:d,icon:vi,droppable:!1,attributes:{[h]:!0},resizable:yc,components:vi,style:{width:"50px",height:"50px"},traits:[Qo()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(p=>p.set({layerable:!1,locked:!0}))}},view:u}),r){const p=(f=t.getType(a))==null?void 0:f.model,[m,g,...y]=p.getDefaults().traits;t.addType(a,{model:{defaults:{traits:[m,g,Qo(),...y]}},view:u})}Ae({editor:n,licenseKey:s,plan:ee.startup,pluginName:Ec,cleanup:()=>{i.remove(c),t.removeType(c)}})},Dc=Me(Nc);function Us(n,e,t){let i,o,r,s,l;const a=e;function c(){const h=Date.now()-s;h<a&&h>=0?i=setTimeout(c,a-h):(i=null,l=n.apply(r,o),r=o=null)}const d=function(){return r=this,o=arguments,s=Date.now(),i||(i=setTimeout(c,a)),l};return d.clear=function(){i&&(clearTimeout(i),i=null)},d.flush=function(){i&&(l=n.apply(r,o),r=o=null,clearTimeout(i),i=null)},d}var T=(n=>(n.table="table",n.tableSettings="tableSettings",n.tableDelete="tableDelete",n.tableHead="tableHead",n.tableFoot="tableFoot",n.tableCellItems="tableCellItems",n.tableCellProperties="tableCellProperties",n.tableCellMerge="tableCellMerge",n.tableCellSplit="tableCellSplit",n.tableRowItems="tableRowItems",n.tableRowInsertBefore="tableRowInsertBefore",n.tableRowInsertAfter="tableRowInsertAfter",n.tableRowDelete="tableRowDelete",n.tableRowProperties="tableRowProperties",n.tableRowCut="tableRowCut",n.tableRowCopy="tableRowCopy",n.tableRowPasteBefore="tableRowPasteBefore",n.tableRowPasteAfter="tableRowPasteAfter",n.tableColumn="tableColumn",n.tableColumnItems="tableColumnItems",n.tableColumnInsertBefore="tableColumnInsertBefore",n.tableColumnInsertAfter="tableColumnInsertAfter",n.tableColumnDelete="tableColumnDelete",n.tableColumnCut="tableColumnCut",n.tableColumnCopy="tableColumnCopy",n.tableColumnPasteBefore="tableColumnPasteBefore",n.tableColumnPasteAfter="tableColumnPasteAfter",n))(T||{});const D={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},xe="table",Zs="thead",Ys="tfoot",Zi="tbody",se="row",B="cell",Mo="clipboardTable",Ic=[xe,Zs,Ys,Zi,se,B],ci=n=>n.em.get(Mo)||[],Pc=n=>n.every(e=>e.is(B)),Ao=(n,e)=>{const{editor:t,event:i,opts:o}=n,r=i.currentTarget||i.target,{x:s,y:l,width:a,height:c}=r.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:s,y:l,w:a,h:c},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...e};$s(o.openSettings)?o.openSettings({...n,layoutProps:d}):t.runCommand(Y.layoutToggle,d)},Rc=(n,{rows:e=1,cells:t=5,text:i}={})=>({type:n,components:Array.from(Array(e).keys()).map(o=>({type:se,components:Array.from(Array(t).keys()).map(r=>({type:B,components:i?{type:"text",content:$s(i)?i({y:o,x:r}):i}:void 0}))}))}),Xs="Table settings",Qs=n=>{const{component:e}=n;return e.is(xe)?e:e.closestType(xe)},Vc=n=>{var e;(e=Qs(n))==null||e.remove(n.opts)},Lc=n=>{const e=Qs(n);e&&(n.editor.select(e),Ao(n,{id:"tableSettings",header:{label:Xs}}))},el=n=>[{id:T.table,icon:D[T.table],label:"Table",items:[{id:T.tableSettings,label:Xs,icon:D[T.tableSettings],onClick:({event:t})=>Lc({...n,event:t})},{id:T.tableDelete,label:"Delete table",icon:D[T.tableDelete],onClick:()=>Vc(n)}]}],tl=({editor:n})=>{const e=ci(n);return e.length&&Pc(e)},er=({component:n,editor:e,after:t})=>{if(!n.is(B))return;const i=n.closestType(xe),o=n.closestType(se),r=n.index()+(t?1:0);i==null||i.findType(se).forEach(l=>l.append({type:B},{at:r}));const s=o==null?void 0:o.components().at(r);s&&e.select(s)},nl=({component:n,opts:e})=>{if(!n.is(B))return;const t=n.closestType(xe),i=n.index();t==null||t.findType(se).forEach(o=>{var r;return(r=o.components().at(i))==null?void 0:r.remove(e)})},il=({component:n,editor:e})=>{if(!n.is(B))return;const t=n.closestType(xe),i=n.index(),o=(t==null?void 0:t.findType(se).map(r=>r.components().at(i)))||[];o.length&&e.em.set(Mo,o)},tr=n=>{const{component:e,editor:t,after:i}=n;if(!e.is(B)||!tl(n))return;const o=ci(t),r=e.closestType(xe),s=e.index()+(i?1:0);r==null||r.findType(se).forEach((l,a)=>{const c=o[a],d=(c==null?void 0:c.clone())||{type:B};l.append(d,{at:s})})},zc=n=>{const{component:e}=n;e.is(B)&&(il(n),nl({...n,opts:{temporary:!0}}))},Bc=n=>{const e=tl(n);return[{id:T.tableColumnItems,icon:D[T.tableColumn],label:"Column",items:[{id:T.tableColumnInsertBefore,label:"Insert column before",icon:D[T.tableColumnInsertBefore],onClick:()=>er(n)},{id:T.tableColumnInsertAfter,label:"Insert column after",icon:D[T.tableColumnInsertAfter],onClick:()=>er({...n,after:!0})},{id:T.tableColumnDelete,label:"Delete column",icon:D[T.tableColumnDelete],onClick:()=>nl(n)},{id:T.tableColumnCut,label:"Cut column",icon:D[T.tableColumnCut],onClick:()=>zc(n)},{id:T.tableColumnCopy,label:"Copy column",icon:D[T.tableColumnCopy],onClick:()=>il(n)},{id:T.tableColumnPasteBefore,label:"Paste column before",icon:D[T.tableColumnPasteBefore],disabled:!e,onClick:()=>tr(n)},{id:T.tableColumnPasteAfter,label:"Paste column after",icon:D[T.tableColumnPasteAfter],disabled:!e,onClick:()=>tr({...n,after:!0})}]}]},ol="Row settings",Hc=n=>n.every(e=>e.is(se)),qt=n=>{const{component:e}=n,t=e.is(B),i=e.is(se);if(!(!t&&!i))return i?e:e.closestType(se)},nr=n=>{const{component:e,editor:t,after:i}=n,o=qt(n);if(!o)return;const r=o.index()+(i?1:0),s=o.components().length,l=Array.from(Array(s).keys()).map(()=>({type:B})),a=o.parent();if(a){const c=a.append({type:se,components:l},{at:r})[0];if(e.is(B)&&c){const d=e.index(),h=c.components().at(d);h&&t.select(h)}}},rl=n=>{var e;(e=qt(n))==null||e.remove(n.opts)},sl=n=>{const e=qt(n);e&&n.editor.em.set(Mo,[e])},ir=n=>{var l;const{editor:e,after:t}=n,i=qt(n);if(!i||!ll(n))return;const r=ci(e)[0],s=i.index()+(t?1:0);r&&((l=i.parent())==null||l.append(r.clone(),{at:s}))},Fc=n=>{qt(n)&&(sl(n),rl({...n,opts:{temporary:!0}}))},ll=({editor:n})=>{const e=ci(n);return e.length&&Hc(e)},$c=n=>{const e=qt(n);e&&(n.editor.select(e),Ao(n,{id:"tableRowSettings",header:{label:ol}}))},al=n=>{const e=ll(n);return[{id:T.tableRowItems,icon:D[T.tableRowProperties],label:"Row",items:[{id:T.tableRowInsertBefore,label:"Insert row before",icon:D[T.tableRowInsertBefore],onClick:()=>nr(n)},{id:T.tableRowInsertAfter,label:"Insert row after",icon:D[T.tableRowInsertAfter],onClick:()=>nr({...n,after:!0})},{id:T.tableRowDelete,label:"Delete row",icon:D[T.tableRowDelete],onClick:()=>rl(n)},{id:T.tableRowProperties,label:ol,icon:D[T.tableRowProperties],onClick:({event:i})=>$c({...n,event:i})},{id:T.tableRowCut,label:"Cut row",icon:D[T.tableRowCut],onClick:()=>Fc(n)},{id:T.tableRowCopy,label:"Copy row",icon:D[T.tableRowCopy],onClick:()=>sl(n)},{id:T.tableRowPasteBefore,label:"Paste row before",icon:D[T.tableRowPasteBefore],disabled:!e,onClick:()=>ir(n)},{id:T.tableRowPasteAfter,label:"Paste row after",icon:D[T.tableRowPasteAfter],disabled:!e,onClick:()=>ir({...n,after:!0})}]},...el(n)]},Oo=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),i=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:i}};function cl(n){const e=[];return n.components().forEach((t,i)=>{t.components().each((o,r)=>{const{rowspan:s,colspan:l}=Oo(o);if(e[i])for(;e[i][r];)r++;for(let a=i;a<i+s;a++){e[a]||(e[a]=[]);for(let c=r;c<r+l;c++)e[a][c]={real:a===i&&c===r,cell:o,rowspan:s,colspan:l}}})}),e}function Et(n,e,t){var i;return(i=n[t])==null?void 0:i[e]}const Yi=n=>n.closestType(se);function Wc(n,{x:e,y:t,rows:i,cols:o}){var l;let r=Yi(n[t][e].cell),s;for(let a=1;a<=i;a++)if(r=(l=r==null?void 0:r.parent())==null?void 0:l.components().at(r.index()+1),r){for(s=e;s>=0;s--){const{cell:c}=n[t+a][s],d=Yi(c);if(d===r){for(let h=1;h<=o;h++){const u=c.index();d.append({type:B},{at:u+1})}break}}if(s===-1){const d=r.components().at(0).index();for(let h=1;h<=o;h++)r.append({type:B},{at:d})}}}function dl(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const o=n[e][t].cell;if(o.em.selected.hasComponent(o)){const{rowspan:r,colspan:s}=Oo(o);if(s>1||r>1){o.addAttributes({colspan:1,rowspan:1});for(let l=0;l<s-1;l++){const a=o.index();Yi(o).append({type:B},{at:a+1})}Wc(n,{x:t,y:e,rows:r-1,cols:s})}}}}function _c(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const di=(n,e={})=>{var s;const t=cl(n),{em:i}=n;let o,r;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((s=e.selected)!=null&&s.includes(c.cell)||i.selected.hasComponent(c.cell)){const d={x:a,y:l};o||(o=d),r=d}}return{grid:t,startPos:o,endPos:r}};function Kc(n,e={}){const t=di(n),{startPos:i,endPos:o}=t;let{grid:r}=t;const{em:s}=n;if(!i||!o)return;const l=i.x,a=i.y,c=o.x,d=o.y,h=Et(r,l,a),u=Et(r,c,d);if(h&&u){dl(r),r=cl(n);const f=[],p=Et(r,l,a).cell;p.addAttributes({colspan:c-l+1,rowspan:d-a+1});for(let m=a;m<=d;m++)for(let g=l;g<=c;g++){const y=Et(r,g,m);if(!y)continue;const{cell:x}=y;x!==p&&f.push(x)}f.forEach(m=>{e.mergeContent&&p.append(m.components().models),m.remove()}),s.setSelected(p),_c(n)}}const hl="Cell settings",qc="Merge cells",jc="Split cell",Jc=n=>n.closestType(se),Bt=n=>{var e;return(e=Jc(n))==null?void 0:e.parent()},Gc=n=>{const e=n.editor.getSelectedAll(),t=Bt(e[0]),i=e[0];if(!t||!(i!=null&&i.is(B))||e.length>1)return!1;const{rowspan:o,colspan:r}=Oo(i);return!(r<2&&o<2)},Uc=n=>{const t=n.editor.getSelectedAll()[0],i=Bt(t),{grid:o}=di(i);dl(o)},ul=n=>{const e=n.editor.getSelectedAll(),t=Bt(e[0]);if(!t||e.length<2||e.some(l=>!l.is(B)||Bt(l)!==t))return!1;const{grid:i,startPos:o,endPos:r}=di(t),{em:s}=t;if(!o||!r)return!1;for(let l=o.y;l<=r.y;l++)for(let a=o.x;a<=r.x;a++){const c=Et(i,a,l);if(!c||!s.selected.hasComponent(c.cell))return!1}return!0},Zc=n=>{const{editor:e}=n;if(!ul(n))return;const t=e.getSelectedAll(),i=Bt(t[0]);Kc(i,{mergeContent:!0})},Yc=n=>{Ao(n,{id:"tableCellSettings",header:{label:hl}})},Xc=n=>[{id:T.tableCellItems,icon:D[T.tableCellProperties],label:"Cell",items:[{id:T.tableCellProperties,label:hl,icon:D[T.tableCellProperties],onClick:({event:t})=>Yc({...n,event:t})},{id:T.tableCellMerge,label:qc,icon:D[T.tableCellMerge],onClick:()=>Zc(n),disabled:!ul(n)},{id:T.tableCellSplit,label:jc,icon:D[T.tableCellSplit],onClick:()=>Uc(n),disabled:!Gc(n)}]},...Bc(n),...al(n)],Qc=n=>{const e=n[0]&&Bt(n[0]);if(!e)return;const{grid:t,startPos:i,endPos:o}=di(e,{selected:n});if(!i||!o)return;const r=[];for(let s=i.y;s<=o.y;s++)for(let l=i.x;l<=o.x;l++){const a=Et(t,l,s);a&&r.push(a.cell)}r.length&&e.em.setSelected(r,{fromCell:!0})},ed="tableComponent",td=function(n,e={}){const t={block:{},...e},{Components:i}=n,o={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};i.addType(xe,{block:t.block&&{label:"Table",media:D.table,category:"Extra",content:{type:xe,style:{width:"100%"}},select:!0,...t.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:D.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:s,value:l,emitUpdate:a}){const c=s.find("caption")[0];l?!c&&s.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(s){return!!s.component.find("caption")[0]}}],components:Rc(Zi,{rows:5}),contextMenu:({items:s,editor:l,component:a})=>[...el({editor:l,component:a,opts:t}),...s]}}}),i.addType(Zs,{model:{defaults:{icon:D.tableHead,...o}}}),i.addType(Ys,{model:{defaults:{icon:D.tableFoot,...o}}}),i.addType(Zi,{model:{defaults:{icon:D.tableRowProperties,...o}}}),i.addType(se,{model:{defaults:{icon:D.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:s,editor:l,component:a})=>[...al({editor:l,component:a,opts:t}),...s]}}}),i.addType(B,{model:{defaults:{icon:D.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:s,editor:l,component:a})=>[...Xc({editor:l,component:a,opts:t}),...s]}}});const r=Us((s,l)=>{var h;const a=n.getSelectedAll(),c=!!((h=l==null?void 0:l.event)!=null&&h.shiftKey);if(a.length<2||!c||l.fromCell)return;const d=a.map(u=>u.is(B)?u:u.closestType(B)).filter(Boolean);d.length===a.length&&Qc(d)},0);n.on("component:select",r),Ae({editor:n,plan:ee.startup,licenseKey:t.licenseKey,pluginName:ed,cleanup:()=>{n.off("component:select",r),n.Blocks.remove(xe),Ic.forEach(s=>i.removeType(s))}})},nd=Me(td),or="page://",et="list-pages",St="list-pages-item",tt="list-pages-link",id=n=>n.components().reduce((e,t)=>{var s;const i=t.findFirstType(tt),o=(s=i==null?void 0:i.attributes.attributes)==null?void 0:s.href,r=o!=null&&o.startsWith(or)?o.replace(or,""):"";if(r&&i){const l=e[r];l?l.push(i):e[r]=[i]}return e},{}),od="listPagesComponent",Bn="data-type-role",rd="page_root",sd=n=>e=>e.is(n),ld=n=>(e,t)=>t.is(n),Ci=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,Bn))===n},ad=function(n,e={}){const{Blocks:t,Components:i,Pages:o}=n,{licenseKey:r,block:s={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${Gi}${et}`,h=`${Gi}${tt}`,u='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',f='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';i.addType(et,{block:s&&{label:l,media:u,category:"Extra",select:!0,...e.block},isComponent:Ci(et),model:{defaults:{tagName:"ul",name:l,[rd]:"",classes:d,attributes:{[Bn]:et},droppable:sd(St),styles:`
62
+ .${d} {
295
63
  list-style: none;
296
64
  margin: 0;
297
65
  padding: 0;
298
66
  }
299
- `},init(){this.syncPageItems=xb(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const g=this.em.Pages.getAll(),b=this.components(),v=uj(this);g.forEach((y,w)=>{const S=y.id,C=y.getName(),x=v[S];x?x==null||x.forEach(E=>{E.getInnerHTML()!==C&&E.components(C)}):b.add({type:Ci,components:[{type:Ho,attributes:{href:`page://${S}`},components:{type:"textnode",content:C}}]},{at:w})})}}}),r.addType(Ci,{isComponent:ud(Ci),model:{defaults:{name:a,tagName:"li",icon:p,attributes:{[Va]:Ci},components:{type:Ho},draggable:hj($o)}}}),r.addType(Ho,{extend:"link",isComponent:ud(Ho),model:{defaults:{removable:!1,copyable:!1,delegate:{move:g=>g.closestType(Ci)},name:c,classes:d,attributes:{[Va]:Ho},components:{type:"textnode",content:"Item"},styles:`
300
- .${d} {
67
+ `},init(){this.syncPageItems=Us(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(n.Components.getSymbolInfo(this).isInstance)return;const p=this.em.Pages.getAll(),m=this.components(),g=id(this);p.forEach((y,x)=>{const b=y.id,S=y.getName(),v=g[b];v?v==null||v.forEach(k=>{k.getInnerHTML()!==S&&k.components(S)}):m.add({type:St,components:[{type:tt,attributes:{href:`page://${b}`},components:{type:"textnode",content:S}}]},{at:x})})}}}),i.addType(St,{isComponent:Ci(St),model:{defaults:{name:a,tagName:"li",icon:f,attributes:{[Bn]:St},components:{type:tt},draggable:ld(et)}}}),i.addType(tt,{extend:"link",isComponent:Ci(tt),model:{defaults:{removable:!1,copyable:!1,delegate:{move:p=>p.closestType(St)},name:c,classes:h,attributes:{[Bn]:tt},components:{type:"textnode",content:"Item"},styles:`
68
+ .${h} {
301
69
  text-decoration: none;
302
70
  }
303
- `}}}),wr({editor:t,licenseKey:i,plan:Ht.startup,pluginName:dj,cleanup:()=>{n.remove($o),r.removeType($o)}})},mj=xr(gj),bj="fsLightboxComponent",va="data-fslightbox",ya="data-type",vj="fslightbox-open",Ei="fslightbox",Oi={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},yj=function(t,e={}){const{Blocks:n,Components:r}=t,o="Lightbox",i=`${Vd}${Ei}`,s={toolbarIconOpen:Oi.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=s,u=function(w){const S=this,C="data-fslightbox",x=window,E=()=>{var j;const _=x.refreshFsLightbox;_==null||_();const M=S.getAttribute(C);if((j=x.fsLightboxInstances)==null||j[M],!x._isEditor)return;Array.from(document.querySelectorAll(`[${C}]`)).forEach(N=>{const P=N.onclick;N.onclick=function(z){z.preventDefault();const W=N;!W.__skipLb&&(P==null||P(z)),W.__skipLb=!0}})};if(x.refreshFsLightbox)E();else{const _=document.createElement("script");_.src=w.cdnScript,_.onload=E,document.head.appendChild(_)}},d=w=>({id:`${Ei}-open-lb`,label:a,command:()=>{const S=w.getView();S==null||S.toggleLightbox()}}),f="source-type",p={type:"radio",name:f,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:Oi.image},{id:"video",label:"Video",icon:Oi.video},{id:"el",label:"Custom Element",icon:Oi.external}],labelToTitle:!0},g={id:"href-image",name:"href",type:"file",label:"Source Image"},b={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},v={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},y={image:[g],video:[b],el:[v]};r.addType(Ei,{block:l&&{label:o,media:Oi.imageLightbox,category:"Extra",select:!0,...s.block},isComponent:w=>{var S;return(S=w.hasAttribute)==null?void 0:S.call(w,va)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:o,icon:Oi.imageLightbox,classes:i,draggable:(w,S)=>!S.is(Ei),attributes:{[va]:"lightbox",[ya]:"image",href:c},components:{type:"image",src:c},script:u,cdnScript:s.cdnScript,"script-props":["attributes","cdnScript"],[f]:"image",traits:[p,{name:va,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(w,S){var x;const C=(x=S.target)==null?void 0:x.getView();C==null||C.toggleLightbox()}}],styles:`
304
- .${i} {
71
+ `}}}),Ae({editor:n,licenseKey:r,plan:ee.startup,pluginName:od,cleanup:()=>{t.remove(et),i.removeType(et)}})},cd=Me(ad),dd="fsLightboxComponent",Tn="data-fslightbox",Mn="data-type",hd="fslightbox-open",vt="fslightbox",xt={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},ud=function(n,e={}){const{Blocks:t,Components:i}=n,o="Lightbox",r=`${Gi}${vt}`,s={toolbarIconOpen:xt.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=s,d=function(x){const b=this,S="data-fslightbox",v=window,k=()=>{var R;const A=v.refreshFsLightbox;A==null||A();const L=b.getAttribute(S);if((R=v.fsLightboxInstances)==null||R[L],!v._isEditor)return;Array.from(document.querySelectorAll(`[${S}]`)).forEach(P=>{const V=P.onclick;P.onclick=function(J){J.preventDefault();const de=P;!de.__skipLb&&(V==null||V(J)),de.__skipLb=!0}})};if(v.refreshFsLightbox)k();else{const A=document.createElement("script");A.src=x.cdnScript,A.onload=k,document.head.appendChild(A)}},h=x=>({id:`${vt}-open-lb`,label:a,command:()=>{const b=x.getView();b==null||b.toggleLightbox()}}),u="source-type",f={type:"radio",name:u,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:xt.image},{id:"video",label:"Video",icon:xt.video},{id:"el",label:"Custom Element",icon:xt.external}],labelToTitle:!0},p={id:"href-image",name:"href",type:"file",label:"Source Image"},m={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},g={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},y={image:[p],video:[m],el:[g]};i.addType(vt,{block:l&&{label:o,media:xt.imageLightbox,category:"Extra",select:!0,...s.block},isComponent:x=>{var b;return(b=x.hasAttribute)==null?void 0:b.call(x,Tn)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:o,icon:xt.imageLightbox,classes:r,draggable:(x,b)=>!b.is(vt),attributes:{[Tn]:"lightbox",[Mn]:"image",href:c},components:{type:"image",src:c},script:d,cdnScript:s.cdnScript,"script-props":["attributes","cdnScript"],[u]:"image",traits:[f,{name:Tn,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(x,b){var v;const S=(v=b.target)==null?void 0:v.getView();S==null||S.toggleLightbox()}}],styles:`
72
+ .${r} {
305
73
  display: inline-block;
306
74
  padding: 10px;
307
75
  }
308
- `},init(){const w=[f].map(S=>`change:${S}`).join(" ");this.on(w,this.updateTraits),this.on(`change:${f}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(w,S,C){if(C.adjust)return;const E=this.get(f)==="video"?"video":"image";this.addAttributes({[ya]:E,href:""})},adjustSourceType(){const w=this.get(f),S=this.getAttributes().href||"",C={adjust:!0};if(w==="video"){const x=S.includes("youtube.com")?"youtube":"video";this.addAttributes({[ya]:x},C)}else w!=="el"&&S.startsWith("#")?this.set(f,"el",C):w==="image"&&this.addAttributes({[ya]:"image"},C)},updateTraits(w={}){const{changed:S}=this,{init:C}=w;if(S[p.name]||C){this.removeTrait([g.name,b.name,v.name]);const x=this.get(f)||"image",E=this.getTraitIndex(f)+1;this.addTrait(y[x],{at:E})}},initToolbar(){if(!a)return;const{toolbar:w}=this,S=d(this);!w.find(x=>x.id===S.id)&&(w==null||w.unshift(S))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var N;const{em:w,el:S,model:C}=this,{Canvas:x}=w,E=C.getAttributes()[va],{defaultView:_,documentElement:M}=S.ownerDocument,k=(N=_.fsLightboxInstances)==null?void 0:N[E];if(M.classList.contains(vj))k.close();else{S.__skipLb=!1;let P;k.props.onOpen=()=>{P=x.getSpots(),setTimeout(()=>x.removeSpots())},k.props.onClose=()=>{P.forEach(z=>x.addSpot(z.attributes))},S.click()}}}}),wr({editor:t,plan:Ht.startup,licenseKey:s.licenseKey,pluginName:bj,cleanup:()=>{n.remove(Ei),r.removeType(Ei)}})},xj=xr(yj);var Ai=(t=>(t.image="image",t.video="video",t.external="external",t))(Ai||{});const Bo="lightGallery",Im=`${Bo}-item`,Ia="data-lightgallery",$m=`${Ia}-item`,dc="toggle",Uo={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},dd={propKeys:[],props:{},traits:[]},Ls=(t,e={})=>{var o;const n={},r=[];for(const i in t){const{value:s,...l}=t[i];r.push({id:i,name:i,changeProp:!0,category:e.category,...l}),n[i]=s;const{subTraits:a={}}=l;for(const c in l.subTraits)(o=a[c])==null||o.forEach(u=>{const d=u.id||u.name;n[d]=u.value})}return{propKeys:Object.keys(n),props:n,traits:r}},Ef=(t,e)=>{const n=t.getTrait(e),r=n.get("category"),o=n.get("subTraits")||{},s=(Object.values(o).flat()||[]).map(c=>c.id||c.name);t.removeTrait(s);const l=o[n.getValue()],a=t.getTraitIndex(e)+1;l&&t.addTrait(l.map(c=>({category:r,...c})),{at:a})},fd=(t,e)=>{e.forEach(n=>{const r=t.getTrait(n);if(!r||!r.get("subTraits"))return;const o=r.changeProp?`change:${n}`:`change:attributes:${n}`;t.on(o,()=>Ef(t,n)),Ef(t,n)})},wj=(t,e,n)=>{const o=t.getTrait(e).get("subTraits")||{},s=(Object.values(o).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(s));l.length&&t.on(l.join(" "),n)},Sj={[dc]:{type:"button",label:"Toggle Gallery",command:(t,e)=>{var n,r;return(r=(n=e.target)==null?void 0:n.getView())==null?void 0:r.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:t})=>!!t.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:t})=>!!t.getTrait("closable").getValue(),value:!0}},Cj={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ej={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Oj={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},Qr="sourceType",xa="data-iframe",Of={name:"href",type:"file",label:"Image Source"},fc={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},_f={name:"data-poster",label:"Video Poster",type:"file"},Hm={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},wy={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},_j={[dc]:{type:"button",label:"Toggle Gallery",command:(t,e)=>{var o,i;const n=e.target,r=(o=n==null?void 0:n.closestType(Bo))==null?void 0:o.getView();if(r&&n){const s=((i=r.getLightGallery())==null?void 0:i.items)||[],l=Array.from(s).indexOf(n.getEl());l>=0&&r.toggleGallery(l)}}},[Qr]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[Of],video:[fc,_f],external:[Hm]},options:[{id:"image",label:Of.label||"",icon:Uo.image},{id:"video",label:fc.label||"",icon:Uo.video},{id:"external",label:Hm.label||"",icon:Uo.external}]},subHtml:wy},kj="lightGalleryComponent",Bm="lgThumbnail",Tj="lgVideo",zm="lgAutoplay",Fm="lgZoom",_i="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Aj=function(t,e={}){const{Blocks:n,Components:r}=t,o="LightGallery",i="LightGallery Item",s={toolbarIconOpen:Uo.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[Bm,Tj,zm,Fm],cdnScript:[`${_i}/lightgallery.min.js`,`${_i}/plugins/thumbnail/lg-thumbnail.min.js`,`${_i}/plugins/video/lg-video.min.js`,`${_i}/plugins/autoplay/lg-autoplay.min.js`,`${_i}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${_i}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=s,u=function(S){const C=this,x=window,{plugins:E,cdnScript:_,cdnStyle:M,inline:k,lgLicenseKey:j,...N}=S||{},P=W=>isNaN(W)?void 0:parseInt(W,10),z=()=>{var $;const W={...N,licenseKey:j,speed:P(N.speed),startAnimationDuration:P(N.startAnimationDuration),thumbMargin:P(N.thumbMargin),thumbWidth:P(N.thumbWidth),slideShowInterval:P(N.slideShowInterval),scale:P(N.scale),enableZoomAfter:P(N.enableZoomAfter),plugins:(E||[]).map(J=>x[J])};k&&(W.container=C,W.closable=!1);const F=($=x.lightGallery)==null?void 0:$.call(x,C,W);k&&F.openGallery()};if(x.lightGallery)z();else{const{head:W}=document,F=Array.isArray(_)?[..._]:[_],$=Array.isArray(M)?[...M]:[M],J=L=>{if(L.length){const I=document.createElement("link");I.href=L.shift(),I.rel="stylesheet",W.appendChild(I),J(L)}},ee=L=>{if(L.length){const I=document.createElement("script");I.src=L.shift(),I.onerror=I.onload=ee.bind(null,L),W.appendChild(I)}else z()};J($),ee(F)}},d=S=>{const C=S.getTrait(dc);if(!a||!C)return;const{toolbar:x}=S,E={id:dc,label:a,command:()=>setTimeout(()=>C.runCommand(),100)};!x.find(M=>M.id===E.id)&&(x==null||x.unshift(E))};let f=[];const p=s.plugins||[],g=Ls(Sj),b=p.includes(Bm)?Ls(Cj):dd,v=p.includes(zm)?Ls(Ej):dd,y=p.includes(Fm)?Ls(Oj):dd;r.addType(Bo,{block:l&&{label:o,media:Uo.gallery,category:"Extra",select:!0,...s.block},isComponent:S=>Ma(S,Ia),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:Uo.gallery,draggable:(S,C)=>!C.is(Bo),attributes:{[Ia]:!0},components:{type:Im},script:u,selector:"",exThumbImage:"",cdnScript:s.cdnScript,cdnStyle:s.cdnStyle,plugins:s.plugins,lgLicenseKey:s.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...g.propKeys,...b.propKeys,...v.propKeys,...y.propKeys],...g.props,...b.props,...v.props,...y.props,traits:[...g.traits,...b.traits,...v.traits,...y.traits]},init(){fd(this,["thumbnail"]),fd(this,["autoplay"]),fd(this,["zoom"])},initToolbar(){d(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,r.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const S=this.getLightGallery();S==null||S.destroy()},disableLgInCanvas(){const S=this.getLightGallery();S.lgOpened=!0},isInlineGallery(){var C;const S=this.getLightGallery();return((C=S==null?void 0:S.settings)==null?void 0:C.container)===this.el},onLgInit(S){this.el.__lg=S.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:S}=this,{Canvas:C}=S,x=this.getLightGallery();f=C.getSpots(),setTimeout(()=>C.removeSpots()),x.__lgOpened=!0},onLgClose(){const S=this.getLightGallery();f.forEach(C=>this.em.Canvas.addSpot(C.attributes)),f=[],S.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(S){const C=this.getLightGallery();if(C.__lgOpened)return C.closeGallery(!0);C.lgOpened=!1,C.openGallery(S)}}});const w=Ls(_j);r.addType(Im,{isComponent:S=>Ma(S,$m)||S.tagName==="A"&&Ma(S.parentElement,Ia),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:i,icon:Uo.galleryItem,attributes:{[$m]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...w.props,traits:[...w.traits]},init(){const S=[Qr].map(C=>`change:${C}`).join(" ");this.initSourceType(),this.on(S,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),wj(this,Qr,this.triggerGalleryUpdate)},initToolbar(){d(this)},initScriptUpdate(){const S=[wy.name].map(C=>`change:attributes:${C}`).join(" ");this.on(S,this.triggerGalleryUpdate)},triggerGalleryUpdate(...S){var C;(C=this.closestType(Bo))==null||C.__scriptPropsChange(...S)},updateTraits(S={}){const{changed:C}=this,{init:x}=S;if(C[Qr]||x){Ef(this,Qr);const E=this.getTrait(Qr).getValue();if(E===Ai.image){this.removeAttributes([fc.name,_f.name,xa]);const _=this.getTrait(Of.name);_.setValue(_.getValue()||c)}else E===Ai.video?this.removeAttributes([xa]):E===Ai.external&&this.addAttributes({[xa]:!0})}},initSourceType(){const S=this.getAttributes({noClass:!0,noStyle:!0});S[xa]?this.set(Qr,Ai.external):(S[fc.name]||S[_f.name])&&this.set(Qr,Ai.video)}}}),wr({editor:t,plan:Ht.startup,licenseKey:s.licenseKey,pluginName:kj,cleanup:()=>{n.remove(Bo),r.removeType(Bo)}})},Mj=xr(Aj),qn="swiper",bl=`${qn}-slide`,Bi=`${qn}-wrapper`,zi=`${qn}-nav-prev`,pc=`${qn}-nav-next`,Fi=`${qn}-pagination`,tl=`${qn}-scrollbar`,$t={slider:`<svg viewBox="0 0 24 24">
76
+ `},init(){const x=[u].map(b=>`change:${b}`).join(" ");this.on(x,this.updateTraits),this.on(`change:${u}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(x,b,S){if(S.adjust)return;const k=this.get(u)==="video"?"video":"image";this.addAttributes({[Mn]:k,href:""})},adjustSourceType(){const x=this.get(u),b=this.getAttributes().href||"",S={adjust:!0};if(x==="video"){const v=b.includes("youtube.com")?"youtube":"video";this.addAttributes({[Mn]:v},S)}else x!=="el"&&b.startsWith("#")?this.set(u,"el",S):x==="image"&&this.addAttributes({[Mn]:"image"},S)},updateTraits(x={}){const{changed:b}=this,{init:S}=x;if(b[f.name]||S){this.removeTrait([p.name,m.name,g.name]);const v=this.get(u)||"image",k=this.getTraitIndex(u)+1;this.addTrait(y[v],{at:k})}},initToolbar(){if(!a)return;const{toolbar:x}=this,b=h(this);!x.find(v=>v.id===b.id)&&(x==null||x.unshift(b))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var P;const{em:x,el:b,model:S}=this,{Canvas:v}=x,k=S.getAttributes()[Tn],{defaultView:A,documentElement:L}=b.ownerDocument,M=(P=A.fsLightboxInstances)==null?void 0:P[k];if(L.classList.contains(hd))M.close();else{b.__skipLb=!1;let V;M.props.onOpen=()=>{V=v.getSpots(),setTimeout(()=>v.removeSpots())},M.props.onClose=()=>{V.forEach(J=>v.addSpot(J.attributes))},b.click()}}}}),Ae({editor:n,plan:ee.startup,licenseKey:s.licenseKey,pluginName:dd,cleanup:()=>{t.remove(vt),i.removeType(vt)}})},fd=Me(ud);var Mt=(n=>(n.image="image",n.video="video",n.external="external",n))(Mt||{});const nt="lightGallery",rr=`${nt}-item`,Hn="data-lightgallery",sr=`${Hn}-item`,qn="toggle",rt={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},ki={propKeys:[],props:{},traits:[]},Jt=(n,e={})=>{var o;const t={},i=[];for(const r in n){const{value:s,...l}=n[r];i.push({id:r,name:r,changeProp:!0,category:e.category,...l}),t[r]=s;const{subTraits:a={}}=l;for(const c in l.subTraits)(o=a[c])==null||o.forEach(d=>{const h=d.id||d.name;t[h]=d.value})}return{propKeys:Object.keys(t),props:t,traits:i}},Xi=(n,e)=>{const t=n.getTrait(e),i=t.get("category"),o=t.get("subTraits")||{},s=(Object.values(o).flat()||[]).map(c=>c.id||c.name);n.removeTrait(s);const l=o[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:i,...c})),{at:a})},Ti=(n,e)=>{e.forEach(t=>{const i=n.getTrait(t);if(!i||!i.get("subTraits"))return;const o=i.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(o,()=>Xi(n,t)),Xi(n,t)})},pd=(n,e,t)=>{const o=n.getTrait(e).get("subTraits")||{},s=(Object.values(o).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(s));l.length&&n.on(l.join(" "),t)},md={[qn]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var t,i;return(i=(t=e.target)==null?void 0:t.getView())==null?void 0:i.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:n})=>!!n.getTrait("closable").getValue(),value:!0}},gd={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},yd={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},bd={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},ze="sourceType",An="data-iframe",Qi={name:"href",type:"file",label:"Image Source"},jn={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},eo={name:"data-poster",label:"Video Poster",type:"file"},lr={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},fl={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},wd={[qn]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var o,r;const t=e.target,i=(o=t==null?void 0:t.closestType(nt))==null?void 0:o.getView();if(i&&t){const s=((r=i.getLightGallery())==null?void 0:r.items)||[],l=Array.from(s).indexOf(t.getEl());l>=0&&i.toggleGallery(l)}}},[ze]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[Qi],video:[jn,eo],external:[lr]},options:[{id:"image",label:Qi.label||"",icon:rt.image},{id:"video",label:jn.label||"",icon:rt.video},{id:"external",label:lr.label||"",icon:rt.external}]},subHtml:fl},Sd="lightGalleryComponent",ar="lgThumbnail",vd="lgVideo",cr="lgAutoplay",dr="lgZoom",Ct="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",xd=function(n,e={}){const{Blocks:t,Components:i}=n,o="LightGallery",r="LightGallery Item",s={toolbarIconOpen:rt.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ar,vd,cr,dr],cdnScript:[`${Ct}/lightgallery.min.js`,`${Ct}/plugins/thumbnail/lg-thumbnail.min.js`,`${Ct}/plugins/video/lg-video.min.js`,`${Ct}/plugins/autoplay/lg-autoplay.min.js`,`${Ct}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Ct}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=s,d=function(b){const S=this,v=window,{plugins:k,cdnScript:A,cdnStyle:L,inline:M,lgLicenseKey:R,...P}=b||{},V=de=>isNaN(de)?void 0:parseInt(de,10),J=()=>{var xn;const de={...P,licenseKey:R,speed:V(P.speed),startAnimationDuration:V(P.startAnimationDuration),thumbMargin:V(P.thumbMargin),thumbWidth:V(P.thumbWidth),slideShowInterval:V(P.slideShowInterval),scale:V(P.scale),enableZoomAfter:V(P.enableZoomAfter),plugins:(k||[]).map(Cn=>v[Cn])};M&&(de.container=S,de.closable=!1);const Si=(xn=v.lightGallery)==null?void 0:xn.call(v,S,de);M&&Si.openGallery()};if(v.lightGallery)J();else{const{head:de}=document,Si=Array.isArray(A)?[...A]:[A],xn=Array.isArray(L)?[...L]:[L],Cn=Qe=>{if(Qe.length){const Le=document.createElement("link");Le.href=Qe.shift(),Le.rel="stylesheet",de.appendChild(Le),Cn(Qe)}},Go=Qe=>{if(Qe.length){const Le=document.createElement("script");Le.src=Qe.shift(),Le.onerror=Le.onload=Go.bind(null,Qe),de.appendChild(Le)}else J()};Cn(xn),Go(Si)}},h=b=>{const S=b.getTrait(qn);if(!a||!S)return;const{toolbar:v}=b,k={id:qn,label:a,command:()=>setTimeout(()=>S.runCommand(),100)};!v.find(L=>L.id===k.id)&&(v==null||v.unshift(k))};let u=[];const f=s.plugins||[],p=Jt(md),m=f.includes(ar)?Jt(gd):ki,g=f.includes(cr)?Jt(yd):ki,y=f.includes(dr)?Jt(bd):ki;i.addType(nt,{block:l&&{label:o,media:rt.gallery,category:"Extra",select:!0,...s.block},isComponent:b=>zn(b,Hn),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:rt.gallery,draggable:(b,S)=>!S.is(nt),attributes:{[Hn]:!0},components:{type:rr},script:d,selector:"",exThumbImage:"",cdnScript:s.cdnScript,cdnStyle:s.cdnStyle,plugins:s.plugins,lgLicenseKey:s.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...p.propKeys,...m.propKeys,...g.propKeys,...y.propKeys],...p.props,...m.props,...g.props,...y.props,traits:[...p.traits,...m.traits,...g.traits,...y.traits]},init(){Ti(this,["thumbnail"]),Ti(this,["autoplay"]),Ti(this,["zoom"])},initToolbar(){h(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,i.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const b=this.getLightGallery();b==null||b.destroy()},disableLgInCanvas(){const b=this.getLightGallery();b.lgOpened=!0},isInlineGallery(){var S;const b=this.getLightGallery();return((S=b==null?void 0:b.settings)==null?void 0:S.container)===this.el},onLgInit(b){this.el.__lg=b.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:b}=this,{Canvas:S}=b,v=this.getLightGallery();u=S.getSpots(),setTimeout(()=>S.removeSpots()),v.__lgOpened=!0},onLgClose(){const b=this.getLightGallery();u.forEach(S=>this.em.Canvas.addSpot(S.attributes)),u=[],b.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(b){const S=this.getLightGallery();if(S.__lgOpened)return S.closeGallery(!0);S.lgOpened=!1,S.openGallery(b)}}});const x=Jt(wd);i.addType(rr,{isComponent:b=>zn(b,sr)||b.tagName==="A"&&zn(b.parentElement,Hn),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:r,icon:rt.galleryItem,attributes:{[sr]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...x.props,traits:[...x.traits]},init(){const b=[ze].map(S=>`change:${S}`).join(" ");this.initSourceType(),this.on(b,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),pd(this,ze,this.triggerGalleryUpdate)},initToolbar(){h(this)},initScriptUpdate(){const b=[fl.name].map(S=>`change:attributes:${S}`).join(" ");this.on(b,this.triggerGalleryUpdate)},triggerGalleryUpdate(...b){var S;(S=this.closestType(nt))==null||S.__scriptPropsChange(...b)},updateTraits(b={}){const{changed:S}=this,{init:v}=b;if(S[ze]||v){Xi(this,ze);const k=this.getTrait(ze).getValue();if(k===Mt.image){this.removeAttributes([jn.name,eo.name,An]);const A=this.getTrait(Qi.name);A.setValue(A.getValue()||c)}else k===Mt.video?this.removeAttributes([An]):k===Mt.external&&this.addAttributes({[An]:!0})}},initSourceType(){const b=this.getAttributes({noClass:!0,noStyle:!0});b[An]?this.set(ze,Mt.external):(b[jn.name]||b[eo.name])&&this.set(ze,Mt.video)}}}),Ae({editor:n,plan:ee.startup,licenseKey:s.licenseKey,pluginName:Sd,cleanup:()=>{t.remove(nt),i.removeType(nt)}})},Cd=Me(xd),be="swiper",an=`${be}-slide`,Dt=`${be}-wrapper`,It=`${be}-nav-prev`,Jn=`${be}-nav-next`,Pt=`${be}-pagination`,tn=`${be}-scrollbar`,Q={slider:`<svg viewBox="0 0 24 24">
309
77
  <path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
310
78
  <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
311
79
  </svg>`,effect:`<svg viewBox="0 0 24 24">
@@ -328,34 +96,34 @@ Check the top-level render call using <`+T+">."),re}var C=m,x=Symbol.for("react.
328
96
  <path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
329
97
  </svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
330
98
  <path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
331
- </svg>`},Wm={id:"swiper-responsive",label:"Responsive",icon:$t.responsive},Um={id:"swiper-extra",label:"Extra",icon:$t.extra},jj={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:$t.reload},{id:"p",label:"Previous slide",icon:$t.prev},{id:"n",label:"Next slide",icon:$t.next},{id:"a",label:"Add new slide",icon:$t.add}],setValue:({component:t,value:e})=>{var r;const n=(r=t.getView())==null?void 0:r.getSwiper();switch(e){case"r":t.reloadSlider();break;case"p":n==null||n.slidePrev();break;case"n":n==null||n.slideNext();break;case"a":t.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:t})=>!!t.findFirstType(zi),setValue:({component:t,value:e})=>{var n,r;e?t.append([{type:zi},{type:pc}]):((n=t.findFirstType(zi))==null||n.remove(),(r=t.findFirstType(pc))==null||r.remove()),t.set({navigation:e})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:$t.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:$t.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:$t.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:t})=>t.findFirstType(Fi)?t.get("pagination")||"bullets":"none",setValue:({component:t,value:e})=>{const n=t.findFirstType(Fi);n==null||n.remove(),e!=="none"&&t.append({type:Fi}),t.set({pagination:e})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:$t.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:t})=>!!t.findFirstType(tl),setValue:({component:t,value:e})=>{const n=t.findFirstType(tl);n==null||n.remove(),e&&t.append({type:tl}),t.set({scrollbar:e})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:$t.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Wm,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:Wm,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Um,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Um,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},qm="Slider",kf="swiper",Os=`${kf}-`,Rj=(t,e)=>{const{Components:n,Blocks:r,Commands:o}=t,{block:i}=e,s=M2(jj),l="core:preview",a=o.events,c=function(f){const p=this,g=window,b=p.__onLoad,v=p.__activeSlide,y=p.__inPreview,{cdnScript:w,cdnStyle:S,slidesPerView:C}=f||{},x=_=>isNaN(_)?void 0:parseFloat(_),E=()=>{const _={loop:f.loop,speed:f.speed,initialSlide:f.initialSlide,direction:f.vertical?"vertical":"horizontal",effect:f.effect,freeMode:f.freeMode,parallax:f.parallax,autoHeight:f.autoHeight,allowTouchMove:f.allowTouchMove,grabCursor:f.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(C)?C:x(C),slidesPerGroup:x(f.slidesPerGroup),spaceBetween:x(f.spaceBetween),slidesOffsetBefore:x(f.slidesOffsetBefore),slidesOffsetAfter:x(f.slidesOffsetAfter),centeredSlides:f.centeredSlides,fadeEffect:{crossFade:f.crossFade},cubeEffect:{shadow:f.cubeEffectShadow,slideShadows:f.cubeEffectSlideShadows,shadowOffset:x(f.cubeEffectShadowOffset),shadowScale:x(f.cubeEffectShadowScale)},coverflowEffect:{depth:x(f.coverflowEffectDepth),modifier:x(f.coverflowEffectModifier),rotate:x(f.coverflowEffectRotate),scale:x(f.coverflowEffectScale),stretch:x(f.coverflowEffectStretch),slideShadows:f.coverflowEffectSlideShadows},flipEffect:{limitRotation:f.flipEffectLimitRotation,slideShadows:f.flipEffectSlideShadows},cardsEffect:{perSlideOffset:x(f.cardsEffectPerSlideOffset),perSlideRotate:x(f.cardsEffectPerSlideRotate),rotate:f.cardsEffectRotate,slideShadows:f.cardsEffectSlideShadows},navigation:{nextEl:p.querySelector(".swiper-button-next"),prevEl:p.querySelector(".swiper-button-prev")},pagination:{type:f.pagination||"bullets",dynamicBullets:f.dynamicBullets,clickable:f.clickableBullets,progressbarOpposite:f.progressbarOpposite,el:p.querySelector(".swiper-pagination")},scrollbar:{el:p.querySelector(".swiper-scrollbar"),draggable:f.scrollbarDraggable,hide:f.scrollbarHide},autoplay:f.autoplay&&{delay:f.autoplayDelay,disableOnInteraction:f.autoplayDisableOnInteraction,pauseOnMouseEnter:f.autoplayPauseOnMouseEnter,reverseDirection:f.autoplayReverseDirection,stopOnLastSlide:f.autoplayStopOnLastSlide,waitForTransition:f.autoplayWaitForTransition}};if(f.tablet){const{tabletBreakpoint:k,tabletSlidesPerView:j}=f,N=x(k);_.breakpoints[N]={slidesPerView:isNaN(j)?j:x(j),slidesPerGroup:x(f.tabletSlidesPerGroup),spaceBetween:x(f.tabletSpaceBetween)}}if(f.mobile){const{mobileBreakpoint:k,mobileSlidesPerView:j}=f,N=x(k);_.breakpoints[N]={slidesPerView:isNaN(j)?j:x(j),slidesPerGroup:x(f.mobileSlidesPerGroup),spaceBetween:x(f.mobileSpaceBetween)}}b&&!y&&(_.simulateTouch=!1),v&&(_.initialSlide=v);const M=new g.Swiper(p,_);b==null||b(M)};if(g.Swiper)E();else{const{head:_}=document,M=Array.isArray(w)?[...w]:[w],k=Array.isArray(S)?[...S]:[S],j=P=>{if(P.length){const z=document.createElement("link");z.href=P.shift(),z.rel="stylesheet",_.appendChild(z),j(P)}},N=P=>{if(P.length){const z=document.createElement("script");z.src=P.shift(),z.onerror=z.onload=N.bind(null,P),_.appendChild(z)}else E()};j(k),N(M)}},u=(f=0)=>({type:bl,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${f}`}}}),d=n.getType("default").model;return n.addType(qn,{block:i&&{label:qm,media:$t.slider,category:"Extra",select:!0,...e.block},isComponent:f=>ri(f,kf),model:{defaults:()=>({name:qm,icon:$t.slider,classes:kf,draggable:(f,p)=>!p.is(qn),components:[{type:Bi,components:[u(1),u(2),u(3)]},{type:Fi}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...s.propKeys],...s.props,traits:[...s.traits]}),init(){const{em:f}=this;j2(this,s.traits),R2(this,s.propKeys),this.listenTo(f,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(f,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const f=this.findFirstType(Bi);f==null||f.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var p;const f=((p=this.findFirstType(Bi))==null?void 0:p.components().length)||0;return{type:bl,components:{type:"text",components:{type:"textnode",content:`Slide ${f+1}`}}}},toJSON(...f){const p=d.prototype.toJSON.apply(this,f);return s.propsNoValues.forEach(g=>delete p[g]),delete p["script-props"],p}},view:{init(){this.listenTo(this.model,n.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var f;(f=this.getSwiper())==null||f.destroy()},onRender(){const f=this.el;f.__onLoad=p=>p.on("slideChange",()=>this.__activeSlide=p.activeIndex),f.__activeSlide=this.__activeSlide,f.__inPreview=this.model.__inPreview}}}),()=>{n.removeType(qn),r.remove(qn)}},Nj="Nav Prev",Pj="Nav Next",wa=`${Os}button-prev`,Sa=`${Os}button-next`,Dj=t=>{const{Components:e}=t,n=r=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:r,fill:"currentColor"}}});return e.addType(zi,{isComponent:r=>ri(r,wa),model:{defaults:{name:Nj,classes:wa,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:n("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
332
- .${wa} {
99
+ </svg>`},hr={id:"swiper-responsive",label:"Responsive",icon:Q.responsive},ur={id:"swiper-extra",label:"Extra",icon:Q.extra},kd={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:Q.reload},{id:"p",label:"Previous slide",icon:Q.prev},{id:"n",label:"Next slide",icon:Q.next},{id:"a",label:"Add new slide",icon:Q.add}],setValue:({component:n,value:e})=>{var i;const t=(i=n.getView())==null?void 0:i.getSwiper();switch(e){case"r":n.reloadSlider();break;case"p":t==null||t.slidePrev();break;case"n":t==null||t.slideNext();break;case"a":n.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:n})=>!!n.findFirstType(It),setValue:({component:n,value:e})=>{var t,i;e?n.append([{type:It},{type:Jn}]):((t=n.findFirstType(It))==null||t.remove(),(i=n.findFirstType(Jn))==null||i.remove()),n.set({navigation:e})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:Q.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:Q.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:Q.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:n})=>n.findFirstType(Pt)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(Pt);t==null||t.remove(),e!=="none"&&n.append({type:Pt}),n.set({pagination:e})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:Q.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(tn),setValue:({component:n,value:e})=>{const t=n.findFirstType(tn);t==null||t.remove(),e&&n.append({type:tn}),n.set({scrollbar:e})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:Q.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:hr,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:hr,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:ur,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:ur,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},fr="Slider",to="swiper",jt=`${to}-`,Td=(n,e)=>{const{Components:t,Blocks:i,Commands:o}=n,{block:r}=e,s=hc(kd),l="core:preview",a=o.events,c=function(u){const f=this,p=window,m=f.__onLoad,g=f.__activeSlide,y=f.__inPreview,{cdnScript:x,cdnStyle:b,slidesPerView:S}=u||{},v=A=>isNaN(A)?void 0:parseFloat(A),k=()=>{const A={loop:u.loop,speed:u.speed,initialSlide:u.initialSlide,direction:u.vertical?"vertical":"horizontal",effect:u.effect,freeMode:u.freeMode,parallax:u.parallax,autoHeight:u.autoHeight,allowTouchMove:u.allowTouchMove,grabCursor:u.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(S)?S:v(S),slidesPerGroup:v(u.slidesPerGroup),spaceBetween:v(u.spaceBetween),slidesOffsetBefore:v(u.slidesOffsetBefore),slidesOffsetAfter:v(u.slidesOffsetAfter),centeredSlides:u.centeredSlides,fadeEffect:{crossFade:u.crossFade},cubeEffect:{shadow:u.cubeEffectShadow,slideShadows:u.cubeEffectSlideShadows,shadowOffset:v(u.cubeEffectShadowOffset),shadowScale:v(u.cubeEffectShadowScale)},coverflowEffect:{depth:v(u.coverflowEffectDepth),modifier:v(u.coverflowEffectModifier),rotate:v(u.coverflowEffectRotate),scale:v(u.coverflowEffectScale),stretch:v(u.coverflowEffectStretch),slideShadows:u.coverflowEffectSlideShadows},flipEffect:{limitRotation:u.flipEffectLimitRotation,slideShadows:u.flipEffectSlideShadows},cardsEffect:{perSlideOffset:v(u.cardsEffectPerSlideOffset),perSlideRotate:v(u.cardsEffectPerSlideRotate),rotate:u.cardsEffectRotate,slideShadows:u.cardsEffectSlideShadows},navigation:{nextEl:f.querySelector(".swiper-button-next"),prevEl:f.querySelector(".swiper-button-prev")},pagination:{type:u.pagination||"bullets",dynamicBullets:u.dynamicBullets,clickable:u.clickableBullets,progressbarOpposite:u.progressbarOpposite,el:f.querySelector(".swiper-pagination")},scrollbar:{el:f.querySelector(".swiper-scrollbar"),draggable:u.scrollbarDraggable,hide:u.scrollbarHide},autoplay:u.autoplay&&{delay:u.autoplayDelay,disableOnInteraction:u.autoplayDisableOnInteraction,pauseOnMouseEnter:u.autoplayPauseOnMouseEnter,reverseDirection:u.autoplayReverseDirection,stopOnLastSlide:u.autoplayStopOnLastSlide,waitForTransition:u.autoplayWaitForTransition}};if(u.tablet){const{tabletBreakpoint:M,tabletSlidesPerView:R}=u,P=v(M);A.breakpoints[P]={slidesPerView:isNaN(R)?R:v(R),slidesPerGroup:v(u.tabletSlidesPerGroup),spaceBetween:v(u.tabletSpaceBetween)}}if(u.mobile){const{mobileBreakpoint:M,mobileSlidesPerView:R}=u,P=v(M);A.breakpoints[P]={slidesPerView:isNaN(R)?R:v(R),slidesPerGroup:v(u.mobileSlidesPerGroup),spaceBetween:v(u.mobileSpaceBetween)}}m&&!y&&(A.simulateTouch=!1),g&&(A.initialSlide=g);const L=new p.Swiper(f,A);m==null||m(L)};if(p.Swiper)k();else{const{head:A}=document,L=Array.isArray(x)?[...x]:[x],M=Array.isArray(b)?[...b]:[b],R=V=>{if(V.length){const J=document.createElement("link");J.href=V.shift(),J.rel="stylesheet",A.appendChild(J),R(V)}},P=V=>{if(V.length){const J=document.createElement("script");J.src=V.shift(),J.onerror=J.onload=P.bind(null,V),A.appendChild(J)}else k()};R(M),P(L)}},d=(u=0)=>({type:an,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${u}`}}}),h=t.getType("default").model;return t.addType(be,{block:r&&{label:fr,media:Q.slider,category:"Extra",select:!0,...e.block},isComponent:u=>mt(u,to),model:{defaults:()=>({name:fr,icon:Q.slider,classes:to,draggable:(u,f)=>!f.is(be),components:[{type:Dt,components:[d(1),d(2),d(3)]},{type:Pt}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...s.propKeys],...s.props,traits:[...s.traits]}),init(){const{em:u}=this;uc(this,s.traits),fc(this,s.propKeys),this.listenTo(u,`${a.runCommand}${l}`,this.onPreviewOn),this.listenTo(u,`${a.stopCommand}${l}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const u=this.findFirstType(Dt);u==null||u.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var f;const u=((f=this.findFirstType(Dt))==null?void 0:f.components().length)||0;return{type:an,components:{type:"text",components:{type:"textnode",content:`Slide ${u+1}`}}}},toJSON(...u){const f=h.prototype.toJSON.apply(this,u);return s.propsNoValues.forEach(p=>delete f[p]),delete f["script-props"],f}},view:{init(){this.listenTo(this.model,t.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var u;(u=this.getSwiper())==null||u.destroy()},onRender(){const u=this.el;u.__onLoad=f=>f.on("slideChange",()=>this.__activeSlide=f.activeIndex),u.__activeSlide=this.__activeSlide,u.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(be),i.remove(be)}},Md="Nav Prev",Ad="Nav Next",On=`${jt}button-prev`,En=`${jt}button-next`,Od=n=>{const{Components:e}=n,t=i=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:i,fill:"currentColor"}}});return e.addType(It,{isComponent:i=>mt(i,On),model:{defaults:{name:Md,classes:On,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:t("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
100
+ .${On} {
333
101
  color: inherit;
334
102
  }
335
- .${wa}:after {
103
+ .${On}:after {
336
104
  content: none;
337
105
  }
338
- `}}}),e.addType(pc,{extend:zi,isComponent:r=>ri(r,Sa),model:{defaults:{name:Pj,classes:Sa,components:n("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
339
- .${Sa} {
106
+ `}}}),e.addType(Jn,{extend:It,isComponent:i=>mt(i,En),model:{defaults:{name:Ad,classes:En,components:t("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
107
+ .${En} {
340
108
  color: inherit;
341
109
  }
342
- .${Sa}:after {
110
+ .${En}:after {
343
111
  content: none;
344
112
  }
345
- `}}}),()=>{e.removeType(zi),e.removeType(pc)}},Lj=t=>{const{Components:e}=t,n=`${Os}pagination`;return e.addType(Fi,{isComponent:r=>ri(r,n),model:{defaults:{name:"Pagination",classes:n,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
346
- .${n}-bullet-active {
113
+ `}}}),()=>{e.removeType(It),e.removeType(Jn)}},Ed=n=>{const{Components:e}=n,t=`${jt}pagination`;return e.addType(Pt,{isComponent:i=>mt(i,t),model:{defaults:{name:"Pagination",classes:t,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
114
+ .${t}-bullet-active {
347
115
  background-color: currentColor;
348
116
  }
349
- .${n}-progressbar-fill {
117
+ .${t}-progressbar-fill {
350
118
  --swiper-pagination-color: currentColor;
351
119
  }
352
- `}}}),()=>{e.removeType(Fi)}},Vj="Scrollbar",Gm=`${Os}scrollbar`,Ij=t=>{const{Components:e}=t;return e.addType(tl,{isComponent:n=>ri(n,Gm),model:{defaults:{name:Vj,classes:Gm,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(tl)}},$j="Slide",Km=`${Os}slide`,Hj=t=>{const{Components:e}=t;return e.addType(bl,{isComponent:n=>ri(n,Km),model:{defaults:{name:$j,classes:Km,icon:$t.slider,draggable:(n,r)=>r.is(Bi)}}}),()=>{e.removeType(bl)}},Bj="Wrapper",Ym=`${Os}wrapper`,zj=t=>{const{Components:e}=t,{events:n}=e;return e.addType(Bi,{isComponent:r=>ri(r,Ym),model:{defaults:{name:Bj,icon:$t.slider,classes:Ym,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:r=>r.is(bl)},init(){const r=this.components();this.listenTo(r,"add remove",this.updateSlider)},updateSlider(r){const o=this.closestType(qn);if(o){const i=o.getView();o.reloadSlider(),this.em.once(n.scriptMount,()=>{setTimeout(()=>{var s;return(s=i.getSwiper())==null?void 0:s.slideTo(r.index())},100)})}}}}),()=>{e.removeType(Bi)}},Fj="swiperComponent",Wj=function(t,e={}){const n={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...e},r=[Rj(t,n),Dj(t),zj(t),Hj(t),Lj(t),Ij(t)];wr({editor:t,plan:Ht.startup,licenseKey:n.licenseKey,pluginName:Fj,cleanup:()=>{r.forEach(o=>o())}})},Uj=xr(Wj),qj=t=>t.dispatchEvent(new CustomEvent("input"));function Gj(t,e){if(!e)return()=>{};const n=t.Components.events,r=u=>t.getSelectedAll().includes(u),o=u=>u.isInstanceOf("text")&&!u.isChildOf("text"),i=u=>u.isChildOf("text"),s=u=>t.getEditing()===u,l=(u,d={})=>{u.trigger("focus",d.event)},a=(u,d)=>{r(u)&&o(u)&&!s(u)&&l(u,d)},c=(u,d)=>{if(r(u)&&!o(u)&&i(u)){const f=u.parents().find(p=>p.isInstanceOf("text"));f&&(l(f,d),setTimeout(()=>t.select(f),0))}};return t.on(n.select,a),t.on(n.selectBefore,c),()=>{t.off(n.select,a),t.off(n.selectBefore,c)}}const lh=new WeakMap,Kj=(t,e)=>{lh.set(t,e)},Yj=t=>{lh.delete(t)},pd=t=>lh.get(t),Ca=t=>{const e=t.target,n=e.closest(".tox"),r=e.matches(".ephox-snooker-resizer-bar");(n||r)&&t.stopPropagation()},Jm=t=>{t.stopPropagation(),t.preventDefault()},Jj=(t,e)=>{const n=t.getDoc(),r=t.getWin();if(e!=null&&e.event){const{event:o}=e,{clientX:i,clientY:s}=o;let l;if(n.caretRangeFromPoint)l=n.caretRangeFromPoint(i,s);else if(n.caretPositionFromPoint){const a=n.caretPositionFromPoint(i,s);l=n.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=r.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),t.selection.setRng(l)}}else t.execCommand("SelectAll")},Zj=t=>{var c,u;const{el:e,editor:n,componentView:r}=t,o=n.runCommand(vt.getStateTheme),i=r.model,s={target:e,inline:!0,skin:(o==null?void 0:o.theme)===Xv.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},l=((u=(c=t.pluginOpts)==null?void 0:c.loadConfig)==null?void 0:u.call(c,{config:s,editor:n,componentView:r,component:i}))||{};return{...s,...l}},Zm=(t,e=document)=>new Promise((n,r)=>{const o=Array.isArray(t)?[...t]:[t],{head:i}=e,s=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=s.bind(null,l),a.onerror=r,i.appendChild(a)}else n()};s(o)}),Xj="rteTinyMce",Qj=function(t,e={}){const n={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:r}=n,o=t.Canvas.events,i=async(a,c)=>{const u=a.ownerDocument,d=u.defaultView,f=c==null?void 0:c.view;if(!d||!f){console.warn("Missing required data",{win:d,componentView:f});return}const p=Zj({el:a,editor:t,componentView:f,pluginOpts:n}),b=(await d.tinymce.init(p))[0];if(!b)return;const y=(await window.tinymce.init({...p,target:document.createElement("div")}))[0];return b.ui.show(),u.body.addEventListener("mousedown",Ca),document.body.addEventListener("mousedown",Ca),b.on("Change",()=>qj(a)),b.on("blur",()=>b.ui.show()),b.on("OpenWindow",function(){var C;const w=(C=u.querySelector(".tox-dialog"))==null?void 0:C.closest(".tox");w&&(w==null?void 0:w.ownerDocument)!==document&&(document.body.appendChild(w),b.once("CloseWindow",()=>{w&&w.ownerDocument===document&&u.body.appendChild(w)}))}),a.addEventListener("dragstart",Jm,{capture:!0}),t.runCommand(vt.setStateContextMenu,{enabled:!1}),Jj(b,c),{rteEditor:b,rteEditorShallow:y}},s=(a,c)=>{a.ownerDocument.body.removeEventListener("mousedown",Ca),document.body.removeEventListener("mousedown",Ca),a.removeEventListener("dragstart",Jm,{capture:!0}),t.runCommand(vt.setStateContextMenu,{enabled:!0}),c.rteEditor.destroy(),c.rteEditorShallow.destroy()};t.on(o.frameLoad,async({window:a})=>{Zm(r,a.document)}),t.onReady(()=>{Zm(r,document)}),t.setCustomRte({parseContent:!0,async enable(a,c,u){const d=pd(a);if(d)return d.rteEditor;const f=await i(a,u);return f&&Kj(a,f),f==null?void 0:f.rteEditor},disable(a){const c=pd(a);c&&(Yj(a),s(a,c))},getContent(a){var u,d;const c=pd(a);return c?(d=(u=c.rteEditor).getContent)==null?void 0:d.call(u):a.innerHTML}});const l=Gj(t,n.enableOnClick);wr({editor:t,licenseKey:n.licenseKey,plan:Ht.startup,pluginName:Xj,cleanup:()=>{t.RichTextEditor.customRte=void 0,l()}})},eR=xr(Qj);function Ot(t){this.content=t}Ot.prototype={constructor:Ot,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Ot(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ot(n)},addToStart:function(t,e){return new Ot([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ot(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Ot(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ot.from(t),t.size?new Ot(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ot.from(t),t.size?new Ot(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ot.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ot.from=function(t){if(t instanceof Ot)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ot(e)};function Sy(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=Sy(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Cy(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let c=Cy(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}class K{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new K(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new K(r,o)}cutByIndex(e,n){return e==n?K.empty:e==0&&n==this.content.length?this:new K(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new K(o,i)}addToStart(e){return new K([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new K(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Sy(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Cy(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Ea(0,e);if(e==this.size)return Ea(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||n>0?Ea(r+1,s):Ea(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return K.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return K.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new K(n||e,r)}static from(e){if(!e)return K.empty;if(e instanceof K)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new K([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const hd={index:0,offset:0};function Ea(t,e){return hd.index=t,hd.offset=e,hd}function hc(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!hc(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!hc(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class ze{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ze.none;if(e instanceof ze)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}ze.none=[];class gc extends Error{}class ne{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Oy(this.content,e+this.openStart,n);return r&&new ne(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ne(Ey(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ne.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ne(K.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new ne(e,r,o)}}ne.empty=new ne(K.empty,0,0);function Ey(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Ey(i.content,e-o-1,n-o-1)))}function Oy(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let l=Oy(s.content,e-i-1,n);return l&&t.replaceChild(o,s.copy(l))}function tR(t,e,n){if(n.openStart>t.depth)throw new gc("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new gc("Inconsistent open depths");return _y(t,e,n,0)}function _y(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=_y(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return Xo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=nR(n,t);return Xo(i,Ty(t,s,l,e,r))}else return Xo(i,mc(t,e,r))}function ky(t,e){if(!e.type.compatibleContent(t.type))throw new gc("Cannot join "+e.type.name+" onto "+t.type.name)}function Tf(t,e,n){let r=t.node(n);return ky(r,e.node(n)),r}function Zo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function nl(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Zo(t.nodeAfter,r),i++));for(let l=i;l<s;l++)Zo(o.child(l),r);e&&e.depth==n&&e.textOffset&&Zo(e.nodeBefore,r)}function Xo(t,e){return t.type.checkContent(e),t.copy(e)}function Ty(t,e,n,r,o){let i=t.depth>o&&Tf(t,e,o+1),s=r.depth>o&&Tf(n,r,o+1),l=[];return nl(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(ky(i,s),Zo(Xo(i,Ty(t,e,n,r,o+1)),l)):(i&&Zo(Xo(i,mc(t,e,o+1)),l),nl(e,n,o,l),s&&Zo(Xo(s,mc(n,r,o+1)),l)),nl(r,null,o,l),new K(l)}function mc(t,e,n){let r=[];if(nl(null,t,n,r),t.depth>n){let o=Tf(t,e,n+1);Zo(Xo(o,mc(t,e,n+1)),r)}return nl(e,null,n,r),new K(r)}function nR(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(K.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class vl{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ze.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new bc(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new vl(n,r,i)}static resolveCached(e,n){let r=Xm.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else Xm.set(e,r=new rR);let o=r.elts[r.i]=vl.resolve(e,n);return r.i=(r.i+1)%oR,o}}class rR{constructor(){this.elts=[],this.i=0}}const oR=12,Xm=new WeakMap;class bc{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iR=Object.create(null);let Qo=class Af{constructor(e,n,r,o=ze.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||K.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&hc(this.attrs,n||e.defaultAttrs||iR)&&ze.sameSet(this.marks,r||ze.none)}copy(e=null){return e==this.content?this:new Af(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Af(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ne.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new ne(c,o.depth-s,i.depth-s)}replace(e,n,r){return tR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return vl.resolveCached(this,e)}resolveNoCache(e){return vl.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ay(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=K.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ze.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ze.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=K.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};Qo.prototype.text=void 0;class vc extends Qo{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ay(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new vc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new vc(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ay(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class pi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new sR(e,n);if(r.next==null)return pi.empty;let o=My(r);r.next&&r.err("Unexpected trailing text");let i=pR(fR(o));return hR(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return K.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
353
- `)}}pi.empty=new pi(!0);class sR{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function My(t){let e=[];do e.push(lR(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function lR(t){let e=[];do e.push(aR(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function aR(t){let e=dR(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=cR(t,e);else break;return e}function Qm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function cR(t,e){let n=Qm(t),r=n;return t.eat(",")&&(t.next!="}"?r=Qm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function uR(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function dR(t){if(t.eat("(")){let e=My(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=uR(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function fR(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function jy(t,e){return e-t}function e1(t,e){let n=[];return r(e),n.sort(jy);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function pR(t){let e=Object.create(null);return n(e1(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);e1(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new pi(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(jy);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function hR(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ry(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Ny(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Py(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function Dy(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new mR(t,r,e[r]);return n}let t1=class Ly{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Dy(e,r.attrs),this.defaultAttrs=Ry(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==pi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ny(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Qo(this,this.computeAttrs(e),K.from(n),ze.setFrom(r))}createChecked(e=null,n,r){return n=K.from(n),this.checkContent(n),new Qo(this,this.computeAttrs(e),n,ze.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=K.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(K.empty,!0);return i?new Qo(this,e,n.append(i),ze.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Py(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ze.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Ly(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function gR(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class mR{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?gR(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class uu{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Dy(e,o.attrs),this.excluded=null;let i=Ry(this.attrs);this.instance=i?new ze(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ze(this,Ny(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new uu(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Py(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class bR{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ot.from(e.nodes),n.marks=Ot.from(e.marks||{}),this.nodes=t1.compile(this.spec.nodes,this),this.marks=uu.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=pi.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?n1(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:n1(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof t1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new vc(r,r.defaultAttrs,e,ze.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Qo.fromJSON(this,e)}markFromJSON(e){return ze.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function n1(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function vR(t){return t.tag!=null}function yR(t){return t.style!=null}let ah=class Mf{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(vR(o))this.tags.push(o);else if(yR(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new o1(this,n,!1);return r.addAll(e,ze.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new o1(this,n,!0);return r.addAll(e,ze.none,n.from,n.to),ne.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(SR(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i1(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=i1(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Mf(e,Mf.schemaRules(e)))}};const Vy={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},xR={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Iy={ol:!0,ul:!0},yc=1,xc=2,rl=4;function r1(t,e,n){return e!=null?(e?yc:0)|(e==="full"?xc:0):t&&t.whitespace=="pre"?yc|xc:n&~rl}class Oa{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ze.none,this.match=i||(s&rl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&yc)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=K.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Vy.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class o1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=r1(null,n.preserveWhitespace,0)|(r?rl:0);o?i=new Oa(o.type,o.attrs,ze.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Oa(null,null,ze.none,!0,null,s):i=new Oa(e.schema.topNodeType,null,ze.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top;if(o.options&xc||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o.options&yc)o.options&xc?r=r.replace(/\r\n?/g,`
354
- `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=e.nodeName.toLowerCase(),i;Iy.hasOwnProperty(o)&&this.parser.normalizeLists&&wR(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,r));if(s?s.ignore:xR.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(Vy.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let u=s&&s.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,s,l,s.consuming===!1?i:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
355
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,o=s,!l.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)n=this.enterInner(r[i],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=ze.none;for(let s of r.concat(e.marks))(o.type?o.type.allowsMarkType(s.type):s1(s.type,e.type))&&(i=s.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=r1(e,i,s.options);s.options&rl&&s.content.length==0&&(l|=rl);let a=ze.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):s1(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Oa(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function wR(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Iy.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function SR(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function i1(t){let e={};for(let n in t)e[n]=t[n];return e}function s1(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class wi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=gd(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=$a(gd(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&$a(gd(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return $a(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=l1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return l1(e.marks)}}function l1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function gd(t){return t.document||window.document}const a1=new WeakMap;function CR(t){let e=a1.get(t);return e===void 0&&a1.set(t,e=ER(t)),e}function ER(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function $a(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=CR(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:g}=$a(t,f,n,r);if(a.appendChild(p),g){if(l)throw new RangeError("Multiple content holes");l=g}}}return{dom:a,contentDOM:l}}const $y=65535,Hy=Math.pow(2,16);function OR(t,e){return t+e*Hy}function c1(t){return t&$y}function _R(t){return(t-(t&$y))/Hy}const By=1,zy=2,Ha=4,Fy=8;class jf{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Fy)>0}get deletedBefore(){return(this.delInfo&(By|Ha))>0}get deletedAfter(){return(this.delInfo&(zy|Ha))>0}get deletedAcross(){return(this.delInfo&Ha)>0}}class cn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&cn.empty)return cn.empty}recover(e){let n=0,r=c1(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+_R(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,p=a+o+(f<0?0:u);if(r)return p;let g=e==(n<0?a:d)?null:OR(l/3,e-a),b=e==a?zy:e==d?By:Ha;return(n<0?e!=a:e!=d)&&(b|=Fy),new jf(p,b,g)}o+=u-c}return r?e+o:new jf(e+o,0,null)}touches(e,n){let r=0,o=c1(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new cn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?cn.empty:new cn(e<0?[0,-e,0]:[0,0,e])}}cn.empty=new cn([]);class Wi{constructor(e=[],n,r=0,o=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=o}slice(e=0,n=this.maps.length){return new Wi(this.maps,this.mirror,e,n)}copy(){return new Wi(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let o=e.getMirror(n);this.appendMap(e.maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Wi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new jf(e,o,null)}}const md=Object.create(null);class Lt{getMap(){return cn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=md[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in md)throw new RangeError("Duplicate use of step JSON ID "+e);return md[e]=n,n.prototype.jsonID=e,n}}class mt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new mt(e,null)}static fail(e){return new mt(null,e)}static fromReplace(e,n,r,o){try{return mt.ok(e.replace(n,r,o))}catch(i){if(i instanceof gc)return mt.fail(i.message);throw i}}}function ch(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(ch(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return K.fromArray(r)}class fo extends Lt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new ne(ch(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,i)}invert(){return new ar(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fo(n.pos,r.pos,this.mark)}merge(e){return e instanceof fo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new fo(n.from,n.to,e.markFromJSON(n.mark))}}Lt.jsonID("addMark",fo);class ar extends Lt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ne(ch(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return mt.fromReplace(e,this.from,this.to,r)}invert(){return new fo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ar(n.pos,r.pos,this.mark)}merge(e){return e instanceof ar&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ar(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ar(n.from,n.to,e.markFromJSON(n.mark))}}Lt.jsonID("removeMark",ar);class po extends Lt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new ne(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new po(this.pos,n.marks[o]);return new po(this.pos,this.mark)}}return new as(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new po(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new po(n.pos,e.markFromJSON(n.mark))}}Lt.jsonID("addNodeMark",po);class as extends Lt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return mt.fromReplace(e,this.pos,this.pos+1,new ne(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new po(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new as(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new as(n.pos,e.markFromJSON(n.mark))}}Lt.jsonID("removeNodeMark",as);class Pt extends Lt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Rf(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new cn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Pt(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Pt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ne.empty:new ne(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Pt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ne.empty:new ne(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Pt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Pt(n.from,n.to,ne.fromJSON(e,n.slice),!!n.structure)}}Lt.jsonID("replace",Pt);class jt extends Lt{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Rf(e,this.from,this.gapFrom)||Rf(e,this.gapTo,this.to)))return mt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return mt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?mt.fromReplace(e,this.from,this.to,r):mt.fail("Content does not fit in gap")}getMap(){return new cn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new jt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new jt(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new jt(n.from,n.to,n.gapFrom,n.gapTo,ne.fromJSON(e,n.slice),n.insert,!!n.structure)}}Lt.jsonID("replaceAround",jt);function Rf(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function kR(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+a.nodeSize,n),g=r.addToSet(d);for(let b=0;b<d.length;b++)d[b].isInSet(g)||(s&&s.to==f&&s.mark.eq(d[b])?s.to=p:o.push(s=new ar(f,p,d[b])));l&&l.to==f?l.to=p:i.push(l=new fo(f,p,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function TR(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof uu){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let p=0;p<o.length;p++){let g=o[p];g.step==i-1&&d.eq(o[p].style)&&(f=g)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new ar(s.from,s.to,s.style)))}function uh(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Pt(l,u,ne.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new ar(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,g;for(;f=p.exec(c.text);)g||(g=new ne(K.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Pt(l+f.index,l+f.index+f[0].length,g))}}l=u}if(!r.validEnd){let a=r.fillBefore(K.empty,!0);t.replace(l,l,new ne(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function AR(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function du(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!AR(o,i,s))break}return null}function MR(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=K.empty,d=0;for(let g=i,b=!1;g>n;g--)b||r.index(g)>0?(b=!0,u=K.from(r.node(g).copy(u)),d++):a--;let f=K.empty,p=0;for(let g=i,b=!1;g>n;g--)b||o.after(g+1)<o.end(g)?(b=!0,f=K.from(o.node(g).copy(f)),p++):c++;t.step(new jt(a,c,s,l,new ne(u.append(f),d,p),u.size-d,!0))}function Wy(t,e,n=null,r=t){let o=jR(t,e),i=o&&RR(r,e);return i?o.map(u1).concat({type:e,attrs:n}).concat(i.map(u1)):null}function u1(t){return{type:t,attrs:null}}function jR(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function RR(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function NR(t,e,n){let r=K.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new jt(o,i,o,i,new ne(r,0,0),n.length,!0))}function PR(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&DR(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!g?c=!1:!p&&g&&(c=!0)}c===!1&&qy(t,s,l,i),uh(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new jt(d,f,d+1,f-1,new ne(K.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Uy(t,s,l,i),!1}})}function Uy(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function qy(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
356
- `))}})}function DR(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function LR(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new jt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ne(K.from(s),0,0),1,!0))}function Ui(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),g=r&&r[u+1];g&&(p=p.replaceChild(0,g.type.create(g.attrs)));let b=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!b.type.validContent(p))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function VR(t,e,n=1,r){let o=t.doc.resolve(e),i=K.empty,s=K.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=K.from(o.node(l).copy(i));let u=r&&r[c];s=K.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new Pt(e,e,new ne(i.append(s),n,n),!0))}function fu(t,e){let n=t.resolve(e),r=n.index();return $R(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function IR(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function $R(t,e){return!!(t&&e&&!t.isLeaf&&IR(t,e))}function HR(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);qy(t,u.node(),u.before(),l)}s.inlineContent&&uh(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new Pt(c,a.map(e+n,-1),ne.empty,!0)),r===!0){let u=t.doc.resolve(c);Uy(t,u.node(),u.before(),t.steps.length)}return t}function BR(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function zR(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function dh(t,e,n=e,r=ne.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Gy(o,i,r)?new Pt(e,n,r):new FR(o,i,r).fit()}function Gy(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class FR{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=K.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new ne(i,s,l);return e>-1?new jt(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Pt(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=bd(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(K.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bd(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ne(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=bd(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ne(zs(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ne(zs(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let b=0;b<o.childCount;b++)u.push(o.child(b));d=d.matchFragment(o)}let p=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let b=l.child(c),v=d.matchType(b.type);if(!v)break;c++,(c>1||a==0||b.content.size)&&(d=v,u.push(Ky(b.mark(f.allowedMarks(b.marks)),c==1?a:0,c==l.childCount?p:-1)))}let g=c==l.childCount;g||(p=-1),this.placed=Fs(this.placed,n,K.from(u)),this.frontier[n].match=d,g&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,v=l;b<p;b++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=g?e==0?ne.empty:new ne(zs(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new ne(zs(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!vd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=vd(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=vd(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Fs(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Fs(this.placed,this.depth,K.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=Fs(this.placed,this.frontier.length,n))}}function zs(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(zs(t.firstChild.content,e-1,n)))}function Fs(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Fs(t.lastChild.content,e-1,n)))}function bd(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ky(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ky(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),t.copy(r)}function vd(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!WR(n,i.content,s)?l:null}function WR(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function UR(t){return t.spec.defining||t.spec.definingForContent}function qR(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Gy(o,i,r))return t.step(new Pt(e,n,r));let s=Jy(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let g=o.node(f).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==p&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let g=f.firstChild;if(c.push(g),p==r.openStart)break;f=g.content}for(let f=u-1;f>=0;f--){let p=c[f],g=UR(p.type);if(g&&!p.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(g||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),g=c[p];if(g)for(let b=0;b<s.length;b++){let v=s[(b+a)%s.length],y=!0;v<0&&(y=!1,v=-v);let w=o.node(v-1),S=o.index(v-1);if(w.canReplaceWith(S,S,g.type,g.marks))return t.replace(o.before(v),y?i.after(v):n,new ne(Yy(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),n=i.after(p))}}function Yy(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Yy(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(K.empty,!0))}return t}function GR(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=BR(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ne(K.from(r),0,0))}function KR(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Jy(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Jy(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class qi extends Lt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return mt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return mt.fromReplace(e,this.pos,this.pos+1,new ne(K.from(o),0,n.isLeaf?0:1))}getMap(){return cn.empty}invert(e){return new qi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qi(n.pos,n.attr,n.value)}}Lt.jsonID("attr",qi);class yl extends Lt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return mt.ok(r)}getMap(){return cn.empty}invert(e){return new yl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new yl(n.attr,n.value)}}Lt.jsonID("docAttr",yl);let cs=class extends Error{};cs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};cs.prototype=Object.create(Error.prototype);cs.prototype.constructor=cs;cs.prototype.name="TransformError";class Zy{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Wi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new cs(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ne.empty){let o=dh(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ne(K.from(r),0,0))}delete(e,n){return this.replace(e,n,ne.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return qR(this,e,n,r),this}replaceRangeWith(e,n,r){return GR(this,e,n,r),this}deleteRange(e,n){return KR(this,e,n),this}lift(e,n){return MR(this,e,n),this}join(e,n=1){return HR(this,e,n),this}wrap(e,n){return NR(this,e,n),this}setBlockType(e,n=e,r,o=null){return PR(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return LR(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new qi(e,n,r)),this}setDocAttribute(e,n){return this.step(new yl(e,n)),this}addNodeMark(e,n){return this.step(new po(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ze)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new as(e,n)),this}split(e,n=1,r){return VR(this,e,n,r),this}addMark(e,n,r){return kR(this,e,n,r),this}removeMark(e,n,r){return TR(this,e,n,r),this}clearIncompatible(e,n,r){return uh(this,e,n,r),this}}const yd=Object.create(null);class Ee{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Xy(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ne.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?ne.empty:n),l==0&&p1(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),p1(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new ke(e):Mi(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?Mi(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Mi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mn(e.node(0))}static atStart(e){return Mi(e,e,0,0,1)||new mn(e)}static atEnd(e){return Mi(e,e,e.content.size,e.childCount,-1)||new mn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=yd[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in yd)throw new RangeError("Duplicate use of selection JSON ID "+e);return yd[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ke.between(this.$anchor,this.$head).getBookmark()}}Ee.prototype.visible=!0;class Xy{constructor(e,n){this.$from=e,this.$to=n}}let d1=!1;function f1(t){!d1&&!t.parent.inlineContent&&(d1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ke extends Ee{constructor(e,n=e){f1(e),f1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ee.near(r);let o=e.resolve(n.map(this.anchor));return new ke(o.parent.inlineContent?o:r,r)}replace(e,n=ne.empty){if(super.replace(e,n),n==ne.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ke&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ke(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Ee.findFrom(n,r,!0)||Ee.findFrom(n,-r,!0);if(i)n=i.$head;else return Ee.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Ee.findFrom(e,-r,!0)||Ee.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new ke(e,n)}}Ee.jsonID("text",ke);class pu{constructor(e,n){this.anchor=e,this.head=n}map(e){return new pu(e.map(this.anchor),e.map(this.head))}resolve(e){return ke.between(e.resolve(this.anchor),e.resolve(this.head))}}class Se extends Ee{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?Ee.near(i):new Se(i)}content(){return new ne(K.from(this.node),0,0)}eq(e){return e instanceof Se&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new fh(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Se(e.resolve(n.anchor))}static create(e,n){return new Se(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Se.prototype.visible=!1;Ee.jsonID("node",Se);class fh{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new pu(r,r):new fh(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Se.isSelectable(r)?new Se(n):Ee.near(n)}}class mn extends Ee{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ne.empty){if(n==ne.empty){e.delete(0,e.doc.content.size);let r=Ee.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new mn(e)}map(e){return new mn(e)}eq(e){return e instanceof mn}getBookmark(){return YR}}Ee.jsonID("all",mn);const YR={map(){return this},resolve(t){return new mn(t)}};function Mi(t,e,n,r,o,i=!1){if(e.inlineContent)return ke.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&Se.isSelectable(l))return Se.create(t,n-(o<0?l.nodeSize:0))}else{let a=Mi(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function p1(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Pt||o instanceof jt))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(Ee.near(t.doc.resolve(s),n))}const h1=1,_a=2,g1=4;class JR extends Zy{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|h1)&~_a,this.storedMarks=null,this}get selectionSet(){return(this.updated&h1)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_a,this}ensureMarks(e){return ze.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_a)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~_a,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ze.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=g1,this}get scrolledIntoView(){return(this.updated&g1)>0}}function m1(t,e){return!e||!t?t:t.bind(e)}class Ws{constructor(e,n,r){this.name=e,this.init=m1(n.init,r),this.apply=m1(n.apply,r)}}const ZR=[new Ws("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ws("selection",{init(t,e){return t.selection||Ee.atStart(e.doc)},apply(t){return t.selection}}),new Ws("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ws("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class xd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ZR.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ws(r.key,r.spec.state,r))})}}class $i{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new $i(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new JR(this)}static create(e){let n=new xd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new $i(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new xd(this.schema,e.plugins),r=n.fields,o=new $i(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new xd(e.schema,e.plugins),i=new $i(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Qo.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Ee.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Qy(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Qy(o,e,{})),n[r]=o}return n}class Bl{constructor(e){this.spec=e,this.props={},e.props&&Qy(e.props,this,this.props),this.key=e.key?e.key.key:ex("plugin")}getState(e){return e[this.key]}}const wd=Object.create(null);function ex(t){return t in wd?t+"$"+ ++wd[t]:(wd[t]=0,t+"$")}class zl{constructor(e="key"){this.key=ex(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const tx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function XR(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const QR=(t,e,n)=>{let r=XR(t,n);if(!r)return!1;let o=nx(r);if(!o){let s=r.blockRange(),l=s&&du(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(ax(t,o,e,-1))return!0;if(r.parent.content.size==0&&(us(i,"end")||Se.isSelectable(i)))for(let s=r.depth;;s--){let l=dh(t.doc,r.before(s),r.after(s),ne.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(us(i,"end")?Ee.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):Se.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function us(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const eN=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=nx(r)}let s=i&&i.nodeBefore;return!s||!Se.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Se.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function nx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function tN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const nN=(t,e,n)=>{let r=tN(t,n);if(!r)return!1;let o=rx(r);if(!o)return!1;let i=o.nodeAfter;if(ax(t,o,e,1))return!0;if(r.parent.content.size==0&&(us(i,"start")||Se.isSelectable(i))){let s=dh(t.doc,r.before(),r.after(),ne.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(us(i,"start")?Ee.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):Se.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},rN=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=rx(r)}let s=i&&i.nodeAfter;return!s||!Se.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Se.create(t.doc,i.pos)).scrollIntoView()),!0)};function rx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const oN=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
357
- `).scrollIntoView()),!0)};function ph(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ox=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=ph(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(Ee.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},iN=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof mn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=ph(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(ke.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},ix=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ui(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&du(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function sx(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Se&&e.selection.node.isBlock)return!r.parentOffset||!Ui(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){a=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),l=ph(r.node(p-1).contentMatchAt(r.indexAfter(p-1)));let b=t&&t(o.parent,a,r);i.unshift(b||(a&&l?{type:l}:null)),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof ke||e.selection instanceof mn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ui(u.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Ui(u.doc,d,i.length,i)),u.split(d,i.length,i),!a&&c&&r.node(s).type!=l){let p=u.mapping.map(r.before(s)),g=u.doc.resolve(p);l&&r.node(s-1).canReplaceWith(g.index(),g.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const sN=sx(),lx=(t,e)=>(e&&e(t.tr.setSelection(new mn(t.doc))),!0);function lN(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||fu(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function ax(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&lN(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,g=K.empty;for(let y=s.length-1;y>=0;y--)g=K.from(s[y].create(null,g));g=K.from(o.copy(g));let b=t.tr.step(new jt(e.pos-1,p,e.pos,p,new ne(g,1,0),s.length,!0)),v=b.doc.resolve(p+2*s.length);v.nodeAfter&&v.nodeAfter.type==o.type&&fu(b.doc,v.pos)&&b.join(v.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:Ee.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&du(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&us(i,"start",!0)&&us(o,"end")){let p=o,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let b=i,v=1;for(;!b.isTextblock;b=b.firstChild)v++;if(p.canReplace(p.childCount,p.childCount,b.content)){if(n){let y=K.empty;for(let S=g.length-1;S>=0;S--)y=K.from(g[S].copy(y));let w=t.tr.step(new jt(e.pos-g.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new ne(y,g.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function cx(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(ke.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const aN=cx(-1),cN=cx(1);function uN(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function dN(t,e,n,r){for(let o=0;o<e.length;o++){let{$from:i,$to:s}=e[o],l=i.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(i.pos,s.pos,(a,c)=>{if(l||!r)return!1;l=a.inlineContent&&a.type.allowsMarkType(n)}),l)return!0}return!1}function zo(t,e=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:l,ranges:a}=o.selection;if(s&&!l||!dN(o.doc,a,t,r))return!1;if(i)if(l)t.isInSet(o.storedMarks||l.marks())?i(o.tr.removeStoredMark(t)):i(o.tr.addStoredMark(t.create(e)));else{let c,u=o.tr;c=!a.some(d=>o.doc.rangeHasMark(d.$from.pos,d.$to.pos,t));for(let d=0;d<a.length;d++){let{$from:f,$to:p}=a[d];if(!c)u.removeMark(f.pos,p.pos,t);else{let g=f.pos,b=p.pos,v=f.nodeAfter,y=p.nodeBefore,w=v&&v.isText?/^\s*/.exec(v.text)[0].length:0,S=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;g+w<b&&(g+=w,b-=S),u.addMark(g,b,t.create(e))}}i(u.scrollIntoView())}return!0}}function xl(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}let Sd=xl(tx,QR,eN),b1=xl(tx,nN,rN);const Rr={Enter:xl(oN,iN,ix,sN),"Mod-Enter":ox,Backspace:Sd,"Mod-Backspace":Sd,"Shift-Backspace":Sd,Delete:b1,"Mod-Delete":b1,"Mod-a":lx},ux={"Ctrl-h":Rr.Backspace,"Alt-Backspace":Rr["Mod-Backspace"],"Ctrl-d":Rr.Delete,"Ctrl-Alt-Backspace":Rr["Mod-Delete"],"Alt-Delete":Rr["Mod-Delete"],"Alt-d":Rr["Mod-Delete"],"Ctrl-a":aN,"Ctrl-e":cN};for(let t in Rr)ux[t]=Rr[t];const fN=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,pN=fN?ux:Rr;var wc=200,Ct=function(){};Ct.prototype.append=function(e){return e.length?(e=Ct.from(e),!this.length&&e||e.length<wc&&this.leafAppend(e)||this.length<wc&&e.leafPrepend(this)||this.appendInner(e)):this};Ct.prototype.prepend=function(e){return e.length?Ct.from(e).append(this):this};Ct.prototype.appendInner=function(e){return new hN(this,e)};Ct.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ct.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ct.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ct.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ct.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};Ct.from=function(e){return e instanceof Ct?e:e&&e.length?new dx(e):Ct.empty};var dx=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=wc)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=wc)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ct);Ct.empty=new dx([]);var hN=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ct);const gN=500;class Wn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new rr(d.map));let p=d.step.map(o.slice(i)),g;p&&s.maybeStep(p).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],c.push(new rr(g,void 0,void 0,c.length+u.length))),i--,g&&o.appendMap(g,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new Wn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new rr(e.mapping.maps[u],d,n),p;(p=a&&a.merge(f))&&(f=p,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>bN&&(l=mN(l,c),s-=c),new Wn(l.append(i),s)}remapping(e,n){let r=new Wi;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Wn(this.items.append(e.map(n=>new rr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let p=i.getMirror(--a);if(p==null)return;s=Math.min(s,p);let g=i.maps[p];if(f.step){let b=e.steps[p].invert(e.docs[p]),v=f.selection&&f.selection.map(i.slice(a+1,p));v&&l++,r.push(new rr(g,b,v))}else r.push(new rr(g))},o);let c=[];for(let f=n;f<s;f++)c.push(new rr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Wn(u,l);return d.emptyItemCount()>gN&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new rr(c.invert(),a,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Wn(Ct.from(o.reverse()),i)}}Wn.empty=new Wn(Ct.empty,0);function mN(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class rr{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new rr(n.getMap().invert(),n,this.selection)}}}class ro{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const bN=20;function vN(t,e,n,r){let o=n.getMeta(ei),i;if(o)return o.historyState;n.getMeta(wN)&&(t=new ro(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ei))return s.getMeta(ei).redo?new ro(t.done.addTransform(n,void 0,r,Ba(e)),t.undone,v1(n.mapping.maps),t.prevTime,t.prevComposition):new ro(t.done,t.undone.addTransform(n,void 0,r,Ba(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!yN(n,t.prevRanges)),c=s?Cd(t.prevRanges,n.mapping):v1(n.mapping.maps);return new ro(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Ba(e)),Wn.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ro(t.done.rebased(n,i),t.undone.rebased(n,i),Cd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ro(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Cd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function yN(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function v1(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function Cd(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function xN(t,e,n){let r=Ba(e),o=ei.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new ro(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ei,{redo:n,historyState:a})}let Ed=!1,y1=null;function Ba(t){let e=t.plugins;if(y1!=e){Ed=!1,y1=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ed=!0;break}}return Ed}const ei=new zl("history"),wN=new zl("closeHistory");function SN(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Bl({key:ei,state:{init(){return new ro(Wn.empty,Wn.empty,null,0,-1)},apply(e,n,r){return vN(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?px:r=="historyRedo"?Nf:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function fx(t,e){return(n,r)=>{let o=ei.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=xN(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const px=fx(!1,!0),Nf=fx(!0,!0);var _o={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Sc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},CN=typeof navigator<"u"&&/Mac/.test(navigator.platform),EN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _t=0;_t<10;_t++)_o[48+_t]=_o[96+_t]=String(_t);for(var _t=1;_t<=24;_t++)_o[_t+111]="F"+_t;for(var _t=65;_t<=90;_t++)_o[_t]=String.fromCharCode(_t+32),Sc[_t]=String.fromCharCode(_t);for(var Od in _o)Sc.hasOwnProperty(Od)||(Sc[Od]=_o[Od]);function ON(t){var e=CN&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||EN&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Sc:_o)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const _N=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function kN(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))_N?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function TN(t){let e=Object.create(null);for(let n in t)e[kN(n)]=t[n];return e}function _d(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function kd(t){return new Bl({props:{handleKeyDown:hx(t)}})}function hx(t){let e=TN(t);return function(n,r){let o=ON(r),i,s=e[_d(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[_d(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=_o[r.keyCode])&&i!=o){let l=e[_d(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}function x1(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);a=new bc(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new bc(o,n.doc.resolve(i.end(s.depth)),s.depth)),l=!0}let c=Wy(a,t,e,s);return c?(r&&r(AN(n.tr,s,c,l,t).scrollIntoView()),!0):!1}}function AN(t,e,n,r,o){let i=K.empty;for(let u=n.length-1;u>=0;u--)i=K.from(n[u].type.create(n[u].attrs,i));t.step(new jt(e.start-(r?2:0),e.end,e.start,e.end,new ne(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ui(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function MN(t,e){return function(n,r){let{$from:o,$to:i,node:s}=n.selection;if(s&&s.isBlock||o.depth<2||!o.sameParent(i))return!1;let l=o.node(-1);if(l.type!=t)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=t||o.index(-2)!=o.node(-2).childCount-1)return!1;if(r){let d=K.empty,f=o.index(-1)?1:o.index(-2)?2:3;for(let y=o.depth-f;y>=o.depth-3;y--)d=K.from(o.node(y).copy(d));let p=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;d=d.append(K.from(t.createAndFill()));let g=o.before(o.depth-(f-1)),b=n.tr.replace(g,o.after(-p),new ne(d,4-f,0)),v=-1;b.doc.nodesBetween(g,b.doc.content.size,(y,w)=>{if(v>-1)return!1;y.isTextblock&&y.content.size==0&&(v=w+1)}),v>-1&&b.setSelection(Ee.near(b.doc.resolve(v))),r(b.scrollIntoView())}return!0}let a=i.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=n.tr.delete(o.pos,i.pos),u=a?[null,{type:a}]:void 0;return Ui(c.doc,o.pos,2,u)?(r&&r(c.split(o.pos,2,u).scrollIntoView()),!0):!1}}function Pf(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?jN(e,n,t,i):RN(e,n,i):!0:!1}}function jN(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new jt(i-1,s,i,s,new ne(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new bc(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=du(r);if(l==null)return!1;o.lift(r,l);let a=o.mapping.map(i,-1)-1;return fu(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function RN(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,g=n.endIndex-1,b=n.startIndex;g>b;g--)p-=o.child(g).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?K.empty:K.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new jt(d-(l?1:0),f+(a?1:0),d+1,f-1,new ne((l?K.empty:K.from(o.copy(K.empty))).append(a?K.empty:K.from(o.copy(K.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function NN(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=K.from(c?t.create():null),d=new ne(K.from(t.create(null,K.from(l.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new jt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const kt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},wl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Df=null;const jr=function(t,e,n){let r=Df||(Df=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},PN=function(){Df=null},hi=function(t,e,n,r){return n&&(w1(t,e,n,r,-1)||w1(t,e,n,r,1))},DN=/^(img|br|input|textarea|hr)$/i;function w1(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:jn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Fl(t)||DN.test(t.nodeName)||t.contentEditable=="false")return!1;e=kt(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?jn(t):0}else return!1}}function jn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function LN(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=jn(t)}else if(t.parentNode&&!Fl(t))e=kt(t),t=t.parentNode;else return null}}function VN(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Fl(t))e=kt(t)+1,t=t.parentNode;else return null}}function IN(t,e,n){for(let r=e==0,o=e==jn(t);r||o;){if(t==n)return!0;let i=kt(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==jn(t)}}function Fl(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const hu=function(t){return t.focusNode&&hi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Fo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function $N(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function HN(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(jn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(jn(r.startContainer),r.startOffset)}}}const br=typeof navigator<"u"?navigator:null,S1=typeof document<"u"?document:null,Ro=br&&br.userAgent||"",Lf=/Edge\/(\d+)/.exec(Ro),gx=/MSIE \d/.exec(Ro),Vf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ro),tn=!!(gx||Vf||Lf),bo=gx?document.documentMode:Vf?+Vf[1]:Lf?+Lf[1]:0,Jn=!tn&&/gecko\/(\d+)/i.test(Ro);Jn&&+(/Firefox\/(\d+)/.exec(Ro)||[0,0])[1];const If=!tn&&/Chrome\/(\d+)/.exec(Ro),Dt=!!If,mx=If?+If[1]:0,zt=!tn&&!!br&&/Apple Computer/.test(br.vendor),ds=zt&&(/Mobile\/\w+/.test(Ro)||!!br&&br.maxTouchPoints>2),_n=ds||(br?/Mac/.test(br.platform):!1),BN=br?/Win/.test(br.platform):!1,Fn=/Android \d/.test(Ro),Wl=!!S1&&"webkitFontSmoothing"in S1.documentElement.style,zN=Wl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function FN(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function kr(t,e){return typeof t=="number"?t:t[e]}function WN(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function C1(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=wl(s)){if(s.nodeType!=1)continue;let l=s,a=l==i.body,c=a?FN(i):WN(l),u=0,d=0;if(e.top<c.top+kr(r,"top")?d=-(c.top-e.top+kr(o,"top")):e.bottom>c.bottom-kr(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+kr(o,"top")-c.top:e.bottom-c.bottom+kr(o,"bottom")),e.left<c.left+kr(r,"left")?u=-(c.left-e.left+kr(o,"left")):e.right>c.right-kr(r,"right")&&(u=e.right-c.right+kr(o,"right")),u||d)if(a)i.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let g=l.scrollLeft-f,b=l.scrollTop-p;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function UN(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:bx(t.dom)}}function bx(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=wl(r));return e}function qN({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;vx(n,r==0?0:r-e)}function vx(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ki=null;function GN(t){if(t.setActive)return t.setActive();if(ki)return t.focus(ki);let e=bx(t);t.focus(ki==null?{get preventScroll(){return ki={preventScroll:!0},!0}}:void 0),ki||(ki=!1,vx(e,0))}function yx(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=jr(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let g=f[p];if(g.top<=s&&g.bottom>=l){s=Math.max(g.bottom,s),l=Math.min(g.top,l);let b=g.left>e.left?g.left-e.left:g.right<e.left?e.left-g.right:0;if(b<r){n=u,r=b,o=b&&n.nodeType==3?{left:g.right<e.left?g.right:g.left,top:e.top}:e,u.nodeType==1&&b&&(i=d+(e.left>=(g.left+g.right)/2?1:0));continue}}else g.top>e.top&&!a&&g.left<=e.left&&g.right>=e.left&&(a=u,c={left:Math.max(g.left,Math.min(g.right,e.left)),top:g.top});!n&&(e.left>=g.right&&e.top>=g.top||e.left>=g.left&&e.top>=g.bottom)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&n.nodeType==3?KN(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:yx(n,o)}function KN(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=eo(r,1);if(i.top!=i.bottom&&hh(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function hh(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function YN(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function JN(t,e,n){let{node:r,offset:o}=yx(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function ZN(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function xx(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(hh(e,c))return xx(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function XN(t,e){let n=t.dom.ownerDocument,r,o=0,i=HN(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!hh(e,c)||(s=xx(t.dom,e,c),!s))return null}if(zt)for(let c=s;r&&c;c=wl(c))c.draggable&&(r=void 0);if(s=YN(s,e),r){if(Jn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Wl&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=ZN(t,r,o,e))}l==null&&(l=JN(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function E1(t){return t.top<t.bottom||t.left<t.right}function eo(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(E1(r))return r}return Array.prototype.find.call(n,E1)||t.getBoundingClientRect()}const QN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function wx(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Wl||Jn;if(r.nodeType==3)if(s&&(QN.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=eo(jr(r,o,o),n);if(Jn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=eo(jr(r,o-1,o-1),-1);if(c.top==a.top){let u=eo(jr(r,o,o+1),-1);if(u.top!=a.top)return Vs(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Vs(eo(jr(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==jn(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Td(a.getBoundingClientRect(),!1)}if(i==null&&o<jn(r)){let a=r.childNodes[o];if(a.nodeType==1)return Td(a.getBoundingClientRect(),!0)}return Td(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==jn(r))){let a=r.childNodes[o-1],c=a.nodeType==3?jr(a,jn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Vs(eo(c,1),!1)}if(i==null&&o<jn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?jr(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Vs(eo(c,-1),!0)}return Vs(eo(r.nodeType==3?jr(r):r,-n),n>=0)}function Vs(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Td(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Sx(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function eP(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Sx(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=wx(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=jr(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const tP=/[\u0590-\u08ac]/;function nP(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!tP.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:Sx(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:g,focusOffset:b}=t.domSelectionRange(),v=g&&!p.contains(g.nodeType==1?g:g.parentNode)||a==g&&c==b;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),v}):r.pos==r.start()||r.pos==r.end()}let O1=null,_1=null,k1=!1;function rP(t,e,n){return O1==e&&_1==n?k1:(O1=e,_1=n,k1=n=="up"||n=="down"?eP(t,e,n):nP(t,e,n))}const In=0,T1=1,qo=2,vr=3;class Ul{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=In,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>kt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e||s instanceof Ex){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Cx&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?kt(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?kt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=kt(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=kt(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let p=0,g=0;p<this.children.length;p++){let b=this.children[p],v=g+b.size;if(i>g&&s<v)return b.setSelection(e-g-b.border,n-g-b.border,r,o);g=v}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Jn||zt)&&e==n){let{node:p,offset:g}=l;if(p.nodeType==3){if(d=!!(g&&p.nodeValue[g-1]==`
358
- `),d&&g==p.nodeValue.length)for(let b=p,v;b;b=b.parentNode){if(v=b.nextSibling){v.nodeName=="BR"&&(l=a={node:v.parentNode,offset:kt(v)+1});break}let y=b.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let b=p.childNodes[g-1];d=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Jn&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&zt)&&hi(l.node,l.offset,u.anchorNode,u.anchorOffset)&&hi(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!d){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let g=l;l=a,a=g}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?qo:T1,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vr:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?qo:vr}r=s}this.dirty=qo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qo:T1;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Cx extends Ul{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==In&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class oP extends Ul{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class gi extends Ul{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=wi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new gi(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&vr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=vr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=In){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=In}}slice(e,n,r){let o=gi.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Hf(i,n,s,r)),e>0&&(i=Hf(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class vo extends Ul{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=wi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=kx(u,r,n),c?a=new iP(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new gu(e,n,r,o,u,f,i):new vo(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>K.empty)}return e}matchesNode(e,n,r){return this.dirty==In&&e.eq(this.node)&&Cc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new lP(this,s&&s.node,e);uP(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?ze.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,o)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let p;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(c,u,d,p,e)||a.updateNextNode(c,u,d,e,f,o)||a.addNode(c,u,d,e,o),o+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==qo)&&(s&&this.protectLocalComposition(e,s),Ox(this.contentDOM,this.children,e),ds&&dP(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof ke)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=fP(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new oP(this,i,n,o);e.input.compositionNodes.push(s),this.children=Hf(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==vr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=In}updateOuterDeco(e){if(Cc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=_x(this.dom,this.nodeDOM,$f(this.outerDeco,this.node,n),$f(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function A1(t,e,n,r,o){kx(r,e,t);let i=new vo(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class gu extends vo{constructor(e,n,r,o,i,s,l){super(e,n,r,o,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==vr||this.dirty!=In&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=In||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=In,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new gu(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=vr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ex extends Ul{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==In&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class iP extends vo{constructor(e,n,r,o,i,s,l,a,c,u){super(e,n,r,o,i,s,l,c,u),this.spec=a}update(e,n,r,o){if(this.dirty==vr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ox(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=M1(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof gi){let a=r?r.previousSibling:t.lastChild;Ox(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=M1(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const ol=function(t){t&&(this.nodeName=t)};ol.prototype=Object.create(null);const Go=[new ol];function $f(t,e,n){if(t.length==0)return Go;let r=n?Go[0]:new ol,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new ol(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new ol(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function _x(t,e,n,r){if(n==Go&&r==Go)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=Go[0]),o=a}sP(o,l||Go[0],s)}return o}function sP(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function kx(t,e,n){return _x(t,t,Go,$f(e,n,t.nodeType!=1))}function Cc(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function M1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class lP{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=aP(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=In,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=gi.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==vr&&s.dom==s.contentDOM&&(s.dirty=qo),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof vo){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=vr&&Cc(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=qo,d.updateChildren(o,s+1),d.dirty=In),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Cc(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=vo.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=vo.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new Cx(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof gi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof gu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((zt||Dt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Ex(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function aP(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof gi)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function cP(t,e){return t.type.side-e.type.side}function uP(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(cP);for(let v=0;v<d.length;v++)n(d[v],c,!!a)}else n(u,c,!!a);let f,p;if(a)p=-1,f=a,a=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let v=0;v<l.length;v++)l[v].to<=i&&l.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let g=i+f.nodeSize;if(f.isText){let v=g;s<o.length&&o[s].from<v&&(v=o[s].from);for(let y=0;y<l.length;y++)l[y].to<v&&(v=l[y].to);v<g&&(a=f.cut(v-i),f=f.cut(0,v-i),g=v,p=-1)}else for(;s<o.length&&o[s].to<g;)s++;let b=f.isInline&&!f.isLeaf?l.filter(v=>!v.inline):l.slice();r(f,b,e.forChild(i,f),p),i=g}}function dP(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function fP(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Hf(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function gh(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(hu(n)){for(a=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Se.isSelectable(d)&&o.parent&&!(d.isInline&&IN(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new Se(s==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p<n.rangeCount;p++){let g=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(g.startContainer,g.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(d<0)return null;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=mh(t,u,l,d)}return c}function Tx(t){return t.editable?t.hasFocus():Mx(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function $r(t,e=!1){let n=t.state.selection;if(Ax(t,n),!!Tx(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Dt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&hi(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)hP(t);else{let{anchor:r,head:o}=n,i,s;j1&&!(n instanceof ke)&&(n.$from.parent.inlineContent||(i=R1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=R1(t,n.to))),t.docView.setSelection(r,o,t,e),j1&&(i&&N1(i),s&&N1(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&pP(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const j1=zt||Dt&&mx<63;function R1(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(zt&&o&&o.contentEditable=="false")return Ad(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Ad(o);if(i)return Ad(i)}}function Ad(t){return t.contentEditable="true",zt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function N1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function pP(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Tx(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hP(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,kt(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&tn&&bo<=11&&(r.disabled=!0,r.disabled=!1)}function Ax(t,e){if(e instanceof Se){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(P1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else P1(t)}function P1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function mh(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||ke.between(e,n,r)}function D1(t){return t.editable&&!t.hasFocus()?!1:Mx(t)}function Mx(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function gP(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return hi(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Bf(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Ee.findFrom(i,e)}function oo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function L1(t,e,n){let r=t.state.selection;if(r instanceof ke)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return oo(t,new ke(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Bf(t.state,e);return o&&o instanceof Se?oo(t,o):!1}else if(!(_n&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Se.isSelectable(i)?oo(t,new Se(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Wl?oo(t,new ke(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Se&&r.node.isInline)return oo(t,new ke(e>0?r.$to:r.$from));{let o=Bf(t.state,e);return o?oo(t,o):!1}}}function Ec(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function il(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ti(t,e){return e<0?mP(t):bP(t)}function mP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Jn&&n.nodeType==1&&r<Ec(n)&&il(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(il(l,-1))o=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(jx(n))break;{let l=n.previousSibling;for(;l&&il(l,-1);)o=n.parentNode,i=kt(l),l=l.previousSibling;if(l)n=l,r=Ec(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?zf(t,n,r):o&&zf(t,o,i)}function bP(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Ec(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(il(l,1))i=n,s=++r;else break}else{if(jx(n))break;{let l=n.nextSibling;for(;l&&il(l,1);)i=l.parentNode,s=kt(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Ec(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&zf(t,i,s)}function jx(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function vP(t,e){for(;t&&e==t.childNodes.length&&!Fl(t);)e=kt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function yP(t,e){for(;t&&!e&&!Fl(t);)e=kt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function zf(t,e,n){if(e.nodeType!=3){let i,s;(s=vP(e,n))?(e=s,n=0):(i=yP(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(hu(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&$r(t)},50)}function V1(t,e){let n=t.state.doc.resolve(e);if(!(Dt||BN)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function I1(t,e,n){let r=t.state.selection;if(r instanceof ke&&!r.empty||n.indexOf("s")>-1||_n&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Bf(t.state,e);if(s&&s instanceof Se)return oo(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof mn?Ee.near(s,e):Ee.findFrom(s,e);return l?oo(t,l):!1}return!1}function $1(t,e){if(!(t.state.selection instanceof ke))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function H1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function xP(t){if(!zt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;H1(t,r,"true"),setTimeout(()=>H1(t,r,"false"),20)}return!1}function wP(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function SP(t,e){let n=e.keyCode,r=wP(e);if(n==8||_n&&n==72&&r=="c")return $1(t,-1)||Ti(t,-1);if(n==46&&!e.shiftKey||_n&&n==68&&r=="c")return $1(t,1)||Ti(t,1);if(n==13||n==27)return!0;if(n==37||_n&&n==66&&r=="c"){let o=n==37?V1(t,t.state.selection.from)=="ltr"?-1:1:-1;return L1(t,o,r)||Ti(t,o)}else if(n==39||_n&&n==70&&r=="c"){let o=n==39?V1(t,t.state.selection.from)=="ltr"?1:-1:1;return L1(t,o,r)||Ti(t,o)}else{if(n==38||_n&&n==80&&r=="c")return I1(t,-1,r)||Ti(t,-1);if(n==40||_n&&n==78&&r=="c")return xP(t)||I1(t,1,r)||Ti(t,1);if(r==(_n?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Rx(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||wi.fromSchema(t.state.schema),l=Ix(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Vx[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let g=l.createElement(u[p]);for(;a.firstChild;)g.appendChild(a.firstChild);a.appendChild(g),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
120
+ `}}}),()=>{e.removeType(Pt)}},Nd="Scrollbar",pr=`${jt}scrollbar`,Dd=n=>{const{Components:e}=n;return e.addType(tn,{isComponent:t=>mt(t,pr),model:{defaults:{name:Nd,classes:pr,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(tn)}},Id="Slide",mr=`${jt}slide`,Pd=n=>{const{Components:e}=n;return e.addType(an,{isComponent:t=>mt(t,mr),model:{defaults:{name:Id,classes:mr,icon:Q.slider,draggable:(t,i)=>i.is(Dt)}}}),()=>{e.removeType(an)}},Rd="Wrapper",gr=`${jt}wrapper`,Vd=n=>{const{Components:e}=n,{events:t}=e;return e.addType(Dt,{isComponent:i=>mt(i,gr),model:{defaults:{name:Rd,icon:Q.slider,classes:gr,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:i=>i.is(an)},init(){const i=this.components();this.listenTo(i,"add remove",this.updateSlider)},updateSlider(i){const o=this.closestType(be);if(o){const r=o.getView();o.reloadSlider(),this.em.once(t.scriptMount,()=>{setTimeout(()=>{var s;return(s=r.getSwiper())==null?void 0:s.slideTo(i.index())},100)})}}}}),()=>{e.removeType(Dt)}},Ld="swiperComponent",zd=function(n,e={}){const t={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...e},i=[Td(n,t),Od(n),Vd(n),Pd(n),Ed(n),Dd(n)];Ae({editor:n,plan:ee.startup,licenseKey:t.licenseKey,pluginName:Ld,cleanup:()=>{i.forEach(o=>o())}})},Bd=Me(zd),Hd=n=>n.dispatchEvent(new CustomEvent("input"));function Fd(n,e){if(!e)return()=>{};const t=n.Components.events,i=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),r=d=>d.isChildOf("text"),s=d=>n.getEditing()===d,l=(d,h={})=>{d.trigger("focus",h.event)},a=(d,h)=>{i(d)&&o(d)&&!s(d)&&l(d,h)},c=(d,h)=>{if(i(d)&&!o(d)&&r(d)){const u=d.parents().find(f=>f.isInstanceOf("text"));u&&(l(u,h),setTimeout(()=>n.select(u),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const Eo=new WeakMap,$d=(n,e)=>{Eo.set(n,e)},Wd=n=>{Eo.delete(n)},Mi=n=>Eo.get(n),Nn=n=>{const e=n.target,t=e.closest(".tox"),i=e.matches(".ephox-snooker-resizer-bar");(t||i)&&n.stopPropagation()},yr=n=>{n.stopPropagation(),n.preventDefault()},_d=(n,e)=>{const t=n.getDoc(),i=n.getWin();if(e!=null&&e.event){const{event:o}=e,{clientX:r,clientY:s}=o;let l;if(t.caretRangeFromPoint)l=t.caretRangeFromPoint(r,s);else if(t.caretPositionFromPoint){const a=t.caretPositionFromPoint(r,s);l=t.createRange(),l==null||l.setStart(a.offsetNode,a.offset)}if(l){const a=i.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(l),n.selection.setRng(l)}}else n.execCommand("SelectAll")},Kd=n=>{var c,d;const{el:e,editor:t,componentView:i}=n,o=t.runCommand(Y.getStateTheme),r=i.model,s={target:e,inline:!0,skin:(o==null?void 0:o.theme)===_s.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},l=((d=(c=n.pluginOpts)==null?void 0:c.loadConfig)==null?void 0:d.call(c,{config:s,editor:t,componentView:i,component:r}))||{};return{...s,...l}},br=(n,e=document)=>new Promise((t,i)=>{const o=Array.isArray(n)?[...n]:[n],{head:r}=e,s=l=>{if(l.length){const a=e.createElement("script");a.src=l.shift(),a.onload=s.bind(null,l),a.onerror=i,r.appendChild(a)}else t()};s(o)}),qd="rteTinyMce",jd=function(n,e={}){const t={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:i}=t,o=n.Canvas.events,r=async(a,c)=>{const d=a.ownerDocument,h=d.defaultView,u=c==null?void 0:c.view;if(!h||!u){console.warn("Missing required data",{win:h,componentView:u});return}const f=Kd({el:a,editor:n,componentView:u,pluginOpts:t}),m=(await h.tinymce.init(f))[0];if(!m)return;const y=(await window.tinymce.init({...f,target:document.createElement("div")}))[0];return m.ui.show(),d.body.addEventListener("mousedown",Nn),document.body.addEventListener("mousedown",Nn),m.on("Change",()=>Hd(a)),m.on("blur",()=>m.ui.show()),m.on("OpenWindow",function(){var S;const x=(S=d.querySelector(".tox-dialog"))==null?void 0:S.closest(".tox");x&&(x==null?void 0:x.ownerDocument)!==document&&(document.body.appendChild(x),m.once("CloseWindow",()=>{x&&x.ownerDocument===document&&d.body.appendChild(x)}))}),a.addEventListener("dragstart",yr,{capture:!0}),n.runCommand(Y.setStateContextMenu,{enabled:!1}),_d(m,c),{rteEditor:m,rteEditorShallow:y}},s=(a,c)=>{a.ownerDocument.body.removeEventListener("mousedown",Nn),document.body.removeEventListener("mousedown",Nn),a.removeEventListener("dragstart",yr,{capture:!0}),n.runCommand(Y.setStateContextMenu,{enabled:!0}),c.rteEditor.destroy(),c.rteEditorShallow.destroy()};n.on(o.frameLoad,async({window:a})=>{br(i,a.document)}),n.onReady(()=>{br(i,document)}),n.setCustomRte({parseContent:!0,async enable(a,c,d){const h=Mi(a);if(h)return h.rteEditor;const u=await r(a,d);return u&&$d(a,u),u==null?void 0:u.rteEditor},disable(a){const c=Mi(a);c&&(Wd(a),s(a,c))},getContent(a){var d,h;const c=Mi(a);return c?(h=(d=c.rteEditor).getContent)==null?void 0:h.call(d):a.innerHTML}});const l=Fd(n,t.enableOnClick);Ae({editor:n,licenseKey:t.licenseKey,plan:ee.startup,pluginName:qd,cleanup:()=>{n.RichTextEditor.customRte=void 0,l()}})},Jd=Me(jd);function _(n){this.content=n}_.prototype={constructor:_,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var i=t&&t!=n?this.remove(t):this,o=i.find(n),r=i.content.slice();return o==-1?r.push(t||n,e):(r[o+1]=e,t&&(r[o]=t)),new _(r)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new _(t)},addToStart:function(n,e){return new _([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new _(t)},addBefore:function(n,e,t){var i=this.remove(e),o=i.content.slice(),r=i.find(n);return o.splice(r==-1?o.length:r,0,e,t),new _(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=_.from(n),n.size?new _(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=_.from(n),n.size?new _(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=_.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};_.from=function(n){if(n instanceof _)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new _(e)};function pl(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(i),r=e.child(i);if(o==r){t+=o.nodeSize;continue}if(!o.sameMarkup(r))return t;if(o.isText&&o.text!=r.text){for(let s=0;o.text[s]==r.text[s];s++)t++;return t}if(o.content.size||r.content.size){let s=pl(o.content,r.content,t+1);if(s!=null)return s}t+=o.nodeSize}}function ml(n,e,t,i){for(let o=n.childCount,r=e.childCount;;){if(o==0||r==0)return o==r?null:{a:t,b:i};let s=n.child(--o),l=e.child(--r),a=s.nodeSize;if(s==l){t-=a,i-=a;continue}if(!s.sameMarkup(l))return{a:t,b:i};if(s.isText&&s.text!=l.text){let c=0,d=Math.min(s.text.length,l.text.length);for(;c<d&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,i--;return{a:t,b:i}}if(s.content.size||l.content.size){let c=ml(s.content,l.content,t-1,i-1);if(c)return c}t-=a,i-=a}}class w{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,o=0,r){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&i(a,o+l,r||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),i,o+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,o){let r="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&i&&(s?s=!1:r+=i),r+=c},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,o=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(i)&&(o[o.length-1]=t.withText(t.text+i.text),r=1);r<e.content.length;r++)o.push(e.content[r]);return new w(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],o=0;if(t>e)for(let r=0,s=0;s<t;r++){let l=this.content[r],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),i.push(l),o+=l.nodeSize),s=a}return new w(i,o)}cutByIndex(e,t){return e==t?w.empty:e==0&&t==this.content.length?this:new w(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let o=this.content.slice(),r=this.size+t.nodeSize-i.nodeSize;return o[e]=t,new w(o,r)}addToStart(e){return new w([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new w(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let o=this.content[t];e(o,i,t),i+=o.nodeSize}}findDiffStart(e,t=0){return pl(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return ml(this,e,t,i)}findIndex(e,t=-1){if(e==0)return Dn(0,e);if(e==this.size)return Dn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,o=0;;i++){let r=this.child(i),s=o+r.nodeSize;if(s>=e)return s==e||t>0?Dn(i+1,s):Dn(i,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return w.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new w(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return w.empty;let t,i=0;for(let o=0;o<e.length;o++){let r=e[o];i+=r.nodeSize,o&&r.isText&&e[o-1].sameMarkup(r)?(t||(t=e.slice(0,o)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new w(t||e,i)}static from(e){if(!e)return w.empty;if(e instanceof w)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new w([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}w.empty=new w([],0);const Ai={index:0,offset:0};function Dn(n,e){return Ai.index=n,Ai.offset=e,Ai}function Gn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!Gn(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!Gn(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}class I{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let o=0;o<e.length;o++){let r=e[o];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,o));else{if(r.type.excludes(this.type))return e;!i&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),i=!0),t&&t.push(r)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=i.create(t.attrs);return i.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return I.none;if(e instanceof I)return[e];let t=e.slice();return t.sort((i,o)=>i.type.rank-o.type.rank),t}}I.none=[];class Un extends Error{}class C{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=yl(this.content,e+this.openStart,t);return i&&new C(i,this.openStart,this.openEnd)}removeBetween(e,t){return new C(gl(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return C.empty;let i=t.openStart||0,o=t.openEnd||0;if(typeof i!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new C(w.fromJSON(e,t.content),i,o)}static maxOpen(e,t=!0){let i=0,o=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)i++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)o++;return new C(e,i,o)}}C.empty=new C(w.empty,0,0);function gl(n,e,t){let{index:i,offset:o}=n.findIndex(e),r=n.maybeChild(i),{index:s,offset:l}=n.findIndex(t);if(o==e||r.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(i,r.copy(gl(r.content,e-o-1,t-o-1)))}function yl(n,e,t,i){let{index:o,offset:r}=n.findIndex(e),s=n.maybeChild(o);if(r==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=yl(s.content,e-r-1,t);return l&&n.replaceChild(o,s.copy(l))}function Gd(n,e,t){if(t.openStart>n.depth)throw new Un("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Un("Inconsistent open depths");return bl(n,e,t,0)}function bl(n,e,t,i){let o=n.index(i),r=n.node(i);if(o==e.index(i)&&i<n.depth-t.openStart){let s=bl(n,e,t,i+1);return r.copy(r.content.replaceChild(o,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let s=n.parent,l=s.content;return dt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Ud(t,n);return dt(r,Sl(n,s,l,e,i))}else return dt(r,Zn(n,e,i))}function wl(n,e){if(!e.type.compatibleContent(n.type))throw new Un("Cannot join "+e.type.name+" onto "+n.type.name)}function no(n,e,t){let i=n.node(t);return wl(i,e.node(t)),i}function ct(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function nn(n,e,t,i){let o=(e||n).node(t),r=0,s=e?e.index(t):o.childCount;n&&(r=n.index(t),n.depth>t?r++:n.textOffset&&(ct(n.nodeAfter,i),r++));for(let l=r;l<s;l++)ct(o.child(l),i);e&&e.depth==t&&e.textOffset&&ct(e.nodeBefore,i)}function dt(n,e){return n.type.checkContent(e),n.copy(e)}function Sl(n,e,t,i,o){let r=n.depth>o&&no(n,e,o+1),s=i.depth>o&&no(t,i,o+1),l=[];return nn(null,n,o,l),r&&s&&e.index(o)==t.index(o)?(wl(r,s),ct(dt(r,Sl(n,e,t,i,o+1)),l)):(r&&ct(dt(r,Zn(n,e,o+1)),l),nn(e,t,o,l),s&&ct(dt(s,Zn(t,i,o+1)),l)),nn(i,null,o,l),new w(l)}function Zn(n,e,t){let i=[];if(nn(null,n,t,i),n.depth>t){let o=no(n,e,t+1);ct(dt(o,Zn(n,e,t+1)),i)}return nn(e,null,t,i),new w(i)}function Ud(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)o=e.node(r).copy(w.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class cn{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],o=e.child(t);return i?e.child(t).cut(i):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)o+=i.child(r).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),o=e.maybeChild(t);if(!i){let l=i;i=o,o=l}let r=i.marks;for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,o=e.parent.maybeChild(e.index());for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!o||!i[r].isInSet(o.marks))&&(i=i[r--].removeFromSet(i));return i}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new Yn(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],o=0,r=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(r),c=r-a;if(i.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;r=c-1,o+=a+1}return new cn(t,i,r)}static resolveCached(e,t){let i=wr.get(e);if(i)for(let r=0;r<i.elts.length;r++){let s=i.elts[r];if(s.pos==t)return s}else wr.set(e,i=new Zd);let o=i.elts[i.i]=cn.resolve(e,t);return i.i=(i.i+1)%Yd,o}}class Zd{constructor(){this.elts=[],this.i=0}}const Yd=12,wr=new WeakMap;class Yn{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Xd=Object.create(null);let ht=class io{constructor(e,t,i,o=I.none){this.type=e,this.attrs=t,this.marks=o,this.content=i||w.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,i,o=0){this.content.nodesBetween(e,t,i,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,i,o){return this.content.textBetween(e,t,i,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,i){return this.type==e&&Gn(this.attrs,t||e.defaultAttrs||Xd)&&I.sameSet(this.marks,i||I.none)}copy(e=null){return e==this.content?this:new io(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new io(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,i=!1){if(e==t)return C.empty;let o=this.resolve(e),r=this.resolve(t),s=i?0:o.sharedDepth(t),l=o.start(s),c=o.node(s).content.cut(o.pos-l,r.pos-l);return new C(c,o.depth-s,r.depth-s)}replace(e,t,i){return Gd(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let o=this.content.child(t-1);return{node:o,index:t-1,offset:i-o.nodeSize}}resolve(e){return cn.resolveCached(this,e)}resolveNoCache(e){return cn.resolve(this,e)}rangeHasMark(e,t,i){let o=!1;return t>e&&this.nodesBetween(e,t,r=>(i.isInSet(r.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),vl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=w.empty,o=0,r=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,o,r),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<r;a++)if(!this.type.allowsMarks(i.child(a).marks))return!1;return!0}canReplaceWith(e,t,i,o){if(o&&!this.type.allowsMarks(o))return!1;let r=this.contentMatchAt(e).matchType(i),s=r&&r.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=I.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!I.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let o=w.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,o,i);return r.type.checkAttrs(r.attrs),r}};ht.prototype.text=void 0;class Xn extends ht{constructor(e,t,i,o){if(super(e,t,null,o),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function vl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new Qd(e,t);if(i.next==null)return gt.empty;let o=xl(i);i.next&&i.err("Unexpected trailing text");let r=sh(rh(o));return lh(r,i),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,i=e.childCount){let o=this;for(let r=t;o&&r<i;r++)o=o.matchType(e.child(r).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let o=[this];function r(s,l){let a=s.matchFragment(e,i);if(a&&(!t||a.validEnd))return w.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:h}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(h)==-1){o.push(h);let u=r(h,l.concat(d));if(u)return u}}return null}return r(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let o=i.shift(),r=o.match;if(r.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<r.next.length;s++){let{type:l,next:a}=r.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(i.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(i){e.push(i);for(let o=0;o<i.next.length;o++)e.indexOf(i.next[o].next)==-1&&t(i.next[o].next)}return t(this),e.map((i,o)=>{let r=o+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)r+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return r}).join(`
121
+ `)}}gt.empty=new gt(!0);class Qd{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function xl(n){let e=[];do e.push(eh(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function eh(n){let e=[];do e.push(th(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function th(n){let e=oh(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=nh(n,e);else break;return e}function Sr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function nh(n,e){let t=Sr(n),i=t;return n.eat(",")&&(n.next!="}"?i=Sr(n):i=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function ih(n,e){let t=n.nodeTypes,i=t[e];if(i)return[i];let o=[];for(let r in t){let s=t[r];s.isInGroup(e)&&o.push(s)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function oh(n){if(n.eat("(")){let e=xl(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ih(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function rh(n){let e=[[]];return o(r(n,0),t()),e;function t(){return e.push([])-1}function i(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function r(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(r(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=r(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=t())}else if(s.type=="star"){let a=t();return i(l,a),o(r(s.expr,a),a),[i(a)]}else if(s.type=="plus"){let a=t();return o(r(s.expr,l),a),o(r(s.expr,a),a),[i(a)]}else{if(s.type=="opt")return[i(l)].concat(r(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=t();o(r(s.expr,a),d),a=d}if(s.max==-1)o(r(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=t();i(a,d),o(r(s.expr,a),d),a=d}return[i(a)]}else{if(s.type=="name")return[i(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Cl(n,e){return e-n}function vr(n,e){let t=[];return i(e),t.sort(Cl);function i(o){let r=n[o];if(r.length==1&&!r[0].term)return i(r[0].to);t.push(o);for(let s=0;s<r.length;s++){let{term:l,to:a}=r[s];!l&&t.indexOf(a)==-1&&i(a)}}}function sh(n){let e=Object.create(null);return t(vr(n,0));function t(i){let o=[];i.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);vr(n,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let r=e[i.join(",")]=new gt(i.indexOf(n.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Cl);r.next.push({type:o[s][0],next:e[l.join(",")]||t(l)})}return r}}function lh(n,e){for(let t=0,i=[n];t<i.length;t++){let o=i[t],r=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),r&&!(a.isText||a.hasRequiredAttrs())&&(r=!1),i.indexOf(c)==-1&&i.push(c)}r&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function kl(n){let e=Object.create(null);for(let t in n){let i=n[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function Tl(n,e){let t=Object.create(null);for(let i in n){let o=e&&e[i];if(o===void 0){let r=n[i];if(r.hasDefault)o=r.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=o}return t}function Ml(n,e,t,i){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let r=n[o];r.validate&&r.validate(e[o])}}function Al(n,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new ch(n,i,e[i]);return t}let xr=class Ol{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=Al(e,i.attrs),this.defaultAttrs=kl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==gt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Tl(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ht(this,this.computeAttrs(e),w.from(t),I.setFrom(i))}createChecked(e=null,t,i){return t=w.from(t),this.checkContent(t),new ht(this,this.computeAttrs(e),t,I.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=w.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let o=this.contentMatch.matchFragment(t),r=o&&o.fillBefore(w.empty,!0);return r?new ht(this,e,t.append(r),I.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ml(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:I.none:e}static compile(e,t){let i=Object.create(null);e.forEach((r,s)=>i[r]=new Ol(r,t,s));let o=t.spec.topNode||"doc";if(!i[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let r in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function ah(n,e,t){let i=t.split("|");return o=>{let r=o===null?"null":typeof o;if(i.indexOf(r)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${n}, got ${r}`)}}class ch{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?ah(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class hi{constructor(e,t,i,o){this.name=e,this.rank=t,this.schema=i,this.spec=o,this.attrs=Al(e,o.attrs),this.excluded=null;let r=kl(this.attrs);this.instance=r?new I(this,r):null}create(e=null){return!e&&this.instance?this.instance:new I(this,Tl(this.attrs,e))}static compile(e,t){let i=Object.create(null),o=0;return e.forEach((r,s)=>i[r]=new hi(r,o++,t,s)),i}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ml(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class dh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=_.from(e.nodes),t.marks=_.from(e.marks||{}),this.nodes=xr.compile(this.spec.nodes,this),this.marks=hi.compile(this.spec.marks,this);let i=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let r=this.nodes[o],s=r.spec.content||"",l=r.spec.marks;if(r.contentMatch=i[s]||(i[s]=gt.parse(s,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=l=="_"?null:l?Cr(this,l.split(" ")):l==""||!r.inlineContent?[]:null}for(let o in this.marks){let r=this.marks[o],s=r.spec.excludes;r.excluded=s==null?[r]:s==""?[]:Cr(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xr){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,i,o)}text(e,t){let i=this.nodes.text;return new Xn(i,i.defaultAttrs,e,I.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return ht.fromJSON(this,e)}markFromJSON(e){return I.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Cr(n,e){let t=[];for(let i=0;i<e.length;i++){let o=e[i],r=n.marks[o],s=r;if(r)t.push(r);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function hh(n){return n.tag!=null}function uh(n){return n.style!=null}class Ht{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(o=>{if(hh(o))this.tags.push(o);else if(uh(o)){let r=/[^=]*/.exec(o.style)[0];i.indexOf(r)<0&&i.push(r),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let r=e.nodes[o.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let i=new Tr(this,t,!1);return i.addAll(e,I.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new Tr(this,t,!0);return i.addAll(e,I.none,t.from,t.to),C.maxOpen(i.finish())}matchTag(e,t,i){for(let o=i?this.tags.indexOf(i)+1:0;o<this.tags.length;o++){let r=this.tags[o];if(mh(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let s=r.getAttrs(e);if(s===!1)continue;r.attrs=s||void 0}return r}}}matchStyle(e,t,i,o){for(let r=o?this.styles.indexOf(o)+1:0;r<this.styles.length;r++){let s=this.styles[r],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!i.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function i(o){let r=o.priority==null?50:o.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<r)break}t.splice(s,0,o)}for(let o in e.marks){let r=e.marks[o].spec.parseDOM;r&&r.forEach(s=>{i(s=Mr(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let r=e.nodes[o].spec.parseDOM;r&&r.forEach(s=>{i(s=Mr(s)),s.node||s.ignore||s.mark||(s.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ht(e,Ht.schemaRules(e)))}}const El={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},fh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Nl={ol:!0,ul:!0},Qn=1,ei=2,on=4;function kr(n,e,t){return e!=null?(e?Qn:0)|(e==="full"?ei:0):n&&n.whitespace=="pre"?Qn|ei:t&~on}class In{constructor(e,t,i,o,r,s){this.type=e,this.attrs=t,this.marks=i,this.solid=o,this.options=s,this.content=[],this.activeMarks=I.none,this.match=r||(s&on?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(w.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,o;return(o=i.findWrapping(e.type))?(this.match=i,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qn)){let i=this.content[this.content.length-1],o;if(i&&i.isText&&(o=/[ \t\r\n\u000c]+$/.exec(i.text))){let r=i;i.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-o[0].length))}}let t=w.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(w.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!El.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Tr{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0;let o=t.topNode,r,s=kr(null,t.preserveWhitespace,0)|(i?on:0);o?r=new In(o.type,o.attrs,I.none,!0,t.topMatch||o.type.contentMatch,s):i?r=new In(null,null,I.none,!0,null,s):r=new In(e.schema.topNodeType,null,I.none,!0,null,s),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let i=e.nodeValue,o=this.top;if(o.options&ei||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(o.options&Qn)o.options&ei?i=i.replace(/\r\n?/g,`
122
+ `):i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let r=o.content[o.content.length-1],s=e.previousSibling;(!r||s&&s.nodeName=="BR"||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(i=i.slice(1))}i&&this.insertNode(this.parser.schema.text(i),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let o=e.nodeName.toLowerCase(),r;Nl.hasOwnProperty(o)&&this.parser.normalizeLists&&ph(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,i));if(s?s.ignore:fh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let l,a=this.top,c=this.needsBlock;if(El.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let d=s&&s.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?r:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
123
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let i=e.style;if(i&&i.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let r=this.parser.matchedStyles[o],s=i.getPropertyValue(r);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(r,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,i,o){let r,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),i)||this.leafFallback(e,i);else{let a=this.enter(s,t.attrs||null,i,t.preserveWhitespace);a&&(r=!0,i=a)}else{let a=this.parser.schema.marks[t.mark];i=i.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,i,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,i));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,i),this.findAround(e,a,!1)}r&&this.sync(l)&&this.open--}addAll(e,t,i,o){let r=i||0;for(let s=i?e.childNodes[i]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(s,t);this.findAtPoint(e,r)}findPlace(e,t){let i,o;for(let r=this.open;r>=0;r--){let s=this.nodes[r],l=s.findWrapping(e);if(l&&(!i||i.length>l.length)&&(i=l,o=s,!l.length)||s.solid)break}if(!i)return null;this.sync(o);for(let r=0;r<i.length;r++)t=this.enterInner(i[r],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let i=this.findPlace(e,t);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let r=I.none;for(let s of i.concat(e.marks))(o.type?o.type.allowsMarkType(s.type):Ar(s.type,e.type))&&(r=s.addToSet(r));return o.content.push(e.mark(r)),!0}return!1}enter(e,t,i,o){let r=this.findPlace(e.create(t),i);return r&&(r=this.enterInner(e,t,i,!0,o)),r}enterInner(e,t,i,o=!1,r){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=kr(e,r,s.options);s.options&on&&s.content.length==0&&(l|=on);let a=I.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):Ar(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new In(e,t,a,o,null,l)),this.open++,i}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let o=i.length-1;o>=0;o--)e+=i[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,i){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(i?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,o=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),r=-(i?i.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=r;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:i&&a>=r?i.node(a-r).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}}function ph(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&Nl.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function mh(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Mr(n){let e={};for(let t in n)e[t]=n[t];return e}function Ar(n,e){let t=e.schema.nodes;for(let i in t){let o=t[i];if(!o.allowsMarkType(n))continue;let r=[],s=l=>{r.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||r.indexOf(d)<0&&s(d))return!0}};if(s(o.contentMatch))return!0}}class wt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=Oi(t).createDocumentFragment());let o=i,r=[];return e.forEach(s=>{if(r.length||s.marks.length){let l=0,a=0;for(;l<r.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(r[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<r.length;)o=r.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],d=this.serializeMark(c,s.isInline,t);d&&(r.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(s,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:o}=Fn(Oi(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let r=this.serializeMark(e.marks[o],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(i),i=r.dom)}return i}serializeMark(e,t,i={}){let o=this.marks[e.type.name];return o&&Fn(Oi(i),o(e,t),null,e.attrs)}static renderSpec(e,t,i=null,o){return Fn(e,t,i,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Or(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return Or(e.marks)}}function Or(n){let e={};for(let t in n){let i=n[t].spec.toDOM;i&&(e[t]=i)}return e}function Oi(n){return n.document||window.document}const Er=new WeakMap;function gh(n){let e=Er.get(n);return e===void 0&&Er.set(n,e=yh(n)),e}function yh(n){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let o=0;o<i.length;o++)t(i[o]);else for(let o in i)t(i[o])}return t(n),e}function Fn(n,e,t,i){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],r;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(r=gh(i))&&r.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(t=o.slice(0,s),o=o.slice(s+1));let l,a=t?n.createElementNS(t,o):n.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let h in c)if(c[h]!=null){let u=h.indexOf(" ");u>0?a.setAttributeNS(h.slice(0,u),h.slice(u+1),c[h]):a.setAttribute(h,c[h])}}for(let h=d;h<e.length;h++){let u=e[h];if(u===0){if(h<e.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:p}=Fn(n,u,t,i);if(a.appendChild(f),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Dl=65535,Il=Math.pow(2,16);function bh(n,e){return n+e*Il}function Nr(n){return n&Dl}function wh(n){return(n-(n&Dl))/Il}const Pl=1,Rl=2,$n=4,Vl=8;class oo{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&Vl)>0}get deletedBefore(){return(this.delInfo&(Pl|$n))>0}get deletedAfter(){return(this.delInfo&(Rl|$n))>0}get deletedAcross(){return(this.delInfo&$n)>0}}class le{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&le.empty)return le.empty}recover(e){let t=0,i=Nr(e);if(!this.inverted)for(let o=0;o<i;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[i*3]+t+wh(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let o=0,r=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+r],d=this.ranges[l+s],h=a+c;if(e<=h){let u=c?e==a?-1:e==h?1:t:t,f=a+o+(u<0?0:d);if(i)return f;let p=e==(t<0?a:h)?null:bh(l/3,e-a),m=e==a?Rl:e==h?Pl:$n;return(t<0?e!=a:e!=h)&&(m|=Vl),new oo(f,m,p)}o+=d-c}return i?e+o:new oo(e+o,0,null)}touches(e,t){let i=0,o=Nr(t),r=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+r],d=a+c;if(e<=d&&l==o*3)return!0;i+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let o=0,r=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?r:0),a=s+(this.inverted?0:r),c=this.ranges[o+t],d=this.ranges[o+i];e(l,l+c,a,a+d),r+=d-c}}invert(){return new le(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?le.empty:new le(e<0?[0,-e,0]:[0,0,e])}}le.empty=new le([]);class Rt{constructor(e=[],t,i=0,o=e.length){this.maps=e,this.mirror=t,this.from=i,this.to=o}slice(e=0,t=this.maps.length){return new Rt(this.maps,this.mirror,e,t)}copy(){return new Rt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,i=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?i+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,i=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?i-o-1:void 0)}}invert(){let e=new Rt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this.maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let o=0;for(let r=this.from;r<this.to;r++){let s=this.maps[r],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(r);if(a!=null&&a>r&&a<this.to){r=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return i?e:new oo(e,o,null)}}const Ei=Object.create(null);class X{getMap(){return le.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Ei[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Ei)throw new RangeError("Duplicate use of step JSON ID "+e);return Ei[e]=t,t.prototype.jsonID=e,t}}class F{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new F(e,null)}static fail(e){return new F(null,e)}static fromReplace(e,t,i,o){try{return F.ok(e.replace(t,i,o))}catch(r){if(r instanceof Un)return F.fail(r.message);throw r}}}function No(n,e,t){let i=[];for(let o=0;o<n.childCount;o++){let r=n.child(o);r.content.size&&(r=r.copy(No(r.content,e,r))),r.isInline&&(r=e(r,t,o)),i.push(r)}return w.fromArray(i)}class Ke extends X{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),o=i.node(i.sharedDepth(this.to)),r=new C(No(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),t.openStart,t.openEnd);return F.fromReplace(e,this.from,this.to,r)}invert(){return new ve(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new Ke(t.pos,i.pos,this.mark)}merge(e){return e instanceof Ke&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ke(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ke(t.from,t.to,e.markFromJSON(t.mark))}}X.jsonID("addMark",Ke);class ve extends X{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new C(No(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return F.fromReplace(e,this.from,this.to,i)}invert(){return new Ke(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new ve(t.pos,i.pos,this.mark)}merge(e){return e instanceof ve&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ve(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ve(t.from,t.to,e.markFromJSON(t.mark))}}X.jsonID("removeMark",ve);class qe extends X{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return F.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return F.fromReplace(e,this.pos,this.pos+1,new C(w.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(i))return new qe(this.pos,t.marks[o]);return new qe(this.pos,this.mark)}}return new Ft(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qe(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new qe(t.pos,e.markFromJSON(t.mark))}}X.jsonID("addNodeMark",qe);class Ft extends X{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return F.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return F.fromReplace(e,this.pos,this.pos+1,new C(w.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new qe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ft(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ft(t.pos,e.markFromJSON(t.mark))}}X.jsonID("removeNodeMark",Ft);class U extends X{constructor(e,t,i,o=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=o}apply(e){return this.structure&&ro(e,this.from,this.to)?F.fail("Structure replace would overwrite content"):F.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new le([this.from,this.to-this.from,this.slice.size])}invert(e){return new U(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deletedAcross&&i.deletedAcross?null:new U(t.pos,Math.max(t.pos,i.pos),this.slice)}merge(e){if(!(e instanceof U)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?C.empty:new C(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new U(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?C.empty:new C(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new U(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new U(t.from,t.to,C.fromJSON(e,t.slice),!!t.structure)}}X.jsonID("replace",U);class j extends X{constructor(e,t,i,o,r,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=o,this.slice=r,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ro(e,this.from,this.gapFrom)||ro(e,this.gapTo,this.to)))return F.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return F.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?F.fromReplace(e,this.from,this.to,i):F.fail("Content does not fit in gap")}getMap(){return new le([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new j(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||o<t.pos||r>i.pos?null:new j(t.pos,i.pos,o,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new j(t.from,t.to,t.gapFrom,t.gapTo,C.fromJSON(e,t.slice),t.insert,!!t.structure)}}X.jsonID("replaceAround",j);function ro(n,e,t){let i=n.resolve(e),o=t-e,r=i.depth;for(;o>0&&r>0&&i.indexAfter(r)==i.node(r).childCount;)r--,o--;if(o>0){let s=i.node(r).maybeChild(i.indexAfter(r));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function Sh(n,e,t,i){let o=[],r=[],s,l;n.doc.nodesBetween(e,t,(a,c,d)=>{if(!a.isInline)return;let h=a.marks;if(!i.isInSet(h)&&d.type.allowsMarkType(i.type)){let u=Math.max(c,e),f=Math.min(c+a.nodeSize,t),p=i.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(p)||(s&&s.to==u&&s.mark.eq(h[m])?s.to=f:o.push(s=new ve(u,f,h[m])));l&&l.to==u?l.to=f:r.push(l=new Ke(u,f,i))}}),o.forEach(a=>n.step(a)),r.forEach(a=>n.step(a))}function vh(n,e,t,i){let o=[],r=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;r++;let a=null;if(i instanceof hi){let c=s.marks,d;for(;d=i.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else i?i.isInSet(s.marks)&&(a=[i]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let h=a[d],u;for(let f=0;f<o.length;f++){let p=o[f];p.step==r-1&&h.eq(o[f].style)&&(u=p)}u?(u.to=c,u.step=r):o.push({style:h,from:Math.max(l,e),to:c,step:r})}}}),o.forEach(s=>n.step(new ve(s.from,s.to,s.style)))}function Do(n,e,t,i=t.contentMatch,o=!0){let r=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<r.childCount;a++){let c=r.child(a),d=l+c.nodeSize,h=i.matchType(c.type);if(!h)s.push(new U(l,d,C.empty));else{i=h;for(let u=0;u<c.marks.length;u++)t.allowsMarkType(c.marks[u].type)||n.step(new ve(l,d,c.marks[u]));if(o&&c.isText&&t.whitespace!="pre"){let u,f=/\r?\n|\r/g,p;for(;u=f.exec(c.text);)p||(p=new C(w.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new U(l+u.index,l+u.index+u[0].length,p))}}l=d}if(!i.validEnd){let a=i.fillBefore(w.empty,!0);n.replace(l,l,new C(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function xh(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function ui(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let i=n.depth;;--i){let o=n.$from.node(i),r=n.$from.index(i),s=n.$to.indexAfter(i);if(i<n.depth&&o.canReplace(r,s,t))return i;if(i==0||o.type.spec.isolating||!xh(o,r,s))break}return null}function Ch(n,e,t){let{$from:i,$to:o,depth:r}=e,s=i.before(r+1),l=o.after(r+1),a=s,c=l,d=w.empty,h=0;for(let p=r,m=!1;p>t;p--)m||i.index(p)>0?(m=!0,d=w.from(i.node(p).copy(d)),h++):a--;let u=w.empty,f=0;for(let p=r,m=!1;p>t;p--)m||o.after(p+1)<o.end(p)?(m=!0,u=w.from(o.node(p).copy(u)),f++):c++;n.step(new j(a,c,s,l,new C(d.append(u),h,f),d.size-h,!0))}function Ll(n,e,t=null,i=n){let o=kh(n,e),r=o&&Th(i,e);return r?o.map(Dr).concat({type:e,attrs:t}).concat(r.map(Dr)):null}function Dr(n){return{type:n,attrs:null}}function kh(n,e){let{parent:t,startIndex:i,endIndex:o}=n,r=t.contentMatchAt(i).findWrapping(e);if(!r)return null;let s=r.length?r[0]:e;return t.canReplaceWith(i,o,s)?r:null}function Th(n,e){let{parent:t,startIndex:i,endIndex:o}=n,r=t.child(i),s=e.contentMatch.findWrapping(r.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=i;a&&c<o;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Mh(n,e,t){let i=w.empty;for(let s=t.length-1;s>=0;s--){if(i.size){let l=t[s].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=w.from(t[s].type.create(t[s].attrs,i))}let o=e.start,r=e.end;n.step(new j(o,r,o,r,new C(i,0,0),t.length,!0))}function Ah(n,e,t,i,o){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(i,a)&&Oh(n.doc,n.mapping.slice(r).map(l),i)){let c=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",p=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Bl(n,s,l,r),Do(n,n.mapping.slice(r).map(l,1),i,void 0,c===null);let d=n.mapping.slice(r),h=d.map(l,1),u=d.map(l+s.nodeSize,1);return n.step(new j(h,u,h+1,u-1,new C(w.from(i.create(a,null,s.marks)),0,0),1,!0)),c===!0&&zl(n,s,l,r),!1}})}function zl(n,e,t,i){e.forEach((o,r)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=n.mapping.slice(i).map(t+1+r+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Bl(n,e,t,i){e.forEach((o,r)=>{if(o.type==o.type.schema.linebreakReplacement){let s=n.mapping.slice(i).map(t+1+r);n.replaceWith(s,s+1,e.type.schema.text(`
124
+ `))}})}function Oh(n,e,t){let i=n.resolve(e),o=i.index();return i.parent.canReplaceWith(o,o+1,t)}function Eh(n,e,t,i,o){let r=n.doc.nodeAt(e);if(!r)throw new RangeError("No node at given position");t||(t=r.type);let s=t.create(i,null,o||r.marks);if(r.isLeaf)return n.replaceWith(e,e+r.nodeSize,s);if(!t.validContent(r.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new j(e,e+r.nodeSize,e+1,e+r.nodeSize-1,new C(w.from(s),0,0),1,!0))}function Vt(n,e,t=1,i){let o=n.resolve(e),r=o.depth-t,s=i&&i[i.length-1]||o.parent;if(r<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=t-2;c>r;c--,d--){let h=o.node(c),u=o.index(c);if(h.type.spec.isolating)return!1;let f=h.content.cutByIndex(u,h.childCount),p=i&&i[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=i&&i[d]||h;if(!h.canReplace(u+1,h.childCount)||!m.type.validContent(f))return!1}let l=o.indexAfter(r),a=i&&i[0];return o.node(r).canReplaceWith(l,l,a?a.type:o.node(r+1).type)}function Nh(n,e,t=1,i){let o=n.doc.resolve(e),r=w.empty,s=w.empty;for(let l=o.depth,a=o.depth-t,c=t-1;l>a;l--,c--){r=w.from(o.node(l).copy(r));let d=i&&i[c];s=w.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}n.step(new U(e,e,new C(r.append(s),t,t),!0))}function fi(n,e){let t=n.resolve(e),i=t.index();return Ih(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function Dh(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:i}=n.type.schema;for(let o=0;o<e.childCount;o++){let r=e.child(o),s=r.type==i?n.type.schema.nodes.text:r.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(r.marks))return!1}return t.validEnd}function Ih(n,e){return!!(n&&e&&!n.isLeaf&&Dh(n,e))}function Ph(n,e,t){let i=null,{linebreakReplacement:o}=n.doc.type.schema,r=n.doc.resolve(e-t),s=r.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",h=!!s.contentMatch.matchType(o);d&&!h?i=!1:!d&&h&&(i=!0)}let l=n.steps.length;if(i===!1){let d=n.doc.resolve(e+t);Bl(n,d.node(),d.before(),l)}s.inlineContent&&Do(n,e+t-1,s,r.node().contentMatchAt(r.index()),i==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new U(c,a.map(e+t,-1),C.empty,!0)),i===!0){let d=n.doc.resolve(c);zl(n,d.node(),d.before(),n.steps.length)}return n}function Rh(n,e,t){let i=n.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),t))return e;if(i.parentOffset==0)for(let o=i.depth-1;o>=0;o--){let r=i.index(o);if(i.node(o).canReplaceWith(r,r,t))return i.before(o+1);if(r>0)return null}if(i.parentOffset==i.parent.content.size)for(let o=i.depth-1;o>=0;o--){let r=i.indexAfter(o);if(i.node(o).canReplaceWith(r,r,t))return i.after(o+1);if(r<i.node(o).childCount)return null}return null}function Vh(n,e,t){let i=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let r=0;r<t.openStart;r++)o=o.firstChild.content;for(let r=1;r<=(t.openStart==0&&t.size?2:1);r++)for(let s=i.depth;s>=0;s--){let l=s==i.depth?0:i.pos<=(i.start(s+1)+i.end(s+1))/2?-1:1,a=i.index(s)+(l>0?1:0),c=i.node(s),d=!1;if(r==1)d=c.canReplace(a,a,o);else{let h=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=h&&c.canReplaceWith(a,a,h[0])}if(d)return l==0?i.pos:l<0?i.before(s+1):i.after(s+1)}return null}function Io(n,e,t=e,i=C.empty){if(e==t&&!i.size)return null;let o=n.resolve(e),r=n.resolve(t);return Hl(o,r,i)?new U(e,t,i):new Lh(o,r,i).fit()}function Hl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Lh{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=w.empty;for(let o=0;o<=e.depth;o++){let r=e.node(o);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=w.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,i=this.$from,o=this.close(e<0?this.$to:i.doc.resolve(e));if(!o)return null;let r=this.placed,s=i.depth,l=o.depth;for(;s&&l&&r.childCount==1;)r=r.firstChild.content,s--,l--;let a=new C(r,s,l);return e>-1?new j(i.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||i.pos!=this.$to.pos?new U(i.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,o=this.unplaced.openEnd;i<e;i++){let r=t.firstChild;if(t.childCount>1&&(o=0),r.type.spec.isolating&&o<=i){e=i;break}t=r.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let o,r=null;i?(r=Ni(this.unplaced.content,i-1).firstChild,o=r.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,h=null;if(t==1&&(s?c.matchType(s.type)||(h=c.fillBefore(w.from(s),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:i,frontierDepth:l,parent:r,inject:h};if(t==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:i,frontierDepth:l,parent:r,wrap:d};if(r&&c.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,o=Ni(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new C(e,t+1,Math.max(i,o.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,o=Ni(e,t);if(o.childCount<=1&&t>0){let r=e.size-t<=t+o.size;this.unplaced=new C(Xt(e,t-1,1),t-1,r?t-1:i)}else this.unplaced=new C(Xt(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:o,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let m=0;m<r.length;m++)this.openFrontierNode(r[m]);let s=this.unplaced,l=i?i.content:s.content,a=s.openStart-e,c=0,d=[],{match:h,type:u}=this.frontier[t];if(o){for(let m=0;m<o.childCount;m++)d.push(o.child(m));h=h.matchFragment(o)}let f=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=h.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(h=g,d.push(Fl(m.mark(u.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?f:-1)))}let p=c==l.childCount;p||(f=-1),this.placed=Qt(this.placed,t,w.from(d)),this.frontier[t].match=h,p&&f<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<f;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?C.empty:new C(Xt(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new C(Xt(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Di(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,o=this.$to.after(i);for(;i>1&&o==this.$to.end(--i);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:o}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Di(e,t,o,i,r);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=Di(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qt(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let o=e.node(i),r=o.type.contentMatch.fillBefore(o.content,!0,e.index(i));this.openFrontierNode(o.type,o.attrs,r)}return e}openFrontierNode(e,t=null,i){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Qt(this.placed,this.depth,w.from(e.create(t,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(w.empty,!0);t.childCount&&(this.placed=Qt(this.placed,this.frontier.length,t))}}function Xt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Xt(n.firstChild.content,e-1,t)))}function Qt(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qt(n.lastChild.content,e-1,t)))}function Ni(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Fl(n,e,t){if(e<=0)return n;let i=n.content;return e>1&&(i=i.replaceChild(0,Fl(i.firstChild,e-1,i.childCount==1?t-1:0))),e>0&&(i=n.type.contentMatch.fillBefore(i).append(i),t<=0&&(i=i.append(n.type.contentMatch.matchFragment(i).fillBefore(w.empty,!0)))),n.copy(i)}function Di(n,e,t,i,o){let r=n.node(e),s=o?n.indexAfter(e):n.index(e);if(s==r.childCount&&!t.compatibleContent(r.type))return null;let l=i.fillBefore(r.content,!0,s);return l&&!zh(t,r.content,s)?l:null}function zh(n,e,t){for(let i=t;i<e.childCount;i++)if(!n.allowsMarks(e.child(i).marks))return!0;return!1}function Bh(n){return n.spec.defining||n.spec.definingForContent}function Hh(n,e,t,i){if(!i.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),r=n.doc.resolve(t);if(Hl(o,r,i))return n.step(new U(e,t,i));let s=Wl(o,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let u=o.depth,f=o.pos-1;u>0;u--,f--){let p=o.node(u).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(u)>-1?l=u:o.before(u)==f&&s.splice(1,0,-u)}let a=s.indexOf(l),c=[],d=i.openStart;for(let u=i.content,f=0;;f++){let p=u.firstChild;if(c.push(p),f==i.openStart)break;u=p.content}for(let u=d-1;u>=0;u--){let f=c[u],p=Bh(f.type);if(p&&!f.sameMarkup(o.node(Math.abs(l)-1)))d=u;else if(p||!f.type.isTextblock)break}for(let u=i.openStart;u>=0;u--){let f=(u+d+1)%(i.openStart+1),p=c[f];if(p)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],y=!0;g<0&&(y=!1,g=-g);let x=o.node(g-1),b=o.index(g-1);if(x.canReplaceWith(b,b,p.type,p.marks))return n.replace(o.before(g),y?r.after(g):t,new C($l(i.content,0,i.openStart,f),f,i.openEnd))}}let h=n.steps.length;for(let u=s.length-1;u>=0&&(n.replace(e,t,i),!(n.steps.length>h));u--){let f=s[u];f<0||(e=o.before(f),t=r.after(f))}}function $l(n,e,t,i,o){if(e<t){let r=n.firstChild;n=n.replaceChild(0,r.copy($l(r.content,e+1,t,i,r)))}if(e>i){let r=o.contentMatchAt(0),s=r.fillBefore(n).append(n);n=s.append(r.matchFragment(s).fillBefore(w.empty,!0))}return n}function Fh(n,e,t,i){if(!i.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Rh(n.doc,e,i.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new C(w.from(i),0,0))}function $h(n,e,t){let i=n.doc.resolve(e),o=n.doc.resolve(t),r=Wl(i,o);for(let s=0;s<r.length;s++){let l=r[s],a=s==r.length-1;if(a&&l==0||i.node(l).type.contentMatch.validEnd)return n.delete(i.start(l),o.end(l));if(l>0&&(a||i.node(l-1).canReplace(i.index(l-1),o.indexAfter(l-1))))return n.delete(i.before(l),o.after(l))}for(let s=1;s<=i.depth&&s<=o.depth;s++)if(e-i.start(s)==i.depth-s&&t>i.end(s)&&o.end(s)-t!=o.depth-s&&i.start(s-1)==o.start(s-1)&&i.node(s-1).canReplace(i.index(s-1),o.index(s-1)))return n.delete(i.before(s),t);n.delete(e,t)}function Wl(n,e){let t=[],i=Math.min(n.depth,e.depth);for(let o=i;o>=0;o--){let r=n.start(o);if(r<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(r==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==r-1)&&t.push(o)}return t}class Lt extends X{constructor(e,t,i){super(),this.pos=e,this.attr=t,this.value=i}apply(e){let t=e.nodeAt(this.pos);if(!t)return F.fail("No node at attribute step's position");let i=Object.create(null);for(let r in t.attrs)i[r]=t.attrs[r];i[this.attr]=this.value;let o=t.type.create(i,null,t.marks);return F.fromReplace(e,this.pos,this.pos+1,new C(w.from(o),0,t.isLeaf?0:1))}getMap(){return le.empty}invert(e){return new Lt(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Lt(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Lt(t.pos,t.attr,t.value)}}X.jsonID("attr",Lt);class dn extends X{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return F.ok(i)}getMap(){return le.empty}invert(e){return new dn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new dn(t.attr,t.value)}}X.jsonID("docAttr",dn);let $t=class extends Error{};$t=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};$t.prototype=Object.create(Error.prototype);$t.prototype.constructor=$t;$t.prototype.name="TransformError";class _l{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Rt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $t(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,i=C.empty){let o=Io(this.doc,e,t,i);return o&&this.step(o),this}replaceWith(e,t,i){return this.replace(e,t,new C(w.from(i),0,0))}delete(e,t){return this.replace(e,t,C.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return Hh(this,e,t,i),this}replaceRangeWith(e,t,i){return Fh(this,e,t,i),this}deleteRange(e,t){return $h(this,e,t),this}lift(e,t){return Ch(this,e,t),this}join(e,t=1){return Ph(this,e,t),this}wrap(e,t){return Mh(this,e,t),this}setBlockType(e,t=e,i,o=null){return Ah(this,e,t,i,o),this}setNodeMarkup(e,t,i=null,o){return Eh(this,e,t,i,o),this}setNodeAttribute(e,t,i){return this.step(new Lt(e,t,i)),this}setDocAttribute(e,t){return this.step(new dn(e,t)),this}addNodeMark(e,t){return this.step(new qe(e,t)),this}removeNodeMark(e,t){if(!(t instanceof I)){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(t=t.isInSet(i.marks),!t)return this}return this.step(new Ft(e,t)),this}split(e,t=1,i){return Nh(this,e,t,i),this}addMark(e,t,i){return Sh(this,e,t,i),this}removeMark(e,t,i){return vh(this,e,t,i),this}clearIncompatible(e,t,i){return Do(this,e,t,i),this}}const Ii=Object.create(null);class E{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new Kl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=C.empty){let i=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=i,i=i.lastChild;let r=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],d=e.mapping.slice(r);e.replaceRange(d.map(a.pos),d.map(c.pos),l?C.empty:t),l==0&&Rr(e,r,(i?i.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){let{$from:s,$to:l}=o[r],a=e.mapping.slice(i),c=a.map(s.pos),d=a.map(l.pos);r?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),Rr(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let o=e.parent.inlineContent?new N(e):At(e.node(0),e.parent,e.pos,e.index(),t,i);if(o)return o;for(let r=e.depth-1;r>=0;r--){let s=t<0?At(e.node(0),e.node(r),e.before(r+1),e.index(r),t,i):At(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,i);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ce(e.node(0))}static atStart(e){return At(e,e,0,0,1)||new ce(e)}static atEnd(e){return At(e,e,e.content.size,e.childCount,-1)||new ce(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Ii[t.type];if(!i)throw new RangeError(`No selection type ${t.type} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Ii)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ii[e]=t,t.prototype.jsonID=e,t}getBookmark(){return N.between(this.$anchor,this.$head).getBookmark()}}E.prototype.visible=!0;class Kl{constructor(e,t){this.$from=e,this.$to=t}}let Ir=!1;function Pr(n){!Ir&&!n.parent.inlineContent&&(Ir=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class N extends E{constructor(e,t=e){Pr(e),Pr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let i=e.resolve(t.map(this.head));if(!i.parent.inlineContent)return E.near(i);let o=e.resolve(t.map(this.anchor));return new N(o.parent.inlineContent?o:i,i)}replace(e,t=C.empty){if(super.replace(e,t),t==C.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof N&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new N(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let o=e.resolve(t);return new this(o,i==t?o:e.resolve(i))}static between(e,t,i){let o=e.pos-t.pos;if((!i||o)&&(i=o>=0?1:-1),!t.parent.inlineContent){let r=E.findFrom(t,i,!0)||E.findFrom(t,-i,!0);if(r)t=r.$head;else return E.near(t,i)}return e.parent.inlineContent||(o==0?e=t:(e=(E.findFrom(e,-i,!0)||E.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new N(e,t)}}E.jsonID("text",N);class pi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new pi(e.map(this.anchor),e.map(this.head))}resolve(e){return N.between(e.resolve(this.anchor),e.resolve(this.head))}}class O extends E{constructor(e){let t=e.nodeAfter,i=e.node(0).resolve(e.pos+t.nodeSize);super(e,i),this.node=t}map(e,t){let{deleted:i,pos:o}=t.mapResult(this.anchor),r=e.resolve(o);return i?E.near(r):new O(r)}content(){return new C(w.from(this.node),0,0)}eq(e){return e instanceof O&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Po(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new O(e.resolve(t.anchor))}static create(e,t){return new O(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}O.prototype.visible=!1;E.jsonID("node",O);class Po{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new pi(i,i):new Po(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&O.isSelectable(i)?new O(t):E.near(t)}}class ce extends E{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=C.empty){if(t==C.empty){e.delete(0,e.doc.content.size);let i=E.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ce(e)}map(e){return new ce(e)}eq(e){return e instanceof ce}getBookmark(){return Wh}}E.jsonID("all",ce);const Wh={map(){return this},resolve(n){return new ce(n)}};function At(n,e,t,i,o,r=!1){if(e.inlineContent)return N.create(n,t);for(let s=i-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!r&&O.isSelectable(l))return O.create(n,t-(o<0?l.nodeSize:0))}else{let a=At(n,l,t+o,o<0?l.childCount:0,o,r);if(a)return a}t+=l.nodeSize*o}return null}function Rr(n,e,t){let i=n.steps.length-1;if(i<e)return;let o=n.steps[i];if(!(o instanceof U||o instanceof j))return;let r=n.mapping.maps[i],s;r.forEach((l,a,c,d)=>{s==null&&(s=d)}),n.setSelection(E.near(n.doc.resolve(s),t))}const Vr=1,Pn=2,Lr=4;class _h extends _l{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Vr)&~Pn,this.storedMarks=null,this}get selectionSet(){return(this.updated&Vr)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Pn,this}ensureMarks(e){return I.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Pn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Pn,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let i=this.selection;return t&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||I.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),i=i??t,!e)return this.deleteRange(t,i);let r=this.storedMarks;if(!r){let s=this.doc.resolve(t);r=i==t?s.marks():s.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,o.text(e,r)),this.selection.empty||this.setSelection(E.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Lr,this}get scrolledIntoView(){return(this.updated&Lr)>0}}function zr(n,e){return!e||!n?n:n.bind(e)}class en{constructor(e,t,i){this.name=e,this.init=zr(t.init,i),this.apply=zr(t.apply,i)}}const Kh=[new en("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new en("selection",{init(n,e){return n.selection||E.atStart(e.doc)},apply(n){return n.selection}}),new en("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,i){return i.selection.$cursor?n.storedMarks:null}}),new en("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Pi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Kh.slice(),t&&t.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new en(i.key,i.spec.state,i))})}}class Nt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=t){let o=this.config.plugins[i];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),o=null;for(;;){let r=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,i);if(d&&i.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let h=0;h<this.config.plugins.length;h++)o.push(h<s?{state:i,n:t.length}:{state:this,n:0})}t.push(d),i=i.applyInner(d),r=!0}o&&(o[s]={state:i,n:t.length})}}if(!r)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Nt(this.config),i=this.config.fields;for(let o=0;o<i.length;o++){let r=i[o];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new _h(this)}static create(e){let t=new Pi(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Nt(t);for(let o=0;o<t.fields.length;o++)i[t.fields[o].name]=t.fields[o].init(e,i);return i}reconfigure(e){let t=new Pi(this.schema,e.plugins),i=t.fields,o=new Nt(t);for(let r=0;r<i.length;r++){let s=i[r].name;o[s]=this.hasOwnProperty(s)?this[s]:i[r].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[i],r=o.spec.state;r&&r.toJSON&&(t[i]=r.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,i){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Pi(e.schema,e.plugins),r=new Nt(o);return o.fields.forEach(s=>{if(s.name=="doc")r.doc=ht.fromJSON(e.schema,t.doc);else if(s.name=="selection")r.selection=E.fromJSON(r.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let l in i){let a=i[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){r[s.name]=c.fromJSON.call(a,e,t[l],r);return}}r[s.name]=s.init(e,r)}}),r}}function ql(n,e,t){for(let i in n){let o=n[i];o instanceof Function?o=o.bind(e):i=="handleDOMEvents"&&(o=ql(o,e,{})),t[i]=o}return t}class gn{constructor(e){this.spec=e,this.props={},e.props&&ql(e.props,this,this.props),this.key=e.key?e.key.key:jl("plugin")}getState(e){return e[this.key]}}const Ri=Object.create(null);function jl(n){return n in Ri?n+"$"+ ++Ri[n]:(Ri[n]=0,n+"$")}class yn{constructor(e="key"){this.key=jl(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Jl=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function qh(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const jh=(n,e,t)=>{let i=qh(n,t);if(!i)return!1;let o=Gl(i);if(!o){let s=i.blockRange(),l=s&&ui(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let r=o.nodeBefore;if(ea(n,o,e,-1))return!0;if(i.parent.content.size==0&&(Wt(r,"end")||O.isSelectable(r)))for(let s=i.depth;;s--){let l=Io(n.doc,i.before(s),i.after(s),C.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Wt(r,"end")?E.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):O.create(a.doc,o.pos-r.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||i.node(s-1).childCount>1)break}return r.isAtom&&o.depth==i.depth-1?(e&&e(n.tr.delete(o.pos-r.nodeSize,o.pos).scrollIntoView()),!0):!1};function Wt(n,e,t=!1){for(let i=n;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(t&&i.childCount!=1)return!1}return!1}const Jh=(n,e,t)=>{let{$head:i,empty:o}=n.selection,r=i;if(!o)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):i.parentOffset>0)return!1;r=Gl(i)}let s=r&&r.nodeBefore;return!s||!O.isSelectable(s)?!1:(e&&e(n.tr.setSelection(O.create(n.doc,r.pos-s.nodeSize)).scrollIntoView()),!0)};function Gl(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Gh(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Uh=(n,e,t)=>{let i=Gh(n,t);if(!i)return!1;let o=Ul(i);if(!o)return!1;let r=o.nodeAfter;if(ea(n,o,e,1))return!0;if(i.parent.content.size==0&&(Wt(r,"start")||O.isSelectable(r))){let s=Io(n.doc,i.before(),i.after(),C.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Wt(r,"start")?E.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):O.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return r.isAtom&&o.depth==i.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+r.nodeSize).scrollIntoView()),!0):!1},Zh=(n,e,t)=>{let{$head:i,empty:o}=n.selection,r=i;if(!o)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):i.parentOffset<i.parent.content.size)return!1;r=Ul(i)}let s=r&&r.nodeAfter;return!s||!O.isSelectable(s)?!1:(e&&e(n.tr.setSelection(O.create(n.doc,r.pos)).scrollIntoView()),!0)};function Ul(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Yh=(n,e)=>{let{$head:t,$anchor:i}=n.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(n.tr.insertText(`
125
+ `).scrollIntoView()),!0)};function Ro(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Zl=(n,e)=>{let{$head:t,$anchor:i}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(i))return!1;let o=t.node(-1),r=t.indexAfter(-1),s=Ro(o.contentMatchAt(r));if(!s||!o.canReplaceWith(r,r,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(E.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Xh=(n,e)=>{let t=n.selection,{$from:i,$to:o}=t;if(t instanceof ce||i.parent.inlineContent||o.parent.inlineContent)return!1;let r=Ro(o.parent.contentMatchAt(o.indexAfter()));if(!r||!r.isTextblock)return!1;if(e){let s=(!i.parentOffset&&o.index()<o.parent.childCount?i:o).pos,l=n.tr.insert(s,r.createAndFill());l.setSelection(N.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Yl=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let r=t.before();if(Vt(n.doc,r))return e&&e(n.tr.split(r).scrollIntoView()),!0}let i=t.blockRange(),o=i&&ui(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)};function Xl(n){return(e,t)=>{let{$from:i,$to:o}=e.selection;if(e.selection instanceof O&&e.selection.node.isBlock)return!i.parentOffset||!Vt(e.doc,i.pos)?!1:(t&&t(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let r=[],s,l,a=!1,c=!1;for(let f=i.depth;;f--)if(i.node(f).isBlock){a=i.end(f)==i.pos+(i.depth-f),c=i.start(f)==i.pos-(i.depth-f),l=Ro(i.node(f-1).contentMatchAt(i.indexAfter(f-1)));let m=n&&n(o.parent,a,i);r.unshift(m||(a&&l?{type:l}:null)),s=f;break}else{if(f==1)return!1;r.unshift(null)}let d=e.tr;(e.selection instanceof N||e.selection instanceof ce)&&d.deleteSelection();let h=d.mapping.map(i.pos),u=Vt(d.doc,h,r.length,r);if(u||(r[0]=l?{type:l}:null,u=Vt(d.doc,h,r.length,r)),d.split(h,r.length,r),!a&&c&&i.node(s).type!=l){let f=d.mapping.map(i.before(s)),p=d.doc.resolve(f);l&&i.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(i.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const Qh=Xl(),Ql=(n,e)=>(e&&e(n.tr.setSelection(new ce(n.doc))),!0);function eu(n,e,t){let i=e.nodeBefore,o=e.nodeAfter,r=e.index();return!i||!o||!i.type.compatibleContent(o.type)?!1:!i.content.size&&e.parent.canReplace(r-1,r)?(t&&t(n.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(r,r+1)||!(o.isTextblock||fi(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ea(n,e,t,i){let o=e.nodeBefore,r=e.nodeAfter,s,l,a=o.type.spec.isolating||r.type.spec.isolating;if(!a&&eu(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(r.type))&&l.matchType(s[0]||r.type).validEnd){if(t){let f=e.pos+r.nodeSize,p=w.empty;for(let y=s.length-1;y>=0;y--)p=w.from(s[y].create(null,p));p=w.from(o.copy(p));let m=n.tr.step(new j(e.pos-1,f,e.pos,f,new C(p,1,0),s.length,!0)),g=m.doc.resolve(f+2*s.length);g.nodeAfter&&g.nodeAfter.type==o.type&&fi(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=r.type.spec.isolating||i>0&&a?null:E.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),u=h&&ui(h);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(h,u).scrollIntoView()),!0;if(c&&Wt(r,"start",!0)&&Wt(o,"end")){let f=o,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=r,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(t){let y=w.empty;for(let b=p.length-1;b>=0;b--)y=w.from(p[b].copy(y));let x=n.tr.step(new j(e.pos-p.length,e.pos+r.nodeSize,e.pos+g,e.pos+r.nodeSize-g,new C(y,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function ta(n){return function(e,t){let i=e.selection,o=n<0?i.$from:i.$to,r=o.depth;for(;o.node(r).isInline;){if(!r)return!1;r--}return o.node(r).isTextblock?(t&&t(e.tr.setSelection(N.create(e.doc,n<0?o.start(r):o.end(r)))),!0):!1}}const tu=ta(-1),nu=ta(1);function iu(n,e=null){return function(t,i){let o=!1;for(let r=0;r<t.selection.ranges.length&&!o;r++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[r];t.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let d=t.doc.resolve(c),h=d.index();o=d.parent.canReplaceWith(h,h+1,n)}})}if(!o)return!1;if(i){let r=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];r.setBlockType(l,a,n,e)}i(r.scrollIntoView())}return!0}}function ou(n,e,t,i){for(let o=0;o<e.length;o++){let{$from:r,$to:s}=e[o],l=r.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(r.pos,s.pos,(a,c)=>{if(l||!i)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function it(n,e=null,t){let i=t!==!1;return function(o,r){let{empty:s,$cursor:l,ranges:a}=o.selection;if(s&&!l||!ou(o.doc,a,n,i))return!1;if(r)if(l)n.isInSet(o.storedMarks||l.marks())?r(o.tr.removeStoredMark(n)):r(o.tr.addStoredMark(n.create(e)));else{let c,d=o.tr;c=!a.some(h=>o.doc.rangeHasMark(h.$from.pos,h.$to.pos,n));for(let h=0;h<a.length;h++){let{$from:u,$to:f}=a[h];if(!c)d.removeMark(u.pos,f.pos,n);else{let p=u.pos,m=f.pos,g=u.nodeAfter,y=f.nodeBefore,x=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,b=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;p+x<m&&(p+=x,m-=b),d.addMark(p,m,n.create(e))}}r(d.scrollIntoView())}return!0}}function hn(...n){return function(e,t,i){for(let o=0;o<n.length;o++)if(n[o](e,t,i))return!0;return!1}}let Vi=hn(Jl,jh,Jh),Br=hn(Jl,Uh,Zh);const Pe={Enter:hn(Yh,Xh,Yl,Qh),"Mod-Enter":Zl,Backspace:Vi,"Mod-Backspace":Vi,"Shift-Backspace":Vi,Delete:Br,"Mod-Delete":Br,"Mod-a":Ql},na={"Ctrl-h":Pe.Backspace,"Alt-Backspace":Pe["Mod-Backspace"],"Ctrl-d":Pe.Delete,"Ctrl-Alt-Backspace":Pe["Mod-Delete"],"Alt-Delete":Pe["Mod-Delete"],"Alt-d":Pe["Mod-Delete"],"Ctrl-a":tu,"Ctrl-e":nu};for(let n in Pe)na[n]=Pe[n];const ru=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,su=ru?na:Pe;var ti=200,$=function(){};$.prototype.append=function(e){return e.length?(e=$.from(e),!this.length&&e||e.length<ti&&this.leafAppend(e)||this.length<ti&&e.leafPrepend(this)||this.appendInner(e)):this};$.prototype.prepend=function(e){return e.length?$.from(e).append(this):this};$.prototype.appendInner=function(e){return new lu(this,e)};$.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?$.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};$.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};$.prototype.forEach=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length),t<=i?this.forEachInner(e,t,i,0):this.forEachInvertedInner(e,t,i,0)};$.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var o=[];return this.forEach(function(r,s){return o.push(e(r,s))},t,i),o};$.from=function(e){return e instanceof $?e:e&&e.length?new ia(e):$.empty};var ia=function(n){function e(i){n.call(this),this.values=i}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,r){return o==0&&r==this.length?this:new e(this.values.slice(o,r))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,r,s,l){for(var a=r;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,s,l){for(var a=r-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ti)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ti)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}($);$.empty=new ia([]);var lu=function(n){function e(t,i){n.call(this),this.left=t,this.right=i,this.length=t.length+i.length,this.depth=Math.max(t.depth,i.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,o,r,s){var l=this.left.length;if(o<l&&this.left.forEachInner(i,o,Math.min(r,l),s)===!1||r>l&&this.right.forEachInner(i,Math.max(o-l,0),Math.min(this.length,r)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,r,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(i,o-l,Math.max(r,l)-l,s+l)===!1||r<l&&this.left.forEachInvertedInner(i,Math.min(o,l),r,s)===!1)return!1},e.prototype.sliceInner=function(i,o){if(i==0&&o==this.length)return this;var r=this.left.length;return o<=r?this.left.slice(i,o):i>=r?this.right.slice(i-r,o-r):this.left.slice(i,r).append(this.right.slice(0,o-r))},e.prototype.leafAppend=function(i){var o=this.right.leafAppend(i);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(i){var o=this.left.leafPrepend(i);if(o)return new e(o,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e}($);const au=500;class ye{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let o,r;t&&(o=this.remapping(i,this.items.length),r=o.maps.length);let s=e.tr,l,a,c=[],d=[];return this.items.forEach((h,u)=>{if(!h.step){o||(o=this.remapping(i,u+1),r=o.maps.length),r--,d.push(h);return}if(o){d.push(new Se(h.map));let f=h.step.map(o.slice(r)),p;f&&s.maybeStep(f).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Se(p,void 0,void 0,c.length+d.length))),r--,p&&o.appendMap(p,r)}else s.maybeStep(h.step);if(h.selection)return l=o?h.selection.map(o.slice(r)):h.selection,a=new ye(this.items.slice(0,i).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,i,o){let r=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let h=e.steps[d].invert(e.docs[d]),u=new Se(e.mapping.maps[d],h,t),f;(f=a&&a.merge(u))&&(u=f,d?r.pop():l=l.slice(0,l.length-1)),r.push(u),t&&(s++,t=void 0),o||(a=u)}let c=s-i.depth;return c>du&&(l=cu(l,c),s-=c),new ye(l.append(r),s)}remapping(e,t){let i=new Rt;return this.items.forEach((o,r)=>{let s=o.mirrorOffset!=null&&r-o.mirrorOffset>=e?i.maps.length-o.mirrorOffset:void 0;i.appendMap(o.map,s)},e,t),i}addMaps(e){return this.eventCount==0?this:new ye(this.items.append(e.map(t=>new Se(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],o=Math.max(0,this.items.length-t),r=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(u=>{u.selection&&l--},o);let a=t;this.items.forEach(u=>{let f=r.getMirror(--a);if(f==null)return;s=Math.min(s,f);let p=r.maps[f];if(u.step){let m=e.steps[f].invert(e.docs[f]),g=u.selection&&u.selection.map(r.slice(a+1,f));g&&l++,i.push(new Se(p,m,g))}else i.push(new Se(p))},o);let c=[];for(let u=t;u<s;u++)c.push(new Se(r.maps[u]));let d=this.items.slice(0,o).append(c).append(i),h=new ye(d,l);return h.emptyItemCount()>au&&(h=h.compress(this.items.length-i.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),i=t.maps.length,o=[],r=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&r++;else if(s.step){let a=s.step.map(t.slice(i)),c=a&&a.getMap();if(i--,c&&t.appendMap(c,i),a){let d=s.selection&&s.selection.map(t.slice(i));d&&r++;let h=new Se(c.invert(),a,d),u,f=o.length-1;(u=o.length&&o[f].merge(h))?o[f]=u:o.push(h)}}else s.map&&i--},this.items.length,0),new ye($.from(o.reverse()),r)}}ye.empty=new ye($.empty,0);function cu(n,e){let t;return n.forEach((i,o)=>{if(i.selection&&e--==0)return t=o,!1}),n.slice(t)}class Se{constructor(e,t,i,o){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Se(t.getMap().invert(),t,this.selection)}}}class He{constructor(e,t,i,o,r){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=o,this.prevComposition=r}}const du=20;function hu(n,e,t,i){let o=t.getMeta(ut),r;if(o)return o.historyState;t.getMeta(pu)&&(n=new He(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(ut))return s.getMeta(ut).redo?new He(n.done.addTransform(t,void 0,i,Wn(e)),n.undone,Hr(t.mapping.maps),n.prevTime,n.prevComposition):new He(n.done,n.undone.addTransform(t,void 0,i,Wn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-i.newGroupDelay||!uu(t,n.prevRanges)),c=s?Li(n.prevRanges,t.mapping):Hr(t.mapping.maps);return new He(n.done.addTransform(t,a?e.selection.getBookmark():void 0,i,Wn(e)),ye.empty,c,t.time,l??n.prevComposition)}else return(r=t.getMeta("rebased"))?new He(n.done.rebased(t,r),n.undone.rebased(t,r),Li(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new He(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Li(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function uu(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((i,o)=>{for(let r=0;r<e.length;r+=2)i<=e[r+1]&&o>=e[r]&&(t=!0)}),t}function Hr(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((i,o,r,s)=>e.push(r,s));return e}function Li(n,e){if(!n)return null;let t=[];for(let i=0;i<n.length;i+=2){let o=e.map(n[i],1),r=e.map(n[i+1],-1);o<=r&&t.push(o,r)}return t}function fu(n,e,t){let i=Wn(e),o=ut.get(e).spec.config,r=(t?n.undone:n.done).popEvent(e,i);if(!r)return null;let s=r.selection.resolve(r.transform.doc),l=(t?n.done:n.undone).addTransform(r.transform,e.selection.getBookmark(),o,i),a=new He(t?l:r.remaining,t?r.remaining:l,null,0,-1);return r.transform.setSelection(s).setMeta(ut,{redo:t,historyState:a})}let zi=!1,Fr=null;function Wn(n){let e=n.plugins;if(Fr!=e){zi=!1,Fr=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){zi=!0;break}}return zi}const ut=new yn("history"),pu=new yn("closeHistory");function mu(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new gn({key:ut,state:{init(){return new He(ye.empty,ye.empty,null,0,-1)},apply(e,t,i){return hu(t,i,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,o=i=="historyUndo"?ra:i=="historyRedo"?so:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function oa(n,e){return(t,i)=>{let o=ut.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(i){let r=fu(o,t,n);r&&i(e?r.scrollIntoView():r)}return!0}}const ra=oa(!1,!0),so=oa(!0,!0);var Ze={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ni={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gu=typeof navigator<"u"&&/Mac/.test(navigator.platform),yu=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var K=0;K<10;K++)Ze[48+K]=Ze[96+K]=String(K);for(var K=1;K<=24;K++)Ze[K+111]="F"+K;for(var K=65;K<=90;K++)Ze[K]=String.fromCharCode(K+32),ni[K]=String.fromCharCode(K);for(var Bi in Ze)ni.hasOwnProperty(Bi)||(ni[Bi]=Ze[Bi]);function bu(n){var e=gu&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||yu&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ni:Ze)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const wu=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Su(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,o,r,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))wu?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return i&&(t="Alt-"+t),o&&(t="Ctrl-"+t),s&&(t="Meta-"+t),r&&(t="Shift-"+t),t}function vu(n){let e=Object.create(null);for(let t in n)e[Su(t)]=n[t];return e}function Hi(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Fi(n){return new gn({props:{handleKeyDown:sa(n)}})}function sa(n){let e=vu(n);return function(t,i){let o=bu(i),r,s=e[Hi(o,i)];if(s&&s(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(i.shiftKey){let l=e[Hi(o,i,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((i.shiftKey||i.altKey||i.metaKey||o.charCodeAt(0)>127)&&(r=Ze[i.keyCode])&&r!=o){let l=e[Hi(r,i)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function $r(n,e=null){return function(t,i){let{$from:o,$to:r}=t.selection,s=o.blockRange(r),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&o.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let d=t.doc.resolve(s.start-2);a=new Yn(d,d,s.depth),s.endIndex<s.parent.childCount&&(s=new Yn(o,t.doc.resolve(r.end(s.depth)),s.depth)),l=!0}let c=Ll(a,n,e,s);return c?(i&&i(xu(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function xu(n,e,t,i,o){let r=w.empty;for(let d=t.length-1;d>=0;d--)r=w.from(t[d].type.create(t[d].attrs,r));n.step(new j(e.start-(i?2:0),e.end,e.start,e.end,new C(r,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==o&&(s=d+1);let l=t.length-s,a=e.start+t.length-(i?2:0),c=e.parent;for(let d=e.startIndex,h=e.endIndex,u=!0;d<h;d++,u=!1)!u&&Vt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Cu(n,e){return function(t,i){let{$from:o,$to:r,node:s}=t.selection;if(s&&s.isBlock||o.depth<2||!o.sameParent(r))return!1;let l=o.node(-1);if(l.type!=n)return!1;if(o.parent.content.size==0&&o.node(-1).childCount==o.indexAfter(-1)){if(o.depth==3||o.node(-3).type!=n||o.index(-2)!=o.node(-2).childCount-1)return!1;if(i){let h=w.empty,u=o.index(-1)?1:o.index(-2)?2:3;for(let y=o.depth-u;y>=o.depth-3;y--)h=w.from(o.node(y).copy(h));let f=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;h=h.append(w.from(n.createAndFill()));let p=o.before(o.depth-(u-1)),m=t.tr.replace(p,o.after(-f),new C(h,4-u,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(y,x)=>{if(g>-1)return!1;y.isTextblock&&y.content.size==0&&(g=x+1)}),g>-1&&m.setSelection(E.near(m.doc.resolve(g))),i(m.scrollIntoView())}return!0}let a=r.pos==o.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(o.pos,r.pos),d=a?[null,{type:a}]:void 0;return Vt(c.doc,o.pos,2,d)?(i&&i(c.split(o.pos,2,d).scrollIntoView()),!0):!1}}function lo(n){return function(e,t){let{$from:i,$to:o}=e.selection,r=i.blockRange(o,s=>s.childCount>0&&s.firstChild.type==n);return r?t?i.node(r.depth-1).type==n?ku(e,t,n,r):Tu(e,t,r):!0:!1}}function ku(n,e,t,i){let o=n.tr,r=i.end,s=i.$to.end(i.depth);r<s&&(o.step(new j(r-1,s,r,s,new C(w.from(t.create(null,i.parent.copy())),1,0),1,!0)),i=new Yn(o.doc.resolve(i.$from.pos),o.doc.resolve(s),i.depth));const l=ui(i);if(l==null)return!1;o.lift(i,l);let a=o.mapping.map(r,-1)-1;return fi(o.doc,a)&&o.join(a),e(o.scrollIntoView()),!0}function Tu(n,e,t){let i=n.tr,o=t.parent;for(let f=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)f-=o.child(p).nodeSize,i.delete(f-1,f+1);let r=i.doc.resolve(t.start),s=r.nodeAfter;if(i.mapping.map(t.end)!=t.start+r.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==o.childCount,c=r.node(-1),d=r.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?w.empty:w.from(o))))return!1;let h=r.pos,u=h+s.nodeSize;return i.step(new j(h-(l?1:0),u+(a?1:0),h+1,u-1,new C((l?w.empty:w.from(o.copy(w.empty))).append(a?w.empty:w.from(o.copy(w.empty))),l?0:1,a?0:1),l?0:1)),e(i.scrollIntoView()),!0}function Mu(n){return function(e,t){let{$from:i,$to:o}=e.selection,r=i.blockRange(o,c=>c.childCount>0&&c.firstChild.type==n);if(!r)return!1;let s=r.startIndex;if(s==0)return!1;let l=r.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=w.from(c?n.create():null),h=new C(w.from(n.create(null,w.from(l.type.create(null,d)))),c?3:1,0),u=r.start,f=r.end;t(e.tr.step(new j(u-(c?3:1),f,u,f,h,1,!0)).scrollIntoView())}return!0}}const q=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},un=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ao=null;const Ie=function(n,e,t){let i=ao||(ao=document.createRange());return i.setEnd(n,t??n.nodeValue.length),i.setStart(n,e||0),i},Au=function(){ao=null},yt=function(n,e,t,i){return t&&(Wr(n,e,t,i,-1)||Wr(n,e,t,i,1))},Ou=/^(img|br|input|textarea|hr)$/i;function Wr(n,e,t,i,o){for(;;){if(n==t&&e==i)return!0;if(e==(o<0?0:fe(n))){let r=n.parentNode;if(!r||r.nodeType!=1||bn(n)||Ou.test(n.nodeName)||n.contentEditable=="false")return!1;e=q(n)+(o<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?fe(n):0}else return!1}}function fe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Eu(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=fe(n)}else if(n.parentNode&&!bn(n))e=q(n),n=n.parentNode;else return null}}function Nu(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!bn(n))e=q(n)+1,n=n.parentNode;else return null}}function Du(n,e,t){for(let i=e==0,o=e==fe(n);i||o;){if(n==t)return!0;let r=q(n);if(n=n.parentNode,!n)return!1;i=i&&r==0,o=o&&r==fe(n)}}function bn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const mi=function(n){return n.focusNode&&yt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ot(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Iu(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Pu(n,e,t){if(n.caretPositionFromPoint)try{let i=n.caretPositionFromPoint(e,t);if(i)return{node:i.offsetNode,offset:Math.min(fe(i.offsetNode),i.offset)}}catch{}if(n.caretRangeFromPoint){let i=n.caretRangeFromPoint(e,t);if(i)return{node:i.startContainer,offset:Math.min(fe(i.startContainer),i.startOffset)}}}const Ce=typeof navigator<"u"?navigator:null,_r=typeof document<"u"?document:null,Ye=Ce&&Ce.userAgent||"",co=/Edge\/(\d+)/.exec(Ye),la=/MSIE \d/.exec(Ye),ho=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ye),re=!!(la||ho||co),Je=la?document.documentMode:ho?+ho[1]:co?+co[1]:0,we=!re&&/gecko\/(\d+)/i.test(Ye);we&&+(/Firefox\/(\d+)/.exec(Ye)||[0,0])[1];const uo=!re&&/Chrome\/(\d+)/.exec(Ye),Z=!!uo,aa=uo?+uo[1]:0,te=!re&&!!Ce&&/Apple Computer/.test(Ce.vendor),_t=te&&(/Mobile\/\w+/.test(Ye)||!!Ce&&Ce.maxTouchPoints>2),ue=_t||(Ce?/Mac/.test(Ce.platform):!1),Ru=Ce?/Win/.test(Ce.platform):!1,ge=/Android \d/.test(Ye),wn=!!_r&&"webkitFontSmoothing"in _r.documentElement.style,Vu=wn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lu(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Oe(n,e){return typeof n=="number"?n:n[e]}function zu(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,i=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*i}}function Kr(n,e,t){let i=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,r=n.dom.ownerDocument;for(let s=t||n.dom;s;s=un(s)){if(s.nodeType!=1)continue;let l=s,a=l==r.body,c=a?Lu(r):zu(l),d=0,h=0;if(e.top<c.top+Oe(i,"top")?h=-(c.top-e.top+Oe(o,"top")):e.bottom>c.bottom-Oe(i,"bottom")&&(h=e.bottom-e.top>c.bottom-c.top?e.top+Oe(o,"top")-c.top:e.bottom-c.bottom+Oe(o,"bottom")),e.left<c.left+Oe(i,"left")?d=-(c.left-e.left+Oe(o,"left")):e.right>c.right-Oe(i,"right")&&(d=e.right-c.right+Oe(o,"right")),d||h)if(a)r.defaultView.scrollBy(d,h);else{let u=l.scrollLeft,f=l.scrollTop;h&&(l.scrollTop+=h),d&&(l.scrollLeft+=d);let p=l.scrollLeft-u,m=l.scrollTop-f;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Bu(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),i,o;for(let r=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(r,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){i=l,o=a.top;break}}return{refDOM:i,refTop:o,stack:ca(n.dom)}}function ca(n){let e=[],t=n.ownerDocument;for(let i=n;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),n!=t);i=un(i));return e}function Hu({refDOM:n,refTop:e,stack:t}){let i=n?n.getBoundingClientRect().top:0;da(t,i==0?0:i-e)}function da(n,e){for(let t=0;t<n.length;t++){let{dom:i,top:o,left:r}=n[t];i.scrollTop!=o+e&&(i.scrollTop=o+e),i.scrollLeft!=r&&(i.scrollLeft=r)}}let kt=null;function Fu(n){if(n.setActive)return n.setActive();if(kt)return n.focus(kt);let e=ca(n);n.focus(kt==null?{get preventScroll(){return kt={preventScroll:!0},!0}}:void 0),kt||(kt=!1,da(e,0))}function ha(n,e){let t,i=2e8,o,r=0,s=e.top,l=e.top,a,c;for(let d=n.firstChild,h=0;d;d=d.nextSibling,h++){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=Ie(d).getClientRects();else continue;for(let f=0;f<u.length;f++){let p=u[f];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<i){t=d,i=m,o=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(r=h+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(r=h+1)}}return!t&&a&&(t=a,o=c,i=0),t&&t.nodeType==3?$u(t,o):!t||i&&t.nodeType==1?{node:n,offset:r}:ha(t,o)}function $u(n,e){let t=n.nodeValue.length,i=document.createRange();for(let o=0;o<t;o++){i.setEnd(n,o+1),i.setStart(n,o);let r=Be(i,1);if(r.top!=r.bottom&&Vo(e,r))return{node:n,offset:o+(e.left>=(r.left+r.right)/2?1:0)}}return{node:n,offset:0}}function Vo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Wu(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function _u(n,e,t){let{node:i,offset:o}=ha(e,t),r=-1;if(i.nodeType==1&&!i.firstChild){let s=i.getBoundingClientRect();r=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(i,o,r)}function Ku(n,e,t,i){let o=-1;for(let r=e,s=!1;r!=n.dom;){let l=n.docView.nearestDesc(r,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!s&&a.left>i.left||a.top>i.top?o=l.posBefore:(!s&&a.right<i.left||a.bottom<i.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?i.top<(a.top+a.bottom)/2:i.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}r=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function ua(n,e,t){let i=n.childNodes.length;if(i&&t.top<t.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-t.top)/(t.bottom-t.top))-2)),r=o;;){let s=n.childNodes[r];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Vo(e,c))return ua(s,e,c)}}if((r=(r+1)%i)==o)break}return n}function qu(n,e){let t=n.dom.ownerDocument,i,o=0,r=Pu(t,e.left,e.top);r&&({node:i,offset:o}=r);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!Vo(e,c)||(s=ua(n.dom,e,c),!s))return null}if(te)for(let c=s;i&&c;c=un(c))c.draggable&&(i=void 0);if(s=Wu(s,e),i){if(we&&i.nodeType==1&&(o=Math.min(o,i.childNodes.length),o<i.childNodes.length)){let d=i.childNodes[o],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&o++}let c;wn&&o&&i.nodeType==1&&(c=i.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,i==n.dom&&o==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||i.nodeType!=1||i.childNodes[o-1].nodeName!="BR")&&(l=Ku(n,i,o,e))}l==null&&(l=_u(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function qr(n){return n.top<n.bottom||n.left<n.right}function Be(n,e){let t=n.getClientRects();if(t.length){let i=t[e<0?0:t.length-1];if(qr(i))return i}return Array.prototype.find.call(t,qr)||n.getBoundingClientRect()}const ju=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function fa(n,e,t){let{node:i,offset:o,atom:r}=n.docView.domFromPos(e,t<0?-1:1),s=wn||we;if(i.nodeType==3)if(s&&(ju.test(i.nodeValue)||(t<0?!o:o==i.nodeValue.length))){let a=Be(Ie(i,o,o),t);if(we&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){let c=Be(Ie(i,o-1,o-1),-1);if(c.top==a.top){let d=Be(Ie(i,o,o+1),-1);if(d.top!=a.top)return Gt(d,d.left<c.left)}}return a}else{let a=o,c=o,d=t<0?1:-1;return t<0&&!o?(c++,d=-1):t>=0&&o==i.nodeValue.length?(a--,d=1):t<0?a--:c++,Gt(Be(Ie(i,a,c),d),d<0)}if(!n.state.doc.resolve(e-(r||0)).parent.inlineContent){if(r==null&&o&&(t<0||o==fe(i))){let a=i.childNodes[o-1];if(a.nodeType==1)return $i(a.getBoundingClientRect(),!1)}if(r==null&&o<fe(i)){let a=i.childNodes[o];if(a.nodeType==1)return $i(a.getBoundingClientRect(),!0)}return $i(i.getBoundingClientRect(),t>=0)}if(r==null&&o&&(t<0||o==fe(i))){let a=i.childNodes[o-1],c=a.nodeType==3?Ie(a,fe(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Gt(Be(c,1),!1)}if(r==null&&o<fe(i)){let a=i.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Ie(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return Gt(Be(c,-1),!0)}return Gt(Be(i.nodeType==3?Ie(i):i,-t),t>=0)}function Gt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function $i(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function pa(n,e,t){let i=n.state,o=n.root.activeElement;i!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{i!=e&&n.updateState(i),o!=n.dom&&o&&o.focus()}}function Ju(n,e,t){let i=e.selection,o=t=="up"?i.$from:i.$to;return pa(n,e,()=>{let{node:r}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(r,!0);if(!l)break;if(l.node.isBlock){r=l.contentDOM||l.dom;break}r=l.dom.parentNode}let s=fa(n,o.pos,1);for(let l=r.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ie(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let d=a[c];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const Gu=/[\u0590-\u08ac]/;function Uu(n,e,t){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let o=i.parentOffset,r=!o,s=o==i.parent.content.size,l=n.domSelection();return l?!Gu.test(i.parent.textContent)||!l.modify?t=="left"||t=="backward"?r:s:pa(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:h}=n.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let f=i.depth?n.docView.domAfterPos(i.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(d,h),a&&(a!=d||c!=h)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),g}):i.pos==i.start()||i.pos==i.end()}let jr=null,Jr=null,Gr=!1;function Zu(n,e,t){return jr==e&&Jr==t?Gr:(jr=e,Jr=t,Gr=t=="up"||t=="down"?Ju(n,e,t):Uu(n,e,t))}const pe=0,Ur=1,st=2,ke=3;class Sn{constructor(e,t,i,o){this.parent=e,this.children=t,this.dom=i,this.contentDOM=o,this.dirty=pe,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,i=this.posAtStart;;t++){let o=this.children[t];if(o==e)return i;i+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let r,s;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&!((s=r.pmViewDesc)&&s.parent==this);)r=r.previousSibling;return r?this.posBeforeChild(s)+s.size:this.posAtStart}else{let r,s;if(e==this.contentDOM)r=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&!((s=r.pmViewDesc)&&s.parent==this);)r=r.nextSibling;return r?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>q(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let r=e;;r=r.parentNode){if(r==this.dom){o=!1;break}if(r.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let r=e;;r=r.parentNode){if(r==this.dom){o=!0;break}if(r.nextSibling)break}}return o??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,o=e;o;o=o.parentNode){let r=this.getDesc(o),s;if(r&&(!t||r.node))if(i&&(s=r.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))i=!1;else return r}}getDesc(e){let t=e.pmViewDesc;for(let i=t;i;i=i.parent)if(i==this)return t}posFromDOM(e,t,i){for(let o=e;o;o=o.parentNode){let r=this.getDesc(o);if(r)return r.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;t<this.children.length;t++){let o=this.children[t],r=i+o.size;if(i==e&&r!=i){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<r)return o.descAt(e-i-o.border);i=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,o=0;for(let r=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(l>e||s instanceof ga){o=e-r;break}r=l}if(o)return this.children[i].domFromPos(o-this.children[i].border,t);for(let r;i&&!(r=this.children[i-1]).size&&r instanceof ma&&r.side>=0;i--);if(t<=0){let r,s=!0;for(;r=i?this.children[i-1]:null,!(!r||r.dom.parentNode==this.contentDOM);i--,s=!1);return r&&t&&s&&!r.border&&!r.domAtom?r.domFromPos(r.size,t):{node:this.contentDOM,offset:r?q(r.dom)+1:0}}else{let r,s=!0;for(;r=i<this.children.length?this.children[i]:null,!(!r||r.dom.parentNode==this.contentDOM);i++,s=!1);return r&&s&&!r.border&&!r.domAtom?r.domFromPos(0,t):{node:this.contentDOM,offset:r?q(r.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,r=-1;for(let s=i,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let d=s+a.border;if(e>=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let h=l;h>0;h--){let u=this.children[h-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){o=q(u.dom)+1;break}e-=u.size}o==-1&&(o=0)}if(o>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;d<this.children.length;d++){let h=this.children[d];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){r=q(h.dom);break}t+=h.size}r==-1&&(r=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:r}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:i}=this.domFromPos(e,0);if(t.nodeType!=1||i==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[i]}setSelection(e,t,i,o=!1){let r=Math.min(e,t),s=Math.max(e,t);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(r>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,i,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=i.root.getSelection(),d=i.domSelectionRange(),h=!1;if((we||te)&&e==t){let{node:f,offset:p}=l;if(f.nodeType==3){if(h=!!(p&&f.nodeValue[p-1]==`
126
+ `),h&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:q(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[p-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(we&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let f=d.focusNode.childNodes[d.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||h&&te)&&yt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&yt(a.node,a.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==t)&&!h){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let i=0,o=0;o<this.children.length;o++){let r=this.children[o],s=i+r.size;if(i==s?e<=s&&t>=i:e<s&&t>i){let l=i+r.border,a=s-r.border;if(e>=l&&t<=a){this.dirty=e==i||t==s?st:Ur,e==l&&t==a&&(r.contentLost||r.dom.parentNode!=this.contentDOM)?r.dirty=ke:r.markDirty(e-l,t-l);return}else r.dirty=r.dom==r.contentDOM&&r.dom.parentNode==this.contentDOM&&!r.children.length?st:ke}i=s}this.dirty=st}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=e==1?st:Ur;t.dirty<i&&(t.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class ma extends Sn{constructor(e,t,i,o){let r,s=t.type.toDOM;if(typeof s=="function"&&(s=s(i,()=>{if(!r)return o;if(r.parent)return r.parent.posBeforeChild(r)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return this.dirty==pe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Yu extends Sn{constructor(e,t,i,o){super(e,[],t,null),this.textDOM=i,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bt extends Sn{constructor(e,t,i,o,r){super(e,[],i,o),this.mark=t,this.spec=r}static create(e,t,i,o){let r=o.nodeViews[t.type.name],s=r&&r(t,o,i);return(!s||!s.dom)&&(s=wt.renderSpec(document,t.type.spec.toDOM(t,i),null,t.attrs)),new bt(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ke||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ke&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=pe){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=pe}}slice(e,t,i){let o=bt.create(this.parent,this.mark,!0,i),r=this.children,s=this.size;t<s&&(r=po(r,t,s,i)),e>0&&(r=po(r,0,e,i));for(let l=0;l<r.length;l++)r[l].parent=o;return o.children=r,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ge extends Sn{constructor(e,t,i,o,r,s,l,a,c){super(e,[],r,s),this.node=t,this.outerDeco=i,this.innerDeco=o,this.nodeDOM=l}static create(e,t,i,o,r,s){let l=r.nodeViews[t.type.name],a,c=l&&l(t,r,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},i,o),d=c&&c.dom,h=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=wt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let u=d;return d=wa(d,i,t),c?a=new Xu(e,t,i,o,d,h||null,u,c,r,s+1):t.isText?new gi(e,t,i,o,d,u,r):new Ge(e,t,i,o,d,h||null,u,r,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>w.empty)}return e}matchesNode(e,t,i){return this.dirty==pe&&e.eq(this.node)&&ii(t,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let i=this.node.inlineContent,o=t,r=e.composing?this.localCompositionInfo(e,t):null,s=r&&r.pos>-1?r:null,l=r&&r.pos<0,a=new ef(this,s&&s.node,e);of(this.node,this.innerDeco,(c,d,h)=>{c.spec.marks?a.syncToMarks(c.spec.marks,i,e):c.type.side>=0&&!h&&a.syncToMarks(d==this.node.childCount?I.none:this.node.child(d).marks,i,e),a.placeWidget(c,e,o)},(c,d,h,u)=>{a.syncToMarks(c.marks,i,e);let f;a.findNodeMatch(c,d,h,u)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(f=a.findIndexWithChild(r.node))>-1&&a.updateNodeAt(c,d,h,f,e)||a.updateNextNode(c,d,h,e,u,o)||a.addNode(c,d,h,e,o),o+=c.nodeSize}),a.syncToMarks([],i,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==st)&&(s&&this.protectLocalComposition(e,s),ya(this.contentDOM,this.children,e),_t&&rf(this.dom))}localCompositionInfo(e,t){let{from:i,to:o}=e.state.selection;if(!(e.state.selection instanceof N)||i<t||o>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let s=r.nodeValue,l=sf(this.node.content,s,i-t,o-t);return l<0?null:{node:r,pos:l,text:s}}else return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:o}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let s=new Yu(this,r,t,o);e.input.compositionNodes.push(s),this.children=po(this.children,i,i+o.length,e,s)}update(e,t,i,o){return this.dirty==ke||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,i,o),!0)}updateInner(e,t,i,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=pe}updateOuterDeco(e){if(ii(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=ba(this.dom,this.nodeDOM,fo(this.outerDeco,this.node,t),fo(e,this.node,t)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Zr(n,e,t,i,o){wa(i,e,n);let r=new Ge(void 0,n,e,t,i,i,i,o,0);return r.contentDOM&&r.updateChildren(o,0),r}class gi extends Ge{constructor(e,t,i,o,r,s,l){super(e,t,i,o,r,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,i,o){return this.dirty==ke||this.dirty!=pe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=pe||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=pe,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,i){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,i){let o=this.node.cut(e,t),r=document.createTextNode(o.text);return new gi(this.parent,o,this.outerDeco,this.innerDeco,r,r,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ke)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ga extends Sn{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==pe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Xu extends Ge{constructor(e,t,i,o,r,s,l,a,c,d){super(e,t,i,o,r,s,l,c,d),this.spec=a}update(e,t,i,o){if(this.dirty==ke)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,i);return r&&this.updateInner(e,t,i,o),r}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,i,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,o){this.spec.setSelection?this.spec.setSelection(e,t,i.root):super.setSelection(e,t,i,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ya(n,e,t){let i=n.firstChild,o=!1;for(let r=0;r<e.length;r++){let s=e[r],l=s.dom;if(l.parentNode==n){for(;l!=i;)i=Yr(i),o=!0;i=i.nextSibling}else o=!0,n.insertBefore(l,i);if(s instanceof bt){let a=i?i.previousSibling:n.lastChild;ya(s.contentDOM,s.children,t),i=a?a.nextSibling:n.firstChild}}for(;i;)i=Yr(i),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const rn=function(n){n&&(this.nodeName=n)};rn.prototype=Object.create(null);const lt=[new rn];function fo(n,e,t){if(n.length==0)return lt;let i=t?lt[0]:new rn,o=[i];for(let r=0;r<n.length;r++){let s=n[r].type.attrs;if(s){s.nodeName&&o.push(i=new rn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&o.length==1&&o.push(i=new rn(e.isInline?"span":"div")),l=="class"?i.class=(i.class?i.class+" ":"")+a:l=="style"?i.style=(i.style?i.style+";":"")+a:l!="nodeName"&&(i[l]=a))}}}return o}function ba(n,e,t,i){if(t==lt&&i==lt)return e;let o=e;for(let r=0;r<i.length;r++){let s=i[r],l=t[r];if(r){let a;l&&l.nodeName==s.nodeName&&o!=n&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=lt[0]),o=a}Qu(o,l||lt[0],s)}return o}function Qu(n,e,t){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in t)&&n.removeAttribute(i);for(let i in t)i!="class"&&i!="style"&&i!="nodeName"&&t[i]!=e[i]&&n.setAttribute(i,t[i]);if(e.class!=t.class){let i=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let r=0;r<i.length;r++)o.indexOf(i[r])==-1&&n.classList.remove(i[r]);for(let r=0;r<o.length;r++)i.indexOf(o[r])==-1&&n.classList.add(o[r]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=i.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function wa(n,e,t){return ba(n,n,lt,fo(e,t,n.nodeType!=1))}function ii(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Yr(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class ef{constructor(e,t,i){this.lock=t,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=tf(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let i=e;i<t;i++)this.top.children[i].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,i){let o=0,r=this.stack.length>>1,s=Math.min(r,e.length);for(;o<s&&(o==r-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<r;)this.destroyRest(),this.top.dirty=pe,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[r])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=bt.create(this.top,e[r],t,i);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,r++}}findNodeMatch(e,t,i,o){let r=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,i))r=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,i)&&!this.preMatch.matched.has(c)){r=l;break}}return r<0?!1:(this.destroyBetween(this.index,r),this.index++,!0)}updateNodeAt(e,t,i,o,r){let s=this.top.children[o];return s.dirty==ke&&s.dom==s.contentDOM&&(s.dirty=st),s.update(e,t,i,r)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==i)return o}return-1}e=t}}updateNextNode(e,t,i,o,r,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Ge){let c=this.preMatch.matched.get(a);if(c!=null&&c!=r)return!1;let d=a.dom,h,u=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ke&&ii(t,a.outerDeco));if(!u&&a.update(e,t,i,o))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(h=this.recreateWrapper(a,e,t,i,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=st,h.updateChildren(o,s+1),h.dirty=pe),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,i,o,r,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ii(i,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Ge.create(this.top,t,i,o,r,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,i,o,r){let s=Ge.create(this.top,e,t,i,o,r);s.contentDOM&&s.updateChildren(o,r+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,i){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let r=new ma(this.top,e,t,i);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof bt;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof gi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((te||Z)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let o=new ga(this.top,[],i,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function tf(n,e){let t=e,i=t.children.length,o=n.childCount,r=new Map,s=[];e:for(;o>0;){let l;for(;;)if(i){let c=t.children[i-1];if(c instanceof bt)t=c,i=c.children.length;else{l=c,i--;break}}else{if(t==e)break e;i=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(o-1))break;--o,r.set(l,o),s.push(l)}}return{index:o,matched:r,matches:s.reverse()}}function nf(n,e){return n.type.side-e.type.side}function of(n,e,t,i){let o=e.locals(n),r=0;if(o.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);i(d,o,e.forChild(r,d),c),r+=d.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,h;for(;s<o.length&&o[s].to==r;){let g=o[s++];g.widget&&(d?(h||(h=[d])).push(g):d=g)}if(d)if(h){h.sort(nf);for(let g=0;g<h.length;g++)t(h[g],c,!!a)}else t(d,c,!!a);let u,f;if(a)f=-1,u=a,a=null;else if(c<n.childCount)f=c,u=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=r&&l.splice(g--,1);for(;s<o.length&&o[s].from<=r&&o[s].to>r;)l.push(o[s++]);let p=r+u.nodeSize;if(u.isText){let g=p;s<o.length&&o[s].from<g&&(g=o[s].from);for(let y=0;y<l.length;y++)l[y].to<g&&(g=l[y].to);g<p&&(a=u.cut(g-r),u=u.cut(0,g-r),p=g,f=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=u.isInline&&!u.isLeaf?l.filter(g=>!g.inline):l.slice();i(u,m,e.forChild(r,u),f),r=p}}function rf(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function sf(n,e,t,i){for(let o=0,r=0;o<n.childCount&&r<=i;){let s=n.child(o++),l=r;if(r+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<n.childCount;){let c=n.child(o++);if(r+=c.nodeSize,!c.isText)break;a+=c.text}if(r>=t){if(r>=i&&a.slice(i-e.length-l,i-l)==e)return i-e.length;let c=l<i?a.lastIndexOf(e,i-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==i&&a.length>=i+e.length-l&&a.slice(i-l,i-l+e.length)==e)return i}}return-1}function po(n,e,t,i,o){let r=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,d=l+=a.size;c>=t||d<=e?r.push(a):(c<e&&r.push(a.slice(0,e-c,i)),o&&(r.push(o),o=void 0),d>t&&r.push(a.slice(t-c,a.size,i)))}return r}function Lo(n,e=null){let t=n.domSelectionRange(),i=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),r=o&&o.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=i.resolve(s),a,c;if(mi(t)){for(a=s;o&&!o.node;)o=o.parent;let h=o.node;if(o&&h.isAtom&&O.isSelectable(h)&&o.parent&&!(h.isInline&&Du(t.focusNode,t.focusOffset,o.dom))){let u=o.posBefore;c=new O(s==u?l:i.resolve(u))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=s,u=s;for(let f=0;f<t.rangeCount;f++){let p=t.getRangeAt(f);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),u=Math.max(u,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,s]=u==n.state.selection.anchor?[u,h]:[h,u],l=i.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=i.resolve(a);if(!c){let h=e=="pointer"||n.state.selection.head<l.pos&&!r?1:-1;c=zo(n,d,l,h)}return c}function Sa(n){return n.editable?n.hasFocus():xa(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Re(n,e=!1){let t=n.state.selection;if(va(n,t),!!Sa(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Z){let i=n.domSelectionRange(),o=n.domObserver.currentSelection;if(i.anchorNode&&o.anchorNode&&yt(i.anchorNode,i.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)af(n);else{let{anchor:i,head:o}=t,r,s;Xr&&!(t instanceof N)&&(t.$from.parent.inlineContent||(r=Qr(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Qr(n,t.to))),n.docView.setSelection(i,o,n,e),Xr&&(r&&es(r),s&&es(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&lf(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Xr=te||Z&&aa<63;function Qr(n,e){let{node:t,offset:i}=n.docView.domFromPos(e,0),o=i<t.childNodes.length?t.childNodes[i]:null,r=i?t.childNodes[i-1]:null;if(te&&o&&o.contentEditable=="false")return Wi(o);if((!o||o.contentEditable=="false")&&(!r||r.contentEditable=="false")){if(o)return Wi(o);if(r)return Wi(r)}}function Wi(n){return n.contentEditable="true",te&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function es(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function lf(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),i=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=i||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Sa(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function af(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let i=n.cursorWrapper.dom,o=i.nodeName=="IMG";o?t.setStart(i.parentNode,q(i)+1):t.setStart(i,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!o&&!n.state.selection.visible&&re&&Je<=11&&(i.disabled=!0,i.disabled=!1)}function va(n,e){if(e instanceof O){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(ts(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else ts(n)}function ts(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function zo(n,e,t,i){return n.someProp("createSelectionBetween",o=>o(n,e,t))||N.between(e,t,i)}function ns(n){return n.editable&&!n.hasFocus()?!1:xa(n)}function xa(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function cf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return yt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function mo(n,e){let{$anchor:t,$head:i}=n.selection,o=e>0?t.max(i):t.min(i),r=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return r&&E.findFrom(r,e)}function Fe(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function is(n,e,t){let i=n.state.selection;if(i instanceof N)if(t.indexOf("s")>-1){let{$head:o}=i,r=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let s=n.state.doc.resolve(o.pos+r.nodeSize*(e<0?-1:1));return Fe(n,new N(i.$anchor,s))}else if(i.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=mo(n.state,e);return o&&o instanceof O?Fe(n,o):!1}else if(!(ue&&t.indexOf("m")>-1)){let o=i.$head,r=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!r||r.isText)return!1;let l=e<0?o.pos-r.nodeSize:o.pos;return r.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?O.isSelectable(r)?Fe(n,new O(e<0?n.state.doc.resolve(o.pos-r.nodeSize):o)):wn?Fe(n,new N(n.state.doc.resolve(e<0?l:l+r.nodeSize))):!1:!1}}else return!1;else{if(i instanceof O&&i.node.isInline)return Fe(n,new N(e>0?i.$to:i.$from));{let o=mo(n.state,e);return o?Fe(n,o):!1}}}function oi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Tt(n,e){return e<0?df(n):hf(n)}function df(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let o,r,s=!1;for(we&&t.nodeType==1&&i<oi(t)&&sn(t.childNodes[i],-1)&&(s=!0);;)if(i>0){if(t.nodeType!=1)break;{let l=t.childNodes[i-1];if(sn(l,-1))o=t,r=--i;else if(l.nodeType==3)t=l,i=t.nodeValue.length;else break}}else{if(Ca(t))break;{let l=t.previousSibling;for(;l&&sn(l,-1);)o=t.parentNode,r=q(l),l=l.previousSibling;if(l)t=l,i=oi(t);else{if(t=t.parentNode,t==n.dom)break;i=0}}}s?go(n,t,i):o&&go(n,o,r)}function hf(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let o=oi(t),r,s;for(;;)if(i<o){if(t.nodeType!=1)break;let l=t.childNodes[i];if(sn(l,1))r=t,s=++i;else break}else{if(Ca(t))break;{let l=t.nextSibling;for(;l&&sn(l,1);)r=l.parentNode,s=q(l)+1,l=l.nextSibling;if(l)t=l,i=0,o=oi(t);else{if(t=t.parentNode,t==n.dom)break;i=o=0}}}r&&go(n,r,s)}function Ca(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function uf(n,e){for(;n&&e==n.childNodes.length&&!bn(n);)e=q(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function ff(n,e){for(;n&&!e&&!bn(n);)e=q(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function go(n,e,t){if(e.nodeType!=3){let r,s;(s=uf(e,t))?(e=s,t=0):(r=ff(e,t))&&(e=r,t=r.nodeValue.length)}let i=n.domSelection();if(!i)return;if(mi(i)){let r=document.createRange();r.setEnd(e,t),r.setStart(e,t),i.removeAllRanges(),i.addRange(r)}else i.extend&&i.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&Re(n)},50)}function rs(n,e){let t=n.state.doc.resolve(e);if(!(Z||Ru)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),s=(r.top+r.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),s=(r.top+r.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function ss(n,e,t){let i=n.state.selection;if(i instanceof N&&!i.empty||t.indexOf("s")>-1||ue&&t.indexOf("m")>-1)return!1;let{$from:o,$to:r}=i;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=mo(n.state,e);if(s&&s instanceof O)return Fe(n,s)}if(!o.parent.inlineContent){let s=e<0?o:r,l=i instanceof ce?E.near(s,e):E.findFrom(s,e);return l?Fe(n,l):!1}return!1}function ls(n,e){if(!(n.state.selection instanceof N))return!0;let{$head:t,$anchor:i,empty:o}=n.state.selection;if(!t.sameParent(i))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let r=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(r&&!r.isText){let s=n.state.tr;return e<0?s.delete(t.pos-r.nodeSize,t.pos):s.delete(t.pos,t.pos+r.nodeSize),n.dispatch(s),!0}return!1}function as(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function pf(n){if(!te||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;as(n,i,"true"),setTimeout(()=>as(n,i,"false"),20)}return!1}function mf(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function gf(n,e){let t=e.keyCode,i=mf(e);if(t==8||ue&&t==72&&i=="c")return ls(n,-1)||Tt(n,-1);if(t==46&&!e.shiftKey||ue&&t==68&&i=="c")return ls(n,1)||Tt(n,1);if(t==13||t==27)return!0;if(t==37||ue&&t==66&&i=="c"){let o=t==37?rs(n,n.state.selection.from)=="ltr"?-1:1:-1;return is(n,o,i)||Tt(n,o)}else if(t==39||ue&&t==70&&i=="c"){let o=t==39?rs(n,n.state.selection.from)=="ltr"?1:-1:1;return is(n,o,i)||Tt(n,o)}else{if(t==38||ue&&t==80&&i=="c")return ss(n,-1,i)||Tt(n,-1);if(t==40||ue&&t==78&&i=="c")return pf(n)||ss(n,1,i)||Tt(n,1);if(i==(ue?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ka(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:i,openStart:o,openEnd:r}=e;for(;o>1&&r>1&&i.childCount==1&&i.firstChild.childCount==1;){o--,r--;let f=i.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),i=f.content}let s=n.someProp("clipboardSerializer")||wt.fromSchema(n.state.schema),l=Na(),a=l.createElement("div");a.appendChild(s.serializeFragment(i,{document:l}));let c=a.firstChild,d,h=0;for(;c&&c.nodeType==1&&(d=Ea[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=l.createElement(d[f]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${r}${h?` -${h}`:""} ${JSON.stringify(t)}`);let u=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
359
127
 
360
- `);return{dom:a,text:f,slice:e}}function Nx(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return e?new ne(K.from(t.state.schema.text(e.replace(/\r\n?/g,`
361
- `))),0,0):ne.empty;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:p}=t.state,g=wi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let v=s.appendChild(document.createElement("p"));b&&v.appendChild(g.serializeNode(p.text(b,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=_P(n),Wl&&kP(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||ah.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!CP.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=TP(B1(l,+u[1],+u[2]),u[4]);else if(l=ne.maxOpen(EP(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let p=l.content.firstChild;d<l.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=l.content.lastChild;f<l.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);l=B1(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t)}),l}const CP=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function EP(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&Dx(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Lx(s[s.length-1],i.length));let u=Px(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return K.from(s)}return t}function Px(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,K.from(t));return t}function Dx(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Dx(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(K.from(Px(n,t,o+1))))}}function Lx(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Lx(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(K.empty,!0);return t.copy(n.append(r))}function Ff(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=Ff(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(K.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function B1(t,e,n){return e<t.openStart&&(t=new ne(Ff(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ne(Ff(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Vx={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let z1=null;function Ix(){return z1||(z1=document.implementation.createHTMLDocument("title"))}let Md=null;function OP(t){let e=window.trustedTypes;return e?(Md||(Md=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Md.createHTML(t)):t}function _P(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Ix().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Vx[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=OP(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function kP(t){let e=t.querySelectorAll(Dt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function TP(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;o=K.from(a.create(r[l+1],o)),i++,s++}return new ne(o,i,s)}const Ft={},Wt={},AP={touchstart:!0,touchmove:!0};class MP{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function jP(t){for(let e in Ft){let n=Ft[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{NP(t,r)&&!bh(t,r)&&(t.editable||!(r.type in Wt))&&n(t,r)},AP[e]?{passive:!0}:void 0)}zt&&t.dom.addEventListener("input",()=>null),Wf(t)}function ho(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function RP(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Wf(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>bh(t,r))})}function bh(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function NP(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function PP(t,e){!bh(t,e)&&Ft[e.type]&&(t.editable||!(e.type in Wt))&&Ft[e.type](t,e)}Wt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Hx(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Fn&&Dt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ds&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,Fo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||SP(t,n)?n.preventDefault():ho(t,"key")};Wt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Wt.keypress=(t,e)=>{let n=e;if(Hx(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||_n&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ke)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function mu(t){return{left:t.clientX,top:t.clientY}}function DP(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function vh(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Gi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function LP(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Se.isSelectable(r)?(Gi(t,new Se(n)),!0):!1}function VP(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Se&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Se.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Gi(t,Se.create(t.state.doc,o)),!0):!1}function IP(t,e,n,r,o){return vh(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?VP(t,n):LP(t,n))}function $P(t,e,n,r){return vh(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function HP(t,e,n,r){return vh(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||BP(t,n,r)}function BP(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Gi(t,ke.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)Gi(t,ke.create(r,l+1,l+1+s.content.size));else if(Se.isSelectable(s))Gi(t,Se.create(r,l));else continue;return!0}}function yh(t){return Oc(t)}const $x=_n?"metaKey":"ctrlKey";Ft.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=yh(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&DP(n,t.input.lastClick)&&!n[$x]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(mu(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new zP(t,s,n,!!r)):(i=="doubleClick"?$P:HP)(t,s.pos,s.inside,n)?n.preventDefault():ho(t,"pointer"))};class zP{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[$x],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Se&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Jn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ho(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>$r(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(mu(e))),this.updateAllowDefault(e),this.allowDefault||!n?ho(this.view,"pointer"):IP(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||zt&&this.mightDrag&&!this.mightDrag.node.isAtom||Dt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Gi(this.view,Ee.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ho(this.view,"pointer")}move(e){this.updateAllowDefault(e),ho(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ft.touchstart=t=>{t.input.lastTouch=Date.now(),yh(t),ho(t,"pointer")};Ft.touchmove=t=>{t.input.lastTouch=Date.now(),ho(t,"pointer")};Ft.contextmenu=t=>yh(t);function Hx(t,e){return t.composing?!0:zt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const FP=Fn?5e3:-1;Wt.compositionstart=Wt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ke&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Oc(t,!0),t.markCursor=null;else if(Oc(t,!e.selection.empty),Jn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Bx(t,FP)};Wt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Bx(t,20))};function Bx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Oc(t),e))}function zx(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=UP());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function WP(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=LN(e.focusNode,e.focusOffset),r=VN(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function UP(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Oc(t,e=!1){if(!(Fn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zx(t),e||t.docView&&t.docView.dirty){let n=gh(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function qP(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Sl=tn&&bo<15||ds&&zN<604;Ft.copy=Wt.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=Sl?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Rx(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):qP(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function GP(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function KP(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Cl(t,r.value,null,o,e):Cl(t,r.textContent,r.innerHTML,o,e)},50)}function Cl(t,e,n,r,o){let i=Nx(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||ne.empty)))return!0;if(!i)return!1;let s=GP(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fx(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Wt.paste=(t,e)=>{let n=e;if(t.composing&&!Fn)return;let r=Sl?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Cl(t,Fx(r),r.getData("text/html"),o,n)?n.preventDefault():KP(t,n)};class Wx{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Ux=_n?"altKey":"ctrlKey";Ft.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(mu(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Se?o.to-1:o.to))){if(r&&r.mightDrag)s=Se.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=Se.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=Rx(t,l);(!n.dataTransfer.files.length||!Dt||mx>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Sl?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Sl||n.dataTransfer.setData("text/plain",c),t.dragging=new Wx(u,!n[Ux],s)};Ft.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Wt.dragover=Wt.dragenter=(t,e)=>e.preventDefault();Wt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(mu(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",g=>{s=g(s,t)}):s=Nx(t,Fx(n.dataTransfer),Sl?null:n.dataTransfer.getData("text/html"),!1,i);let l=!!(r&&!n[Ux]);if(t.someProp("handleDrop",g=>g(t,n,s||ne.empty,l))){n.preventDefault();return}if(!s)return;n.preventDefault();let a=s?zR(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let c=t.state.tr;if(l){let{node:g}=r;g?g.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&Se.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Se(p));else{let g=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((b,v,y,w)=>g=w),c.setSelection(mh(t,p,c.doc.resolve(g)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ft.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&$r(t)},20))};Ft.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ft.beforeinput=(t,e)=>{if(Dt&&Fn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Fo(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Wt)Ft[t]=Wt[t];function El(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class _c{constructor(e,n){this.toDOM=e,this.spec=n||ti,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new Zt(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _c&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&El(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class yo{constructor(e,n){this.attrs=e,this.spec=n||ti}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new Zt(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof yo&&El(this.attrs,e.attrs)&&El(this.spec,e.spec)}static is(e){return e.type instanceof yo}destroy(){}}class xh{constructor(e,n){this.attrs=e,this.spec=n||ti}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new Zt(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof xh&&El(this.attrs,e.attrs)&&El(this.spec,e.spec)}destroy(){}}class Zt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Zt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Zt(e,e,new _c(n,r))}static inline(e,n,r,o){return new Zt(e,n,new yo(r,o))}static node(e,n,r,o){return new Zt(e,n,new xh(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof yo}get widget(){return this.type instanceof _c}}const ji=[],ti={};class ut{constructor(e,n){this.local=e.length?e:ji,this.children=n.length?n:ji}static create(e,n){return n.length?kc(n,e,0,ti):Nt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ti)}mapInner(e,n,r,o,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,o);a&&a.type.valid(n,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?YP(this.children,s||[],e,n,r,o,i):s?new ut(s.sort(ni),ji):Nt}add(e,n){return n.length?this==Nt?ut.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Gx(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,kc(u,l,c+1,ti)),i+=3}});let s=qx(i?Kx(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ut(s.length?this.local.concat(s).sort(ni):this.local,o||this.children)}remove(e){return e.length==0||this==Nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Nt?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ut(o,r):Nt}forChild(e,n){if(this==Nt)return this;if(n.isLeaf)return ut.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof yo){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new ut(o.sort(ni),ji);return r?new so([l,r]):l}return r||Nt}eq(e){if(this==e)return!0;if(!(e instanceof ut)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return wh(this.localsInner(e))}localsInner(e){if(this==Nt)return ji;if(e.inlineContent||!this.local.some(yo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof yo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ut.empty=new ut([],[]);ut.removeOverlap=wh;const Nt=ut.empty;class so{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,ti));return so.from(r)}forChild(e,n){if(n.isLeaf)return ut.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Nt&&(i instanceof so?r=r.concat(i.members):r.push(i))}return so.from(r)}eq(e){if(!(e instanceof so)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?wh(r?n:n.sort(ni)):ji}static from(e){switch(e.length){case 0:return Nt;case 1:return e[0];default:return new so(e.every(n=>n instanceof ut)?e:e.reduce((n,r)=>n.concat(r instanceof ut?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function YP(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,g,b)=>{let v=b-g-(p-f);for(let y=0;y<l.length;y+=3){let w=l[y+1];if(w<0||f>w+u-d)continue;let S=l[y]+u-d;p>=S?l[y+1]=f<=S?-2:-1:f>=u&&v&&(l[y]+=v,l[y+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-o,{index:g,offset:b}=r.content.findIndex(d),v=r.maybeChild(g);if(v&&b==d&&b+v.nodeSize==p){let y=l[c+2].mapInner(n,v,u+1,t[c]+i+1,s);y!=Nt?(l[c]=d,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=JP(l,t,e,n,o,i,s),u=kc(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<l.length&&l[f]<p;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ut(e.sort(ni),l)}function qx(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Zt(o.from+e,o.to+e,o.type))}return n}function JP(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Gx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Kx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function kc(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Gx(t,l,a+n);if(c){i=!0;let u=kc(c,l,n+a+1,r);u!=Nt&&o.push(a,a+l.nodeSize,u)}});let s=qx(i?Kx(t):t,-n).sort(ni);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new ut(s,o):Nt}function ni(t,e){return t.from-e.from||t.to-e.to}function wh(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),F1(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),F1(e,o,r.copy(i.from,r.to)));break}}}return e}function F1(t,e,n){for(;e<t.length&&ni(n,t[e])>0;)e++;t.splice(e,0,n)}function jd(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Nt&&e.push(r)}),t.cursorWrapper&&e.push(ut.create(t.state.doc,[t.cursorWrapper.deco])),so.from(e)}const ZP={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},XP=tn&&bo<=11;class QP{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class eD{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new QP,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);tn&&bo<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),XP&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ZP)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(D1(this.view)){if(this.suppressingSelectionUpdates)return $r(this.view);if(tn&&bo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=wl(i))n.add(i);for(let i=e.anchorNode;i;i=wl(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&D1(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(Jn&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||rD(e,d)!=p)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&hu(r)&&(c=gh(e))&&c.eq(Ee.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,$r(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),tD(e)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||$r(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(tn&&bo<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?kt(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?kt(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let W1=new WeakMap,U1=!1;function tD(t){if(!W1.has(t)&&(W1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Jn,U1)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),U1=!0}}function q1(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return hi(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function nD(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return q1(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?q1(t,n):null}function rD(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function oD(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],hu(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Dt&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let y=r.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||ah.fromSchema(t.state.schema),p=d.resolve(s),g=null,b=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:iD,context:p});if(c&&c[0].pos!=null){let v=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=v),g={anchor:v+s,head:y+s}}return{doc:b,sel:g,from:s,to:l}}function iD(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(zt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||zt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const sD=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function lD(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let k=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,j=gh(t,k);if(j&&!t.state.selection.eq(j)){if(Dt&&Fn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",P=>P(t,Fo(13,"Enter"))))return;let N=t.state.tr.setSelection(j);k=="pointer"?N.setMeta("pointer",!0):k=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=oD(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let g=uD(d.content,c.doc.content,c.from,f,p);if(g&&t.input.domChangeCount++,(ds&&t.input.lastIOSEnter>Date.now()-225||Fn)&&o.some(k=>k.nodeType==1&&!sD.test(k.nodeName))&&(!g||g.endA>=g.endB)&&t.someProp("handleKeyDown",k=>k(t,Fo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!g)if(r&&a instanceof ke&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))g={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let k=G1(t,t.state.doc,c.sel);if(k&&!k.eq(t.state.selection)){let j=t.state.tr.setSelection(k);i&&j.setMeta("composition",i),t.dispatch(j)}}return}t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof ke&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),tn&&bo<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>c.from&&c.doc.textBetween(g.start-c.from-1,g.start-c.from+1)=="  "&&(g.start--,g.endA--,g.endB--);let b=c.doc.resolveNoCache(g.start-c.from),v=c.doc.resolveNoCache(g.endB-c.from),y=u.resolve(g.start),w=b.sameParent(v)&&b.parent.inlineContent&&y.end()>=g.endA,S;if((ds&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!w&&b.pos<c.doc.content.size&&!b.sameParent(v)&&(S=Ee.findFrom(c.doc.resolve(b.pos+1),1,!0))&&S.head==v.pos)&&t.someProp("handleKeyDown",k=>k(t,Fo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>g.start&&cD(u,g.start,g.endA,b,v)&&t.someProp("handleKeyDown",k=>k(t,Fo(8,"Backspace")))){Fn&&Dt&&t.domObserver.suppressSelectionUpdates();return}Dt&&Fn&&g.endB==g.start&&(t.input.lastAndroidDelete=Date.now()),Fn&&!w&&b.start()!=v.start()&&v.parentOffset==0&&b.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==g.endA&&(g.endB-=2,v=c.doc.resolveNoCache(g.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(k){return k(t,Fo(13,"Enter"))})},20));let C=g.start,x=g.endA,E,_,M;if(w){if(b.pos==v.pos)tn&&bo<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>$r(t),20)),E=t.state.tr.delete(C,x),_=u.resolve(g.start).marksAcross(u.resolve(g.endA));else if(g.endA==g.endB&&(M=aD(b.parent.content.cut(b.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,g.endA-y.start()))))E=t.state.tr,M.type=="add"?E.addMark(C,x,M.mark):E.removeMark(C,x,M.mark);else if(b.parent.child(b.index()).isText&&b.index()==v.index()-(v.textOffset?0:1)){let k=b.parent.textBetween(b.parentOffset,v.parentOffset);if(t.someProp("handleTextInput",j=>j(t,C,x,k)))return;E=t.state.tr.insertText(k,C,x)}}if(E||(E=t.state.tr.replace(C,x,c.doc.slice(g.start-c.from,g.endB-c.from))),c.sel){let k=G1(t,E.doc,c.sel);k&&!(Dt&&Fn&&t.composing&&k.empty&&(g.start!=g.endB||t.input.lastAndroidDelete<Date.now()-100)&&(k.head==C||k.head==E.mapping.map(x)-1)||tn&&k.empty&&k.head==C)&&E.setSelection(k)}_&&E.ensureMarks(_),i&&E.setMeta("composition",i),t.dispatch(E.scrollIntoView())}function G1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:mh(t,e.resolve(n.anchor),e.resolve(n.head))}function aD(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(K.from(c).eq(t))return{mark:l,type:s}}function cD(t,e,n,r,o){if(n-e<=o.pos-r.pos||Rd(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Rd(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Rd(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Rd(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function uD(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let a=Math.max(0,i-Math.min(s,l));r-=s+a-i}if(s<i&&t.size<e.size){let a=r<=i&&r>=s?i-r:0;i-=a,i&&i<e.size&&K1(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&K1(t.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function K1(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class dD{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new MP,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Q1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Z1(this),J1(this),this.nodeViews=X1(this),this.docView=A1(this.state.doc,Y1(this),jd(this),this.dom,this),this.domObserver=new eD(this,(r,o,i,s)=>lD(this,r,o,i,s)),this.domObserver.start(),jP(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Wf(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Q1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zx(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=X1(this);pD(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Wf(this),this.editable=Z1(this),J1(this);let a=jd(this),c=Y1(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&UN(this);if(s){this.domObserver.stop();let p=d&&(tn||Dt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&fD(o.selection,e.selection);if(d){let g=Dt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=WP(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=A1(e.doc,c,a,this.dom,this)),g&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gP(this))?$r(this,p):(Ax(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&qN(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Se){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&C1(this,n.getBoundingClientRect(),e)}else C1(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Wx(e.slice,e.move,o<0?void 0:Se.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(tn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&GN(this.dom),$r(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return XN(this,e)}coordsAtPos(e,n=1){return wx(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return rP(this,n||this.state,e)}pasteHTML(e,n){return Cl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Cl(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(RP(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,PN())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return PP(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?zt&&this.root.nodeType===11&&$N(this.dom.ownerDocument)==this.dom&&nD(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Y1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Zt.node(0,t.state.doc.content.size,e)]}function J1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Zt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Z1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function fD(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function X1(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function pD(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Q1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Uf,qf;if(typeof WeakMap<"u"){let t=new WeakMap;Uf=e=>t.get(e),qf=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Uf=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},qf=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var gt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const l=(t+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(t){return Uf(t)||qf(t,hD(t))}};function hD(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=gD(t),n=t.childCount,r=[];let o=0,i=null;const s=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let g=0;;g++){for(;o<r.length&&r[o]!=0;)o++;if(g==d.childCount)break;const b=d.child(g),{colspan:v,rowspan:y,colwidth:w}=b.attrs;for(let S=0;S<y;S++){if(S+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-S});break}const C=o+S*e;for(let x=0;x<v;x++){r[C+x]==0?r[C+x]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:v-x});const E=w&&w[x];if(E){const _=(C+x)%e*2,M=s[_];M==null||M!=E&&s[_+1]==1?(s[_]=E,s[_+1]=1):M==E&&s[_+1]++}}}o+=v,u+=b.nodeSize}const f=(c+1)*e;let p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}const l=new gt(e,n,r,i);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(a=!0);return a&&mD(l,s,t),l}function gD(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let s=0;s<r;s++){const l=t.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function mD(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(o+c)%t.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=bD(a)))[c]=d)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function bD(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function e0(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(s=>Number(s)):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(const s in e){const l=e[s].getFromDOM,a=l&&l(t);a!=null&&(i[s]=a)}return i}function t0(t,e){const n={};t.attrs.colspan!=1&&(n.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const o=e[r].setDOMAttr;o&&o(t.attrs[r],n)}return n}function vD(t){const e=t.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const r in e)n[r]={default:e[r].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>e0(r,e)}],toDOM(r){return["td",t0(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>e0(r,e)}],toDOM(r){return["th",t0(r,e),0]}}}}function yr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var lo=new zl("selectingCells");function ql(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function bu(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Sh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=ql(e.$head)||yD(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function yD(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Gf(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function xD(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ch(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Yx(t,e,n){const r=t.node(-1),o=gt.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function fs(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}var Et=class Mr extends Ee{constructor(e,n=e){const r=e.node(-1),o=gt.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=n.pos-i);a.unshift(n.pos-i);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new Xy(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(Gf(r)&&Gf(o)&&Ch(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Mr.rowSelection(r,o):i&&this.isColSelection()?Mr.colSelection(r,o):new Mr(r,o)}return ke.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=gt.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let u=a*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let g=e.nodeAt(f);if(!g)throw RangeError(`No cell with offset ${f} found`);const b=o.left-p.left,v=p.right-o.right;if(b>0||v>0){let y=g.attrs;if(b>0&&(y=fs(y,0,b)),v>0&&(y=fs(y,y.colspan-v,v)),p.left<o.left){if(g=g.type.createAndFill(y),!g)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else g=g.type.create(y,g.content)}if(p.top<o.top||p.bottom>o.bottom){const y={...g.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?g=g.type.createAndFill(y):g=g.type.create(y,g.content)}c.push(g)}s.push(e.child(a).copy(K.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new ne(K.from(l),1,1)}replace(e,n=ne.empty){const r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?ne.empty:n)}const i=Ee.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new ne(K.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=gt.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=gt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(n=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Mr(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=gt.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof Mr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=gt.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(n=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new Mr(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Mr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Mr(e.resolve(n),e.resolve(r))}getBookmark(){return new wD(this.$anchorCell.pos,this.$headCell.pos)}};Et.prototype.visible=!1;Ee.jsonID("cell",Et);var wD=class Jx{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Jx(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Ch(n,r)?new Et(n,r):Ee.near(r,1)}};function SD(t){if(!(t.selection instanceof Et))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Zt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function CD({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function ED({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function OD(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,s;if(r instanceof Se&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Et.create(o,r.from);else if(s=="row"){const l=o.resolve(r.from+1);i=Et.rowSelection(l,l)}else if(!n){const l=gt.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=Et.create(o,a+1,c)}}else r instanceof ke&&CD(r)?i=ke.create(o,r.from):r instanceof ke&&ED(r)&&(i=ke.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var _D=new zl("fix-tables");function Zx(t,e,n,r){const o=t.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?Zx(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function kD(t,e){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=TD(t,o,i,n))};return e?e.doc!=t.doc&&Zx(e.doc,t.doc,0,r):t.doc.descendants(r),n}function TD(t,e,n,r){const o=gt.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,fs(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=n+1;a<o.height;a++){const u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const g=[];for(let v=0;v<f;v++){const y=yr(t.schema)[p].createAndFill();y&&g.push(y)}const b=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(b),g)}c=d}return r.setMeta(_D,{fixTables:!0})}function Xx(t){const e=t.selection,n=Sh(t),r=n.node(-1),o=n.start(-1),i=gt.get(r);return{...e instanceof Et?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function AD(t){return function(e,n){if(!bu(e))return!1;if(n){const r=yr(e.schema),o=Xx(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);n(i)}return!0}}function n0(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Eh(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?AD(t):function(n,r){if(!bu(n))return!1;if(r){const o=yr(n.schema),i=Xx(n),s=n.tr,l=n0("row",i,o),a=n0("column",i,o),u=(t==="column"?l:t==="row"?a:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(p=>{const g=p+i.tableStart,b=s.doc.nodeAt(g);b&&s.setNodeMarkup(g,f,b.attrs)}),r(s)}return!0}}Eh("row",{useDeprecatedLogic:!0});Eh("column",{useDeprecatedLogic:!0});Eh("cell",{useDeprecatedLogic:!0});function MD(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const i=t.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function r0(t){return function(e,n){if(!bu(e))return!1;const r=MD(Sh(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(ke.between(o,xD(o))).scrollIntoView())}return!0}}function ka(t,e){const n=t.selection;if(!(n instanceof Et))return!1;if(e){const r=t.tr,o=yr(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new ne(o,0,0))}),r.docChanged&&e(r)}return!0}function jD(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Kf(yr(s).row,new ne(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(n||r?Kf(yr(s).row,new ne(e,n,r)).content:e);else return null;return RD(s,l)}function RD(t,e){const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(K.empty),n[o]<r){const i=yr(t).cell.createAndFill(),s=[];for(let l=n[o];l<r;l++)s.push(i);e[o]=e[o].append(K.from(s))}return{height:e.length,width:r,rows:e}}function Kf(t,e){const n=t.createAndFill();return new Zy(n).replace(0,n.content.size,e).doc}function ND({width:t,height:e,rows:n},r,o){if(t!=r){const i=[],s=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(fs(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[l+p]=(i[l+p]||0)+f.attrs.colspan}s.push(K.from(c))}n=s,t=r}if(e!=o){const i=[];for(let s=0,l=0;s<o;s++,l++){const a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(K.from(a))}n=i,e=o}return{width:t,height:e,rows:n}}function PD(t,e,n,r,o,i,s){const l=t.doc.type.schema,a=yr(l);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const p=n.child(d);f+=p.nodeSize;const g=[];let b;p.lastChild==null||p.lastChild.type==a.cell?b=c||(c=a.cell.createAndFill()):b=u||(u=a.header_cell.createAndFill());for(let v=e.width;v<o;v++)g.push(b);t.insert(t.mapping.slice(s).map(f-1+r),g)}if(i>e.height){const d=[];for(let g=0,b=(e.height-1)*e.width;g<Math.max(e.width,o);g++){const v=g>=e.width?!1:n.nodeAt(e.map[b+g]).type==a.header_cell;d.push(v?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,K.from(d)),p=[];for(let g=e.height;g<i;g++)p.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p)}return!!(c||u)}function o0(t,e,n,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=n.nodeAt(d),{top:p,left:g}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-p}),t.insert(t.mapping.slice(l).map(e.positionAt(s,g,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function i0(t,e,n,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=n.nodeAt(d),p=e.colCount(d),g=t.mapping.slice(l).map(d+r);t.setNodeMarkup(g,null,fs(f.attrs,s-p,f.attrs.colspan-(s-p))),t.insert(g+f.nodeSize,f.type.createAndFill(fs(f.attrs,0,s-p))),c+=f.attrs.rowspan-1}}return a}function s0(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=gt.get(i);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=t.tr;let f=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=gt.get(i),f=d.mapping.maps.length}PD(d,s,i,n,c,u,f)&&p(),o0(d,s,i,n,a,c,l,f)&&p(),o0(d,s,i,n,a,c,u,f)&&p(),i0(d,s,i,n,l,u,a,f)&&p(),i0(d,s,i,n,l,u,c,f)&&p();for(let g=l;g<u;g++){const b=s.positionAt(g,a,i),v=s.positionAt(g,c,i);d.replace(d.mapping.slice(f).map(b+n),d.mapping.slice(f).map(v+n),new ne(o.rows[g-l],0,0))}p(),d.setSelection(new Et(d.doc.resolve(n+s.positionAt(l,a,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),e(d)}var DD=hx({ArrowLeft:Ta("horiz",-1),ArrowRight:Ta("horiz",1),ArrowUp:Ta("vert",-1),ArrowDown:Ta("vert",1),"Shift-ArrowLeft":Aa("horiz",-1),"Shift-ArrowRight":Aa("horiz",1),"Shift-ArrowUp":Aa("vert",-1),"Shift-ArrowDown":Aa("vert",1),Backspace:ka,"Mod-Backspace":ka,Delete:ka,"Mod-Delete":ka});function za(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ta(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Et)return za(n,r,Ee.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const s=Qx(o,t,e);if(s==null)return!1;if(t=="horiz")return za(n,r,Ee.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(s),a=Yx(l,t,e);let c;return a?c=Ee.near(a,1):e<0?c=Ee.near(n.doc.resolve(l.before(-1)),-1):c=Ee.near(n.doc.resolve(l.after(-1)),1),za(n,r,c)}}}function Aa(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof Et)s=i;else{const a=Qx(o,t,e);if(a==null)return!1;s=new Et(n.doc.resolve(a))}const l=Yx(s.$headCell,t,e);return l?za(n,r,new Et(s.$anchorCell,l)):!1}}function LD(t,e){const n=t.state.doc,r=ql(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Et(r))),!0):!1}function VD(t,e,n){if(!bu(t.state))return!1;let r=jD(n);const o=t.state.selection;if(o instanceof Et){r||(r={width:1,height:1,rows:[K.from(Kf(yr(t.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=gt.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=ND(r,l.right-l.left,l.bottom-l.top),s0(t.state,t.dispatch,s,l,r),!0}else if(r){const i=Sh(t.state),s=i.start(-1);return s0(t.state,t.dispatch,s,gt.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function ID(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=l0(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof Et)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=ql(t.state.selection.$anchor))!=null&&((n=Nd(t,e))==null?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=Nd(t,c);const d=lo.getState(t.state)==null;if(!u||!Ch(a,u))if(d)u=a;else return;const f=new Et(a,u);if(d||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);d&&p.setMeta(lo,a.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),lo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(lo,-1))}function l(a){const c=a,u=lo.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(l0(t,c.target)!=r&&(d=Nd(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function Qx(t,e,n){if(!(t.state.selection instanceof ke))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function l0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Nd(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ql(t.state.doc.resolve(n.pos)):null}var $D=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Yf(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Yf(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Yf(t,e,n,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:g}=u.child(d).attrs;for(let b=0;b<p;b++,f++){const v=o==f?i:g&&g[b],y=v?v+"px":"";if(l+=v||r,v||(a=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=y,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var un=new zl("tableColumnResizing");function HD({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=$D,lastColumnResizable:o=!0}={}){const i=new Bl({key:un,state:{init(s,l){var a,c;const u=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=yr(l.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new BD(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=un.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{zD(s,l,t,o)},mouseleave:s=>{FD(s)},mousedown:(s,l)=>{WD(s,l,e,n)}},decorations:s=>{const l=un.getState(s);if(l&&l.activeHandle>-1)return YD(s,l.activeHandle)},nodeViews:{}}});return i}var BD=class Fa{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(un);if(r&&r.setHandle!=null)return new Fa(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Fa(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Gf(e.doc.resolve(o))||(o=-1),new Fa(o,n.dragging)}return n}};function zD(t,e,n,r){const o=un.getState(t.state);if(o&&!o.dragging){const i=qD(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=n?s=a0(t,e,"left",n):a-e.clientX<=n&&(s=a0(t,e,"right",n))}if(s!=o.activeHandle){if(!r&&s!==-1){const l=t.state.doc.resolve(s),a=l.node(-1),c=gt.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}e2(t,s)}}}function FD(t){const e=un.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&e2(t,-1)}function WD(t,e,n,r){var o;const i=(o=t.dom.ownerDocument.defaultView)!=null?o:window,s=un.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=t.state.doc.nodeAt(s.activeHandle),a=UD(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(un,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=un.getState(t.state);f!=null&&f.dragging&&(GD(t,f.activeHandle,c0(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(un,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=un.getState(t.state);if(f&&f.dragging){const p=c0(f.dragging,d,n);u0(t,f.activeHandle,p,r)}}return u0(t,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function UD(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],a--);return l/a}function qD(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function a0(t,e,n,r){const o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=ql(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;const a=gt.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function c0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function e2(t,e){t.dispatch(t.state.tr.setMeta(un,{setHandle:e}))}function GD(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=gt.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const g=f.colwidth?f.colwidth.slice():KD(f.colspan);g[p]=n,a.setNodeMarkup(s+d,null,{...f,colwidth:g})}a.docChanged&&t.dispatch(a)}function u0(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=gt.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Yf(i,a.firstChild,a,r,l,n)}function KD(t){return Array(t).fill(0)}function YD(t,e){var n;const r=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return ut.empty;const s=gt.get(i),l=o.start(-1),a=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=un.getState(t))!=null&&n.dragging&&r.push(Zt.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Zt.widget(f,p))}}return ut.create(t.doc,r)}function JD({allowTableNodeSelection:t=!1}={}){return new Bl({key:lo,state:{init(){return null},apply(e,n){const r=e.getMeta(lo);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:SD,handleDOMEvents:{mousedown:ID},createSelectionBetween(e){return lo.getState(e.state)!=null?e.state.selection:null},handleTripleClick:LD,handleKeyDown:DD,handlePaste:VD},appendTransaction(e,n,r){return OD(r,kD(r,n),t)}})}const sl=t=>{const e=Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value]));return delete e.draggable,e},d0="data-gs-mrk-fs",f0="data-gs-ib",Tc="data-gs-ifrg",qr="attrs",t2={[qr]:{default:"{}"}},Tr={[qr]:{default:{}}},n2=t=>({[qr]:JSON.stringify(sl(t))}),Ar=t=>({attrs:sl(t)}),Is=t=>e=>[t,e.attrs.attrs,0],io=t=>t.attrs[qr]?JSON.parse(t.attrs[qr]):{},ZD={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${Tc}]`,getAttrs:Ar}],toDOM:()=>["span",{[Tc]:""},0]},div:{group:"block",content:"inline*",attrs:Tr,parseDOM:[{tag:"div",getAttrs:Ar}],toDOM:Is("div")},paragraph:{group:"block",content:"inline*",attrs:Tr,parseDOM:[{tag:"p",getAttrs:Ar}],toDOM:Is("p")},orderedList:{group:"block",content:"listItem+",attrs:Tr,parseDOM:[{tag:"ol",getAttrs:Ar}],toDOM:Is("ol")},bulletList:{group:"block",content:"listItem+",attrs:Tr,parseDOM:[{tag:"ul",getAttrs:Ar}],toDOM:Is("ul")},listItem:{content:"block*",group:"block",attrs:Tr,parseDOM:[{tag:"li",getAttrs:Ar}],toDOM:Is("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Tr,parseDOM:[{tag:"pre",getAttrs:Ar}],toDOM:t=>["pre",t.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Tr,parseDOM:[{tag:"img[src]",getAttrs:Ar}],toDOM:t=>["img",t.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${f0}]`}],toDOM(){return["br",{[f0]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:Tr,parseDOM:[{tag:"br",getAttrs:Ar}],toDOM:t=>["br",{...t.attrs.attrs}]},heading:{group:"block",content:"inline*",attrs:{level:{default:1},attrs:{default:{}}},defining:!0,parseDOM:Array.from({length:6},(t,e)=>({tag:`h${e+1}`,getAttrs:n=>({level:e+1,attrs:sl(n)})})),toDOM({attrs:t}){const{level:e}=t;return[e?`h${e}`:"div",t.attrs,0]}},...vD({tableGroup:"block",cellContent:"block+",cellAttributes:{[qr]:{default:Tr[qr].default,getFromDOM:sl,setDOMAttr:(t,e)=>{t&&Object.assign(e,t)}},background:{default:null,getFromDOM(t){return t.style.backgroundColor||null},setDOMAttr(t,e){t&&(e.style=(e.style||"")+`background-color: ${t};`)}}}}),nonTextNode:{group:"block",content:"block*",attrs:{tagName:{default:"span"},attrs:{default:{}}},parseDOM:[{tag:"*:not(tbody)",getAttrs:t=>({tagName:t.tagName.toLowerCase(),attrs:sl(t)}),priority:0}],toDOM(t){const{tagName:e,attrs:n}=t.attrs;return[e,n,0]}}},$s=(t,e)=>({attrs:t2,parseDOM:t.map(n=>({tag:n,getAttrs:n2})),toDOM:e}),XD={strong:$s(["strong","b"],t=>["b",io(t)]),link:$s(["a"],t=>["a",io(t),0]),em:$s(["em","i"],t=>["em",io(t)]),underline:$s(["u"],t=>["u",io(t),0]),strikethrough:$s(["s"],t=>["s",io(t),0]),font_size:{attrs:{...t2,size:{default:null}},parseDOM:[{tag:`span[${d0}]`,getAttrs:t=>({...n2(t),size:t.style.fontSize})}],toDOM(t){const{size:e}=t.attrs,n={...io(t),[d0]:!0};return e&&(n.style=`font-size: ${e}`),["span",n,0]}}},p0=new bR({nodes:ZD,marks:XD}),vu=new WeakMap,Oh=new WeakMap,QD=(t,e)=>{vu.set(t,e),Oh.set(e,t)},eL=(t,e)=>{vu.delete(t),Oh.delete(e)},Pd=t=>vu.get(t),tL=t=>Oh.get(t),h0=t=>{var n;const e=tL(t);return(n=e==null?void 0:e.__gjsv)==null?void 0:n.model},nL=t=>t.dispatchEvent(new CustomEvent("input"));function rL(t){const e=n=>{if(n.tagName==="SPAN"&&n.hasAttribute(Tc)){if(n.getAttribute("style")){n.removeAttribute(Tc);return}const r=n.parentElement;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);r.removeChild(n)}}else Array.from(n.children).forEach(r=>e(r))};e(t)}function oL(t,e={}){if(!e.enableOnClick)return()=>{};const n=t.Components.events,r=u=>t.getSelectedAll().includes(u),o=u=>u.isInstanceOf("text")&&!u.isChildOf("text"),i=u=>u.isChildOf("text"),s=u=>t.getEditing()===u,l=(u,d={})=>{u.trigger("focus",d.event)},a=(u,d)=>{r(u)&&o(u)&&!s(u)&&l(u,d)},c=(u,d)=>{if(r(u)&&!o(u)&&i(u)){const f=u.parents().find(p=>p.isInstanceOf("text"));f&&(l(f,d),setTimeout(()=>t.select(f),0))}};return t.on(n.select,a),t.on(n.selectBefore,c),()=>{t.off(n.select,a),t.off(n.selectBefore,c)}}const iL=(t,e)=>{const n=sL(t);return n&&gL(n)?lL(t,e):n?sx(()=>({type:t.schema.nodes.div}))(t,e):!1};function sL(t){const e=t.selection.$from;if(e.node(e.depth).type===t.schema.nodes.inlineFragment){const n=e.depth-1;return e.node(n)}return e.node(e.depth)}function lL(t,e){const{selection:n,schema:r,tr:o}=t;o.split(n.from,1);const i=n.from+1,s=o.doc.nodeAt(i),l={...s.attrs.attrs,id:void 0},a=s.textContent.length>0,c=s.textContent.length||0,u=s.textContent||" ",d=r.text(u),f=r.nodes.div.create(l,a?d:[],[]);return o.replaceRangeWith(i,i+c+2,f),o.setSelection(ke.create(o.doc,i+1)),e==null||e(o.scrollIntoView()),!0}function aL(t,e,n){const{state:r,dispatch:o}=t,{selection:i,tr:s}=r,l=(a,c,u)=>{const d={};return a.split(";").forEach(f=>{const[p,g]=f.split(":").map(b=>b.trim());p&&(d[p]=g)}),d[c]=u,Object.entries(d).map(([f,p])=>`${f}: ${p}`).join("; ")};if(!i.empty||n)s.doc.nodesBetween(i.from,i.to,(a,c)=>{var u,d;if(a.type===r.schema.nodes.image){const f=l(((u=a.attrs.attrs)==null?void 0:u.style)||"","float",e);s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:f}})}else if(a.type.isBlock){const f=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","text-align",e);r2(a)?s.setBlockType(i.from,void 0,r.schema.nodes.div,{attrs:{style:f}}):s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:f}})}});else{const a=r.doc.resolve(i.from),c=a.start(a.depth),u=r.doc.nodeAt(c);if(u!=null&&u.type.isBlock){const d=l(u.attrs.style||"","text-align",e);s.setNodeMarkup(c,void 0,{...u.attrs,style:d})}}s.docChanged&&o(s.scrollIntoView())}const Hs=(t,e)=>{const{from:n,to:r}=t.selection;let o=!1;return t.doc.nodesBetween(n,r,i=>{if(o)return!1;i.marks.some(s=>s.type===e)&&(o=!0)}),o};function cL(t,e,n="_blank"){const{state:r,dispatch:o}=t,{schema:i,selection:s,tr:l}=r,a=i.marks.link;try{const c=a.create({[qr]:JSON.stringify({href:e,target:n})});l.addMark(s.from,s.to,c),o(l.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function uL(t,e){const{state:n,dispatch:r}=t,{selection:o,tr:i}=n;if(o.empty)return;const s=n.schema.marks.font_size;if(!s){console.error("Font size mark is not defined in the schema.");return}i.addMark(o.from,o.to,s.create({size:e})),r(i.scrollIntoView())}const Ko=(t,e)=>{const{doc:n,selection:r}=t.state,o=n.resolve(r.from);for(let i=o.depth;i>0;i--){const s=o.node(i);if(e(s))return{pos:i>0?o.before(i):0,start:o.start(i),depth:i,node:s}}},dL=t=>(t||"").split(";").map(e=>e.split(":")).reduce((e,[n,r])=>(n=n.replace(/-./g,o=>o.toUpperCase()[1]).trim(),e[n]=`${r}`.trim(),e),{});function fL(...t){return(e,n)=>{const r=s=>{e=e.apply(s),n==null||n(s)},o=t.pop();return t.reduce((s,l)=>s||l(e,r),!1)&&o!==void 0&&o(e,n)}}const pL=(t,e)=>{const{state:n,dispatch:r}=t;if(e!=null&&e.event){const{event:o}=e,i=t.posAtCoords({left:o.clientX,top:o.clientY});i!=null&&i.pos&&r(n.tr.setSelection(ke.create(n.doc,i.pos)))}else lx(n,r);setTimeout(()=>setTimeout(()=>t.focus()))},Jf=t=>t.isBlock,r2=t=>t.type.name==="inlineFragment",hL=t=>Jf(t)&&!r2(t),o2=t=>t.type.name==="bulletList",i2=t=>t.type.name==="orderedList",gL=t=>t.type.name==="heading",mL=t=>o2(t)||i2(t),g0=(t,e)=>{var i,s;const n=(i=Ko(t,l=>l.type===e))==null?void 0:i.node,r=t.state.schema.nodes.listItem;let o;return n?o=Pf(r):(s=Ko(t,mL))!=null&&s.node?o=fL(Pf(r),x1(e)):o=x1(e),o(t.state,t.dispatch)},s2=(t,e)=>{const{selection:n}=t.state;return[...n.$from.marks(),...n.$to.marks()].find(r=>r.type.name===e)},bL=t=>{var s;const{view:e,prop:n,editor:r,propCSS:o}=t,i=(s=Ko(e,hL))==null?void 0:s.node;if(i){const l=i.attrs.attrs||{},a=dL(l.style);if(n in a)return a[n]||"";if(l.id){const c=r.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[o]||""}}return""},vL=t=>{const{view:e,prop:n,markName:r,editor:o,propCSS:i}=t,s=s2(e,r);if(s){const l=s.attrs;if(l[n])return l[n];if(l[qr]){const a=io(s).id;if(a){const c=o.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[i]||""}}}return""},l2=(t,e)=>{const{dispatch:n}=t,{nodes:r,marks:o}=t.state.schema;return{text:{selected:()=>{const{selection:i,doc:s}=t.state;return s.textBetween(i.from,i.to," ")},replace:(i,s={})=>{const{state:l}=t,{from:a}=l.selection;let c=l.tr.replaceSelectionWith(l.schema.text(i));s.select&&(c=c.setSelection(ke.create(c.doc,a,a+i.length))),n==null||n(c)}},bold:{toggle:()=>zo(o.strong)(t.state,n),isActive:()=>Hs(t.state,o.strong)},italic:{toggle:()=>zo(o.em)(t.state,n),isActive:()=>Hs(t.state,o.em)},underline:{toggle:()=>zo(o.underline)(t.state,n),isActive:()=>Hs(t.state,o.underline)},strikethrough:{toggle:()=>zo(o.strikethrough)(t.state,n),isActive:()=>Hs(t.state,o.strikethrough)},link:{get:()=>{const i=h0(t);if(i!=null&&i.is("link"))return i.getAttributes();{const s=s2(t,"link");return s?io(s):{}}},toggle:()=>zo(o.link)(t.state,n),isActive:()=>Hs(t.state,o.link),create:i=>{const s=h0(t);s!=null&&s.is("link")?(s.addAttributes({href:i.url,target:i.target}),t.focus()):cL(t,i.url,i.target)}},alignText:{get:()=>bL({view:t,editor:e,prop:"textAlign",propCSS:"text-align"}),set:i=>aL(t,i.value,!0)},fontSize:{get:()=>vL({view:t,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:i=>uL(t,i.value)},image:{open(){const i="assetLayout",{state:s,dispatch:l}=t,{selection:a,doc:c}=s,u=c.textBetween(a.from,a.to," "),d={id:i,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:f=>{const p={alt:u,src:f.asset.getSrc()};l(s.tr.replaceSelectionWith(r.image.createAndFill({attrs:p})))}}};e.runCommand(vt.layoutToggle,d)}},heading:{get:()=>{var s;const i=(s=Ko(t,Jf))==null?void 0:s.node;return`${(i==null?void 0:i.attrs.level)||""}`},set:({value:i})=>{var a;const{state:s}=t,l=(a=Ko(t,Jf))==null?void 0:a.node;uN(s.schema.nodes.heading,{attrs:l==null?void 0:l.attrs.attrs,level:i?parseInt(i,10):0})(s,n)}},listBullet:{isActive:()=>{var i;return!!((i=Ko(t,o2))!=null&&i.node)},toggle:()=>g0(t,r.bulletList)},listOrdered:{isActive:()=>{var i;return!!((i=Ko(t,i2))!=null&&i.node)},toggle:()=>g0(t,r.orderedList)}}},zn="rte:selectionchange",En={bold:'<svg viewBox="0 0 24 24"><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',italic:'<svg viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',underline:'<svg viewBox="0 0 24 24"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z" /></svg>',strikethrough:'<svg viewBox="0 0 24 24"><path d="M7.2 9.8c-1.2-2.3.5-5 2.9-5.5 3.1-1 7.6.4 7.5 4.2h-3l-.1-.8c-.2-.6-.6-.9-1.2-1.1-.8-.3-2.1-.2-2.8.3C9 8.2 10.4 9.5 12 10H7.4l-.2-.2M21 13v-2H3v2h9.6l.6.2c.6.3 1.1.5 1.3 1.1.1.4.2.9 0 1.3-.2.5-.6.7-1.1.9-1.8.5-4-.2-3.9-2.4h-3c-.1 2.6 2.1 4.4 4.5 4.7 3.8.8 8.3-1.6 6.3-5.9l3.7.1Z"/></svg>',link:'<svg viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',image:'<svg viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z"></path></svg>',listBullet:'<svg viewBox="0 0 24 24"><path d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6 1.5 1.5 0 0 1 4 7.5 1.5 1.5 0 0 1 2.5 6 1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12 1.5 1.5 0 0 1 4 13.5 1.5 1.5 0 0 1 2.5 12 1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18 1.5 1.5 0 0 1 4 19.5 1.5 1.5 0 0 1 2.5 18 1.5 1.5 0 0 1 4 16.5Z"/></svg>',listOrdered:'<svg viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.3-7a.8.8 0 0 1 .7.8c0 .1 0 .3-.2.5L3 13h2v1H2v-1l2-2H2v-1h2.3Z"/></svg>',alignTextLeft:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H15V9H3V7M3,11H21V13H3V11M3,15H15V17H3V15M3,19H21V21H3V19Z" /></svg>',alignTextCenter:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M7,7H17V9H7V7M3,11H21V13H3V11M7,15H17V17H7V15M3,19H21V21H3V19Z" /></svg>',alignTextRight:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M9,7H21V9H9V7M3,11H21V13H3V11M9,15H21V17H9V15M3,19H21V21H3V19Z" /></svg>',alignTextJustify:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H21V9H3V7M3,11H21V13H3V11M3,15H21V17H3V15M3,19H21V21H3V19Z" /></svg>'},yL=(t,e)=>{var a;const{editor:n,el:r}=t,o=vu.get(r),i=l2(o,n),s={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:En.bold,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.bold.isActive()})}},onClick:({setState:c})=>{i.bold.toggle(),c({active:i.bold.isActive()})}},italic:{id:"italic",icon:En.italic,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.italic.isActive()})}},onClick:({setState:c})=>{i.italic.toggle(),c({active:i.italic.isActive()})}},underline:{id:"underline",icon:En.underline,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.underline.isActive()})}},onClick:({setState:c})=>{i.underline.toggle(),c({active:i.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:En.strikethrough,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.strikethrough.isActive()})}},onClick:({setState:c})=>{i.strikethrough.toggle(),c({active:i.strikethrough.isActive()})}},image:{id:"image",icon:En.image,size:"s",type:"button",onClick:()=>i.image.open()},link:{id:"link",icon:En.link,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.link.isActive(),disabled:o.state.selection.empty})}},onClick:({event:c})=>{const u=c.currentTarget||c.target,{x:d,y:f,width:p,height:g}=u.getBoundingClientRect(),b="linkLayout",v=()=>n.runCommand(vt.layoutRemove,{id:b}),y=i.link.get(),w={id:b,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:d,y:f,w:p,h:g},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:S=>{S.preventDefault();const C=new FormData(S.currentTarget);i.link.create({url:C.get("url"),target:C.get("target")}),v()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(y==null?void 0:y.href)||"",onChange:({value:S,setState:C})=>C({value:S})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(y==null?void 0:y.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:S,setState:C})=>C({value:S})},{type:"row",style:{gap:10,justifyContent:"end"},children:[i.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{i.link.toggle(),v()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};n.runCommand(vt.layoutToggle,w)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:En.alignTextLeft},{id:"center",icon:En.alignTextCenter},{id:"right",icon:En.alignTextRight},{id:"justify",icon:En.alignTextJustify}],editorEvents:{[zn]:({setState:c})=>{c({value:i.alignText.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),i.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:En.listBullet,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.listBullet.isActive()})}},onClick:({setState:c})=>{i.listBullet.toggle(),c({active:i.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:En.listOrdered,size:"s",type:"button",editorEvents:{[zn]:({setState:c})=>{c({active:i.listOrdered.isActive()})}},onClick:({setState:c})=>{i.listOrdered.toggle(),c({active:i.listOrdered.isActive()})}},heading:{id:"heading",type:"selectField",size:"s",value:"",emptyState:"Heading",options:[{id:"",label:"Normal"},{id:"1",label:"Heading 1"},{id:"2",label:"Heading 2"},{id:"3",label:"Heading 3"},{id:"4",label:"Heading 4"},{id:"5",label:"Heading 5"},{id:"6",label:"Heading 6"}],editorEvents:{[zn]:({setState:c})=>{c({value:i.heading.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),i.heading.set({value:c}),o.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"Font size",options:[{id:"8pt",label:"8pt"},{id:"10pt",label:"10pt"},{id:"12pt",label:"12pt"},{id:"14pt",label:"14pt"},{id:"18pt",label:"18pt"},{id:"24pt",label:"24pt"},{id:"36pt",label:"36pt"}],editorEvents:{[zn]:({setState:c})=>{c({value:i.fontSize.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),i.fontSize.set({value:c}),o.focus()}}},l=[s.bold,s.italic,s.underline,s.strikethrough,s.image,s.link,s.listBullet,s.listOrdered,s.alignText,s.heading,s.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...t,commands:i,layouts:s,proseMirror:{view:o},items:l}))||l};class xL{constructor(e,n,r){this.editor=r,this.node=e,this.dom=document.createElement("img"),this.view=n,Object.keys(e.attrs.attrs).forEach(o=>{this.dom.setAttribute(o,e.attrs.attrs[o])}),this.dom.addEventListener("dblclick",o=>this.handleDoubleClick(o))}handleDoubleClick(e){const{editor:n,view:r}=this;l2(r,n).image.open(),e.preventDefault()}update(e){return e.type!==this.node.type?!1:(this.node=e,Object.keys(e.attrs.attrs).forEach(n=>{this.dom.setAttribute(n,e.attrs.attrs[n])}),!0)}selectNode(){this.dom.style.outline="2px solid #ffca6f"}deselectNode(){this.dom.style.outline=""}}class No{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?wL(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function wL(t){return function(e,n,r,o){let i=t;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let l=r-o;l>0&&(i=n[0].slice(s-l,s)+i,r=o)}return e.tr.insertText(i,r,o)}}const SL=500;function CL({rules:t}){let e=new Bl({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return m0(n,r,o,i,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&m0(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function m0(t,e,n,r,o,i){if(t.composing)return!1;let s=t.state,l=s.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-SL),l.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(l.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let d=u.match.exec(a),f=d&&u.handler(s,d,e-(d[0].length-r.length),n);if(f)return u.undoable&&f.setMeta(i,{transform:f,from:e,to:n,text:r}),t.dispatch(f),!0}return!1}const EL=new No(/--$/,"—"),OL=new No(/\.\.\.$/,"…"),_L=new No(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),kL=new No(/"$/,"”"),TL=new No(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),AL=new No(/'$/,"’"),ML=[_L,kL,TL,AL];function _h(t,e,n=null,r){return new No(t,(o,i,s,l)=>{let a=n instanceof Function?n(i):n,c=o.tr.delete(s,l),u=c.doc.resolve(s),d=u.blockRange(),f=d&&Wy(d,e,a);if(!f)return null;c.wrap(d,f);let p=c.doc.resolve(s-1).nodeBefore;return p&&p.type==e&&fu(c.doc,s-1)&&(!r||r(i,p))&&c.join(s-1),c})}function a2(t,e,n=null){return new No(t,(r,o,i,s)=>{let l=r.doc.resolve(i),a=n instanceof Function?n(o):n;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?r.tr.delete(i,s).setBlockType(i,i,e,a):null})}function jL(t){return _h(/^\s*>\s$/,t)}function RL(t){return _h(/^(\d+)\.\s$/,t,e=>({order:+e[1]}),(e,n)=>n.childCount+n.attrs.order==+e[1])}function NL(t){return _h(/^\s*([-+*])\s$/,t)}function PL(t){return a2(/^```$/,t)}function DL(t,e){return a2(new RegExp("^(#{1,"+e+"})\\s$"),t,n=>({level:n[1].length}))}function LL(t){const e=ML.concat(OL,EL);let n;return(n=t.nodes.blockquote)&&e.push(jL(n)),(n=t.nodes.orderedList)&&e.push(RL(n)),(n=t.nodes.bulletList)&&e.push(NL(n)),(n=t.nodes.codeBlock)&&e.push(PL(n)),(n=t.nodes.heading)&&e.push(DL(n,6)),CL({rules:e})}const VL="rteProseMirror",IL=function(t,e={}){const n={plugins:s=>s.plugins,...e},r=(s,l)=>{var g,b;const a=((g=n.schema)==null?void 0:g.call(n,{editor:t,schema:p0}))||p0,{nodes:c,marks:u}=a,d=ah.fromSchema(a).parse(s),f=$i.create({doc:d,schema:a,plugins:(b=n.plugins)==null?void 0:b.call(n,{editor:t,plugins:[HD(),JD(),LL(a),SN(),kd({Tab:r0(1),"Shift-Tab":r0(-1)}),kd({Enter:xl(ix,MN(c.listItem),iL),"Shift-Enter":xl(ox,(v,y)=>(y&&y(v.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":px,"Mod-y":Nf,"Mod-Shift-z":Nf,"Mod-b":zo(u.strong),"Mod-i":zo(u.em),"Shift-Tab":Pf(c.listItem),Tab:NN(c.listItem)}),kd(pN)]})}),p=new dD({mount:s},{state:f,dispatchTransaction(v){var x;const{state:y}=p,w=y.apply(v),S=!y.doc.eq(w.doc);p.updateState(w);const C=!y.selection.eq(w.selection);S&&(nL(((x=l==null?void 0:l.view)==null?void 0:x.el)||s),p.focus()),(C||S)&&t.trigger(zn)}});return s.__rteView=p,p.setProps({nodeViews:{image(v){return new xL(v,p,t)}}}),p},o=s=>yL(s,n);t.setCustomRte({toolbar:o,parseContent:!0,async enable(s,l,a){const c=Pd(s);if(c)return c;const u=r(s,a);return QD(s,u),pL(u,a),u},disable(s){const l=Pd(s);if(l)return eL(s,l),l.destroy(),{forceSync:!0}},getContent(s){const l=Pd(s);if(l){const{schema:a,doc:c}=l.state,u=document.createElement("div"),d=wi.fromSchema(a).serializeFragment(c.content);return d.childNodes.forEach(f=>{f.nodeType===Node.ELEMENT_NODE&&f.innerHTML===""&&(f.innerHTML="<br/>")}),u.appendChild(d),rL(u),s.classList.remove("ProseMirror-focused"),u.innerHTML}return s.innerHTML}});const i=oL(t,n);wr({editor:t,licenseKey:n.licenseKey,plan:Ht.free,pluginName:VL,cleanup:()=>{t.RichTextEditor.customRte=void 0,i()}})},$L=xr(IL),HL=t=>{const e={};for(const n of Object.keys(t)){let r=t[n];r&&(Array.isArray(r)?r=r.map(o=>o.toString()).join(","):r=r.toString(),e[n]=r)}return new URLSearchParams(e)},BL=t=>{const{apiKey:e,searchParams:n,thumbnailQuality:r="high"}=t,o=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",u=HL(l);return`${c}?${u}`},i=l=>{var a,c,u;return((a=l[r])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((u=l.medium)==null?void 0:u.url)||l.default.url},s=l=>{const a=i(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:["youtube-video"],label:"YouTube Videos",search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:l,pageCustomData:a}){var b;const c={maxResults:25,q:l,pageToken:a==null?void 0:a.token,type:["video"],key:e},u=n==null?void 0:n({searchValue:l}),d={...c,...u};d.part?d.part.includes("snippet")||d.part.push("snippet"):d.part=["snippet"];const p=await(await fetch(o(d))).json();return(b=p.items)!=null&&b.length?{items:p.items.map(s),nextPageCustomData:{token:p.nextPageToken},isLastPage:!p.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:l,onSelect:a})=>({type:"column",onClick:()=>a(l),htmlAttrs:{title:l.name},style:{border:"1px solid gray",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=l.customData)==null?void 0:c.thumbnailUrl}" alt="${l.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:l.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},zL="youtubeAssetProvider",FL=function(t,e){const{skipVideoComponent:n}=e,r=BL(e);t.runCommand(vt.assetProviderAdd,{provider:r});const o="search-on-youtube",i="video";if(!n){const s=t.Components.getType(i).model.prototype;t.Components.addType(i,{model:{getYoutubeTraits(){const[l,...a]=s.getYoutubeTraits.apply(this);return[l,{id:o,type:"button",label:t.I18n.t("youtube.searchBtn"),command:()=>{t.AssetManager.open({select:c=>{t.Assets.close(),this.set({videoId:c.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})}},...a]}}})}wr({editor:t,licenseKey:e.licenseKey,plan:Ht.startup,pluginName:zL,cleanup:()=>{if(t.runCommand(vt.assetProviderRemove,{id:r.id}),!n){const s=t.Components.getType(i).model.prototype;t.Components.addType(i,{model:{getYoutubeTraits(){return s.getYoutubeTraits.apply(this).filter(l=>l.id!==o)}}})}}})},WL=xr(FL);exports.dialogComponent=D2;exports.fsLightboxComponent=xj;exports.iconifyComponent=I4;exports.lightGalleryComponent=Mj;exports.listPagesComponent=mj;exports.rteProseMirror=$L;exports.rteTinyMce=eR;exports.swiperComponent=Uj;exports.tableComponent=cj;exports.youtubeAssetProvider=WL;
128
+ `);return{dom:a,text:u,slice:e}}function Ta(n,e,t,i,o){let r=o.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(i||r||!t);if(a){if(n.someProp("transformPastedText",u=>{e=u(e,r||i,n)}),r)return e?new C(w.from(n.state.schema.text(e.replace(/\r\n?/g,`
129
+ `))),0,0):C.empty;let h=n.someProp("clipboardTextParser",u=>u(e,o,i,n));if(h)l=h;else{let u=o.marks(),{schema:f}=n.state,p=wt.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,u)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),s=Sf(t),wn&&vf(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let u=s.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;s=u}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Ht.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!yf.test(u.parentNode.nodeName)?{ignore:!0}:null}})),d)l=xf(cs(l,+d[1],+d[2]),d[4]);else if(l=C.maxOpen(bf(l.content,o),!0),l.openStart||l.openEnd){let h=0,u=0;for(let f=l.content.firstChild;h<l.openStart&&!f.type.spec.isolating;h++,f=f.firstChild);for(let f=l.content.lastChild;u<l.openEnd&&!f.type.spec.isolating;u++,f=f.lastChild);l=cs(l,h,u)}return n.someProp("transformPasted",h=>{l=h(l,n)}),l}const yf=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function bf(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),r,s=[];if(n.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&r.length&&Aa(a,r,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Oa(s[s.length-1],r.length));let d=Ma(l,a);s.push(d),o=o.matchType(d.type),r=a}}),s)return w.from(s)}return n}function Ma(n,e,t=0){for(let i=e.length-1;i>=t;i--)n=e[i].create(null,w.from(n));return n}function Aa(n,e,t,i,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let r=Aa(n,e,t,i.lastChild,o+1);if(r)return i.copy(i.content.replaceChild(i.childCount-1,r));if(i.contentMatchAt(i.childCount).matchType(o==n.length-1?t.type:n[o+1]))return i.copy(i.content.append(w.from(Ma(t,n,o+1))))}}function Oa(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Oa(n.lastChild,e-1)),i=n.contentMatchAt(n.childCount).fillBefore(w.empty,!0);return n.copy(t.append(i))}function yo(n,e,t,i,o,r){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(r=0),o<i-1&&(l=yo(l,e,t,i,o+1,r)),o>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,r<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(w.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function cs(n,e,t){return e<n.openStart&&(n=new C(yo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new C(yo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ea={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let ds=null;function Na(){return ds||(ds=document.implementation.createHTMLDocument("title"))}let _i=null;function wf(n){let e=window.trustedTypes;return e?(_i||(_i=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),_i.createHTML(n)):n}function Sf(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Na().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(n),o;if((o=i&&Ea[i[1].toLowerCase()])&&(n=o.map(r=>"<"+r+">").join("")+n+o.map(r=>"</"+r+">").reverse().join("")),t.innerHTML=wf(n),o)for(let r=0;r<o.length;r++)t=t.querySelector(o[r])||t;return t}function vf(n){let e=n.querySelectorAll(Z?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let i=e[t];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),i)}}function xf(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return n}let{content:o,openStart:r,openEnd:s}=n;for(let l=i.length-2;l>=0;l-=2){let a=t.nodes[i[l]];if(!a||a.hasRequiredAttrs())break;o=w.from(a.create(i[l+1],o)),r++,s++}return new C(o,r,s)}const ne={},ie={},Cf={touchstart:!0,touchmove:!0};class kf{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Tf(n){for(let e in ne){let t=ne[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=i=>{Af(n,i)&&!Bo(n,i)&&(n.editable||!(i.type in ie))&&t(n,i)},Cf[e]?{passive:!0}:void 0)}te&&n.dom.addEventListener("input",()=>null),bo(n)}function je(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Mf(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function bo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=i=>Bo(n,i))})}function Bo(n,e){return n.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(n,e)||e.defaultPrevented:!1})}function Af(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Of(n,e){!Bo(n,e)&&ne[e.type]&&(n.editable||!(e.type in ie))&&ne[e.type](n,e)}ie.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Ia(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ge&&Z&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),_t&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let i=Date.now();n.input.lastIOSEnter=i,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==i&&(n.someProp("handleKeyDown",o=>o(n,ot(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",i=>i(n,t))||gf(n,t)?t.preventDefault():je(n,"key")};ie.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};ie.keypress=(n,e)=>{let t=e;if(Ia(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ue&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let i=n.state.selection;if(!(i instanceof N)||!i.$from.sameParent(i.$to)){let o=String.fromCharCode(t.charCode);!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",r=>r(n,i.$from.pos,i.$to.pos,o))&&n.dispatch(n.state.tr.insertText(o).scrollIntoView()),t.preventDefault()}};function yi(n){return{left:n.clientX,top:n.clientY}}function Ef(n,e){let t=e.x-n.clientX,i=e.y-n.clientY;return t*t+i*i<100}function Ho(n,e,t,i,o){if(i==-1)return!1;let r=n.state.doc.resolve(i);for(let s=r.depth+1;s>0;s--)if(n.someProp(e,l=>s>r.depth?l(n,t,r.nodeAfter,r.before(s),o,!0):l(n,t,r.node(s),r.before(s),o,!1)))return!0;return!1}function zt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let i=n.state.tr.setSelection(e);i.setMeta("pointer",!0),n.dispatch(i)}function Nf(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&O.isSelectable(i)?(zt(n,new O(t)),!0):!1}function Df(n,e){if(e==-1)return!1;let t=n.state.selection,i,o;t instanceof O&&(i=t.node);let r=n.state.doc.resolve(e);for(let s=r.depth+1;s>0;s--){let l=s>r.depth?r.nodeAfter:r.node(s);if(O.isSelectable(l)){i&&t.$from.depth>0&&s>=t.$from.depth&&r.before(t.$from.depth+1)==t.$from.pos?o=r.before(t.$from.depth):o=r.before(s);break}}return o!=null?(zt(n,O.create(n.state.doc,o)),!0):!1}function If(n,e,t,i,o){return Ho(n,"handleClickOn",e,t,i)||n.someProp("handleClick",r=>r(n,e,i))||(o?Df(n,t):Nf(n,t))}function Pf(n,e,t,i){return Ho(n,"handleDoubleClickOn",e,t,i)||n.someProp("handleDoubleClick",o=>o(n,e,i))}function Rf(n,e,t,i){return Ho(n,"handleTripleClickOn",e,t,i)||n.someProp("handleTripleClick",o=>o(n,e,i))||Vf(n,t,i)}function Vf(n,e,t){if(t.button!=0)return!1;let i=n.state.doc;if(e==-1)return i.inlineContent?(zt(n,N.create(i,0,i.content.size)),!0):!1;let o=i.resolve(e);for(let r=o.depth+1;r>0;r--){let s=r>o.depth?o.nodeAfter:o.node(r),l=o.before(r);if(s.inlineContent)zt(n,N.create(i,l+1,l+1+s.content.size));else if(O.isSelectable(s))zt(n,O.create(i,l));else continue;return!0}}function Fo(n){return ri(n)}const Da=ue?"metaKey":"ctrlKey";ne.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let i=Fo(n),o=Date.now(),r="singleClick";o-n.input.lastClick.time<500&&Ef(t,n.input.lastClick)&&!t[Da]&&(n.input.lastClick.type=="singleClick"?r="doubleClick":n.input.lastClick.type=="doubleClick"&&(r="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:r};let s=n.posAtCoords(yi(t));s&&(r=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Lf(n,s,t,!!i)):(r=="doubleClick"?Pf:Rf)(n,s.pos,s.inside,t)?t.preventDefault():je(n,"pointer"))};class Lf{constructor(e,t,i,o){this.view=e,this.pos=t,this.event=i,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[Da],this.allowDefault=i.shiftKey;let r,s;if(t.inside>-1)r=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);r=d.parent,s=d.depth?d.before():0}const l=o?null:i.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(i.button==0&&r.type.spec.draggable&&r.type.spec.selectable!==!1||c instanceof O&&c.from<=s&&c.to>s)&&(this.mightDrag={node:r,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&we&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),je(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Re(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(yi(e))),this.updateAllowDefault(e),this.allowDefault||!t?je(this.view,"pointer"):If(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||te&&this.mightDrag&&!this.mightDrag.node.isAtom||Z&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(zt(this.view,E.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):je(this.view,"pointer")}move(e){this.updateAllowDefault(e),je(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ne.touchstart=n=>{n.input.lastTouch=Date.now(),Fo(n),je(n,"pointer")};ne.touchmove=n=>{n.input.lastTouch=Date.now(),je(n,"pointer")};ne.contextmenu=n=>Fo(n);function Ia(n,e){return n.composing?!0:te&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const zf=ge?5e3:-1;ie.compositionstart=ie.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),ri(n,!0),n.markCursor=null;else if(ri(n,!e.selection.empty),we&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=n.domSelectionRange();for(let o=i.focusNode,r=i.focusOffset;o&&o.nodeType==1&&r!=0;){let s=r<0?o.lastChild:o.childNodes[r-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,r=-1}}n.input.composing=!0}Pa(n,zf)};ie.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Pa(n,20))};function Pa(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ri(n),e))}function Ra(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Hf());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Bf(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Eu(e.focusNode,e.focusOffset),i=Nu(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let o=i.pmViewDesc,r=n.domObserver.lastChangedTextNode;if(t==r||i==r)return r;if(!o||!o.isText(i.nodeValue))return i;if(n.input.compositionNode==i){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return i}}return t||i}function Hf(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ri(n,e=!1){if(!(ge&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Ra(n),e||n.docView&&n.docView.dirty){let t=Lo(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Ff(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),i.removeAllRanges(),i.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const fn=re&&Je<15||_t&&Vu<604;ne.copy=ie.cut=(n,e)=>{let t=e,i=n.state.selection,o=t.type=="cut";if(i.empty)return;let r=fn?null:t.clipboardData,s=i.content(),{dom:l,text:a}=ka(n,s);r?(t.preventDefault(),r.clearData(),r.setData("text/html",l.innerHTML),r.setData("text/plain",a)):Ff(n,l),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function $f(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Wf(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,i=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),i.parentNode&&i.parentNode.removeChild(i),t?pn(n,i.value,null,o,e):pn(n,i.textContent,i.innerHTML,o,e)},50)}function pn(n,e,t,i,o){let r=Ta(n,e,t,i,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,o,r||C.empty)))return!0;if(!r)return!1;let s=$f(r),l=s?n.state.tr.replaceSelectionWith(s,i):n.state.tr.replaceSelection(r);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Va(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ie.paste=(n,e)=>{let t=e;if(n.composing&&!ge)return;let i=fn?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;i&&pn(n,Va(i),i.getData("text/html"),o,t)?t.preventDefault():Wf(n,t)};class La{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const za=ue?"altKey":"ctrlKey";ne.dragstart=(n,e)=>{let t=e,i=n.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let o=n.state.selection,r=o.empty?null:n.posAtCoords(yi(t)),s;if(!(r&&r.pos>=o.from&&r.pos<=(o instanceof O?o.to-1:o.to))){if(i&&i.mightDrag)s=O.create(n.state.doc,i.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(s=O.create(n.state.doc,h.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:d}=ka(n,l);(!t.dataTransfer.files.length||!Z||aa>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(fn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",fn||t.dataTransfer.setData("text/plain",c),n.dragging=new La(d,!t[za],s)};ne.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};ie.dragover=ie.dragenter=(n,e)=>e.preventDefault();ie.drop=(n,e)=>{let t=e,i=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(yi(t));if(!o)return;let r=n.state.doc.resolve(o.pos),s=i&&i.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=Ta(n,Va(t.dataTransfer),fn?null:t.dataTransfer.getData("text/html"),!1,r);let l=!!(i&&!t[za]);if(n.someProp("handleDrop",p=>p(n,t,s||C.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?Vh(n.state.doc,r.pos,s):r.pos;a==null&&(a=r.pos);let c=n.state.tr;if(l){let{node:p}=i;p?p.replace(c):c.deleteSelection()}let d=c.mapping.map(a),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,u=c.doc;if(h?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(u))return;let f=c.doc.resolve(d);if(h&&O.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new O(f));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>p=x),c.setSelection(zo(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};ne.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Re(n)},20))};ne.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ne.beforeinput=(n,e)=>{if(Z&&ge&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:i}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=i||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,ot(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in ie)ne[n]=ie[n];function mn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class si{constructor(e,t){this.toDOM=e,this.spec=t||ft,this.side=this.spec.side||0}map(e,t,i,o){let{pos:r,deleted:s}=e.mapResult(t.from+o,this.side<0?-1:1);return s?null:new oe(r-i,r-i,this)}valid(){return!0}eq(e){return this==e||e instanceof si&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&mn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ue{constructor(e,t){this.attrs=e,this.spec=t||ft}map(e,t,i,o){let r=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-i,s=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-i;return r>=s?null:new oe(r,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ue&&mn(this.attrs,e.attrs)&&mn(this.spec,e.spec)}static is(e){return e.type instanceof Ue}destroy(){}}class $o{constructor(e,t){this.attrs=e,this.spec=t||ft}map(e,t,i,o){let r=e.mapResult(t.from+o,1);if(r.deleted)return null;let s=e.mapResult(t.to+o,-1);return s.deleted||s.pos<=r.pos?null:new oe(r.pos-i,s.pos-i,this)}valid(e,t){let{index:i,offset:o}=e.content.findIndex(t.from),r;return o==t.from&&!(r=e.child(i)).isText&&o+r.nodeSize==t.to}eq(e){return this==e||e instanceof $o&&mn(this.attrs,e.attrs)&&mn(this.spec,e.spec)}destroy(){}}class oe{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new oe(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,i){return this.type.map(e,this,t,i)}static widget(e,t,i){return new oe(e,e,new si(t,i))}static inline(e,t,i,o){return new oe(e,t,new Ue(i,o))}static node(e,t,i,o){return new oe(e,t,new $o(i,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ue}get widget(){return this.type instanceof si}}const Ot=[],ft={};class z{constructor(e,t){this.local=e.length?e:Ot,this.children=t.length?t:Ot}static create(e,t){return t.length?li(t,e,0,ft):G}find(e,t,i){let o=[];return this.findInner(e??0,t??1e9,o,0,i),o}findInner(e,t,i,o,r){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!r||r(l.spec))&&i.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,i,o+l,r)}}map(e,t,i){return this==G||e.maps.length==0?this:this.mapInner(e,t,0,0,i||ft)}mapInner(e,t,i,o,r){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,i,o);a&&a.type.valid(t,a)?(s||(s=[])).push(a):r.onRemove&&r.onRemove(this.local[l].spec)}return this.children.length?_f(this.children,s||[],e,t,i,o,r):s?new z(s.sort(pt),Ot):G}add(e,t){return t.length?this==G?z.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let o,r=0;e.forEach((l,a)=>{let c=a+i,d;if(d=Ha(t,l,c)){for(o||(o=this.children.slice());r<o.length&&o[r]<a;)r+=3;o[r]==a?o[r+2]=o[r+2].addInner(l,d,c+1):o.splice(r,0,a,a+l.nodeSize,li(d,l,c+1,ft)),r+=3}});let s=Ba(r?Fa(t):t,-i);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new z(s.length?this.local.concat(s).sort(pt):this.local,o||this.children)}remove(e){return e.length==0||this==G?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,o=this.local;for(let r=0;r<i.length;r+=3){let s,l=i[r]+t,a=i[r+1]+t;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>l&&h.to<a&&(e[d]=null,(s||(s=[])).push(h));if(!s)continue;i==this.children&&(i=this.children.slice());let c=i[r+2].removeInner(s,l+1);c!=G?i[r+2]=c:(i.splice(r,3),r-=3)}if(o.length){for(let r=0,s;r<e.length;r++)if(s=e[r])for(let l=0;l<o.length;l++)o[l].eq(s,t)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return i==this.children&&o==this.local?this:o.length||i.length?new z(o,i):G}forChild(e,t){if(this==G)return this;if(t.isLeaf)return z.empty;let i,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(i=this.children[l+2]);break}let r=e+1,s=r+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>r&&a.type instanceof Ue){let c=Math.max(r,a.from)-r,d=Math.min(s,a.to)-r;c<d&&(o||(o=[])).push(a.copy(c,d))}}if(o){let l=new z(o.sort(pt),Ot);return i?new We([l,i]):l}return i||G}eq(e){if(this==e)return!0;if(!(e instanceof z)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Wo(this.localsInner(e))}localsInner(e){if(this==G)return Ot;if(e.inlineContent||!this.local.some(Ue.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Ue||t.push(this.local[i]);return t}forEachSet(e){e(this)}}z.empty=new z([],[]);z.removeOverlap=Wo;const G=z.empty;class We{constructor(e){this.members=e}map(e,t){const i=this.members.map(o=>o.map(e,t,ft));return We.from(i)}forChild(e,t){if(t.isLeaf)return z.empty;let i=[];for(let o=0;o<this.members.length;o++){let r=this.members[o].forChild(e,t);r!=G&&(r instanceof We?i=i.concat(r.members):i.push(r))}return We.from(i)}eq(e){if(!(e instanceof We)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,i=!0;for(let o=0;o<this.members.length;o++){let r=this.members[o].localsInner(e);if(r.length)if(!t)t=r;else{i&&(t=t.slice(),i=!1);for(let s=0;s<r.length;s++)t.push(r[s])}}return t?Wo(i?t:t.sort(pt)):Ot}static from(e){switch(e.length){case 0:return G;case 1:return e[0];default:return new We(e.every(t=>t instanceof z)?e:e.reduce((t,i)=>t.concat(i instanceof z?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function _f(n,e,t,i,o,r,s){let l=n.slice();for(let c=0,d=r;c<t.maps.length;c++){let h=0;t.maps[c].forEach((u,f,p,m)=>{let g=m-p-(f-u);for(let y=0;y<l.length;y+=3){let x=l[y+1];if(x<0||u>x+d-h)continue;let b=l[y]+d-h;f>=b?l[y+1]=u<=b?-2:-1:u>=d&&g&&(l[y]+=g,l[y+1]+=g)}h+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let d=t.map(n[c]+r),h=d-o;if(h<0||h>=i.content.size){a=!0;continue}let u=t.map(n[c+1]+r,-1),f=u-o,{index:p,offset:m}=i.content.findIndex(h),g=i.maybeChild(p);if(g&&m==h&&m+g.nodeSize==f){let y=l[c+2].mapInner(t,g,d+1,n[c]+r+1,s);y!=G?(l[c]=h,l[c+1]=f,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Kf(l,n,e,t,o,r,s),d=li(c,i,0,s);e=d.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,u=0;h<d.children.length;h+=3){let f=d.children[h];for(;u<l.length&&l[u]<f;)u+=3;l.splice(u,0,d.children[h],d.children[h+1],d.children[h+2])}}return new z(e.sort(pt),l)}function Ba(n,e){if(!e||!n.length)return n;let t=[];for(let i=0;i<n.length;i++){let o=n[i];t.push(new oe(o.from+e,o.to+e,o.type))}return t}function Kf(n,e,t,i,o,r,s){function l(a,c){for(let d=0;d<a.local.length;d++){let h=a.local[d].map(i,o,c);h?t.push(h):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+r+1);return t}function Ha(n,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,o=null;for(let r=0,s;r<n.length;r++)(s=n[r])&&s.from>t&&s.to<i&&((o||(o=[])).push(s),n[r]=null);return o}function Fa(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function li(n,e,t,i){let o=[],r=!1;e.forEach((l,a)=>{let c=Ha(n,l,a+t);if(c){r=!0;let d=li(c,l,t+a+1,i);d!=G&&o.push(a,a+l.nodeSize,d)}});let s=Ba(r?Fa(n):n,-t).sort(pt);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(i.onRemove&&i.onRemove(s[l].spec),s.splice(l--,1));return s.length||o.length?new z(s,o):G}function pt(n,e){return n.from-e.from||n.to-e.to}function Wo(n){let e=n;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let o=t+1;o<e.length;o++){let r=e[o];if(r.from==i.from){r.to!=i.to&&(e==n&&(e=n.slice()),e[o]=r.copy(r.from,i.to),hs(e,o+1,r.copy(i.to,r.to)));continue}else{r.from<i.to&&(e==n&&(e=n.slice()),e[t]=i.copy(i.from,r.from),hs(e,o,i.copy(r.from,i.to)));break}}}return e}function hs(n,e,t){for(;e<n.length&&pt(t,n[e])>0;)e++;n.splice(e,0,t)}function Ki(n){let e=[];return n.someProp("decorations",t=>{let i=t(n.state);i&&i!=G&&e.push(i)}),n.cursorWrapper&&e.push(z.create(n.state.doc,[n.cursorWrapper.deco])),We.from(e)}const qf={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jf=re&&Je<=11;class Jf{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Gf{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Jf,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let o=0;o<i.length;o++)this.queue.push(i[o]);re&&Je<=11&&i.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),jf&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,qf)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ns(this.view)){if(this.suppressingSelectionUpdates)return Re(this.view);if(re&&Je<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,i;for(let r=e.focusNode;r;r=un(r))t.add(r);for(let r=e.anchorNode;r;r=un(r))if(t.has(r)){i=r;break}let o=i&&this.view.docView.nearestDesc(i);if(o&&o.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let i=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&ns(e)&&!this.ignoreSelectionChange(i),r=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let h=this.registerMutation(t[d],a);h&&(r=r<0?h.from:Math.min(h.from,r),s=s<0?h.to:Math.max(h.to,s),h.typeOver&&(l=!0))}if(we&&a.length){let d=a.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,u]=d;h.parentNode&&h.parentNode.parentNode==u.parentNode?u.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let u of d){let f=u.parentNode;f&&f.nodeName=="LI"&&(!h||Yf(e,h)!=f)&&u.remove()}}}let c=null;r<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&mi(i)&&(c=Lo(e))&&c.eq(E.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Re(e),this.currentSelection.set(i),e.scrollToSelection()):(r>-1||o)&&(r>-1&&(e.docView.markDirty(r,s),Uf(e)),this.handleDOMChange(r,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||Re(e),this.currentSelection.set(i))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let h=e.addedNodes[d];t.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let o=e.previousSibling,r=e.nextSibling;if(re&&Je<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:u}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(r=u)}let s=o&&o.parentNode==e.target?q(o)+1:0,l=i.localPosFromDOM(e.target,s,-1),a=r&&r.parentNode==e.target?q(r):e.target.childNodes.length,c=i.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let us=new WeakMap,fs=!1;function Uf(n){if(!us.has(n)&&(us.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=we,fs)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),fs=!0}}function ps(n,e){let t=e.startContainer,i=e.startOffset,o=e.endContainer,r=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return yt(s.node,s.offset,o,r)&&([t,i,o,r]=[o,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:o,focusOffset:r}}function Zf(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return ps(n,o)}let t;function i(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",i,!0),t?ps(n,t):null}function Yf(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let i=n.docView.nearestDesc(t,!0);if(i&&i.node.isBlock)return t}return null}function Xf(n,e,t){let{node:i,fromOffset:o,toOffset:r,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:a.anchorOffset}],mi(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Z&&n.input.lastKeyCode===8)for(let g=r;g>o;g--){let y=i.childNodes[g-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){r=g;break}if(!x||x.size)break}let h=n.state.doc,u=n.someProp("domParser")||Ht.fromSchema(n.state.schema),f=h.resolve(s),p=null,m=u.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:r,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Qf,context:f});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+s,head:y+s}}return{doc:m,sel:p,from:s,to:l}}function Qf(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(te&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||te&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ep=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function tp(n,e,t,i,o){let r=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let M=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,R=Lo(n,M);if(R&&!n.state.selection.eq(R)){if(Z&&ge&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",V=>V(n,ot(13,"Enter"))))return;let P=n.state.tr.setSelection(R);M=="pointer"?P.setMeta("pointer",!0):M=="key"&&P.scrollIntoView(),r&&P.setMeta("composition",r),n.dispatch(P)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=Xf(n,e,t),d=n.state.doc,h=d.slice(c.from,c.to),u,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(u=n.state.selection.to,f="end"):(u=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let p=op(h.content,c.doc.content,c.from,u,f);if(p&&n.input.domChangeCount++,(_t&&n.input.lastIOSEnter>Date.now()-225||ge)&&o.some(M=>M.nodeType==1&&!ep.test(M.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",M=>M(n,ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(i&&a instanceof N&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let M=ms(n,n.state.doc,c.sel);if(M&&!M.eq(n.state.selection)){let R=n.state.tr.setSelection(M);r&&R.setMeta("composition",r),n.dispatch(R)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof N&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),re&&Je<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=d.resolve(p.start),x=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,b;if((_t&&n.input.lastIOSEnter>Date.now()-225&&(!x||o.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(b=E.findFrom(c.doc.resolve(m.pos+1),1,!0))&&b.head==g.pos)&&n.someProp("handleKeyDown",M=>M(n,ot(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&ip(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",M=>M(n,ot(8,"Backspace")))){ge&&Z&&n.domObserver.suppressSelectionUpdates();return}Z&&ge&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),ge&&!x&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(M){return M(n,ot(13,"Enter"))})},20));let S=p.start,v=p.endA,k,A,L;if(x){if(m.pos==g.pos)re&&Je<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Re(n),20)),k=n.state.tr.delete(S,v),A=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(L=np(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))k=n.state.tr,L.type=="add"?k.addMark(S,v,L.mark):k.removeMark(S,v,L.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",R=>R(n,S,v,M)))return;k=n.state.tr.insertText(M,S,v)}}if(k||(k=n.state.tr.replace(S,v,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let M=ms(n,k.doc,c.sel);M&&!(Z&&ge&&n.composing&&M.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(M.head==S||M.head==k.mapping.map(v)-1)||re&&M.empty&&M.head==S)&&k.setSelection(M)}A&&k.ensureMarks(A),r&&k.setMeta("composition",r),n.dispatch(k.scrollIntoView())}function ms(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:zo(n,e.resolve(t.anchor),e.resolve(t.head))}function np(n,e){let t=n.firstChild.marks,i=e.firstChild.marks,o=t,r=i,s,l,a;for(let d=0;d<i.length;d++)o=i[d].removeFromSet(o);for(let d=0;d<t.length;d++)r=t[d].removeFromSet(r);if(o.length==1&&r.length==0)l=o[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(o.length==0&&r.length==1)l=r[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(a(e.child(d)));if(w.from(c).eq(n))return{mark:l,type:s}}function ip(n,e,t,i,o){if(t-e<=o.pos-i.pos||qi(i,!0,!1)<o.pos)return!1;let r=n.resolve(e);if(!i.parent.isTextblock){let l=r.nodeAfter;return l!=null&&t==e+l.nodeSize}if(r.parentOffset<r.parent.content.size||!r.parent.isTextblock)return!1;let s=n.resolve(qi(r,!0,!0));return!s.parent.isTextblock||s.pos>t||qi(s,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(s.parent.content)}function qi(n,e,t){let i=n.depth,o=e?n.end():n.pos;for(;i>0&&(e||n.indexAfter(i)==n.node(i).childCount);)i--,o++,e=!1;if(t){let r=n.node(i).maybeChild(n.indexAfter(i));for(;r&&!r.isLeaf;)r=r.firstChild,o++}return o}function op(n,e,t,i,o){let r=n.findDiffStart(e,t);if(r==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let a=Math.max(0,r-Math.min(s,l));i-=s+a-r}if(s<r&&n.size<e.size){let a=i<=r&&i>=s?r-i:0;r-=a,r&&r<e.size&&gs(e.textBetween(r-1,r+1))&&(r+=a?1:-1),l=r+(l-s),s=r}else if(l<r){let a=i<=r&&i>=l?r-i:0;r-=a,r&&r<n.size&&gs(n.textBetween(r-1,r+1))&&(r+=a?1:-1),s=r+(s-l),l=r}return{start:r,endA:s,endB:l}}function gs(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class rp{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new kf,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(vs),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ws(this),bs(this),this.nodeViews=Ss(this),this.docView=Zr(this.state.doc,ys(this),Ki(this),this.dom,this),this.domObserver=new Gf(this,(i,o,r,s)=>tp(this,i,o,r,s)),this.domObserver.start(),Tf(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&bo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(vs),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let i in this._props)t[i]=this._props[i];t.state=this.state;for(let i in e)t[i]=e[i];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var i;let o=this.state,r=!1,s=!1;e.storedMarks&&this.composing&&(Ra(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=Ss(this);lp(f,this.nodeViews)&&(this.nodeViews=f,r=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&bo(this),this.editable=ws(this),bs(this);let a=Ki(this),c=ys(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",h=r||!this.docView.matchesNode(e.doc,c,a);(h||!e.selection.eq(o.selection))&&(s=!0);let u=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Bu(this);if(s){this.domObserver.stop();let f=h&&(re||Z)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&sp(o.selection,e.selection);if(h){let p=Z?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Bf(this)),(r||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zr(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&cf(this))?Re(this,f):(va(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((i=this.dragging)===null||i===void 0)&&i.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():u&&Hu(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof O){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Kr(this,t.getBoundingClientRect(),e)}else Kr(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let i=this.directPlugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let i=this.state.plugins[t];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let i=this.pluginViews[t];i.update&&i.update(this,e)}}updateDraggedNode(e,t){let i=e.node,o=-1;if(this.state.doc.nodeAt(i.from)==i.node)o=i.from;else{let r=i.from+(this.state.doc.content.size-t.doc.content.size);(r>0&&this.state.doc.nodeAt(r))==i.node&&(o=r)}this.dragging=new La(e.slice,e.move,o<0?void 0:O.create(this.state.doc,o))}someProp(e,t){let i=this._props&&this._props[e],o;if(i!=null&&(o=t?t(i):i))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=t?t(l):l))return o}let r=this.state.plugins;if(r)for(let s=0;s<r.length;s++){let l=r[s].props[e];if(l!=null&&(o=t?t(l):l))return o}}hasFocus(){if(re){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Fu(this.dom),Re(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return qu(this,e)}coordsAtPos(e,t=1){return fa(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,i=-1){let o=this.docView.posFromDOM(e,t,i);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Zu(this,t||this.state,e)}pasteHTML(e,t){return pn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return pn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Mf(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ki(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Au())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Of(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?te&&this.root.nodeType===11&&Iu(this.dom.ownerDocument)==this.dom&&Zf(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ys(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let i in t)i=="class"?e.class+=" "+t[i]:i=="style"?e.style=(e.style?e.style+";":"")+t[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(t[i]))}),e.translate||(e.translate="no"),[oe.node(0,n.state.doc.content.size,e)]}function bs(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:oe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ws(n){return!n.someProp("editable",e=>e(n.state)===!1)}function sp(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ss(n){let e=Object.create(null);function t(i){for(let o in i)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=i[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function lp(n,e){let t=0,i=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)i++;return t!=i}function vs(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var wo,So;if(typeof WeakMap<"u"){let n=new WeakMap;wo=e=>n.get(e),So=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;wo=i=>{for(let o=0;o<n.length;o+=2)if(n[o]==i)return n[o+1]},So=(i,o)=>(t==10&&(t=0),n[t++]=i,n[t++]=o)}var H=class{constructor(n,e,t,i){this.width=n,this.height=e,this.map=t,this.problems=i}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const i=e%this.width,o=e/this.width|0;let r=i+1,s=o+1;for(let l=1;r<this.width&&this.map[e+l]==t;l++)r++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:i,top:o,right:r,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:i,right:o,top:r,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?i==0:o==this.width)?null:this.map[r*this.width+(t<0?i-1:o)]:(t<0?r==0:s==this.height)?null:this.map[i+this.width*(t<0?r-1:s)]}rectBetween(n,e){const{left:t,right:i,top:o,bottom:r}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,a),right:Math.max(i,l),bottom:Math.max(r,c)}}cellsInRect(n){const e=[],t={};for(let i=n.top;i<n.bottom;i++)for(let o=n.left;o<n.right;o++){const r=i*this.width+o,s=this.map[r];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[r-1]==s||i==n.top&&i&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let i=0,o=0;;i++){const r=o+t.child(i).nodeSize;if(i==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?r-1:this.map[s]}o=r}}static get(n){return wo(n)||So(n,ap(n))}};function ap(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=cp(n),t=n.childCount,i=[];let o=0,r=null;const s=[];for(let c=0,d=e*t;c<d;c++)i[c]=0;for(let c=0,d=0;c<t;c++){const h=n.child(c);d++;for(let p=0;;p++){for(;o<i.length&&i[o]!=0;)o++;if(p==h.childCount)break;const m=h.child(p),{colspan:g,rowspan:y,colwidth:x}=m.attrs;for(let b=0;b<y;b++){if(b+c>=t){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:y-b});break}const S=o+b*e;for(let v=0;v<g;v++){i[S+v]==0?i[S+v]=d:(r||(r=[])).push({type:"collision",row:c,pos:d,n:g-v});const k=x&&x[v];if(k){const A=(S+v)%e*2,L=s[A];L==null||L!=k&&s[A+1]==1?(s[A]=k,s[A+1]=1):L==k&&s[A+1]++}}}o+=g,d+=m.nodeSize}const u=(c+1)*e;let f=0;for(;o<u;)i[o++]==0&&f++;f&&(r||(r=[])).push({type:"missing",row:c,n:f}),d++}const l=new H(e,t,i,r);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&dp(l,s,n),l}function cp(n){let e=-1,t=!1;for(let i=0;i<n.childCount;i++){const o=n.child(i);let r=0;if(t)for(let s=0;s<i;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>i&&(r+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const l=o.child(s);r+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function dp(n,e,t){n.problems||(n.problems=[]);const i={};for(let o=0;o<n.map.length;o++){const r=n.map[o];if(i[r])continue;i[r]=!0;const s=t.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const d=(o+c)%n.width,h=e[d*2];h!=null&&(!a.colwidth||a.colwidth[c]!=h)&&((l||(l=hp(a)))[c]=h)}l&&n.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:l})}}function hp(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function xs(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),i=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(s=>Number(s)):null,o=Number(n.getAttribute("colspan")||1),r={colspan:o,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:i&&i.length==o?i:null};for(const s in e){const l=e[s].getFromDOM,a=l&&l(n);a!=null&&(r[s]=a)}return r}function Cs(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const i in e){const o=e[i].setDOMAttr;o&&o(n.attrs[i],t)}return t}function up(n){const e=n.cellAttributes||{},t={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(const i in e)t[i]={default:e[i].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:i=>xs(i,e)}],toDOM(i){return["td",Cs(i,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:i=>xs(i,e)}],toDOM(i){return["th",Cs(i,e),0]}}}}function Te(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const i=n.nodes[t],o=i.spec.tableRole;o&&(e[o]=i)}}return e}var _e=new yn("selectingCells");function vn(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function bi(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function _o(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=vn(e.$head)||fp(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function fp(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const i=e.type.spec.tableRole;if(i=="cell"||i=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function vo(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function pp(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Ko(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function $a(n,e,t){const i=n.node(-1),o=H.get(i),r=n.start(-1),s=o.nextCell(n.pos-r,e,t);return s==null?null:n.node(0).resolve(r+s)}function Kt(n,e,t=1){const i={...n,colspan:n.colspan-t};return i.colwidth&&(i.colwidth=i.colwidth.slice(),i.colwidth.splice(e,t),i.colwidth.some(o=>o>0)||(i.colwidth=null)),i}var W=class De extends E{constructor(e,t=e){const i=e.node(-1),o=H.get(i),r=e.start(-1),s=o.rectBetween(e.pos-r,t.pos-r),l=e.node(0),a=o.cellsInRect(s).filter(d=>d!=t.pos-r);a.unshift(t.pos-r);const c=a.map(d=>{const h=i.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const u=r+d+1;return new Kl(l.resolve(u),l.resolve(u+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const i=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(vo(i)&&vo(o)&&Ko(i,o)){const r=this.$anchorCell.node(-1)!=i.node(-1);return r&&this.isRowSelection()?De.rowSelection(i,o):r&&this.isColSelection()?De.colSelection(i,o):new De(i,o)}return N.between(i,o)}content(){const e=this.$anchorCell.node(-1),t=H.get(e),i=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i),r={},s=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let d=a*t.width+o.left,h=o.left;h<o.right;h++,d++){const u=t.map[d];if(r[u])continue;r[u]=!0;const f=t.findCell(u);let p=e.nodeAt(u);if(!p)throw RangeError(`No cell with offset ${u} found`);const m=o.left-f.left,g=f.right-o.right;if(m>0||g>0){let y=p.attrs;if(m>0&&(y=Kt(y,0,m)),g>0&&(y=Kt(y,y.colspan-g,g)),f.left<o.left){if(p=p.type.createAndFill(y),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(f.top<o.top||f.bottom>o.bottom){const y={...p.attrs,rowspan:Math.min(f.bottom,o.bottom)-Math.max(f.top,o.top)};f.top<o.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}c.push(p)}s.push(e.child(a).copy(w.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new C(w.from(l),1,1)}replace(e,t=C.empty){const i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:l,$to:a}=o[s],c=e.mapping.slice(i);e.replace(c.map(l.pos),c.map(a.pos),s?C.empty:t)}const r=E.findFrom(e.doc.resolve(e.mapping.slice(i).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,t){this.replace(e,new C(w.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),i=H.get(t),o=this.$anchorCell.start(-1),r=i.cellsInRect(i.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<r.length;s++)e(t.nodeAt(r[s]),o+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const i=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(i,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const i=e.node(-1),o=H.get(i),r=e.start(-1),s=o.findCell(e.pos-r),l=o.findCell(t.pos-r),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(r+o.map[s.left])),l.bottom<o.height&&(t=a.resolve(r+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(r+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(r+o.map[o.width*(o.height-1)+s.right-1]))),new De(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=H.get(e),i=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-i),r=t.colCount(this.$headCell.pos-i);if(Math.min(o,r)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof De&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const i=e.node(-1),o=H.get(i),r=e.start(-1),s=o.findCell(e.pos-r),l=o.findCell(t.pos-r),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(r+o.map[s.top*o.width])),l.right<o.width&&(t=a.resolve(r+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(r+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(r+o.map[o.width*(s.top+1)-1]))),new De(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new De(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){return new De(e.resolve(t),e.resolve(i))}getBookmark(){return new mp(this.$anchorCell.pos,this.$headCell.pos)}};W.prototype.visible=!1;E.jsonID("cell",W);var mp=class Wa{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Wa(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),i=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&i.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&i.index()<i.parent.childCount&&Ko(t,i)?new W(t,i):E.near(i,1)}};function gp(n){if(!(n.selection instanceof W))return null;const e=[];return n.selection.forEachCell((t,i)=>{e.push(oe.node(i,i+t.nodeSize,{class:"selectedCell"}))}),z.create(n.doc,e)}function yp({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,i=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,i--);return t==i&&/row|table/.test(n.node(o).type.spec.tableRole)}function bp({$from:n,$to:e}){let t,i;for(let o=n.depth;o>0;o--){const r=n.node(o);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){t=r;break}}for(let o=e.depth;o>0;o--){const r=e.node(o);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){i=r;break}}return t!==i&&e.parentOffset===0}function wp(n,e,t){const i=(e||n).selection,o=(e||n).doc;let r,s;if(i instanceof O&&(s=i.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=W.create(o,i.from);else if(s=="row"){const l=o.resolve(i.from+1);r=W.rowSelection(l,l)}else if(!t){const l=H.get(i.node),a=i.from+1,c=a+l.map[l.width*l.height-1];r=W.create(o,a+1,c)}}else i instanceof N&&yp(i)?r=N.create(o,i.from):i instanceof N&&bp(i)&&(r=N.create(o,i.$from.start(),i.$from.end()));return r&&(e||(e=n.tr)).setSelection(r),e}var Sp=new yn("fix-tables");function _a(n,e,t,i){const o=n.childCount,r=e.childCount;e:for(let s=0,l=0;s<r;s++){const a=e.child(s);for(let c=l,d=Math.min(o,s+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}i(a,t),l<o&&n.child(l).sameMarkup(a)?_a(n.child(l),a,t+1,i):a.nodesBetween(0,a.content.size,i,t+1),t+=a.nodeSize}}function vp(n,e){let t;const i=(o,r)=>{o.type.spec.tableRole=="table"&&(t=xp(n,o,r,t))};return e?e.doc!=n.doc&&_a(e.doc,n.doc,0,i):n.doc.descendants(i),t}function xp(n,e,t,i){const o=H.get(e);if(!o.problems)return i;i||(i=n.tr);const r=[];for(let a=0;a<o.height;a++)r.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const h=d.attrs;for(let u=0;u<h.rowspan;u++)r[c.row+u]+=c.n;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,Kt(h,h.colspan-c.n,c.n))}else if(c.type=="missing")r[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<r.length;a++)r[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){const d=e.child(a),h=c+d.nodeSize,u=r[a];if(u>0){let f="cell";d.firstChild&&(f=d.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<u;g++){const y=Te(n.schema)[f].createAndFill();y&&p.push(y)}const m=(a==0||s==a-1)&&l==a?c+1:h-1;i.insert(i.mapping.map(m),p)}c=h}return i.setMeta(Sp,{fixTables:!0})}function Ka(n){const e=n.selection,t=_o(n),i=t.node(-1),o=t.start(-1),r=H.get(i);return{...e instanceof W?r.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):r.findCell(t.pos-o),tableStart:o,map:r,table:i}}function Cp(n){return function(e,t){if(!bi(e))return!1;if(t){const i=Te(e.schema),o=Ka(e),r=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==i.header_cell&&r.setNodeMarkup(o.tableStart+s[a],i.cell,l[a].attrs);if(r.steps.length==0)for(let a=0;a<s.length;a++)r.setNodeMarkup(o.tableStart+s[a],i.header_cell,l[a].attrs);t(r)}return!0}}function ks(n,e,t){const i=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<i.length;o++){const r=e.table.nodeAt(i[o]);if(r&&r.type!==t.header_cell)return!1}return!0}function qo(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Cp(n):function(t,i){if(!bi(t))return!1;if(i){const o=Te(t.schema),r=Ka(t),s=t.tr,l=ks("row",r,o),a=ks("column",r,o),d=(n==="column"?l:n==="row"?a:!1)?1:0,h=n=="column"?{left:0,top:d,right:1,bottom:r.map.height}:n=="row"?{left:d,top:0,right:r.map.width,bottom:1}:r,u=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;r.map.cellsInRect(h).forEach(f=>{const p=f+r.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,u,m.attrs)}),i(s)}return!0}}qo("row",{useDeprecatedLogic:!0});qo("column",{useDeprecatedLogic:!0});qo("cell",{useDeprecatedLogic:!0});function kp(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let i=n.index(-1)-1,o=n.before();i>=0;i--){const r=n.node(-1).child(i),s=r.lastChild;if(s)return o-1-s.nodeSize;o-=r.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let i=n.indexAfter(-1),o=n.after();i<t.childCount;i++){const r=t.child(i);if(r.childCount)return o+1;o+=r.nodeSize}}return null}function Ts(n){return function(e,t){if(!bi(e))return!1;const i=kp(_o(e),n);if(i==null)return!1;if(t){const o=e.doc.resolve(i);t(e.tr.setSelection(N.between(o,pp(o))).scrollIntoView())}return!0}}function Rn(n,e){const t=n.selection;if(!(t instanceof W))return!1;if(e){const i=n.tr,o=Te(n.schema).cell.createAndFill().content;t.forEachCell((r,s)=>{r.content.eq(o)||i.replace(i.mapping.map(s+1),i.mapping.map(s+r.nodeSize-1),new C(o,0,0))}),i.docChanged&&e(i)}return!0}function Tp(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:i}=n;for(;e.childCount==1&&(t>0&&i>0||e.child(0).type.spec.tableRole=="table");)t--,i--,e=e.child(0).content;const o=e.child(0),r=o.type.spec.tableRole,s=o.type.schema,l=[];if(r=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const d=a?0:Math.max(0,t-1),h=a<e.childCount-1?0:Math.max(0,i-1);(d||h)&&(c=xo(Te(s).row,new C(c,d,h)).content),l.push(c)}else if(r=="cell"||r=="header_cell")l.push(t||i?xo(Te(s).row,new C(e,t,i)).content:e);else return null;return Mp(s,l)}function Mp(n,e){const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(let s=r.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=r.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let i=0;for(let o=0;o<t.length;o++)i=Math.max(i,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(w.empty),t[o]<i){const r=Te(n).cell.createAndFill(),s=[];for(let l=t[o];l<i;l++)s.push(r);e[o]=e[o].append(w.from(s))}return{height:e.length,width:i,rows:e}}function xo(n,e){const t=n.createAndFill();return new _l(t).replace(0,t.content.size,e).doc}function Ap({width:n,height:e,rows:t},i,o){if(n!=i){const r=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=r[l]||0,h=0;d<i;h++){let u=a.child(h%a.childCount);d+u.attrs.colspan>i&&(u=u.type.createChecked(Kt(u.attrs,u.attrs.colspan,d+u.attrs.colspan-i),u.content)),c.push(u),d+=u.attrs.colspan;for(let f=1;f<u.attrs.rowspan;f++)r[l+f]=(r[l+f]||0)+u.attrs.colspan}s.push(w.from(c))}t=s,n=i}if(e!=o){const r=[];for(let s=0,l=0;s<o;s++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let h=c.child(d);s+h.attrs.rowspan>o&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,o-h.attrs.rowspan)},h.content)),a.push(h)}r.push(w.from(a))}t=r,e=o}return{width:n,height:e,rows:t}}function Op(n,e,t,i,o,r,s){const l=n.doc.type.schema,a=Te(l);let c,d;if(o>e.width)for(let h=0,u=0;h<e.height;h++){const f=t.child(h);u+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=e.width;g<o;g++)p.push(m);n.insert(n.mapping.slice(s).map(u-1+i),p)}if(r>e.height){const h=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;h.push(g?d||(d=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const u=a.row.create(null,w.from(h)),f=[];for(let p=e.height;p<r;p++)f.push(u);n.insert(n.mapping.slice(s).map(i+t.nodeSize-2),f)}return!!(c||d)}function Ms(n,e,t,i,o,r,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<r;c++){const d=s*e.width+c,h=e.map[d];if(e.map[d-e.width]==h){a=!0;const u=t.nodeAt(h),{top:f,left:p}=e.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+i),null,{...u.attrs,rowspan:s-f}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),u.type.createAndFill({...u.attrs,rowspan:f+u.attrs.rowspan-s})),c+=u.attrs.colspan-1}}return a}function As(n,e,t,i,o,r,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<r;c++){const d=c*e.width+s,h=e.map[d];if(e.map[d-1]==h){a=!0;const u=t.nodeAt(h),f=e.colCount(h),p=n.mapping.slice(l).map(h+i);n.setNodeMarkup(p,null,Kt(u.attrs,s-f,u.attrs.colspan-(s-f))),n.insert(p+u.nodeSize,u.type.createAndFill(Kt(u.attrs,0,s-f))),c+=u.attrs.rowspan-1}}return a}function Os(n,e,t,i,o){let r=t?n.doc.nodeAt(t-1):n.doc;if(!r)throw new Error("No table found");let s=H.get(r);const{top:l,left:a}=i,c=a+o.width,d=l+o.height,h=n.tr;let u=0;function f(){if(r=t?h.doc.nodeAt(t-1):h.doc,!r)throw new Error("No table found");s=H.get(r),u=h.mapping.maps.length}Op(h,s,r,t,c,d,u)&&f(),Ms(h,s,r,t,a,c,l,u)&&f(),Ms(h,s,r,t,a,c,d,u)&&f(),As(h,s,r,t,l,d,a,u)&&f(),As(h,s,r,t,l,d,c,u)&&f();for(let p=l;p<d;p++){const m=s.positionAt(p,a,r),g=s.positionAt(p,c,r);h.replace(h.mapping.slice(u).map(m+t),h.mapping.slice(u).map(g+t),new C(o.rows[p-l],0,0))}f(),h.setSelection(new W(h.doc.resolve(t+s.positionAt(l,a,r)),h.doc.resolve(t+s.positionAt(d-1,c-1,r)))),e(h)}var Ep=sa({ArrowLeft:Vn("horiz",-1),ArrowRight:Vn("horiz",1),ArrowUp:Vn("vert",-1),ArrowDown:Vn("vert",1),"Shift-ArrowLeft":Ln("horiz",-1),"Shift-ArrowRight":Ln("horiz",1),"Shift-ArrowUp":Ln("vert",-1),"Shift-ArrowDown":Ln("vert",1),Backspace:Rn,"Mod-Backspace":Rn,Delete:Rn,"Mod-Delete":Rn});function _n(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Vn(n,e){return(t,i,o)=>{if(!o)return!1;const r=t.selection;if(r instanceof W)return _n(t,i,E.near(r.$headCell,e));if(n!="horiz"&&!r.empty)return!1;const s=qa(o,n,e);if(s==null)return!1;if(n=="horiz")return _n(t,i,E.near(t.doc.resolve(r.head+e),e));{const l=t.doc.resolve(s),a=$a(l,n,e);let c;return a?c=E.near(a,1):e<0?c=E.near(t.doc.resolve(l.before(-1)),-1):c=E.near(t.doc.resolve(l.after(-1)),1),_n(t,i,c)}}}function Ln(n,e){return(t,i,o)=>{if(!o)return!1;const r=t.selection;let s;if(r instanceof W)s=r;else{const a=qa(o,n,e);if(a==null)return!1;s=new W(t.doc.resolve(a))}const l=$a(s.$headCell,n,e);return l?_n(t,i,new W(s.$anchorCell,l)):!1}}function Np(n,e){const t=n.state.doc,i=vn(t.resolve(e));return i?(n.dispatch(n.state.tr.setSelection(new W(i))),!0):!1}function Dp(n,e,t){if(!bi(n.state))return!1;let i=Tp(t);const o=n.state.selection;if(o instanceof W){i||(i={width:1,height:1,rows:[w.from(xo(Te(n.state.schema).cell,t))]});const r=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=H.get(r).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return i=Ap(i,l.right-l.left,l.bottom-l.top),Os(n.state,n.dispatch,s,l,i),!0}else if(i){const r=_o(n.state),s=r.start(-1);return Os(n.state,n.dispatch,s,H.get(r.node(-1)).findCell(r.pos-s),i),!0}else return!1}function Ip(n,e){var t;if(e.ctrlKey||e.metaKey)return;const i=Es(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof W)r(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&i&&(o=vn(n.state.selection.$anchor))!=null&&((t=ji(n,e))==null?void 0:t.pos)!=o.pos)r(o,e),e.preventDefault();else if(!i)return;function r(a,c){let d=ji(n,c);const h=_e.getState(n.state)==null;if(!d||!Ko(a,d))if(h)d=a;else return;const u=new W(a,d);if(h||!n.state.selection.eq(u)){const f=n.state.tr.setSelection(u);h&&f.setMeta(_e,a.pos),n.dispatch(f)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),_e.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(_e,-1))}function l(a){const c=a,d=_e.getState(n.state);let h;if(d!=null)h=n.state.doc.resolve(d);else if(Es(n,c.target)!=i&&(h=ji(n,e),!h))return s();h&&r(h,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function qa(n,e,t){if(!(n.state.selection instanceof N))return null;const{$head:i}=n.state.selection;for(let o=i.depth-1;o>=0;o--){const r=i.node(o);if((t<0?i.index(o):i.indexAfter(o))!=(t<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const l=i.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Es(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ji(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?vn(n.state.doc.resolve(t.pos)):null}var Pp=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Co(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Co(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Co(n,e,t,i,o,r){var s;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let h=0,u=0;h<d.childCount;h++){const{colspan:f,colwidth:p}=d.child(h).attrs;for(let m=0;m<f;m++,u++){const g=o==u?r:p&&p[m],y=g?g+"px":"";if(l+=g||i,g||(a=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=y,e.appendChild(x)}}}for(;c;){const h=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=h}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var ae=new yn("tableColumnResizing");function Rp({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:i=Pp,lastColumnResizable:o=!0}={}){const r=new gn({key:ae,state:{init(s,l){var a,c;const d=(c=(a=r.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,h=Te(l.schema).table.name;return i&&d&&(d[h]=(u,f)=>new i(u,t,f)),new Vp(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=ae.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{Lp(s,l,n,o)},mouseleave:s=>{zp(s)},mousedown:(s,l)=>{Bp(s,l,e,t)}},decorations:s=>{const l=ae.getState(s);if(l&&l.activeHandle>-1)return _p(s,l.activeHandle)},nodeViews:{}}});return r}var Vp=class Kn{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,i=e.getMeta(ae);if(i&&i.setHandle!=null)return new Kn(i.setHandle,!1);if(i&&i.setDragging!==void 0)return new Kn(t.activeHandle,i.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return vo(e.doc.resolve(o))||(o=-1),new Kn(o,t.dragging)}return t}};function Lp(n,e,t,i){const o=ae.getState(n.state);if(o&&!o.dragging){const r=Fp(e.target);let s=-1;if(r){const{left:l,right:a}=r.getBoundingClientRect();e.clientX-l<=t?s=Ns(n,e,"left",t):a-e.clientX<=t&&(s=Ns(n,e,"right",t))}if(s!=o.activeHandle){if(!i&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=H.get(a),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}ja(n,s)}}}function zp(n){const e=ae.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&ja(n,-1)}function Bp(n,e,t,i){var o;const r=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=ae.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=Hp(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(ae,{setDragging:{startX:e.clientX,startWidth:a}}));function c(h){r.removeEventListener("mouseup",c),r.removeEventListener("mousemove",d);const u=ae.getState(n.state);u!=null&&u.dragging&&($p(n,u.activeHandle,Ds(u.dragging,h,t)),n.dispatch(n.state.tr.setMeta(ae,{setDragging:null})))}function d(h){if(!h.which)return c(h);const u=ae.getState(n.state);if(u&&u.dragging){const f=Ds(u.dragging,h,t);Is(n,u.activeHandle,f,i)}}return Is(n,s.activeHandle,a,i),r.addEventListener("mouseup",c),r.addEventListener("mousemove",d),e.preventDefault(),!0}function Hp(n,e,{colspan:t,colwidth:i}){const o=i&&i[i.length-1];if(o)return o;const r=n.domAtPos(e);let l=r.node.childNodes[r.offset].offsetWidth,a=t;if(i)for(let c=0;c<t;c++)i[c]&&(l-=i[c],a--);return l/a}function Fp(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Ns(n,e,t,i){const o=t=="right"?-i:i,r=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!r)return-1;const{pos:s}=r,l=vn(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=H.get(l.node(-1)),c=l.start(-1),d=a.map.indexOf(l.pos-c);return d%a.width==0?-1:c+a.map[d-1]}function Ds(n,e,t){const i=e.clientX-n.startX;return Math.max(t,n.startWidth+i)}function ja(n,e){n.dispatch(n.state.tr.setMeta(ae,{setHandle:e}))}function $p(n,e,t){const i=n.state.doc.resolve(e),o=i.node(-1),r=H.get(o),s=i.start(-1),l=r.colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<r.height;c++){const d=c*r.width+l;if(c&&r.map[d]==r.map[d-r.width])continue;const h=r.map[d],u=o.nodeAt(h).attrs,f=u.colspan==1?0:l-r.colCount(h);if(u.colwidth&&u.colwidth[f]==t)continue;const p=u.colwidth?u.colwidth.slice():Wp(u.colspan);p[f]=t,a.setNodeMarkup(s+h,null,{...u,colwidth:p})}a.docChanged&&n.dispatch(a)}function Is(n,e,t,i){const o=n.state.doc.resolve(e),r=o.node(-1),s=o.start(-1),l=H.get(r).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Co(r,a.firstChild,a,i,l,t)}function Wp(n){return Array(n).fill(0)}function _p(n,e){var t;const i=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return z.empty;const s=H.get(r),l=o.start(-1),a=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const d=a+c*s.width;if((a==s.width-1||s.map[d]!=s.map[d+1])&&(c==0||s.map[d]!=s.map[d-s.width])){const h=s.map[d],u=l+h+r.nodeAt(h).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=ae.getState(n))!=null&&t.dragging&&i.push(oe.node(l+h,l+h+r.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),i.push(oe.widget(u,f))}}return z.create(n.doc,i)}function Kp({allowTableNodeSelection:n=!1}={}){return new gn({key:_e,state:{init(){return null},apply(e,t){const i=e.getMeta(_e);if(i!=null)return i==-1?null:i;if(t==null||!e.docChanged)return t;const{deleted:o,pos:r}=e.mapping.mapResult(t);return o?null:r}},props:{decorations:gp,handleDOMEvents:{mousedown:Ip},createSelectionBetween(e){return _e.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Np,handleKeyDown:Ep,handlePaste:Dp},appendTransaction(e,t,i){return wp(i,vp(i,t),n)}})}const ln=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},Ps="data-gs-mrk-fs",Rs="data-gs-ib",ai="data-gs-ifrg",Ve="attrs",Ja={[Ve]:{default:"{}"}},Ee={[Ve]:{default:{}}},Ga=n=>({[Ve]:JSON.stringify(ln(n))}),Ne=n=>({attrs:ln(n)}),Ut=n=>e=>[n,e.attrs.attrs,0],$e=n=>n.attrs[Ve]?JSON.parse(n.attrs[Ve]):{},qp={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${ai}]`,getAttrs:Ne}],toDOM:()=>["span",{[ai]:""},0]},div:{group:"block",content:"inline*",attrs:Ee,parseDOM:[{tag:"div",getAttrs:Ne}],toDOM:Ut("div")},paragraph:{group:"block",content:"inline*",attrs:Ee,parseDOM:[{tag:"p",getAttrs:Ne}],toDOM:Ut("p")},orderedList:{group:"block",content:"listItem+",attrs:Ee,parseDOM:[{tag:"ol",getAttrs:Ne}],toDOM:Ut("ol")},bulletList:{group:"block",content:"listItem+",attrs:Ee,parseDOM:[{tag:"ul",getAttrs:Ne}],toDOM:Ut("ul")},listItem:{content:"block*",group:"block",attrs:Ee,parseDOM:[{tag:"li",getAttrs:Ne}],toDOM:Ut("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Ee,parseDOM:[{tag:"pre",getAttrs:Ne}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Ee,parseDOM:[{tag:"img[src]",getAttrs:Ne}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${Rs}]`}],toDOM(){return["br",{[Rs]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:Ee,parseDOM:[{tag:"br",getAttrs:Ne}],toDOM:n=>["br",{...n.attrs.attrs}]},heading:{group:"block",content:"inline*",attrs:{level:{default:1},attrs:{default:{}}},defining:!0,parseDOM:Array.from({length:6},(n,e)=>({tag:`h${e+1}`,getAttrs:t=>({level:e+1,attrs:ln(t)})})),toDOM({attrs:n}){const{level:e}=n;return[e?`h${e}`:"div",n.attrs,0]}},...up({tableGroup:"block",cellContent:"block+",cellAttributes:{[Ve]:{default:Ee[Ve].default,getFromDOM:ln,setDOMAttr:(n,e)=>{n&&Object.assign(e,n)}},background:{default:null,getFromDOM(n){return n.style.backgroundColor||null},setDOMAttr(n,e){n&&(e.style=(e.style||"")+`background-color: ${n};`)}}}}),nonTextNode:{group:"block",content:"block*",attrs:{tagName:{default:"span"},attrs:{default:{}}},parseDOM:[{tag:"*:not(tbody)",getAttrs:n=>({tagName:n.tagName.toLowerCase(),attrs:ln(n)}),priority:0}],toDOM(n){const{tagName:e,attrs:t}=n.attrs;return[e,t,0]}}},Zt=(n,e)=>({attrs:Ja,parseDOM:n.map(t=>({tag:t,getAttrs:Ga})),toDOM:e}),jp={strong:Zt(["strong","b"],n=>["b",$e(n)]),link:Zt(["a"],n=>["a",$e(n),0]),em:Zt(["em","i"],n=>["em",$e(n)]),underline:Zt(["u"],n=>["u",$e(n),0]),strikethrough:Zt(["s"],n=>["s",$e(n),0]),font_size:{attrs:{...Ja,size:{default:null}},parseDOM:[{tag:`span[${Ps}]`,getAttrs:n=>({...Ga(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...$e(n),[Ps]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}}},Vs=new dh({nodes:qp,marks:jp}),wi=new WeakMap,jo=new WeakMap,Jp=(n,e)=>{wi.set(n,e),jo.set(e,n)},Gp=(n,e)=>{wi.delete(n),jo.delete(e)},Ji=n=>wi.get(n),Up=n=>jo.get(n),Ls=n=>{var t;const e=Up(n);return(t=e==null?void 0:e.__gjsv)==null?void 0:t.model},Zp=n=>n.dispatchEvent(new CustomEvent("input"));function Yp(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(ai)){if(t.getAttribute("style")){t.removeAttribute(ai);return}const i=t.parentElement;if(i){for(;t.firstChild;)i.insertBefore(t.firstChild,t);i.removeChild(t)}}else Array.from(t.children).forEach(i=>e(i))};e(n)}function Xp(n,e={}){if(!e.enableOnClick)return()=>{};const t=n.Components.events,i=d=>n.getSelectedAll().includes(d),o=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),r=d=>d.isChildOf("text"),s=d=>n.getEditing()===d,l=(d,h={})=>{d.trigger("focus",h.event)},a=(d,h)=>{i(d)&&o(d)&&!s(d)&&l(d,h)},c=(d,h)=>{if(i(d)&&!o(d)&&r(d)){const u=d.parents().find(f=>f.isInstanceOf("text"));u&&(l(u,h),setTimeout(()=>n.select(u),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const Qp=(n,e)=>{const t=em(n);return t&&cm(t)?tm(n,e):t?Xl(()=>({type:n.schema.nodes.div}))(n,e):!1};function em(n){const e=n.selection.$from;if(e.node(e.depth).type===n.schema.nodes.inlineFragment){const t=e.depth-1;return e.node(t)}return e.node(e.depth)}function tm(n,e){const{selection:t,schema:i,tr:o}=n;o.split(t.from,1);const r=t.from+1,s=o.doc.nodeAt(r),l={...s.attrs.attrs,id:void 0},a=s.textContent.length>0,c=s.textContent.length||0,d=s.textContent||" ",h=i.text(d),u=i.nodes.div.create(l,a?h:[],[]);return o.replaceRangeWith(r,r+c+2,u),o.setSelection(N.create(o.doc,r+1)),e==null||e(o.scrollIntoView()),!0}function nm(n,e,t){const{state:i,dispatch:o}=n,{selection:r,tr:s}=i,l=(a,c,d)=>{const h={};return a.split(";").forEach(u=>{const[f,p]=u.split(":").map(m=>m.trim());f&&(h[f]=p)}),h[c]=d,Object.entries(h).map(([u,f])=>`${u}: ${f}`).join("; ")};if(!r.empty||t)s.doc.nodesBetween(r.from,r.to,(a,c)=>{var d,h;if(a.type===i.schema.nodes.image){const u=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}else if(a.type.isBlock){const u=l(((h=a.attrs.attrs)==null?void 0:h.style)||"","text-align",e);Ua(a)?s.setBlockType(r.from,void 0,i.schema.nodes.div,{attrs:{style:u}}):s.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:u}})}});else{const a=i.doc.resolve(r.from),c=a.start(a.depth),d=i.doc.nodeAt(c);if(d!=null&&d.type.isBlock){const h=l(d.attrs.style||"","text-align",e);s.setNodeMarkup(c,void 0,{...d.attrs,style:h})}}s.docChanged&&o(s.scrollIntoView())}const Yt=(n,e)=>{const{from:t,to:i}=n.selection;let o=!1;return n.doc.nodesBetween(t,i,r=>{if(o)return!1;r.marks.some(s=>s.type===e)&&(o=!0)}),o};function im(n,e,t="_blank"){const{state:i,dispatch:o}=n,{schema:r,selection:s,tr:l}=i,a=r.marks.link;try{const c=a.create({[Ve]:JSON.stringify({href:e,target:t})});l.addMark(s.from,s.to,c),o(l.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function om(n,e){const{state:t,dispatch:i}=n,{selection:o,tr:r}=t;if(o.empty)return;const s=t.schema.marks.font_size;if(!s){console.error("Font size mark is not defined in the schema.");return}r.addMark(o.from,o.to,s.create({size:e})),i(r.scrollIntoView())}const at=(n,e)=>{const{doc:t,selection:i}=n.state,o=t.resolve(i.from);for(let r=o.depth;r>0;r--){const s=o.node(r);if(e(s))return{pos:r>0?o.before(r):0,start:o.start(r),depth:r,node:s}}},rm=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,i])=>(t=t.replace(/-./g,o=>o.toUpperCase()[1]).trim(),e[t]=`${i}`.trim(),e),{});function sm(...n){return(e,t)=>{const i=s=>{e=e.apply(s),t==null||t(s)},o=n.pop();return n.reduce((s,l)=>s||l(e,i),!1)&&o!==void 0&&o(e,t)}}const lm=(n,e)=>{const{state:t,dispatch:i}=n;if(e!=null&&e.event){const{event:o}=e,r=n.posAtCoords({left:o.clientX,top:o.clientY});r!=null&&r.pos&&i(t.tr.setSelection(N.create(t.doc,r.pos)))}else Ql(t,i);setTimeout(()=>setTimeout(()=>n.focus()))},ko=n=>n.isBlock,Ua=n=>n.type.name==="inlineFragment",am=n=>ko(n)&&!Ua(n),Za=n=>n.type.name==="bulletList",Ya=n=>n.type.name==="orderedList",cm=n=>n.type.name==="heading",dm=n=>Za(n)||Ya(n),zs=(n,e)=>{var r,s;const t=(r=at(n,l=>l.type===e))==null?void 0:r.node,i=n.state.schema.nodes.listItem;let o;return t?o=lo(i):(s=at(n,dm))!=null&&s.node?o=sm(lo(i),$r(e)):o=$r(e),o(n.state,n.dispatch)},Xa=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(i=>i.type.name===e)},hm=n=>{var s;const{view:e,prop:t,editor:i,propCSS:o}=n,r=(s=at(e,am))==null?void 0:s.node;if(r){const l=r.attrs.attrs||{},a=rm(l.style);if(t in a)return a[t]||"";if(l.id){const c=i.Components.getById(l.id);return((c==null?void 0:c.getStyle())||{})[o]||""}}return""},um=n=>{const{view:e,prop:t,markName:i,editor:o,propCSS:r}=n,s=Xa(e,i);if(s){const l=s.attrs;if(l[t])return l[t];if(l[Ve]){const a=$e(s).id;if(a){const c=o.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[r]||""}}}return""},Qa=(n,e)=>{const{dispatch:t}=n,{nodes:i,marks:o}=n.state.schema;return{text:{selected:()=>{const{selection:r,doc:s}=n.state;return s.textBetween(r.from,r.to," ")},replace:(r,s={})=>{const{state:l}=n,{from:a}=l.selection;let c=l.tr.replaceSelectionWith(l.schema.text(r));s.select&&(c=c.setSelection(N.create(c.doc,a,a+r.length))),t==null||t(c)}},bold:{toggle:()=>it(o.strong)(n.state,t),isActive:()=>Yt(n.state,o.strong)},italic:{toggle:()=>it(o.em)(n.state,t),isActive:()=>Yt(n.state,o.em)},underline:{toggle:()=>it(o.underline)(n.state,t),isActive:()=>Yt(n.state,o.underline)},strikethrough:{toggle:()=>it(o.strikethrough)(n.state,t),isActive:()=>Yt(n.state,o.strikethrough)},link:{get:()=>{const r=Ls(n);if(r!=null&&r.is("link"))return r.getAttributes();{const s=Xa(n,"link");return s?$e(s):{}}},toggle:()=>it(o.link)(n.state,t),isActive:()=>Yt(n.state,o.link),create:r=>{const s=Ls(n);s!=null&&s.is("link")?(s.addAttributes({href:r.url,target:r.target}),n.focus()):im(n,r.url,r.target)}},alignText:{get:()=>hm({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:r=>nm(n,r.value,!0)},fontSize:{get:()=>um({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:r=>om(n,r.value)},image:{open(){const r="assetLayout",{state:s,dispatch:l}=n,{selection:a,doc:c}=s,d=c.textBetween(a.from,a.to," "),h={id:r,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:u=>{const f={alt:d,src:u.asset.getSrc()};l(s.tr.replaceSelectionWith(i.image.createAndFill({attrs:f})))}}};e.runCommand(Y.layoutToggle,h)}},heading:{get:()=>{var s;const r=(s=at(n,ko))==null?void 0:s.node;return`${(r==null?void 0:r.attrs.level)||""}`},set:({value:r})=>{var a;const{state:s}=n,l=(a=at(n,ko))==null?void 0:a.node;iu(s.schema.nodes.heading,{attrs:l==null?void 0:l.attrs.attrs,level:r?parseInt(r,10):0})(s,t)}},listBullet:{isActive:()=>{var r;return!!((r=at(n,Za))!=null&&r.node)},toggle:()=>zs(n,i.bulletList)},listOrdered:{isActive:()=>{var r;return!!((r=at(n,Ya))!=null&&r.node)},toggle:()=>zs(n,i.orderedList)}}},me="rte:selectionchange",he={bold:'<svg viewBox="0 0 24 24"><path d="M13.5,15.5H10V12.5H13.5A1.5,1.5 0 0,1 15,14A1.5,1.5 0 0,1 13.5,15.5M10,6.5H13A1.5,1.5 0 0,1 14.5,8A1.5,1.5 0 0,1 13,9.5H10M15.6,10.79C16.57,10.11 17.25,9 17.25,8C17.25,5.74 15.5,4 13.25,4H7V18H14.04C16.14,18 17.75,16.3 17.75,14.21C17.75,12.69 16.89,11.39 15.6,10.79Z" /></svg>',italic:'<svg viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',underline:'<svg viewBox="0 0 24 24"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z" /></svg>',strikethrough:'<svg viewBox="0 0 24 24"><path d="M7.2 9.8c-1.2-2.3.5-5 2.9-5.5 3.1-1 7.6.4 7.5 4.2h-3l-.1-.8c-.2-.6-.6-.9-1.2-1.1-.8-.3-2.1-.2-2.8.3C9 8.2 10.4 9.5 12 10H7.4l-.2-.2M21 13v-2H3v2h9.6l.6.2c.6.3 1.1.5 1.3 1.1.1.4.2.9 0 1.3-.2.5-.6.7-1.1.9-1.8.5-4-.2-3.9-2.4h-3c-.1 2.6 2.1 4.4 4.5 4.7 3.8.8 8.3-1.6 6.3-5.9l3.7.1Z"/></svg>',link:'<svg viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',image:'<svg viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z"></path></svg>',listBullet:'<svg viewBox="0 0 24 24"><path d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6 1.5 1.5 0 0 1 4 7.5 1.5 1.5 0 0 1 2.5 6 1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12 1.5 1.5 0 0 1 4 13.5 1.5 1.5 0 0 1 2.5 12 1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18 1.5 1.5 0 0 1 4 19.5 1.5 1.5 0 0 1 2.5 18 1.5 1.5 0 0 1 4 16.5Z"/></svg>',listOrdered:'<svg viewBox="0 0 24 24"><path d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.3-7a.8.8 0 0 1 .7.8c0 .1 0 .3-.2.5L3 13h2v1H2v-1l2-2H2v-1h2.3Z"/></svg>',alignTextLeft:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H15V9H3V7M3,11H21V13H3V11M3,15H15V17H3V15M3,19H21V21H3V19Z" /></svg>',alignTextCenter:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M7,7H17V9H7V7M3,11H21V13H3V11M7,15H17V17H7V15M3,19H21V21H3V19Z" /></svg>',alignTextRight:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M9,7H21V9H9V7M3,11H21V13H3V11M9,15H21V17H9V15M3,19H21V21H3V19Z" /></svg>',alignTextJustify:'<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H21V9H3V7M3,11H21V13H3V11M3,15H21V17H3V15M3,19H21V21H3V19Z" /></svg>'},fm=(n,e)=>{var a;const{editor:t,el:i}=n,o=wi.get(i),r=Qa(o,t),s={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:he.bold,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.bold.isActive()})}},onClick:({setState:c})=>{r.bold.toggle(),c({active:r.bold.isActive()})}},italic:{id:"italic",icon:he.italic,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.italic.isActive()})}},onClick:({setState:c})=>{r.italic.toggle(),c({active:r.italic.isActive()})}},underline:{id:"underline",icon:he.underline,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.underline.isActive()})}},onClick:({setState:c})=>{r.underline.toggle(),c({active:r.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:he.strikethrough,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.strikethrough.isActive()})}},onClick:({setState:c})=>{r.strikethrough.toggle(),c({active:r.strikethrough.isActive()})}},image:{id:"image",icon:he.image,size:"s",type:"button",onClick:()=>r.image.open()},link:{id:"link",icon:he.link,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.link.isActive(),disabled:o.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,{x:h,y:u,width:f,height:p}=d.getBoundingClientRect(),m="linkLayout",g=()=>t.runCommand(Y.layoutRemove,{id:m}),y=r.link.get(),x={id:m,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:h,y:u,w:f,h:p},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:b=>{b.preventDefault();const S=new FormData(b.currentTarget);r.link.create({url:S.get("url"),target:S.get("target")}),g()},children:[{type:"inputField",name:"url",label:"URL",placeholder:"eg. https://google.com",required:!0,value:(y==null?void 0:y.href)||"",onChange:({value:b,setState:S})=>S({value:b})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(y==null?void 0:y.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:b,setState:S})=>S({value:b})},{type:"row",style:{gap:10,justifyContent:"end"},children:[r.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{r.link.toggle(),g()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(Y.layoutToggle,x)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:he.alignTextLeft},{id:"center",icon:he.alignTextCenter},{id:"right",icon:he.alignTextRight},{id:"justify",icon:he.alignTextJustify}],editorEvents:{[me]:({setState:c})=>{c({value:r.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:he.listBullet,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.listBullet.isActive()})}},onClick:({setState:c})=>{r.listBullet.toggle(),c({active:r.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:he.listOrdered,size:"s",type:"button",editorEvents:{[me]:({setState:c})=>{c({active:r.listOrdered.isActive()})}},onClick:({setState:c})=>{r.listOrdered.toggle(),c({active:r.listOrdered.isActive()})}},heading:{id:"heading",type:"selectField",size:"s",value:"",emptyState:"Heading",options:[{id:"",label:"Normal"},{id:"1",label:"Heading 1"},{id:"2",label:"Heading 2"},{id:"3",label:"Heading 3"},{id:"4",label:"Heading 4"},{id:"5",label:"Heading 5"},{id:"6",label:"Heading 6"}],editorEvents:{[me]:({setState:c})=>{c({value:r.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.heading.set({value:c}),o.focus()}},fontSize:{id:"fontSize",type:"selectField",size:"s",value:"",emptyState:"Font size",options:[{id:"8pt",label:"8pt"},{id:"10pt",label:"10pt"},{id:"12pt",label:"12pt"},{id:"14pt",label:"14pt"},{id:"18pt",label:"18pt"},{id:"24pt",label:"24pt"},{id:"36pt",label:"36pt"}],editorEvents:{[me]:({setState:c})=>{c({value:r.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),r.fontSize.set({value:c}),o.focus()}}},l=[s.bold,s.italic,s.underline,s.strikethrough,s.image,s.link,s.listBullet,s.listOrdered,s.alignText,s.heading,s.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:r,layouts:s,proseMirror:{view:o},items:l}))||l};class pm{constructor(e,t,i){this.editor=i,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(o=>{this.dom.setAttribute(o,e.attrs.attrs[o])}),this.dom.addEventListener("dblclick",o=>this.handleDoubleClick(o))}handleDoubleClick(e){const{editor:t,view:i}=this;Qa(i,t).image.open(),e.preventDefault()}update(e){return e.type!==this.node.type?!1:(this.node=e,Object.keys(e.attrs.attrs).forEach(t=>{this.dom.setAttribute(t,e.attrs.attrs[t])}),!0)}selectNode(){this.dom.style.outline="2px solid #ffca6f"}deselectNode(){this.dom.style.outline=""}}class Xe{constructor(e,t,i={}){this.match=e,this.match=e,this.handler=typeof t=="string"?mm(t):t,this.undoable=i.undoable!==!1,this.inCode=i.inCode||!1}}function mm(n){return function(e,t,i,o){let r=n;if(t[1]){let s=t[0].lastIndexOf(t[1]);r+=t[0].slice(s+t[1].length),i+=s;let l=i-o;l>0&&(r=t[0].slice(s-l,s)+r,i=o)}return e.tr.insertText(r,i,o)}}const gm=500;function ym({rules:n}){let e=new gn({state:{init(){return null},apply(t,i){let o=t.getMeta(this);return o||(t.selectionSet||t.docChanged?null:i)}},props:{handleTextInput(t,i,o,r){return Bs(t,i,o,r,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:i}=t.state.selection;i&&Bs(t,i.pos,i.pos,"",n,e)})}}},isInputRules:!0});return e}function Bs(n,e,t,i,o,r){if(n.composing)return!1;let s=n.state,l=s.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-gm),l.parentOffset,null,"")+i;for(let c=0;c<o.length;c++){let d=o[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let h=d.match.exec(a),u=h&&d.handler(s,h,e-(h[0].length-i.length),t);if(u)return d.undoable&&u.setMeta(r,{transform:u,from:e,to:t,text:i}),n.dispatch(u),!0}return!1}const bm=new Xe(/--$/,"—"),wm=new Xe(/\.\.\.$/,"…"),Sm=new Xe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),vm=new Xe(/"$/,"”"),xm=new Xe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Cm=new Xe(/'$/,"’"),km=[Sm,vm,xm,Cm];function Jo(n,e,t=null,i){return new Xe(n,(o,r,s,l)=>{let a=t instanceof Function?t(r):t,c=o.tr.delete(s,l),d=c.doc.resolve(s),h=d.blockRange(),u=h&&Ll(h,e,a);if(!u)return null;c.wrap(h,u);let f=c.doc.resolve(s-1).nodeBefore;return f&&f.type==e&&fi(c.doc,s-1)&&(!i||i(r,f))&&c.join(s-1),c})}function ec(n,e,t=null){return new Xe(n,(i,o,r,s)=>{let l=i.doc.resolve(r),a=t instanceof Function?t(o):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?i.tr.delete(r,s).setBlockType(r,r,e,a):null})}function Tm(n){return Jo(/^\s*>\s$/,n)}function Mm(n){return Jo(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function Am(n){return Jo(/^\s*([-+*])\s$/,n)}function Om(n){return ec(/^```$/,n)}function Em(n,e){return ec(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function Nm(n){const e=km.concat(wm,bm);let t;return(t=n.nodes.blockquote)&&e.push(Tm(t)),(t=n.nodes.orderedList)&&e.push(Mm(t)),(t=n.nodes.bulletList)&&e.push(Am(t)),(t=n.nodes.codeBlock)&&e.push(Om(t)),(t=n.nodes.heading)&&e.push(Em(t,6)),ym({rules:e})}const Dm="rteProseMirror",Im=function(n,e={}){const t={plugins:s=>s.plugins,...e},i=(s,l)=>{var p,m;const a=((p=t.schema)==null?void 0:p.call(t,{editor:n,schema:Vs}))||Vs,{nodes:c,marks:d}=a,h=Ht.fromSchema(a).parse(s),u=Nt.create({doc:h,schema:a,plugins:(m=t.plugins)==null?void 0:m.call(t,{editor:n,plugins:[Rp(),Kp(),Nm(a),mu(),Fi({Tab:Ts(1),"Shift-Tab":Ts(-1)}),Fi({Enter:hn(Yl,Cu(c.listItem),Qp),"Shift-Enter":hn(Zl,(g,y)=>(y&&y(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":ra,"Mod-y":so,"Mod-Shift-z":so,"Mod-b":it(d.strong),"Mod-i":it(d.em),"Shift-Tab":lo(c.listItem),Tab:Mu(c.listItem)}),Fi(su)]})}),f=new rp({mount:s},{state:u,dispatchTransaction(g){var v;const{state:y}=f,x=y.apply(g),b=!y.doc.eq(x.doc);f.updateState(x);const S=!y.selection.eq(x.selection);b&&(Zp(((v=l==null?void 0:l.view)==null?void 0:v.el)||s),f.focus()),(S||b)&&n.trigger(me)}});return s.__rteView=f,f.setProps({nodeViews:{image(g){return new pm(g,f,n)}}}),f},o=s=>fm(s,t);n.setCustomRte({toolbar:o,parseContent:!0,async enable(s,l,a){const c=Ji(s);if(c)return c;const d=i(s,a);return Jp(s,d),lm(d,a),d},disable(s){const l=Ji(s);if(l)return Gp(s,l),l.destroy(),{forceSync:!0}},getContent(s){const l=Ji(s);if(l){const{schema:a,doc:c}=l.state,d=document.createElement("div"),h=wt.fromSchema(a).serializeFragment(c.content);return h.childNodes.forEach(u=>{u.nodeType===Node.ELEMENT_NODE&&u.innerHTML===""&&(u.innerHTML="<br/>")}),d.appendChild(h),Yp(d),s.classList.remove("ProseMirror-focused"),d.innerHTML}return s.innerHTML}});const r=Xp(n,t);Ae({editor:n,licenseKey:t.licenseKey,plan:ee.free,pluginName:Dm,cleanup:()=>{n.RichTextEditor.customRte=void 0,r()}})},Pm=Me(Im),Rm=n=>{const e={};for(const t of Object.keys(n)){let i=n[t];i&&(Array.isArray(i)?i=i.map(o=>o.toString()).join(","):i=i.toString(),e[t]=i)}return new URLSearchParams(e)},Vm=n=>{const{apiKey:e,searchParams:t,thumbnailQuality:i="high"}=n,o=(l={})=>{const c="https://www.googleapis.com/youtube/v3/search",d=Rm(l);return`${c}?${d}`},r=l=>{var a,c,d;return((a=l[i])==null?void 0:a.url)||((c=l.high)==null?void 0:c.url)||((d=l.medium)==null?void 0:d.url)||l.default.url},s=l=>{const a=r(l.snippet.thumbnails);return{id:l.id.videoId,src:`https://www.youtube.com/watch?v=${l.id.videoId}`,name:l.snippet.title,customData:{thumbnailUrl:a,videoItem:l}}};return{id:"youtube",types:["youtube-video"],label:"YouTube Videos",search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:l,pageCustomData:a}){var m;const c={maxResults:25,q:l,pageToken:a==null?void 0:a.token,type:["video"],key:e},d=t==null?void 0:t({searchValue:l}),h={...c,...d};h.part?h.part.includes("snippet")||h.part.push("snippet"):h.part=["snippet"];const f=await(await fetch(o(h))).json();return(m=f.items)!=null&&m.length?{items:f.items.map(s),nextPageCustomData:{token:f.nextPageToken},isLastPage:!f.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:l,onSelect:a})=>({type:"column",onClick:()=>a(l),htmlAttrs:{title:l.name},style:{border:"1px solid gray",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=l.customData)==null?void 0:c.thumbnailUrl}" alt="${l.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:l.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},Lm="youtubeAssetProvider",zm=function(n,e){const{skipVideoComponent:t}=e,i=Vm(e);n.runCommand(Y.assetProviderAdd,{provider:i});const o="search-on-youtube",r="video";if(!t){const s=n.Components.getType(r).model.prototype;n.Components.addType(r,{model:{getYoutubeTraits(){const[l,...a]=s.getYoutubeTraits.apply(this);return[l,{id:o,type:"button",label:n.I18n.t("youtube.searchBtn"),command:()=>{n.AssetManager.open({select:c=>{n.Assets.close(),this.set({videoId:c.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})}},...a]}}})}Ae({editor:n,licenseKey:e.licenseKey,plan:ee.startup,pluginName:Lm,cleanup:()=>{if(n.runCommand(Y.assetProviderRemove,{id:i.id}),!t){const s=n.Components.getType(r).model.prototype;n.Components.addType(r,{model:{getYoutubeTraits(){return s.getYoutubeTraits.apply(this).filter(l=>l.id!==o)}}})}}})},Bm=Me(zm);exports.dialogComponent=gc;exports.fsLightboxComponent=fd;exports.iconifyComponent=Dc;exports.lightGalleryComponent=Cd;exports.listPagesComponent=cd;exports.rteProseMirror=Pm;exports.rteTinyMce=Jd;exports.swiperComponent=Bd;exports.tableComponent=nd;exports.youtubeAssetProvider=Bm;