@grapesjs/studio-sdk-plugins 1.0.11 → 1.0.12

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.
package/dist/index.umd.js CHANGED
@@ -1,14 +1,14 @@
1
- (function(le,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("grapesjs")):typeof define=="function"&&define.amd?define(["exports","grapesjs"],St):(le=typeof globalThis<"u"?globalThis:le||self,St(le.StudioSdkPlugins={}))})(this,function(le){"use strict";const St="app.grapesjs.com",$r="app-stage.grapesjs.com",Wr=[St,$r,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],La="license:check:start",Ha="license:check:end",Fa=()=>typeof window<"u",$a=({isDev:n,isStage:e})=>`${n?"":`https://${e?$r:St}`}/api`,Wa=()=>{const n=Fa()&&window.location.hostname;return!!n&&(Wr.includes(n)||Wr.some(e=>n.endsWith(e)))},_a=n=>n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase()),qa=n=>typeof n<"u";function _r(n){return typeof n=="function"}var ae=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(ae||{});async function Ka({path:n,baseApiUrl:e,method:t="GET",headers:i={},params:r,body:s}){const l=`${e||$a({isDev:!1,isStage:!1})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...i}};s&&(a.body=JSON.stringify(s));const c=r?new URLSearchParams(r).toString():"",d=c?`?${c}`:"",h=await fetch(`${l}${d}`,a);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}const qr={[ae.free]:0,[ae.startup]:10,[ae.business]:20,[ae.enterprise]:30};function Ja(n){const e=n;return e.init=t=>i=>n(i,t),e}const Ze=n=>Ja(n);async function Xe({editor:n,plan:e,pluginName:t,licenseKey:i,cleanup:r}){let s="",o=!1;const l=Wa(),a=d=>{console.warn("Cleanup plugin:",t,"Reason:",d),r()},c=(d={})=>{var m;const{error:h,sdkLicense:f}=d,u=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||h)a(h||"Invalid license");else if(u){const g=qr[e],b=qr[u];g>b&&a({pluginRequiredPlan:e,licensePlan:u})}};n.on(La,d=>{s=d==null?void 0:d.baseApiUrl,o=!0}),n.on(Ha,d=>{c(d)}),setTimeout(async()=>{if(!o){if(l)return;if(i){const d=await ja({licenseKey:i,pluginName:t,baseApiUrl:s});d&&c(d)}else a("The `licenseKey` option not provided")}},2e3)}async function ja(n){const{licenseKey:e,pluginName:t,baseApiUrl:i}=n;try{return(await Ka({baseApiUrl:i,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const wi=(n,e)=>{var t;return!!((t=n==null?void 0:n.hasAttribute)!=null&&t.call(n,e))},Ye=(n,e)=>{var t;return!!((t=n==null?void 0:n.classList)!=null&&t.contains(e))},Ga=(n,e={})=>{var s;const t={},i=[],r=[];for(const o in n){const{value:l,...a}=n[o];i.push({id:o,name:o,changeProp:!0,category:e.category,...a}),t[o]=l,!qa(l)&&r.push(o);const{subTraits:c={}}=a;for(const d in a.subTraits)(s=c[d])==null||s.forEach(h=>{const f=h.id||h.name;t[f]=h.value})}return{propKeys:Object.keys(t),propsNoValues:r,props:t,traits:i}},Ua=(n,e)=>{e.forEach(t=>{if(t.subTraits){const i=`${t.id||t.name}`,r=t.changeProp?`change:${i}`:`change:attributes:${i}`;n.on(r,()=>Kr(n,i)),Kr(n,i)}})},Kr=(n,e)=>{const t=n.getTrait(e),i=t.get("category"),r=t.get("subTraits")||{},o=(Object.values(r).flat()||[]).map(c=>c.id||c.name);n.removeTrait(o);const l=r[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:i,...c})),{at:a})},Za=(n,e)=>{e.forEach(t=>{const i=_a(t);i!==t&&n.has(i)&&n.set({[t]:n.get(i),[i]:void 0})})},Si="gjs-plg-",Jr=(...n)=>n.map(e=>`[data-gjs-type="${e}"]`).join(","),Xa="dialogComponent",Ya=Ze(function(n,e={}){const{Blocks:t,Components:i}=n,{licenseKey:r}=e,s="gjs-plg-dialog",o="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",f="gjs-plg-dialog-placeholder";t.add(s,{label:"Dialog",media:`
1
+ (function(Xe,Os){typeof exports=="object"&&typeof module<"u"?Os(exports,require("grapesjs"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","grapesjs","react","react-dom"],Os):(Xe=typeof globalThis<"u"?globalThis:Xe||self,Os(Xe.StudioSdkPlugins={},Xe.grapesjs,Xe.React,Xe.ReactDOM))})(this,function(Xe,Os,C,Es){"use strict";function Wf(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 Mt=Wf(C),gb=Wf(Es),Uf="app.grapesjs.com",qf="app-stage.grapesjs.com",Gf=[Uf,qf,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],bb="license:check:start",vb="license:check:end",Kf=()=>typeof window<"u",yb=(t="",e)=>{const r=new DOMParser().parseFromString(t,"text/html");if(e){const o=r.querySelectorAll("svg")[0].style||{},s=Ob(e)?`${e}px`:e;o.width=s,o.height=s,o.fill="currentColor"}return new XMLSerializer().serializeToString(r)},wb=({isDev:t,isStage:e})=>`${t?"":`https://${e?qf:Uf}`}/api`,Zf=(t={})=>{const{width:e=300,height:n,text:r="IMAGE",bg:i="777",fg:o="white"}=t,s=n?`x${n}`:"";return`https://placehold.co/${e}${s}/${i}/${o}.png?text=${r}`},xb=Zf(),Sb=()=>{const t=Kf()&&window.location.hostname;return!!t&&(Gf.includes(t)||Gf.some(e=>t.endsWith(e)))},Pl=t=>t&&t.charAt(0).toUpperCase()+t.substring(1),Cb=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,n)=>(n?"-":"")+e.toLowerCase()),Jf=t=>typeof t<"u",Yf=t=>typeof t=="string",Ob=t=>typeof t=="number";function hi(t){return typeof t=="function"}const Eb=t=>(t||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim();var vt=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(vt||{});async function _b({path:t,baseApiUrl:e,method:n="GET",headers:r={},params:i,body:o}){const a=`${e||wb({isDev:!1,isStage:!1})}${t}`,l={method:n,headers:{"Content-Type":"application/json",...r}};o&&(l.body=JSON.stringify(o));const c=i?new URLSearchParams(i).toString():"",u=c?`?${c}`:"",f=await fetch(`${a}${u}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}const Xf={[vt.free]:0,[vt.startup]:10,[vt.business]:20,[vt.enterprise]:30};function kb(t){const e=t;return e.init=n=>r=>t(r,n),e}const Jn=t=>kb(t);async function Yn({editor:t,plan:e,pluginName:n,licenseKey:r,cleanup:i}){let o="",s=!1;const a=Sb(),l=u=>{console.warn("Cleanup plugin:",n,"Reason:",u),i()},c=(u={})=>{var m;const{error:f,sdkLicense:d}=u,p=(m=u.plan)==null?void 0:m.category;if(!(d||u.license)||f)l(f||"Invalid license");else if(p){const g=Xf[e],y=Xf[p];g>y&&l({pluginRequiredPlan:e,licensePlan:p})}};t.on(bb,u=>{o=u==null?void 0:u.baseApiUrl,s=!0}),t.on(vb,u=>{c(u)}),setTimeout(async()=>{if(!s){if(a)return;if(r){const u=await Ab({licenseKey:r,pluginName:n,baseApiUrl:o});u&&c(u)}else l("The `licenseKey` option not provided")}},2e3)}async function Ab(t){const{licenseKey:e,pluginName:n,baseApiUrl:r}=t;try{return(await _b({baseApiUrl:r,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const Vl=(t,e)=>{var n;return!!((n=t==null?void 0:t.hasAttribute)!=null&&n.call(t,e))},Ar=(t,e)=>{var n;return!!((n=t==null?void 0:t.classList)!=null&&n.contains(e))},Tb=(t,e={})=>{var o;const n={},r=[],i=[];for(const s in t){const{value:a,...l}=t[s];r.push({id:s,name:s,changeProp:!0,category:e.category,...l}),n[s]=a,!Jf(a)&&i.push(s);const{subTraits:c={}}=l;for(const u in l.subTraits)(o=c[u])==null||o.forEach(f=>{const d=f.id||f.name;n[d]=f.value})}return{propKeys:Object.keys(n),propsNoValues:i,props:n,traits:r}},Mb=(t,e)=>{e.forEach(n=>{if(n.subTraits){const r=`${n.id||n.name}`,i=n.changeProp?`change:${r}`:`change:attributes:${r}`;t.on(i,()=>Qf(t,r)),Qf(t,r)}})},Qf=(t,e)=>{const n=t.getTrait(e),r=n.get("category"),i=n.get("subTraits")||{},s=(Object.values(i).flat()||[]).map(c=>c.id||c.name);t.removeTrait(s);const a=i[n.getValue()],l=t.getTraitIndex(e)+1;a&&t.addTrait(a.map(c=>({category:r,...c})),{at:l})},Nb=(t,e)=>{e.forEach(n=>{const r=Cb(n);r!==n&&t.has(r)&&t.set({[n]:t.get(r),[r]:void 0})})},Dl="gjs-plg-",ed=(...t)=>t.map(e=>`[data-gjs-type="${e}"]`).join(","),Pb="dialogComponent",Vb=Jn(function(t,e={}){const{Blocks:n,Components:r}=t,{licenseKey:i}=e,o="gjs-plg-dialog",s="gjs-plg-dialog-overlay",a="gjs-plg-dialog-content",l="gjs-plg-dialog-close",c="gjs-plg-dialog-title",u="gjs-plg-dialog-body",f="gjs-plg-dialog-description",d="gjs-plg-dialog-placeholder";n.add(o,{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:s},activate:!0,...e.block}),i.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:[{type:o},{type:f}],draggable:Jr("wrapper"),droppable:Jr(s),styles:`
6
- .${s} {
5
+ `,category:"Extra",content:{type:o},activate:!0,...e.block}),r.addType(o,{model:{defaults:{tagName:"div",attributes:{class:o,"data-type-role":o},components:[{type:s},{type:d}],draggable:ed("wrapper"),droppable:ed(o),styles:`
6
+ .${o} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
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 x=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),k=m.querySelector('[data-type-role="gjs-plg-dialog-close"]');function N(){x.style.display="none"}S?(m._onCloseWhenPressingX=N,k.addEventListener("click",m._onCloseWhenPressingX)):(k.removeEventListener("click",m._onCloseWhenPressingX),m._onCloseWhenPressingX=null)}function b(S){const x=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(N){N.key==="Escape"&&(x.style.display="none")}S?(m._onCloseWhenPressingEsc=k,m.addEventListener("keydown",m._onCloseWhenPressingEsc)):(m.removeEventListener("keydown",m._onCloseWhenPressingEsc),m._onCloseWhenPressingEsc=null)}function C(S){const x=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(){x.style.display="flex"}S?(m._onOpenWhenLeavingWindow=k,document.addEventListener("mouseleave",m._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",m._onOpenWhenLeavingWindow),m._onOpenWhenLeavingWindow=null)}function y(S){const x=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function k(){const N=document.documentElement.scrollTop;S&&N>=Number(S)&&(x.style.display="flex")}S?(m._onOpenWhenScrollingToLevel=k,document.addEventListener("scroll",m._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",m._onOpenWhenScrollingToLevel),m._onOpenWhenScrollingToLevel=null)}g(p.closeWhenPressingX),b(p.closeWhenPressingEsc),C(p.openWhenLeavingWindow),y(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(o,{model:{defaults:{tagName:"div",attributes:{class:o,"data-type-role":o},components:{type:l},droppable:!1,draggable:!1,styles:`
11
- .${o} {
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(h){var m;(m=h.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(h){const m=this;function g(O){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),E=m.querySelector('[data-type-role="gjs-plg-dialog-close"]');function A(){v.style.display="none"}O?(m._onCloseWhenPressingX=A,E.addEventListener("click",m._onCloseWhenPressingX)):(E.removeEventListener("click",m._onCloseWhenPressingX),m._onCloseWhenPressingX=null)}function y(O){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(A){A.key==="Escape"&&(v.style.display="none")}O?(m._onCloseWhenPressingEsc=E,m.addEventListener("keydown",m._onCloseWhenPressingEsc)):(m.removeEventListener("keydown",m._onCloseWhenPressingEsc),m._onCloseWhenPressingEsc=null)}function w(O){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(){v.style.display="flex"}O?(m._onOpenWhenLeavingWindow=E,document.addEventListener("mouseleave",m._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",m._onOpenWhenLeavingWindow),m._onOpenWhenLeavingWindow=null)}function x(O){const v=m.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function E(){const A=document.documentElement.scrollTop;O&&A>=Number(O)&&(v.style.display="flex")}O?(m._onOpenWhenScrollingToLevel=E,document.addEventListener("scroll",m._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",m._onOpenWhenScrollingToLevel),m._onOpenWhenScrollingToLevel=null)}g(h.closeWhenPressingX),y(h.closeWhenPressingEsc),w(h.openWhenLeavingWindow),x(h.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 h=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');h.style.display="flex"}}}),r.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:{type:a},droppable:!1,draggable:!1,styles:`
11
+ .${s} {
12
12
  position: fixed;
13
13
  top: 0;
14
14
  left: 0;
@@ -19,8 +19,8 @@
19
19
  justify-content: center;
20
20
  background-color: rgba(0, 0, 0, 0.5);
21
21
  }
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
- .${l} {
22
+ `}}}),r.addType(a,{model:{defaults:{tagName:"div",attributes:{class:a,"data-type-role":a},components:[{type:l},{type:c},{type:u}],droppable:!1,draggable:!1,styles:`
23
+ .${a} {
24
24
  position: relative;
25
25
  background-color: #fff;
26
26
  border-radius: 10px;
@@ -30,8 +30,8 @@
30
30
  height: 600px;
31
31
  box-sizing: border-box;
32
32
  }
33
- `}}}),i.addType(a,{model:{defaults:{tagName:"button",attributes:{class:a,"data-type-role":a},components:"&times;",droppable:!1,draggable:!1,styles:`
34
- .${a} {
33
+ `}}}),r.addType(l,{model:{defaults:{tagName:"button",attributes:{class:l,"data-type-role":l},components:"&times;",droppable:!1,draggable:!1,styles:`
34
+ .${l} {
35
35
  position: absolute;
36
36
  top: 10px;
37
37
  right: 10px;
@@ -42,36 +42,36 @@
42
42
  font-size: 20px;
43
43
  cursor: pointer;
44
44
  }
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:`
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:`
46
46
  .${c} {
47
47
  margin: 0;
48
48
  padding: 0 40px 20px 0;
49
49
  }
50
- `}}}),i.addType(d,{model:{defaults:{tagName:"div",attributes:{class:d,"data-type-role":d},components:[{type:h}],styles:`
51
- .${d} {
50
+ `}}}),r.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:f}],styles:`
51
+ .${u} {
52
52
  height: 90%;
53
53
  overflow: auto;
54
54
  }
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} {
55
+ `}}}),r.addType(f,{model:{defaults:{tagName:"p",attributes:{class:f,"data-type-role":f},components:"This is a customizable dialog!",editable:!0,styles:`
56
+ .${f} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),i.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(){this.listenTo(this.em,"run:core:preview",()=>{this.el.style.display="none"}),this.listenTo(this.em,"stop:core:preview",()=>{this.el.style.display=""})}}}),Xe({editor:n,licenseKey:r,plan:ae.startup,pluginName:Xa,cleanup:()=>{t.remove(s),i.removeType(s)}})});function jr(n,e,t){let i,r,s,o,l;const a=e;function c(){const h=Date.now()-o;h<a&&h>=0?i=setTimeout(c,a-h):(i=null,l=n.apply(s,r),s=r=null)}const d=function(){return s=this,r=arguments,o=Date.now(),i||(i=setTimeout(c,a)),l};return d.clear=function(){i&&(clearTimeout(i),i=null)},d.flush=function(){i&&(l=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},d}var Gt=(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.contextMenuComponent="studio:contextMenuComponent",n.layoutAdd="studio:layoutAdd",n.layoutRemove="studio:layoutRemove",n.layoutToggle="studio:layoutToggle",n))(Gt||{}),M=(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))(M||{});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>'},we="table",Gr="thead",Ur="tfoot",xi="tbody",te="row",z="cell",vi="clipboardTable",Qa=[we,Gr,Ur,xi,te,z],kn=n=>n.em.get(vi)||[],ec=n=>n.every(e=>e.is(z)),Ci=(n,e)=>{const{editor:t,event:i,opts:r}=n,s=i.currentTarget||i.target,{x:o,y:l,width:a,height:c}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:o,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};_r(r.openSettings)?r.openSettings({...n,layoutProps:d}):t.runCommand(Gt.layoutToggle,d)},tc=(n,{rows:e=1,cells:t=5,text:i}={})=>({type:n,components:Array.from(Array(e).keys()).map(r=>({type:te,components:Array.from(Array(t).keys()).map(s=>({type:z,components:i?{type:"text",content:_r(i)?i({y:r,x:s}):i}:void 0}))}))}),Zr="Table settings",Xr=n=>{const{component:e}=n;return e.is(we)?e:e.closestType(we)},nc=n=>{var e;(e=Xr(n))==null||e.remove(n.opts)},ic=n=>{const e=Xr(n);e&&(n.editor.select(e),Ci(n,{id:"tableSettings",header:{label:Zr}}))},Yr=n=>[{id:M.table,icon:D[M.table],label:"Table",items:[{id:M.tableSettings,label:Zr,icon:D[M.tableSettings],onClick:({event:t})=>ic({...n,event:t})},{id:M.tableDelete,label:"Delete table",icon:D[M.tableDelete],onClick:()=>nc(n)}]}],Qr=({editor:n})=>{const e=kn(n);return e.length&&ec(e)},es=({component:n,editor:e,after:t})=>{if(!n.is(z))return;const i=n.closestType(we),r=n.closestType(te),s=n.index()+(t?1:0);i==null||i.findType(te).forEach(l=>l.append({type:z},{at:s}));const o=r==null?void 0:r.components().at(s);o&&e.select(o)},ts=({component:n,opts:e})=>{if(!n.is(z))return;const t=n.closestType(we),i=n.index();t==null||t.findType(te).forEach(r=>{var s;return(s=r.components().at(i))==null?void 0:s.remove(e)})},ns=({component:n,editor:e})=>{if(!n.is(z))return;const t=n.closestType(we),i=n.index(),r=(t==null?void 0:t.findType(te).map(s=>s.components().at(i)))||[];r.length&&e.em.set(vi,r)},is=n=>{const{component:e,editor:t,after:i}=n;if(!e.is(z)||!Qr(n))return;const r=kn(t),s=e.closestType(we),o=e.index()+(i?1:0);s==null||s.findType(te).forEach((l,a)=>{const c=r[a],d=(c==null?void 0:c.clone())||{type:z};l.append(d,{at:o})})},rc=n=>{const{component:e}=n;e.is(z)&&(ns(n),ts({...n,opts:{temporary:!0}}))},sc=n=>{const e=Qr(n);return[{id:M.tableColumnItems,icon:D[M.tableColumn],label:"Column",items:[{id:M.tableColumnInsertBefore,label:"Insert column before",icon:D[M.tableColumnInsertBefore],onClick:()=>es(n)},{id:M.tableColumnInsertAfter,label:"Insert column after",icon:D[M.tableColumnInsertAfter],onClick:()=>es({...n,after:!0})},{id:M.tableColumnDelete,label:"Delete column",icon:D[M.tableColumnDelete],onClick:()=>ts(n)},{id:M.tableColumnCut,label:"Cut column",icon:D[M.tableColumnCut],onClick:()=>rc(n)},{id:M.tableColumnCopy,label:"Copy column",icon:D[M.tableColumnCopy],onClick:()=>ns(n)},{id:M.tableColumnPasteBefore,label:"Paste column before",icon:D[M.tableColumnPasteBefore],disabled:!e,onClick:()=>is(n)},{id:M.tableColumnPasteAfter,label:"Paste column after",icon:D[M.tableColumnPasteAfter],disabled:!e,onClick:()=>is({...n,after:!0})}]}]},rs="Row settings",oc=n=>n.every(e=>e.is(te)),xt=n=>{const{component:e}=n,t=e.is(z),i=e.is(te);if(!(!t&&!i))return i?e:e.closestType(te)},ss=n=>{const{component:e,editor:t,after:i}=n,r=xt(n);if(!r)return;const s=r.index()+(i?1:0),o=r.components().length,l=Array.from(Array(o).keys()).map(()=>({type:z})),a=r.parent();if(a){const c=a.append({type:te,components:l},{at:s})[0];if(e.is(z)&&c){const d=e.index(),h=c.components().at(d);h&&t.select(h)}}},ls=n=>{var e;(e=xt(n))==null||e.remove(n.opts)},as=n=>{const e=xt(n);e&&n.editor.em.set(vi,[e])},cs=n=>{var l;const{editor:e,after:t}=n,i=xt(n);if(!i||!ds(n))return;const s=kn(e)[0],o=i.index()+(t?1:0);s&&((l=i.parent())==null||l.append(s.clone(),{at:o}))},lc=n=>{xt(n)&&(as(n),ls({...n,opts:{temporary:!0}}))},ds=({editor:n})=>{const e=kn(n);return e.length&&oc(e)},ac=n=>{const e=xt(n);e&&(n.editor.select(e),Ci(n,{id:"tableRowSettings",header:{label:rs}}))},hs=n=>{const e=ds(n);return[{id:M.tableRowItems,icon:D[M.tableRowProperties],label:"Row",items:[{id:M.tableRowInsertBefore,label:"Insert row before",icon:D[M.tableRowInsertBefore],onClick:()=>ss(n)},{id:M.tableRowInsertAfter,label:"Insert row after",icon:D[M.tableRowInsertAfter],onClick:()=>ss({...n,after:!0})},{id:M.tableRowDelete,label:"Delete row",icon:D[M.tableRowDelete],onClick:()=>ls(n)},{id:M.tableRowProperties,label:rs,icon:D[M.tableRowProperties],onClick:({event:i})=>ac({...n,event:i})},{id:M.tableRowCut,label:"Cut row",icon:D[M.tableRowCut],onClick:()=>lc(n)},{id:M.tableRowCopy,label:"Copy row",icon:D[M.tableRowCopy],onClick:()=>as(n)},{id:M.tableRowPasteBefore,label:"Paste row before",icon:D[M.tableRowPasteBefore],disabled:!e,onClick:()=>cs(n)},{id:M.tableRowPasteAfter,label:"Paste row after",icon:D[M.tableRowPasteAfter],disabled:!e,onClick:()=>cs({...n,after:!0})}]},...Yr(n)]},ki=n=>{const e=n.attributes.attributes||{},t=parseInt(`${e.rowspan||1}`,10),i=parseInt(`${e.colspan||1}`,10);return{rowspan:t,colspan:i}};function fs(n){const e=[];return n.components().forEach((t,i)=>{t.components().each((r,s)=>{const{rowspan:o,colspan:l}=ki(r);if(e[i])for(;e[i][s];)s++;for(let a=i;a<i+o;a++){e[a]||(e[a]=[]);for(let c=s;c<s+l;c++)e[a][c]={real:a===i&&c===s,cell:r,rowspan:o,colspan:l}}})}),e}function vt(n,e,t){var i;return(i=n[t])==null?void 0:i[e]}const Mi=n=>n.closestType(te);function cc(n,{x:e,y:t,rows:i,cols:r}){var l;let s=Mi(n[t][e].cell),o;for(let a=1;a<=i;a++)if(s=(l=s==null?void 0:s.parent())==null?void 0:l.components().at(s.index()+1),s){for(o=e;o>=0;o--){const{cell:c}=n[t+a][o],d=Mi(c);if(d===s){for(let h=1;h<=r;h++){const f=c.index();d.append({type:z},{at:f+1})}break}}if(o===-1){const d=s.components().at(0).index();for(let h=1;h<=r;h++)s.append({type:z},{at:d})}}}function us(n){for(let e=0;e<n.length;e++)for(let t=0;t<n[e].length;t++){const r=n[e][t].cell;if(r.em.selected.hasComponent(r)){const{rowspan:s,colspan:o}=ki(r);if(o>1||s>1){r.addAttributes({colspan:1,rowspan:1});for(let l=0;l<o-1;l++){const a=r.index();Mi(r).append({type:z},{at:a+1})}cc(n,{x:t,y:e,rows:s-1,cols:o})}}}}function dc(n){const e=[];n.components().forEach(t=>{t.components().length||e.push(t)}),e.forEach(t=>t.remove())}const Mn=(n,e={})=>{var o;const t=fs(n),{em:i}=n;let r,s;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++){const c=t[l][a];if((o=e.selected)!=null&&o.includes(c.cell)||i.selected.hasComponent(c.cell)){const d={x:a,y:l};r||(r=d),s=d}}return{grid:t,startPos:r,endPos:s}};function hc(n,e={}){const t=Mn(n),{startPos:i,endPos:r}=t;let{grid:s}=t;const{em:o}=n;if(!i||!r)return;const l=i.x,a=i.y,c=r.x,d=r.y,h=vt(s,l,a),f=vt(s,c,d);if(h&&f){us(s),s=fs(n);const u=[],p=vt(s,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 b=vt(s,g,m);if(!b)continue;const{cell:C}=b;C!==p&&u.push(C)}u.forEach(m=>{e.mergeContent&&p.append(m.components().models),m.remove()}),o.setSelected(p),dc(n)}}const ps="Cell settings",fc="Merge cells",uc="Split cell",pc=n=>n.closestType(te),Ct=n=>{var e;return(e=pc(n))==null?void 0:e.parent()},mc=n=>{const e=n.editor.getSelectedAll(),t=Ct(e[0]),i=e[0];if(!t||!(i!=null&&i.is(z))||e.length>1)return!1;const{rowspan:r,colspan:s}=ki(i);return!(s<2&&r<2)},gc=n=>{const t=n.editor.getSelectedAll()[0],i=Ct(t),{grid:r}=Mn(i);us(r)},ms=n=>{const e=n.editor.getSelectedAll(),t=Ct(e[0]);if(!t||e.length<2||e.some(l=>!l.is(z)||Ct(l)!==t))return!1;const{grid:i,startPos:r,endPos:s}=Mn(t),{em:o}=t;if(!r||!s)return!1;for(let l=r.y;l<=s.y;l++)for(let a=r.x;a<=s.x;a++){const c=vt(i,a,l);if(!c||!o.selected.hasComponent(c.cell))return!1}return!0},yc=n=>{const{editor:e}=n;if(!ms(n))return;const t=e.getSelectedAll(),i=Ct(t[0]);hc(i,{mergeContent:!0})},bc=n=>{Ci(n,{id:"tableCellSettings",header:{label:ps}})},wc=n=>[{id:M.tableCellItems,icon:D[M.tableCellProperties],label:"Cell",items:[{id:M.tableCellProperties,label:ps,icon:D[M.tableCellProperties],onClick:({event:t})=>bc({...n,event:t})},{id:M.tableCellMerge,label:fc,icon:D[M.tableCellMerge],onClick:()=>yc(n),disabled:!ms(n)},{id:M.tableCellSplit,label:uc,icon:D[M.tableCellSplit],onClick:()=>gc(n),disabled:!mc(n)}]},...sc(n),...hs(n)],Sc=n=>{const e=n[0]&&Ct(n[0]);if(!e)return;const{grid:t,startPos:i,endPos:r}=Mn(e,{selected:n});if(!i||!r)return;const s=[];for(let o=i.y;o<=r.y;o++)for(let l=i.x;l<=r.x;l++){const a=vt(t,l,o);a&&s.push(a.cell)}s.length&&e.em.setSelected(s,{fromCell:!0})},xc="tableComponent",vc=Ze(function(n,e={}){const t={block:{},...e},{Components:i}=n,r={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(we,{block:t.block&&{label:"Table",media:D.table,category:"Extra",content:{type:we,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:o,value:l,emitUpdate:a}){const c=o.find("caption")[0];l?!c&&o.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),a(),n.refresh({tools:!0})},getValue(o){return!!o.component.find("caption")[0]}}],components:tc(xi,{rows:5}),contextMenu:({items:o,editor:l,component:a})=>[...Yr({editor:l,component:a,opts:t}),...o]}}}),i.addType(Gr,{model:{defaults:{icon:D.tableHead,...r}}}),i.addType(Ur,{model:{defaults:{icon:D.tableFoot,...r}}}),i.addType(xi,{model:{defaults:{icon:D.tableRowProperties,...r}}}),i.addType(te,{model:{defaults:{icon:D.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:o,editor:l,component:a})=>[...hs({editor:l,component:a,opts:t}),...o]}}}),i.addType(z,{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:o,editor:l,component:a})=>[...wc({editor:l,component:a,opts:t}),...o]}}});const s=jr((o,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(f=>f.is(z)?f:f.closestType(z)).filter(Boolean);d.length===a.length&&Sc(d)},0);n.on("component:select",s),Xe({editor:n,plan:ae.startup,licenseKey:t.licenseKey,pluginName:xc,cleanup:()=>{n.off("component:select",s),n.Blocks.remove(we),Qa.forEach(o=>i.removeType(o))}})}),gs="page://",Qe="list-pages",kt="list-pages-item",et="list-pages-link",Cc=n=>n.components().reduce((e,t)=>{var o;const i=t.findFirstType(et),r=(o=i==null?void 0:i.attributes.attributes)==null?void 0:o.href,s=r!=null&&r.startsWith(gs)?r.replace(gs,""):"";if(s&&i){const l=e[s];l?l.push(i):e[s]=[i]}return e},{}),kc="listPagesComponent",Tn="data-type-role",Mc="page_root",Tc=n=>e=>e.is(n),Ac=n=>(e,t)=>t.is(n),Ti=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,Tn))===n},Oc=Ze(function(n,e={}){const{Blocks:t,Components:i,Pages:r}=n,{licenseKey:s,block:o={}}=e,l="List Pages",a="List Pages Item",c="Link",d=`${Si}${Qe}`,h=`${Si}${et}`,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>',u='<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(Qe,{block:o&&{label:l,media:f,category:"Extra",select:!0,...e.block},isComponent:Ti(Qe),model:{defaults:{tagName:"ul",name:l,[Mc]:"",classes:d,attributes:{[Tn]:Qe},droppable:Tc(kt),styles:`
60
- .${d} {
59
+ `}}}),r.addType(d,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:d,"data-type-role":d},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:h,el:m}=this,g="core:preview",y=h.Commands.events;this.listenTo(h,`${y.runCommand}${g}`,()=>{m.style.display="none"}),this.listenTo(h,`${y.stopCommand}${g}`,()=>{m.style.display=""})}}}),Yn({editor:t,licenseKey:i,plan:vt.startup,pluginName:Pb,cleanup:()=>{n.remove(o),r.removeType(o)}})});function td(t,e,n){let r,i,o,s,a;const l=e;function c(){const f=Date.now()-s;f<l&&f>=0?r=setTimeout(c,l-f):(r=null,a=t.apply(o,i),o=i=null)}const u=function(){return o=this,i=arguments,s=Date.now(),r||(r=setTimeout(c,l)),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=t.apply(o,i),o=i=null,clearTimeout(r),r=null)},u}var Kt=(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))(Kt||{}),nd=(t=>(t.layoutToggleId="studio:layoutToggle:",t.toggleBlocksPanel="studio:toggleBlocksPanel",t.pageSettingsUpdate="studio:pageSettingsUpdate",t))(nd||{}),ce=(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))(ce||{});const Se={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>'},cn="table",rd="thead",id="tfoot",Ll="tbody",ut="row",Ve="cell",Rl="clipboardTable",Db=[cn,rd,id,Ll,ut,Ve],_s=t=>t.em.get(Rl)||[],Lb=t=>t.every(e=>e.is(Ve)),jl=(t,e)=>{const{editor:n,event:r,opts:i}=t,o=r.currentTarget||r.target,{x:s,y:a,width:l,height:c}=o.getBoundingClientRect(),u={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:s,y:a,w:l,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};hi(i.openSettings)?i.openSettings({...t,layoutProps:u}):n.runCommand(Kt.layoutToggle,u)},Rb=(t,{rows:e=1,cells:n=5,text:r}={})=>({type:t,components:Array.from(Array(e).keys()).map(i=>({type:ut,components:Array.from(Array(n).keys()).map(o=>({type:Ve,components:r?{type:"text",content:hi(r)?r({y:i,x:o}):r}:void 0}))}))}),od="Table settings",sd=t=>{const{component:e}=t;return e.is(cn)?e:e.closestType(cn)},jb=t=>{var e;(e=sd(t))==null||e.remove(t.opts)},Hb=t=>{const e=sd(t);e&&(t.editor.select(e),jl(t,{id:"tableSettings",header:{label:od}}))},ad=t=>[{id:ce.table,icon:Se[ce.table],label:"Table",items:[{id:ce.tableSettings,label:od,icon:Se[ce.tableSettings],onClick:({event:n})=>Hb({...t,event:n})},{id:ce.tableDelete,label:"Delete table",icon:Se[ce.tableDelete],onClick:()=>jb(t)}]}],ld=({editor:t})=>{const e=_s(t);return e.length&&Lb(e)},cd=({component:t,editor:e,after:n})=>{if(!t.is(Ve))return;const r=t.closestType(cn),i=t.closestType(ut),o=t.index()+(n?1:0);r==null||r.findType(ut).forEach(a=>a.append({type:Ve},{at:o}));const s=i==null?void 0:i.components().at(o);s&&e.select(s)},ud=({component:t,opts:e})=>{if(!t.is(Ve))return;const n=t.closestType(cn),r=t.index();n==null||n.findType(ut).forEach(i=>{var o;return(o=i.components().at(r))==null?void 0:o.remove(e)})},fd=({component:t,editor:e})=>{if(!t.is(Ve))return;const n=t.closestType(cn),r=t.index(),i=(n==null?void 0:n.findType(ut).map(o=>o.components().at(r)))||[];i.length&&e.em.set(Rl,i)},dd=t=>{const{component:e,editor:n,after:r}=t;if(!e.is(Ve)||!ld(t))return;const i=_s(n),o=e.closestType(cn),s=e.index()+(r?1:0);o==null||o.findType(ut).forEach((a,l)=>{const c=i[l],u=(c==null?void 0:c.clone())||{type:Ve};a.append(u,{at:s})})},Ib=t=>{const{component:e}=t;e.is(Ve)&&(fd(t),ud({...t,opts:{temporary:!0}}))},Bb=t=>{const e=ld(t);return[{id:ce.tableColumnItems,icon:Se[ce.tableColumn],label:"Column",items:[{id:ce.tableColumnInsertBefore,label:"Insert column before",icon:Se[ce.tableColumnInsertBefore],onClick:()=>cd(t)},{id:ce.tableColumnInsertAfter,label:"Insert column after",icon:Se[ce.tableColumnInsertAfter],onClick:()=>cd({...t,after:!0})},{id:ce.tableColumnDelete,label:"Delete column",icon:Se[ce.tableColumnDelete],onClick:()=>ud(t)},{id:ce.tableColumnCut,label:"Cut column",icon:Se[ce.tableColumnCut],onClick:()=>Ib(t)},{id:ce.tableColumnCopy,label:"Copy column",icon:Se[ce.tableColumnCopy],onClick:()=>fd(t)},{id:ce.tableColumnPasteBefore,label:"Paste column before",icon:Se[ce.tableColumnPasteBefore],disabled:!e,onClick:()=>dd(t)},{id:ce.tableColumnPasteAfter,label:"Paste column after",icon:Se[ce.tableColumnPasteAfter],disabled:!e,onClick:()=>dd({...t,after:!0})}]}]},pd="Row settings",$b=t=>t.every(e=>e.is(ut)),mi=t=>{const{component:e}=t,n=e.is(Ve),r=e.is(ut);if(!(!n&&!r))return r?e:e.closestType(ut)},hd=t=>{const{component:e,editor:n,after:r}=t,i=mi(t);if(!i)return;const o=i.index()+(r?1:0),s=i.components().length,a=Array.from(Array(s).keys()).map(()=>({type:Ve})),l=i.parent();if(l){const c=l.append({type:ut,components:a},{at:o})[0];if(e.is(Ve)&&c){const u=e.index(),f=c.components().at(u);f&&n.select(f)}}},md=t=>{var e;(e=mi(t))==null||e.remove(t.opts)},gd=t=>{const e=mi(t);e&&t.editor.em.set(Rl,[e])},bd=t=>{var a;const{editor:e,after:n}=t,r=mi(t);if(!r||!vd(t))return;const o=_s(e)[0],s=r.index()+(n?1:0);o&&((a=r.parent())==null||a.append(o.clone(),{at:s}))},zb=t=>{mi(t)&&(gd(t),md({...t,opts:{temporary:!0}}))},vd=({editor:t})=>{const e=_s(t);return e.length&&$b(e)},Fb=t=>{const e=mi(t);e&&(t.editor.select(e),jl(t,{id:"tableRowSettings",header:{label:pd}}))},yd=t=>{const e=vd(t);return[{id:ce.tableRowItems,icon:Se[ce.tableRowProperties],label:"Row",items:[{id:ce.tableRowInsertBefore,label:"Insert row before",icon:Se[ce.tableRowInsertBefore],onClick:()=>hd(t)},{id:ce.tableRowInsertAfter,label:"Insert row after",icon:Se[ce.tableRowInsertAfter],onClick:()=>hd({...t,after:!0})},{id:ce.tableRowDelete,label:"Delete row",icon:Se[ce.tableRowDelete],onClick:()=>md(t)},{id:ce.tableRowProperties,label:pd,icon:Se[ce.tableRowProperties],onClick:({event:r})=>Fb({...t,event:r})},{id:ce.tableRowCut,label:"Cut row",icon:Se[ce.tableRowCut],onClick:()=>zb(t)},{id:ce.tableRowCopy,label:"Copy row",icon:Se[ce.tableRowCopy],onClick:()=>gd(t)},{id:ce.tableRowPasteBefore,label:"Paste row before",icon:Se[ce.tableRowPasteBefore],disabled:!e,onClick:()=>bd(t)},{id:ce.tableRowPasteAfter,label:"Paste row after",icon:Se[ce.tableRowPasteAfter],disabled:!e,onClick:()=>bd({...t,after:!0})}]},...ad(t)]},Hl=t=>{const e=t.attributes.attributes||{},n=parseInt(`${e.rowspan||1}`,10),r=parseInt(`${e.colspan||1}`,10);return{rowspan:n,colspan:r}};function wd(t){const e=[];return t.components().forEach((n,r)=>{n.components().each((i,o)=>{const{rowspan:s,colspan:a}=Hl(i);if(e[r])for(;e[r][o];)o++;for(let l=r;l<r+s;l++){e[l]||(e[l]=[]);for(let c=o;c<o+a;c++)e[l][c]={real:l===r&&c===o,cell:i,rowspan:s,colspan:a}}})}),e}function gi(t,e,n){var r;return(r=t[n])==null?void 0:r[e]}const Il=t=>t.closestType(ut);function Wb(t,{x:e,y:n,rows:r,cols:i}){var a;let o=Il(t[n][e].cell),s;for(let l=1;l<=r;l++)if(o=(a=o==null?void 0:o.parent())==null?void 0:a.components().at(o.index()+1),o){for(s=e;s>=0;s--){const{cell:c}=t[n+l][s],u=Il(c);if(u===o){for(let f=1;f<=i;f++){const d=c.index();u.append({type:Ve},{at:d+1})}break}}if(s===-1){const u=o.components().at(0).index();for(let f=1;f<=i;f++)o.append({type:Ve},{at:u})}}}function xd(t){for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++){const i=t[e][n].cell;if(i.em.selected.hasComponent(i)){const{rowspan:o,colspan:s}=Hl(i);if(s>1||o>1){i.addAttributes({colspan:1,rowspan:1});for(let a=0;a<s-1;a++){const l=i.index();Il(i).append({type:Ve},{at:l+1})}Wb(t,{x:n,y:e,rows:o-1,cols:s})}}}}function Ub(t){const e=[];t.components().forEach(n=>{n.components().length||e.push(n)}),e.forEach(n=>n.remove())}const ks=(t,e={})=>{var s;const n=wd(t),{em:r}=t;let i,o;for(let a=0;a<n.length;a++)for(let l=0;l<n[a].length;l++){const c=n[a][l];if((s=e.selected)!=null&&s.includes(c.cell)||r.selected.hasComponent(c.cell)){const u={x:l,y:a};i||(i=u),o=u}}return{grid:n,startPos:i,endPos:o}};function qb(t,e={}){const n=ks(t),{startPos:r,endPos:i}=n;let{grid:o}=n;const{em:s}=t;if(!r||!i)return;const a=r.x,l=r.y,c=i.x,u=i.y,f=gi(o,a,l),d=gi(o,c,u);if(f&&d){xd(o),o=wd(t);const p=[],h=gi(o,a,l).cell;h.addAttributes({colspan:c-a+1,rowspan:u-l+1});for(let m=l;m<=u;m++)for(let g=a;g<=c;g++){const y=gi(o,g,m);if(!y)continue;const{cell:w}=y;w!==h&&p.push(w)}p.forEach(m=>{e.mergeContent&&h.append(m.components().models),m.remove()}),s.setSelected(h),Ub(t)}}const Sd="Cell settings",Gb="Merge cells",Kb="Split cell",Zb=t=>t.closestType(ut),bi=t=>{var e;return(e=Zb(t))==null?void 0:e.parent()},Jb=t=>{const e=t.editor.getSelectedAll(),n=bi(e[0]),r=e[0];if(!n||!(r!=null&&r.is(Ve))||e.length>1)return!1;const{rowspan:i,colspan:o}=Hl(r);return!(o<2&&i<2)},Yb=t=>{const n=t.editor.getSelectedAll()[0],r=bi(n),{grid:i}=ks(r);xd(i)},Cd=t=>{const e=t.editor.getSelectedAll(),n=bi(e[0]);if(!n||e.length<2||e.some(a=>!a.is(Ve)||bi(a)!==n))return!1;const{grid:r,startPos:i,endPos:o}=ks(n),{em:s}=n;if(!i||!o)return!1;for(let a=i.y;a<=o.y;a++)for(let l=i.x;l<=o.x;l++){const c=gi(r,l,a);if(!c||!s.selected.hasComponent(c.cell))return!1}return!0},Xb=t=>{const{editor:e}=t;if(!Cd(t))return;const n=e.getSelectedAll(),r=bi(n[0]);qb(r,{mergeContent:!0})},Qb=t=>{jl(t,{id:"tableCellSettings",header:{label:Sd}})},ev=t=>[{id:ce.tableCellItems,icon:Se[ce.tableCellProperties],label:"Cell",items:[{id:ce.tableCellProperties,label:Sd,icon:Se[ce.tableCellProperties],onClick:({event:n})=>Qb({...t,event:n})},{id:ce.tableCellMerge,label:Gb,icon:Se[ce.tableCellMerge],onClick:()=>Xb(t),disabled:!Cd(t)},{id:ce.tableCellSplit,label:Kb,icon:Se[ce.tableCellSplit],onClick:()=>Yb(t),disabled:!Jb(t)}]},...Bb(t),...yd(t)],tv=t=>{const e=t[0]&&bi(t[0]);if(!e)return;const{grid:n,startPos:r,endPos:i}=ks(e,{selected:t});if(!r||!i)return;const o=[];for(let s=r.y;s<=i.y;s++)for(let a=r.x;a<=i.x;a++){const l=gi(n,a,s);l&&o.push(l.cell)}o.length&&e.em.setSelected(o,{fromCell:!0})},nv="tableComponent",rv=Jn(function(t,e={}){const n={block:{},...e},{Components:r}=t,i={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(cn,{block:n.block&&{label:"Table",media:Se.table,category:"Extra",content:{type:cn,style:{width:"100%"}},select:!0,...n.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:Se.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:a,emitUpdate:l}){const c=s.find("caption")[0];a?!c&&s.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):c==null||c.remove(),l(),t.refresh({tools:!0})},getValue(s){return!!s.component.find("caption")[0]}}],components:Rb(Ll,{rows:5}),contextMenu:({items:s,editor:a,component:l})=>[...ad({editor:a,component:l,opts:n}),...s]}}}),r.addType(rd,{model:{defaults:{icon:Se.tableHead,...i}}}),r.addType(id,{model:{defaults:{icon:Se.tableFoot,...i}}}),r.addType(Ll,{model:{defaults:{icon:Se.tableRowProperties,...i}}}),r.addType(ut,{model:{defaults:{icon:Se.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:s,editor:a,component:l})=>[...yd({editor:a,component:l,opts:n}),...s]}}}),r.addType(Ve,{model:{defaults:{icon:Se.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:a,component:l})=>[...ev({editor:a,component:l,opts:n}),...s]}}});const o=td((s,a)=>{var f;const l=t.getSelectedAll(),c=!!((f=a==null?void 0:a.event)!=null&&f.shiftKey);if(l.length<2||!c||a.fromCell)return;const u=l.map(d=>d.is(Ve)?d:d.closestType(Ve)).filter(Boolean);u.length===l.length&&tv(u)},0);t.on("component:select",o),Yn({editor:t,plan:vt.startup,licenseKey:n.licenseKey,pluginName:nv,cleanup:()=>{t.off("component:select",o),t.Blocks.remove(cn),Db.forEach(s=>r.removeType(s))}})}),Od="page://",Tr="list-pages",vi="list-pages-item",Mr="list-pages-link",iv=t=>t.components().reduce((e,n)=>{var s;const r=n.findFirstType(Mr),i=(s=r==null?void 0:r.attributes.attributes)==null?void 0:s.href,o=i!=null&&i.startsWith(Od)?i.replace(Od,""):"";if(o&&r){const a=e[o];a?a.push(r):e[o]=[r]}return e},{}),ov="listPagesComponent",As="data-type-role",sv="page_root",av=t=>e=>e.is(t),lv=t=>(e,n)=>n.is(t),Bl=t=>e=>{var n;return((n=e.getAttribute)==null?void 0:n.call(e,As))===t},cv=Jn(function(t,e={}){const{Blocks:n,Components:r,Pages:i}=t,{licenseKey:o,block:s={}}=e,a="List Pages",l="List Pages Item",c="Link",u=`${Dl}${Tr}`,f=`${Dl}${Mr}`,d='<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(Tr,{block:s&&{label:a,media:d,category:"Extra",select:!0,...e.block},isComponent:Bl(Tr),model:{defaults:{tagName:"ul",name:a,[sv]:"",classes:u,attributes:{[As]:Tr},droppable:av(vi),styles:`
60
+ .${u} {
61
61
  list-style: none;
62
62
  margin: 0;
63
63
  padding: 0;
64
64
  }
65
- `},init(){this.syncPageItems=jr(this.syncPageItems.bind(this),0),this.listenTo(this.em,r.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(n.Components.getSymbolInfo(this).isInstance)return;const p=this.em.Pages.getAll(),m=this.components(),g=Cc(this);p.forEach((b,C)=>{const y=b.id,S=b.getName(),x=g[y];x?x==null||x.forEach(k=>{k.getInnerHTML()!==S&&k.components(S)}):m.add({type:kt,components:[{type:et,attributes:{href:`page://${y}`},components:{type:"textnode",content:S}}]},{at:C})})}}}),i.addType(kt,{isComponent:Ti(kt),model:{defaults:{name:a,tagName:"li",icon:u,attributes:{[Tn]:kt},components:{type:et},draggable:Ac(Qe)}}}),i.addType(et,{extend:"link",isComponent:Ti(et),model:{defaults:{removable:!1,copyable:!1,delegate:{move:p=>p.closestType(kt)},name:c,classes:h,attributes:{[Tn]:et},components:{type:"textnode",content:"Item"},styles:`
66
- .${h} {
65
+ `},init(){this.syncPageItems=td(this.syncPageItems.bind(this),0),this.listenTo(this.em,i.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const h=this.em.Pages.getAll(),m=this.components(),g=iv(this);h.forEach((y,w)=>{const x=y.id,O=y.getName(),v=g[x];v?v==null||v.forEach(E=>{E.getInnerHTML()!==O&&E.components(O)}):m.add({type:vi,components:[{type:Mr,attributes:{href:`page://${x}`},components:{type:"textnode",content:O}}]},{at:w})})}}}),r.addType(vi,{isComponent:Bl(vi),model:{defaults:{name:l,tagName:"li",icon:p,attributes:{[As]:vi},components:{type:Mr},draggable:lv(Tr)}}}),r.addType(Mr,{extend:"link",isComponent:Bl(Mr),model:{defaults:{removable:!1,copyable:!1,delegate:{move:h=>h.closestType(vi)},name:c,classes:f,attributes:{[As]:Mr},components:{type:"textnode",content:"Item"},styles:`
66
+ .${f} {
67
67
  text-decoration: none;
68
68
  }
69
- `}}}),Xe({editor:n,licenseKey:s,plan:ae.startup,pluginName:kc,cleanup:()=>{t.remove(Qe),i.removeType(Qe)}})}),Nc="fsLightboxComponent",An="data-fslightbox",On="data-type",Ec="fslightbox-open",Mt="fslightbox",Tt={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>'},Dc=Ze(function(n,e={}){const{Blocks:t,Components:i}=n,r="Lightbox",s=`${Si}${Mt}`,o={toolbarIconOpen:Tt.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}=o,d=function(C){const y=this,S="data-fslightbox",x=window,k=()=>{var V;const N=x.refreshFsLightbox;N==null||N();const R=y.getAttribute(S);if((V=x.fsLightboxInstances)==null||V[R],!x._isEditor)return;Array.from(document.querySelectorAll(`[${S}]`)).forEach(I=>{const Z=I.onclick;I.onclick=function(bt){bt.preventDefault();const ue=I;!ue.__skipLb&&(Z==null||Z(bt)),ue.__skipLb=!0}})};if(x.refreshFsLightbox)k();else{const N=document.createElement("script");N.src=C.cdnScript,N.onload=k,document.head.appendChild(N)}},h=C=>({id:`${Mt}-open-lb`,label:a,command:()=>{const y=C.getView();y==null||y.toggleLightbox()}}),f="source-type",u={type:"radio",name:f,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:Tt.image},{id:"video",label:"Video",icon:Tt.video},{id:"el",label:"Custom Element",icon:Tt.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"},b={image:[p],video:[m],el:[g]};i.addType(Mt,{block:l&&{label:r,media:Tt.imageLightbox,category:"Extra",select:!0,...o.block},isComponent:C=>{var y;return(y=C.hasAttribute)==null?void 0:y.call(C,An)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:r,icon:Tt.imageLightbox,classes:s,draggable:(C,y)=>!y.is(Mt),attributes:{[An]:"lightbox",[On]:"image",href:c},components:{type:"image",src:c},script:d,cdnScript:o.cdnScript,"script-props":["attributes","cdnScript"],[f]:"image",traits:[u,{name:An,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(C,y){var x;const S=(x=y.target)==null?void 0:x.getView();S==null||S.toggleLightbox()}}],styles:`
70
- .${s} {
69
+ `}}}),Yn({editor:t,licenseKey:o,plan:vt.startup,pluginName:ov,cleanup:()=>{n.remove(Tr),r.removeType(Tr)}})}),uv="fsLightboxComponent",Ts="data-fslightbox",Ms="data-type",fv="fslightbox-open",yi="fslightbox",wi={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>'},dv=Jn(function(t,e={}){const{Blocks:n,Components:r}=t,i="Lightbox",o=`${Dl}${yi}`,s={toolbarIconOpen:wi.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:a,toolbarIconOpen:l,defaultSrc:c}=s,u=function(w){const x=this,O="data-fslightbox",v=window,E=()=>{var V;const A=v.refreshFsLightbox;A==null||A();const B=x.getAttribute(O);if((V=v.fsLightboxInstances)==null||V[B],!v._isEditor)return;Array.from(document.querySelectorAll(`[${O}]`)).forEach(I=>{const z=I.onclick;I.onclick=function(K){K.preventDefault();const te=I;!te.__skipLb&&(z==null||z(K)),te.__skipLb=!0}})};if(v.refreshFsLightbox)E();else{const A=document.createElement("script");A.src=w.cdnScript,A.onload=E,document.head.appendChild(A)}},f=w=>({id:`${yi}-open-lb`,label:l,command:()=>{const x=w.getView();x==null||x.toggleLightbox()}}),d="source-type",p={type:"radio",name:d,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:wi.image},{id:"video",label:"Video",icon:wi.video},{id:"el",label:"Custom Element",icon:wi.external}],labelToTitle:!0},h={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:[h],video:[m],el:[g]};r.addType(yi,{block:a&&{label:i,media:wi.imageLightbox,category:"Extra",select:!0,...s.block},isComponent:w=>{var x;return(x=w.hasAttribute)==null?void 0:x.call(w,Ts)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:i,icon:wi.imageLightbox,classes:o,draggable:(w,x)=>!x.is(yi),attributes:{[Ts]:"lightbox",[Ms]:"image",href:c},components:{type:"image",src:c},script:u,cdnScript:s.cdnScript,"script-props":["attributes","cdnScript"],[d]:"image",traits:[p,{name:Ts,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(w,x){var v;const O=(v=x.target)==null?void 0:v.getView();O==null||O.toggleLightbox()}}],styles:`
70
+ .${o} {
71
71
  display: inline-block;
72
72
  padding: 10px;
73
73
  }
74
- `},init(){const C=[f].map(y=>`change:${y}`).join(" ");this.on(C,this.updateTraits),this.on(`change:${f}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(C,y,S){if(S.adjust)return;const k=this.get(f)==="video"?"video":"image";this.addAttributes({[On]:k,href:""})},adjustSourceType(){const C=this.get(f),y=this.getAttributes().href||"",S={adjust:!0};if(C==="video"){const x=y.includes("youtube.com")?"youtube":"video";this.addAttributes({[On]:x},S)}else C!=="el"&&y.startsWith("#")?this.set(f,"el",S):C==="image"&&this.addAttributes({[On]:"image"},S)},updateTraits(C={}){const{changed:y}=this,{init:S}=C;if(y[u.name]||S){this.removeTrait([p.name,m.name,g.name]);const x=this.get(f)||"image",k=this.getTraitIndex(f)+1;this.addTrait(b[x],{at:k})}},initToolbar(){if(!a)return;const{toolbar:C}=this,y=h(this);!C.find(x=>x.id===y.id)&&(C==null||C.unshift(y))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var I;const{em:C,el:y,model:S}=this,{Canvas:x}=C,k=S.getAttributes()[An],{defaultView:N,documentElement:R}=y.ownerDocument,T=(I=N.fsLightboxInstances)==null?void 0:I[k];if(R.classList.contains(Ec))T.close();else{y.__skipLb=!1;let Z;T.props.onOpen=()=>{Z=x.getSpots(),setTimeout(()=>x.removeSpots())},T.props.onClose=()=>{Z.forEach(bt=>x.addSpot(bt.attributes))},y.click()}}}}),Xe({editor:n,plan:ae.startup,licenseKey:o.licenseKey,pluginName:Nc,cleanup:()=>{t.remove(Mt),i.removeType(Mt)}})});var At=(n=>(n.image="image",n.video="video",n.external="external",n))(At||{});const tt="lightGallery",ys=`${tt}-item`,Nn="data-lightgallery",bs=`${Nn}-item`,En="toggle",nt={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>'},Ai={propKeys:[],props:{},traits:[]},Ut=(n,e={})=>{var r;const t={},i=[];for(const s in n){const{value:o,...l}=n[s];i.push({id:s,name:s,changeProp:!0,category:e.category,...l}),t[s]=o;const{subTraits:a={}}=l;for(const c in l.subTraits)(r=a[c])==null||r.forEach(d=>{const h=d.id||d.name;t[h]=d.value})}return{propKeys:Object.keys(t),props:t,traits:i}},Oi=(n,e)=>{const t=n.getTrait(e),i=t.get("category"),r=t.get("subTraits")||{},o=(Object.values(r).flat()||[]).map(c=>c.id||c.name);n.removeTrait(o);const l=r[t.getValue()],a=n.getTraitIndex(e)+1;l&&n.addTrait(l.map(c=>({category:i,...c})),{at:a})},Ni=(n,e)=>{e.forEach(t=>{const i=n.getTrait(t);if(!i||!i.get("subTraits"))return;const r=i.changeProp?`change:${t}`:`change:attributes:${t}`;n.on(r,()=>Oi(n,t)),Oi(n,t)})},Pc=(n,e,t)=>{const r=n.getTrait(e).get("subTraits")||{},o=(Object.values(r).flat()||[]).map(a=>{const c=a.name||a.id;return a.changeProp?`change:${c}`:`change:attributes:${c}`}),l=Array.from(new Set(o));l.length&&n.on(l.join(" "),t)},Rc={[En]:{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}},Ic={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"}]}}},Vc={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}]}}},zc={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}]}}},Re="sourceType",Dn="data-iframe",Ei={name:"href",type:"file",label:"Image Source"},Pn={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},Di={name:"data-poster",label:"Video Poster",type:"file"},ws={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},Ss={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Bc={[En]:{type:"button",label:"Toggle Gallery",command:(n,e)=>{var r,s;const t=e.target,i=(r=t==null?void 0:t.closestType(tt))==null?void 0:r.getView();if(i&&t){const o=((s=i.getLightGallery())==null?void 0:s.items)||[],l=Array.from(o).indexOf(t.getEl());l>=0&&i.toggleGallery(l)}}},[Re]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[Ei],video:[Pn,Di],external:[ws]},options:[{id:"image",label:Ei.label||"",icon:nt.image},{id:"video",label:Pn.label||"",icon:nt.video},{id:"external",label:ws.label||"",icon:nt.external}]},subHtml:Ss},Lc="lightGalleryComponent",xs="lgThumbnail",Hc="lgVideo",vs="lgAutoplay",Cs="lgZoom",Ot="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Fc=Ze(function(n,e={}){const{Blocks:t,Components:i}=n,r="LightGallery",s="LightGallery Item",o={toolbarIconOpen:nt.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[xs,Hc,vs,Cs],cdnScript:[`${Ot}/lightgallery.min.js`,`${Ot}/plugins/thumbnail/lg-thumbnail.min.js`,`${Ot}/plugins/video/lg-video.min.js`,`${Ot}/plugins/autoplay/lg-autoplay.min.js`,`${Ot}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Ot}/css/lightgallery-bundle.min.css`,...e},{block:l,toolbarIconOpen:a,defaultSrc:c}=o,d=function(y){const S=this,x=window,{plugins:k,cdnScript:N,cdnStyle:R,inline:T,lgLicenseKey:V,...I}=y||{},Z=ue=>isNaN(ue)?void 0:parseInt(ue,10),bt=()=>{var gi;const ue={...I,licenseKey:V,speed:Z(I.speed),startAnimationDuration:Z(I.startAnimationDuration),thumbMargin:Z(I.thumbMargin),thumbWidth:Z(I.thumbWidth),slideShowInterval:Z(I.slideShowInterval),scale:Z(I.scale),enableZoomAfter:Z(I.enableZoomAfter),plugins:(k||[]).map(yi=>x[yi])};T&&(ue.container=S,ue.closable=!1);const Hr=(gi=x.lightGallery)==null?void 0:gi.call(x,S,ue);T&&Hr.openGallery()};if(x.lightGallery)bt();else{const{head:ue}=document,Hr=Array.isArray(N)?[...N]:[N],gi=Array.isArray(R)?[...R]:[R],yi=wt=>{if(wt.length){const Ue=document.createElement("link");Ue.href=wt.shift(),Ue.rel="stylesheet",ue.appendChild(Ue),yi(wt)}},Va=wt=>{if(wt.length){const Ue=document.createElement("script");Ue.src=wt.shift(),Ue.onerror=Ue.onload=Va.bind(null,wt),ue.appendChild(Ue)}else bt()};yi(gi),Va(Hr)}},h=y=>{const S=y.getTrait(En);if(!a||!S)return;const{toolbar:x}=y,k={id:En,label:a,command:()=>setTimeout(()=>S.runCommand(),100)};!x.find(R=>R.id===k.id)&&(x==null||x.unshift(k))};let f=[];const u=o.plugins||[],p=Ut(Rc),m=u.includes(xs)?Ut(Ic):Ai,g=u.includes(vs)?Ut(Vc):Ai,b=u.includes(Cs)?Ut(zc):Ai;i.addType(tt,{block:l&&{label:r,media:nt.gallery,category:"Extra",select:!0,...o.block},isComponent:y=>wi(y,Nn),extendFn:["init","initToolbar"],model:{defaults:{name:r,icon:nt.gallery,draggable:(y,S)=>!S.is(tt),attributes:{[Nn]:!0},components:{type:ys},script:d,selector:"",exThumbImage:"",cdnScript:o.cdnScript,cdnStyle:o.cdnStyle,plugins:o.plugins,lgLicenseKey:o.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...p.propKeys,...m.propKeys,...g.propKeys,...b.propKeys],...p.props,...m.props,...g.props,...b.props,traits:[...p.traits,...m.traits,...g.traits,...b.traits]},init(){Ni(this,["thumbnail"]),Ni(this,["autoplay"]),Ni(this,["zoom"])},initToolbar(){h(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const y=i.events.scriptUnmount;y&&this.listenTo(this.model,y,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const y=this.getLightGallery();y==null||y.destroy()},disableLgInCanvas(){const y=this.getLightGallery();y.lgOpened=!0},isInlineGallery(){var S;const y=this.getLightGallery();return((S=y==null?void 0:y.settings)==null?void 0:S.container)===this.el},onLgInit(y){this.el.__lg=y.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:y}=this,{Canvas:S}=y,x=this.getLightGallery();f=S.getSpots(),setTimeout(()=>S.removeSpots()),x.__lgOpened=!0},onLgClose(){const y=this.getLightGallery();f.forEach(S=>this.em.Canvas.addSpot(S.attributes)),f=[],y.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(y){const S=this.getLightGallery();if(S.__lgOpened)return S.closeGallery(!0);S.lgOpened=!1,S.openGallery(y)}}});const C=Ut(Bc);i.addType(ys,{isComponent:y=>wi(y,bs)||y.tagName==="A"&&wi(y.parentElement,Nn),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:s,icon:nt.galleryItem,attributes:{[bs]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...C.props,traits:[...C.traits]},init(){const y=[Re].map(S=>`change:${S}`).join(" ");this.initSourceType(),this.on(y,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Pc(this,Re,this.triggerGalleryUpdate)},initToolbar(){h(this)},initScriptUpdate(){const y=[Ss.name].map(S=>`change:attributes:${S}`).join(" ");this.on(y,this.triggerGalleryUpdate)},triggerGalleryUpdate(...y){var S;(S=this.closestType(tt))==null||S.__scriptPropsChange(...y)},updateTraits(y={}){const{changed:S}=this,{init:x}=y;if(S[Re]||x){Oi(this,Re);const k=this.getTrait(Re).getValue();if(k===At.image){this.removeAttributes([Pn.name,Di.name,Dn]);const N=this.getTrait(Ei.name);N.setValue(N.getValue()||c)}else k===At.video?this.removeAttributes([Dn]):k===At.external&&this.addAttributes({[Dn]:!0})}},initSourceType(){const y=this.getAttributes({noClass:!0,noStyle:!0});y[Dn]?this.set(Re,At.external):(y[Pn.name]||y[Di.name])&&this.set(Re,At.video)}}}),Xe({editor:n,plan:ae.startup,licenseKey:o.licenseKey,pluginName:Lc,cleanup:()=>{t.remove(tt),i.removeType(tt)}})}),pe="swiper",Zt=`${pe}-slide`,Nt=`${pe}-wrapper`,Et=`${pe}-nav-prev`,Rn=`${pe}-nav-next`,Dt=`${pe}-pagination`,Xt=`${pe}-scrollbar`,X={slider:`<svg viewBox="0 0 24 24">
74
+ `},init(){const w=[d].map(x=>`change:${x}`).join(" ");this.on(w,this.updateTraits),this.on(`change:${d}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(w,x,O){if(O.adjust)return;const E=this.get(d)==="video"?"video":"image";this.addAttributes({[Ms]:E,href:""})},adjustSourceType(){const w=this.get(d),x=this.getAttributes().href||"",O={adjust:!0};if(w==="video"){const v=x.includes("youtube.com")?"youtube":"video";this.addAttributes({[Ms]:v},O)}else w!=="el"&&x.startsWith("#")?this.set(d,"el",O):w==="image"&&this.addAttributes({[Ms]:"image"},O)},updateTraits(w={}){const{changed:x}=this,{init:O}=w;if(x[p.name]||O){this.removeTrait([h.name,m.name,g.name]);const v=this.get(d)||"image",E=this.getTraitIndex(d)+1;this.addTrait(y[v],{at:E})}},initToolbar(){if(!l)return;const{toolbar:w}=this,x=f(this);!w.find(v=>v.id===x.id)&&(w==null||w.unshift(x))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var I;const{em:w,el:x,model:O}=this,{Canvas:v}=w,E=O.getAttributes()[Ts],{defaultView:A,documentElement:B}=x.ownerDocument,T=(I=A.fsLightboxInstances)==null?void 0:I[E];if(B.classList.contains(fv))T.close();else{x.__skipLb=!1;let z;T.props.onOpen=()=>{z=v.getSpots(),setTimeout(()=>v.removeSpots())},T.props.onClose=()=>{z.forEach(K=>v.addSpot(K.attributes))},x.click()}}}}),Yn({editor:t,plan:vt.startup,licenseKey:s.licenseKey,pluginName:uv,cleanup:()=>{n.remove(yi),r.removeType(yi)}})});var xi=(t=>(t.image="image",t.video="video",t.external="external",t))(xi||{});const Nr="lightGallery",Ed=`${Nr}-item`,Ns="data-lightgallery",_d=`${Ns}-item`,Ps="toggle",Pr={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>'},$l={propKeys:[],props:{},traits:[]},fo=(t,e={})=>{var i;const n={},r=[];for(const o in t){const{value:s,...a}=t[o];r.push({id:o,name:o,changeProp:!0,category:e.category,...a}),n[o]=s;const{subTraits:l={}}=a;for(const c in a.subTraits)(i=l[c])==null||i.forEach(u=>{const f=u.id||u.name;n[f]=u.value})}return{propKeys:Object.keys(n),props:n,traits:r}},zl=(t,e)=>{const n=t.getTrait(e),r=n.get("category"),i=n.get("subTraits")||{},s=(Object.values(i).flat()||[]).map(c=>c.id||c.name);t.removeTrait(s);const a=i[n.getValue()],l=t.getTraitIndex(e)+1;a&&t.addTrait(a.map(c=>({category:r,...c})),{at:l})},Fl=(t,e)=>{e.forEach(n=>{const r=t.getTrait(n);if(!r||!r.get("subTraits"))return;const i=r.changeProp?`change:${n}`:`change:attributes:${n}`;t.on(i,()=>zl(t,n)),zl(t,n)})},pv=(t,e,n)=>{const i=t.getTrait(e).get("subTraits")||{},s=(Object.values(i).flat()||[]).map(l=>{const c=l.name||l.id;return l.changeProp?`change:${c}`:`change:attributes:${c}`}),a=Array.from(new Set(s));a.length&&t.on(a.join(" "),n)},hv={[Ps]:{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}},mv={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"}]}}},gv={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}]}}},bv={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}]}}},Xn="sourceType",Vs="data-iframe",Wl={name:"href",type:"file",label:"Image Source"},Ds={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},Ul={name:"data-poster",label:"Video Poster",type:"file"},kd={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},Ad={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},vv={[Ps]:{type:"button",label:"Toggle Gallery",command:(t,e)=>{var i,o;const n=e.target,r=(i=n==null?void 0:n.closestType(Nr))==null?void 0:i.getView();if(r&&n){const s=((o=r.getLightGallery())==null?void 0:o.items)||[],a=Array.from(s).indexOf(n.getEl());a>=0&&r.toggleGallery(a)}}},[Xn]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[Wl],video:[Ds,Ul],external:[kd]},options:[{id:"image",label:Wl.label||"",icon:Pr.image},{id:"video",label:Ds.label||"",icon:Pr.video},{id:"external",label:kd.label||"",icon:Pr.external}]},subHtml:Ad},yv="lightGalleryComponent",Td="lgThumbnail",wv="lgVideo",Md="lgAutoplay",Nd="lgZoom",Si="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",xv=Jn(function(t,e={}){const{Blocks:n,Components:r}=t,i="LightGallery",o="LightGallery Item",s={toolbarIconOpen:Pr.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[Td,wv,Md,Nd],cdnScript:[`${Si}/lightgallery.min.js`,`${Si}/plugins/thumbnail/lg-thumbnail.min.js`,`${Si}/plugins/video/lg-video.min.js`,`${Si}/plugins/autoplay/lg-autoplay.min.js`,`${Si}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${Si}/css/lightgallery-bundle.min.css`,...e},{block:a,toolbarIconOpen:l,defaultSrc:c}=s,u=function(x){const O=this,v=window,{plugins:E,cdnScript:A,cdnStyle:B,inline:T,lgLicenseKey:V,...I}=x||{},z=te=>isNaN(te)?void 0:parseInt(te,10),K=()=>{var Y;const te={...I,licenseKey:V,speed:z(I.speed),startAnimationDuration:z(I.startAnimationDuration),thumbMargin:z(I.thumbMargin),thumbWidth:z(I.thumbWidth),slideShowInterval:z(I.slideShowInterval),scale:z(I.scale),enableZoomAfter:z(I.enableZoomAfter),plugins:(E||[]).map(re=>v[re])};T&&(te.container=O,te.closable=!1);const H=(Y=v.lightGallery)==null?void 0:Y.call(v,O,te);T&&H.openGallery()};if(v.lightGallery)K();else{const{head:te}=document,H=Array.isArray(A)?[...A]:[A],Y=Array.isArray(B)?[...B]:[B],re=me=>{if(me.length){const pe=document.createElement("link");pe.href=me.shift(),pe.rel="stylesheet",te.appendChild(pe),re(me)}},oe=me=>{if(me.length){const pe=document.createElement("script");pe.src=me.shift(),pe.onerror=pe.onload=oe.bind(null,me),te.appendChild(pe)}else K()};re(Y),oe(H)}},f=x=>{const O=x.getTrait(Ps);if(!l||!O)return;const{toolbar:v}=x,E={id:Ps,label:l,command:()=>setTimeout(()=>O.runCommand(),100)};!v.find(B=>B.id===E.id)&&(v==null||v.unshift(E))};let d=[];const p=s.plugins||[],h=fo(hv),m=p.includes(Td)?fo(mv):$l,g=p.includes(Md)?fo(gv):$l,y=p.includes(Nd)?fo(bv):$l;r.addType(Nr,{block:a&&{label:i,media:Pr.gallery,category:"Extra",select:!0,...s.block},isComponent:x=>Vl(x,Ns),extendFn:["init","initToolbar"],model:{defaults:{name:i,icon:Pr.gallery,draggable:(x,O)=>!O.is(Nr),attributes:{[Ns]:!0},components:{type:Ed},script:u,selector:"",exThumbImage:"",cdnScript:s.cdnScript,cdnStyle:s.cdnStyle,plugins:s.plugins,lgLicenseKey:s.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...h.propKeys,...m.propKeys,...g.propKeys,...y.propKeys],...h.props,...m.props,...g.props,...y.props,traits:[...h.traits,...m.traits,...g.traits,...y.traits]},init(){Fl(this,["thumbnail"]),Fl(this,["autoplay"]),Fl(this,["zoom"])},initToolbar(){f(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const x=r.events.scriptUnmount;x&&this.listenTo(this.model,x,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const x=this.getLightGallery();x==null||x.destroy()},disableLgInCanvas(){const x=this.getLightGallery();x.lgOpened=!0},isInlineGallery(){var O;const x=this.getLightGallery();return((O=x==null?void 0:x.settings)==null?void 0:O.container)===this.el},onLgInit(x){this.el.__lg=x.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:x}=this,{Canvas:O}=x,v=this.getLightGallery();d=O.getSpots(),setTimeout(()=>O.removeSpots()),v.__lgOpened=!0},onLgClose(){const x=this.getLightGallery();d.forEach(O=>this.em.Canvas.addSpot(O.attributes)),d=[],x.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(x){const O=this.getLightGallery();if(O.__lgOpened)return O.closeGallery(!0);O.lgOpened=!1,O.openGallery(x)}}});const w=fo(vv);r.addType(Ed,{isComponent:x=>Vl(x,_d)||x.tagName==="A"&&Vl(x.parentElement,Ns),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:o,icon:Pr.galleryItem,attributes:{[_d]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...w.props,traits:[...w.traits]},init(){const x=[Xn].map(O=>`change:${O}`).join(" ");this.initSourceType(),this.on(x,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),pv(this,Xn,this.triggerGalleryUpdate)},initToolbar(){f(this)},initScriptUpdate(){const x=[Ad.name].map(O=>`change:attributes:${O}`).join(" ");this.on(x,this.triggerGalleryUpdate)},triggerGalleryUpdate(...x){var O;(O=this.closestType(Nr))==null||O.__scriptPropsChange(...x)},updateTraits(x={}){const{changed:O}=this,{init:v}=x;if(O[Xn]||v){zl(this,Xn);const E=this.getTrait(Xn).getValue();if(E===xi.image){this.removeAttributes([Ds.name,Ul.name,Vs]);const A=this.getTrait(Wl.name);A.setValue(A.getValue()||c)}else E===xi.video?this.removeAttributes([Vs]):E===xi.external&&this.addAttributes({[Vs]:!0})}},initSourceType(){const x=this.getAttributes({noClass:!0,noStyle:!0});x[Vs]?this.set(Xn,xi.external):(x[Ds.name]||x[Ul.name])&&this.set(Xn,xi.video)}}}),Yn({editor:t,plan:vt.startup,licenseKey:s.licenseKey,pluginName:yv,cleanup:()=>{n.remove(Nr),r.removeType(Nr)}})}),Zt="swiper",po=`${Zt}-slide`,Ci=`${Zt}-wrapper`,Oi=`${Zt}-nav-prev`,Ls=`${Zt}-nav-next`,Ei=`${Zt}-pagination`,ho=`${Zt}-scrollbar`,ot={slider:`<svg viewBox="0 0 24 24">
75
75
  <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"/>
76
76
  <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
77
77
  </svg>`,effect:`<svg viewBox="0 0 24 24">
@@ -94,34 +94,256 @@
94
94
  <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"/>
95
95
  </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">
96
96
  <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"/>
97
- </svg>`},ks={id:"swiper-responsive",label:"Responsive",icon:X.responsive},Ms={id:"swiper-extra",label:"Extra",icon:X.extra},$c={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:X.reload},{id:"p",label:"Previous slide",icon:X.prev},{id:"n",label:"Next slide",icon:X.next},{id:"a",label:"Add new slide",icon:X.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(Et),setValue:({component:n,value:e})=>{var t,i;e?n.append([{type:Et},{type:Rn}]):((t=n.findFirstType(Et))==null||t.remove(),(i=n.findFirstType(Rn))==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:X.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:X.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:X.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(Dt)?n.get("pagination")||"bullets":"none",setValue:({component:n,value:e})=>{const t=n.findFirstType(Dt);t==null||t.remove(),e!=="none"&&n.append({type:Dt}),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:X.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:n})=>!!n.findFirstType(Xt),setValue:({component:n,value:e})=>{const t=n.findFirstType(Xt);t==null||t.remove(),e&&n.append({type:Xt}),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:X.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:ks,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:ks,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:Ms,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Ms,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Ts="Slider",Pi="swiper",Pt=`${Pi}-`,Wc=(n,e)=>{const{Components:t,Blocks:i}=n,{block:r}=e,s=Ga($c),o="core:preview",l=function(d){const h=this,f=window,u=h.__onLoad,p=h.__activeSlide,m=h.__inPreview,{cdnScript:g,cdnStyle:b,slidesPerView:C}=d||{},y=x=>isNaN(x)?void 0:parseFloat(x),S=()=>{const x={loop:d.loop,speed:d.speed,initialSlide:d.initialSlide,direction:d.vertical?"vertical":"horizontal",effect:d.effect,freeMode:d.freeMode,parallax:d.parallax,autoHeight:d.autoHeight,allowTouchMove:d.allowTouchMove,grabCursor:d.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(C)?C:y(C),slidesPerGroup:y(d.slidesPerGroup),spaceBetween:y(d.spaceBetween),slidesOffsetBefore:y(d.slidesOffsetBefore),slidesOffsetAfter:y(d.slidesOffsetAfter),centeredSlides:d.centeredSlides,fadeEffect:{crossFade:d.crossFade},cubeEffect:{shadow:d.cubeEffectShadow,slideShadows:d.cubeEffectSlideShadows,shadowOffset:y(d.cubeEffectShadowOffset),shadowScale:y(d.cubeEffectShadowScale)},coverflowEffect:{depth:y(d.coverflowEffectDepth),modifier:y(d.coverflowEffectModifier),rotate:y(d.coverflowEffectRotate),scale:y(d.coverflowEffectScale),stretch:y(d.coverflowEffectStretch),slideShadows:d.coverflowEffectSlideShadows},flipEffect:{limitRotation:d.flipEffectLimitRotation,slideShadows:d.flipEffectSlideShadows},cardsEffect:{perSlideOffset:y(d.cardsEffectPerSlideOffset),perSlideRotate:y(d.cardsEffectPerSlideRotate),rotate:d.cardsEffectRotate,slideShadows:d.cardsEffectSlideShadows},navigation:{nextEl:h.querySelector(".swiper-button-next"),prevEl:h.querySelector(".swiper-button-prev")},pagination:{type:d.pagination||"bullets",dynamicBullets:d.dynamicBullets,clickable:d.clickableBullets,progressbarOpposite:d.progressbarOpposite,el:h.querySelector(".swiper-pagination")},scrollbar:{el:h.querySelector(".swiper-scrollbar"),draggable:d.scrollbarDraggable,hide:d.scrollbarHide},autoplay:d.autoplay&&{delay:d.autoplayDelay,disableOnInteraction:d.autoplayDisableOnInteraction,pauseOnMouseEnter:d.autoplayPauseOnMouseEnter,reverseDirection:d.autoplayReverseDirection,stopOnLastSlide:d.autoplayStopOnLastSlide,waitForTransition:d.autoplayWaitForTransition}};if(d.tablet){const{tabletBreakpoint:N,tabletSlidesPerView:R}=d,T=y(N);x.breakpoints[T]={slidesPerView:isNaN(R)?R:y(R),slidesPerGroup:y(d.tabletSlidesPerGroup),spaceBetween:y(d.tabletSpaceBetween)}}if(d.mobile){const{mobileBreakpoint:N,mobileSlidesPerView:R}=d,T=y(N);x.breakpoints[T]={slidesPerView:isNaN(R)?R:y(R),slidesPerGroup:y(d.mobileSlidesPerGroup),spaceBetween:y(d.mobileSpaceBetween)}}u&&!m&&(x.simulateTouch=!1),p&&(x.initialSlide=p);const k=new f.Swiper(h,x);u==null||u(k)};if(f.Swiper)S();else{const{head:x}=document,k=Array.isArray(g)?[...g]:[g],N=Array.isArray(b)?[...b]:[b],R=V=>{if(V.length){const I=document.createElement("link");I.href=V.shift(),I.rel="stylesheet",x.appendChild(I),R(V)}},T=V=>{if(V.length){const I=document.createElement("script");I.src=V.shift(),I.onerror=I.onload=T.bind(null,V),x.appendChild(I)}else S()};R(N),T(k)}},a=(d=0)=>({type:Zt,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${d}`}}}),c=t.getType("default").model;return t.addType(pe,{block:r&&{label:Ts,media:X.slider,category:"Extra",select:!0,...e.block},isComponent:d=>Ye(d,Pi),model:{defaults:()=>({name:Ts,icon:X.slider,classes:Pi,draggable:(d,h)=>!h.is(pe),components:[{type:Nt,components:[a(1),a(2),a(3)]},{type:Dt}],script:l,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...s.propKeys],...s.props,traits:[...s.traits]}),init(){const{em:d}=this;Ua(this,s.traits),Za(this,s.propKeys),this.listenTo(d,`run:${o}`,this.onPreviewOn),this.listenTo(d,`stop:${o}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const d=this.findFirstType(Nt);d==null||d.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var h;const d=((h=this.findFirstType(Nt))==null?void 0:h.components().length)||0;return{type:Zt,components:{type:"text",components:{type:"textnode",content:`Slide ${d+1}`}}}},toJSON(...d){const h=c.prototype.toJSON.apply(this,d);return s.propsNoValues.forEach(f=>delete h[f]),delete h["script-props"],h}},view:{init(){const d=t.events.scriptUnmount;d&&this.listenTo(this.model,d,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var d;(d=this.getSwiper())==null||d.destroy()},onRender(){const d=this.el;d.__onLoad=h=>h.on("slideChange",()=>this.__activeSlide=h.activeIndex),d.__activeSlide=this.__activeSlide,d.__inPreview=this.model.__inPreview}}}),()=>{t.removeType(pe),i.remove(pe)}},_c="Nav Prev",qc="Nav Next",In=`${Pt}button-prev`,Vn=`${Pt}button-next`,Kc=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(Et,{isComponent:i=>Ye(i,In),model:{defaults:{name:_c,classes:In,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:`
98
- .${In} {
97
+ </svg>`},Pd={id:"swiper-responsive",label:"Responsive",icon:ot.responsive},Vd={id:"swiper-extra",label:"Extra",icon:ot.extra},Sv={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:ot.reload},{id:"p",label:"Previous slide",icon:ot.prev},{id:"n",label:"Next slide",icon:ot.next},{id:"a",label:"Add new slide",icon:ot.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(Oi),setValue:({component:t,value:e})=>{var n,r;e?t.append([{type:Oi},{type:Ls}]):((n=t.findFirstType(Oi))==null||n.remove(),(r=t.findFirstType(Ls))==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:ot.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:ot.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:ot.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(Ei)?t.get("pagination")||"bullets":"none",setValue:({component:t,value:e})=>{const n=t.findFirstType(Ei);n==null||n.remove(),e!=="none"&&t.append({type:Ei}),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:ot.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:t})=>!!t.findFirstType(ho),setValue:({component:t,value:e})=>{const n=t.findFirstType(ho);n==null||n.remove(),e&&t.append({type:ho}),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:ot.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Pd,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:Pd,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:Vd,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Vd,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Dd="Slider",ql="swiper",_i=`${ql}-`,Cv=(t,e)=>{const{Components:n,Blocks:r,Commands:i}=t,{block:o}=e,s=Tb(Sv),a="core:preview",l=i.events,c=function(d){const p=this,h=window,m=p.__onLoad,g=p.__activeSlide,y=p.__inPreview,{cdnScript:w,cdnStyle:x,slidesPerView:O}=d||{},v=A=>isNaN(A)?void 0:parseFloat(A),E=()=>{const A={loop:d.loop,speed:d.speed,initialSlide:d.initialSlide,direction:d.vertical?"vertical":"horizontal",effect:d.effect,freeMode:d.freeMode,parallax:d.parallax,autoHeight:d.autoHeight,allowTouchMove:d.allowTouchMove,grabCursor:d.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(O)?O:v(O),slidesPerGroup:v(d.slidesPerGroup),spaceBetween:v(d.spaceBetween),slidesOffsetBefore:v(d.slidesOffsetBefore),slidesOffsetAfter:v(d.slidesOffsetAfter),centeredSlides:d.centeredSlides,fadeEffect:{crossFade:d.crossFade},cubeEffect:{shadow:d.cubeEffectShadow,slideShadows:d.cubeEffectSlideShadows,shadowOffset:v(d.cubeEffectShadowOffset),shadowScale:v(d.cubeEffectShadowScale)},coverflowEffect:{depth:v(d.coverflowEffectDepth),modifier:v(d.coverflowEffectModifier),rotate:v(d.coverflowEffectRotate),scale:v(d.coverflowEffectScale),stretch:v(d.coverflowEffectStretch),slideShadows:d.coverflowEffectSlideShadows},flipEffect:{limitRotation:d.flipEffectLimitRotation,slideShadows:d.flipEffectSlideShadows},cardsEffect:{perSlideOffset:v(d.cardsEffectPerSlideOffset),perSlideRotate:v(d.cardsEffectPerSlideRotate),rotate:d.cardsEffectRotate,slideShadows:d.cardsEffectSlideShadows},navigation:{nextEl:p.querySelector(".swiper-button-next"),prevEl:p.querySelector(".swiper-button-prev")},pagination:{type:d.pagination||"bullets",dynamicBullets:d.dynamicBullets,clickable:d.clickableBullets,progressbarOpposite:d.progressbarOpposite,el:p.querySelector(".swiper-pagination")},scrollbar:{el:p.querySelector(".swiper-scrollbar"),draggable:d.scrollbarDraggable,hide:d.scrollbarHide},autoplay:d.autoplay&&{delay:d.autoplayDelay,disableOnInteraction:d.autoplayDisableOnInteraction,pauseOnMouseEnter:d.autoplayPauseOnMouseEnter,reverseDirection:d.autoplayReverseDirection,stopOnLastSlide:d.autoplayStopOnLastSlide,waitForTransition:d.autoplayWaitForTransition}};if(d.tablet){const{tabletBreakpoint:T,tabletSlidesPerView:V}=d,I=v(T);A.breakpoints[I]={slidesPerView:isNaN(V)?V:v(V),slidesPerGroup:v(d.tabletSlidesPerGroup),spaceBetween:v(d.tabletSpaceBetween)}}if(d.mobile){const{mobileBreakpoint:T,mobileSlidesPerView:V}=d,I=v(T);A.breakpoints[I]={slidesPerView:isNaN(V)?V:v(V),slidesPerGroup:v(d.mobileSlidesPerGroup),spaceBetween:v(d.mobileSpaceBetween)}}m&&!y&&(A.simulateTouch=!1),g&&(A.initialSlide=g);const B=new h.Swiper(p,A);m==null||m(B)};if(h.Swiper)E();else{const{head:A}=document,B=Array.isArray(w)?[...w]:[w],T=Array.isArray(x)?[...x]:[x],V=z=>{if(z.length){const K=document.createElement("link");K.href=z.shift(),K.rel="stylesheet",A.appendChild(K),V(z)}},I=z=>{if(z.length){const K=document.createElement("script");K.src=z.shift(),K.onerror=K.onload=I.bind(null,z),A.appendChild(K)}else E()};V(T),I(B)}},u=(d=0)=>({type:po,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${d}`}}}),f=n.getType("default").model;return n.addType(Zt,{block:o&&{label:Dd,media:ot.slider,category:"Extra",select:!0,...e.block},isComponent:d=>Ar(d,ql),model:{defaults:()=>({name:Dd,icon:ot.slider,classes:ql,draggable:(d,p)=>!p.is(Zt),components:[{type:Ci,components:[u(1),u(2),u(3)]},{type:Ei}],script:c,cdnScript:e.cdnScript,cdnStyle:e.cdnStyle,"script-props":["cdnScript","cdnStyle",...s.propKeys],...s.props,traits:[...s.traits]}),init(){const{em:d}=this;Mb(this,s.traits),Nb(this,s.propKeys),this.listenTo(d,`${l.runCommand}${a}`,this.onPreviewOn),this.listenTo(d,`${l.stopCommand}${a}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const d=this.findFirstType(Ci);d==null||d.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var p;const d=((p=this.findFirstType(Ci))==null?void 0:p.components().length)||0;return{type:po,components:{type:"text",components:{type:"textnode",content:`Slide ${d+1}`}}}},toJSON(...d){const p=f.prototype.toJSON.apply(this,d);return s.propsNoValues.forEach(h=>delete p[h]),delete p["script-props"],p}},view:{init(){const d=n.events.scriptUnmount;d&&this.listenTo(this.model,d,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var d;(d=this.getSwiper())==null||d.destroy()},onRender(){const d=this.el;d.__onLoad=p=>p.on("slideChange",()=>this.__activeSlide=p.activeIndex),d.__activeSlide=this.__activeSlide,d.__inPreview=this.model.__inPreview}}}),()=>{n.removeType(Zt),r.remove(Zt)}},Ov="Nav Prev",Ev="Nav Next",Rs=`${_i}button-prev`,js=`${_i}button-next`,_v=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(Oi,{isComponent:r=>Ar(r,Rs),model:{defaults:{name:Ov,classes:Rs,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:`
98
+ .${Rs} {
99
99
  color: inherit;
100
100
  }
101
- .${In}:after {
101
+ .${Rs}:after {
102
102
  content: none;
103
103
  }
104
- `}}}),e.addType(Rn,{extend:Et,isComponent:i=>Ye(i,Vn),model:{defaults:{name:qc,classes:Vn,components:t("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
105
- .${Vn} {
104
+ `}}}),e.addType(Ls,{extend:Oi,isComponent:r=>Ar(r,js),model:{defaults:{name:Ev,classes:js,components:n("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
105
+ .${js} {
106
106
  color: inherit;
107
107
  }
108
- .${Vn}:after {
108
+ .${js}:after {
109
109
  content: none;
110
110
  }
111
- `}}}),()=>{e.removeType(Et),e.removeType(Rn)}},Jc=n=>{const{Components:e}=n,t=`${Pt}pagination`;return e.addType(Dt,{isComponent:i=>Ye(i,t),model:{defaults:{name:"Pagination",classes:t,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
112
- .${t}-bullet-active {
111
+ `}}}),()=>{e.removeType(Oi),e.removeType(Ls)}},kv=t=>{const{Components:e}=t,n=`${_i}pagination`;return e.addType(Ei,{isComponent:r=>Ar(r,n),model:{defaults:{name:"Pagination",classes:n,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
112
+ .${n}-bullet-active {
113
113
  background-color: currentColor;
114
114
  }
115
- .${t}-progressbar-fill {
115
+ .${n}-progressbar-fill {
116
116
  --swiper-pagination-color: currentColor;
117
117
  }
118
- `}}}),()=>{e.removeType(Dt)}},jc="Scrollbar",As=`${Pt}scrollbar`,Gc=n=>{const{Components:e}=n;return e.addType(Xt,{isComponent:t=>Ye(t,As),model:{defaults:{name:jc,classes:As,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(Xt)}},Uc="Slide",Os=`${Pt}slide`,Zc=n=>{const{Components:e}=n;return e.addType(Zt,{isComponent:t=>Ye(t,Os),model:{defaults:{name:Uc,classes:Os,icon:X.slider,draggable:(t,i)=>i.is(Nt)}}}),()=>{e.removeType(Zt)}},Xc="Wrapper",Ns=`${Pt}wrapper`,Yc=n=>{const{Components:e}=n,{events:t}=e;return e.addType(Nt,{isComponent:i=>Ye(i,Ns),model:{defaults:{name:Xc,icon:X.slider,classes:Ns,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:i=>i.is(Zt)},init(){const i=this.components();this.listenTo(i,"add remove",this.updateSlider)},updateSlider(i){const r=this.closestType(pe);if(r){const s=r.getView();r.reloadSlider();const o=t.scriptMount;o&&this.em.once(o,()=>{setTimeout(()=>{var l;return(l=s.getSwiper())==null?void 0:l.slideTo(i.index())},100)})}}}}),()=>{e.removeType(Nt)}},Qc="swiperComponent",ed=Ze(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=[Wc(n,t),Kc(n),Yc(n),Zc(n),Jc(n),Gc(n)];Xe({editor:n,plan:ae.startup,licenseKey:t.licenseKey,pluginName:Qc,cleanup:()=>{i.forEach(r=>r())}})});function W(n){this.content=n}W.prototype={constructor:W,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,r=i.find(n),s=i.content.slice();return r==-1?s.push(t||n,e):(s[r+1]=e,t&&(s[r]=t)),new W(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new W(t)},addToStart:function(n,e){return new W([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new W(t)},addBefore:function(n,e,t){var i=this.remove(e),r=i.content.slice(),s=i.find(n);return r.splice(s==-1?r.length:s,0,e,t),new W(r)},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=W.from(n),n.size?new W(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=W.from(n),n.size?new W(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=W.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}},W.from=function(n){if(n instanceof W)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new W(e)};function Es(n,e,t){for(let i=0;;i++){if(i==n.childCount||i==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(i),s=e.child(i);if(r==s){t+=r.nodeSize;continue}if(!r.sameMarkup(s))return t;if(r.isText&&r.text!=s.text){for(let o=0;r.text[o]==s.text[o];o++)t++;return t}if(r.content.size||s.content.size){let o=Es(r.content,s.content,t+1);if(o!=null)return o}t+=r.nodeSize}}function Ds(n,e,t,i){for(let r=n.childCount,s=e.childCount;;){if(r==0||s==0)return r==s?null:{a:t,b:i};let o=n.child(--r),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,i-=a;continue}if(!o.sameMarkup(l))return{a:t,b:i};if(o.isText&&o.text!=l.text){let c=0,d=Math.min(o.text.length,l.text.length);for(;c<d&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,i--;return{a:t,b:i}}if(o.content.size||l.content.size){let c=Ds(o.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,r=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&i(a,r+l,s||null,o)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),i,r+d)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,r){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&i&&(o?o=!1:s+=i),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,r=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(i)&&(r[r.length-1]=t.withText(t.text+i.text),s=1);s<e.content.length;s++)r.push(e.content[s]);return new w(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],r=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),i.push(l),r+=l.nodeSize),o=a}return new w(i,r)}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 r=this.content.slice(),s=this.size+t.nodeSize-i.nodeSize;return r[e]=t,new w(r,s)}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 r=this.content[t];e(r,i,t),i+=r.nodeSize}}findDiffStart(e,t=0){return Es(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return Ds(this,e,t,i)}findIndex(e,t=-1){if(e==0)return zn(0,e);if(e==this.size)return zn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,r=0;;i++){let s=this.child(i),o=r+s.nodeSize;if(o>=e)return o==e||t>0?zn(i+1,o):zn(i,r);r=o}}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 r=0;r<e.length;r++){let s=e[r];i+=s.nodeSize,r&&s.isText&&e[r-1].sameMarkup(s)?(t||(t=e.slice(0,r)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}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 Ri={index:0,offset:0};function zn(n,e){return Ri.index=n,Ri.offset=e,Ri}function Bn(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(!Bn(n[i],e[i]))return!1}else{for(let i in n)if(!(i in e)||!Bn(n[i],e[i]))return!1;for(let i in e)if(!(i in n))return!1}return!0}class P{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,r));else{if(s.type.excludes(this.type))return e;!i&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),i=!0),t&&t.push(s)}}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&&Bn(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 r=i.create(t.attrs);return i.checkAttrs(r.attrs),r}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 P.none;if(e instanceof P)return[e];let t=e.slice();return t.sort((i,r)=>i.type.rank-r.type.rank),t}}P.none=[];class Ln extends Error{}class v{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=Rs(this.content,e+this.openStart,t);return i&&new v(i,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ps(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 v.empty;let i=t.openStart||0,r=t.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(w.fromJSON(e,t.content),i,r)}static maxOpen(e,t=!0){let i=0,r=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)i++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)r++;return new v(e,i,r)}}v.empty=new v(w.empty,0,0);function Ps(n,e,t){let{index:i,offset:r}=n.findIndex(e),s=n.maybeChild(i),{index:o,offset:l}=n.findIndex(t);if(r==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(i!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(i,s.copy(Ps(s.content,e-r-1,t-r-1)))}function Rs(n,e,t,i){let{index:r,offset:s}=n.findIndex(e),o=n.maybeChild(r);if(s==e||o.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Rs(o.content,e-s-1,t);return l&&n.replaceChild(r,o.copy(l))}function td(n,e,t){if(t.openStart>n.depth)throw new Ln("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ln("Inconsistent open depths");return Is(n,e,t,0)}function Is(n,e,t,i){let r=n.index(i),s=n.node(i);if(r==e.index(i)&&i<n.depth-t.openStart){let o=Is(n,e,t,i+1);return s.copy(s.content.replaceChild(r,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==i&&e.depth==i){let o=n.parent,l=o.content;return rt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=nd(t,n);return rt(s,zs(n,o,l,e,i))}else return rt(s,Hn(n,e,i))}function Vs(n,e){if(!e.type.compatibleContent(n.type))throw new Ln("Cannot join "+e.type.name+" onto "+n.type.name)}function Ii(n,e,t){let i=n.node(t);return Vs(i,e.node(t)),i}function it(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 Yt(n,e,t,i){let r=(e||n).node(t),s=0,o=e?e.index(t):r.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(it(n.nodeAfter,i),s++));for(let l=s;l<o;l++)it(r.child(l),i);e&&e.depth==t&&e.textOffset&&it(e.nodeBefore,i)}function rt(n,e){return n.type.checkContent(e),n.copy(e)}function zs(n,e,t,i,r){let s=n.depth>r&&Ii(n,e,r+1),o=i.depth>r&&Ii(t,i,r+1),l=[];return Yt(null,n,r,l),s&&o&&e.index(r)==t.index(r)?(Vs(s,o),it(rt(s,zs(n,e,t,i,r+1)),l)):(s&&it(rt(s,Hn(n,e,r+1)),l),Yt(e,t,r,l),o&&it(rt(o,Hn(t,i,r+1)),l)),Yt(i,null,r,l),new w(l)}function Hn(n,e,t){let i=[];if(Yt(null,n,t,i),n.depth>t){let r=Ii(n,e,t+1);it(rt(r,Hn(n,e,t+1)),i)}return Yt(e,null,t,i),new w(i)}function nd(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)r=e.node(s).copy(w.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Qt{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],r=e.child(t);return i?e.child(t).cut(i):r}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],r=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)r+=i.child(s).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return P.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),r=e.maybeChild(t);if(!i){let l=i;i=r,r=l}let s=i.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!r||!s[o].isInSet(r.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,r=e.parent.maybeChild(e.index());for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].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 Fn(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=[],r=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(i.push(o,l,r+a),!c||(o=o.child(l),o.isText))break;s=c-1,r+=a+1}return new Qt(t,i,s)}static resolveCached(e,t){let i=Bs.get(e);if(i)for(let s=0;s<i.elts.length;s++){let o=i.elts[s];if(o.pos==t)return o}else Bs.set(e,i=new id);let r=i.elts[i.i]=Qt.resolve(e,t);return i.i=(i.i+1)%rd,r}}class id{constructor(){this.elts=[],this.i=0}}const rd=12,Bs=new WeakMap;class Fn{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 sd=Object.create(null);let st=class Fr{constructor(e,t,i,r=P.none){this.type=e,this.attrs=t,this.marks=r,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,r=0){this.content.nodesBetween(e,t,i,r,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,r){return this.content.textBetween(e,t,i,r)}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&&Bn(this.attrs,t||e.defaultAttrs||sd)&&P.sameSet(this.marks,i||P.none)}copy(e=null){return e==this.content?this:new Fr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fr(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 v.empty;let r=this.resolve(e),s=this.resolve(t),o=i?0:r.sharedDepth(t),l=r.start(o),c=r.node(o).content.cut(r.pos-l,s.pos-l);return new v(c,r.depth-o,s.depth-o)}replace(e,t,i){return td(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(r==e||t.isText)return t;e-=r+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 r=this.content.child(t-1);return{node:r,index:t-1,offset:i-r.nodeSize}}resolve(e){return Qt.resolveCached(this,e)}resolveNoCache(e){return Qt.resolve(this,e)}rangeHasMark(e,t,i){let r=!1;return t>e&&this.nodesBetween(e,t,s=>(i.isInSet(s.marks)&&(r=!0),!r)),r}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()+")"),Ls(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,r=0,s=i.childCount){let o=this.contentMatchAt(e).matchFragment(i,r,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<s;a++)if(!this.type.allowsMarks(i.child(a).marks))return!1;return!0}canReplaceWith(e,t,i,r){if(r&&!this.type.allowsMarks(r))return!1;let s=this.contentMatchAt(e).matchType(i),o=s&&s.matchFragment(this.content,t);return o?o.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=P.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(!P.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 r=w.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,r,i);return s.type.checkAttrs(s.attrs),s}};st.prototype.text=void 0;class $n extends st{constructor(e,t,i,r){if(super(e,t,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ls(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 $n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $n(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 Ls(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ot{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new od(e,t);if(i.next==null)return ot.empty;let r=Hs(i);i.next&&i.err("Unexpected trailing text");let s=ud(fd(r));return pd(s,i),s}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 r=this;for(let s=t;r&&s<i;s++)r=r.matchType(e.child(s).type);return r}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 r=[this];function s(o,l){let a=o.matchFragment(e,i);if(a&&(!t||a.validEnd))return w.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:h}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(h)==-1){r.push(h);let f=s(h,l.concat(d));if(f)return f}}return null}return s(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 r=i.shift(),s=r.match;if(s.matchType(e)){let o=[];for(let l=r;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(i.push({match:l.contentMatch,type:l,via:r}),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 r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&t(i.next[r].next)}return t(this),e.map((i,r)=>{let s=r+(i.validEnd?"*":" ")+" ";for(let o=0;o<i.next.length;o++)s+=(o?", ":"")+i.next[o].type.name+"->"+e.indexOf(i.next[o].next);return s}).join(`
119
- `)}}ot.empty=new ot(!0);class od{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 Hs(n){let e=[];do e.push(ld(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ld(n){let e=[];do e.push(ad(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ad(n){let e=hd(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=cd(n,e);else break;return e}function Fs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function cd(n,e){let t=Fs(n),i=t;return n.eat(",")&&(n.next!="}"?i=Fs(n):i=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function dd(n,e){let t=n.nodeTypes,i=t[e];if(i)return[i];let r=[];for(let s in t){let o=t[s];o.isInGroup(e)&&r.push(o)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function hd(n){if(n.eat("(")){let e=Hs(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=dd(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 fd(n){let e=[[]];return r(s(n,0),t()),e;function t(){return e.push([])-1}function i(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function r(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;r(c,l=t())}else if(o.type=="star"){let a=t();return i(l,a),r(s(o.expr,a),a),[i(a)]}else if(o.type=="plus"){let a=t();return r(s(o.expr,l),a),r(s(o.expr,a),a),[i(a)]}else{if(o.type=="opt")return[i(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let d=t();r(s(o.expr,a),d),a=d}if(o.max==-1)r(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let d=t();i(a,d),r(s(o.expr,a),d),a=d}return[i(a)]}else{if(o.type=="name")return[i(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function $s(n,e){return e-n}function Ws(n,e){let t=[];return i(e),t.sort($s);function i(r){let s=n[r];if(s.length==1&&!s[0].term)return i(s[0].to);t.push(r);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&i(a)}}}function ud(n){let e=Object.create(null);return t(Ws(n,0));function t(i){let r=[];i.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<r.length;d++)r[d][0]==l&&(c=r[d][1]);Ws(n,a).forEach(d=>{c||r.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[i.join(",")]=new ot(i.indexOf(n.length-1)>-1);for(let o=0;o<r.length;o++){let l=r[o][1].sort($s);s.next.push({type:r[o][0],next:e[l.join(",")]||t(l)})}return s}}function pd(n,e){for(let t=0,i=[n];t<i.length;t++){let r=i[t],s=!r.validEnd,o=[];for(let l=0;l<r.next.length;l++){let{type:a,next:c}=r.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),i.indexOf(c)==-1&&i.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _s(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 qs(n,e){let t=Object.create(null);for(let i in n){let r=e&&e[i];if(r===void 0){let s=n[i];if(s.hasDefault)r=s.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=r}return t}function Ks(n,e,t,i){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let s=n[r];s.validate&&s.validate(e[r])}}function Js(n,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new gd(n,i,e[i]);return t}let js=class za{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=Js(e,i.attrs),this.defaultAttrs=_s(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==ot.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:qs(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new st(this,this.computeAttrs(e),w.from(t),P.setFrom(i))}createChecked(e=null,t,i){return t=w.from(t),this.checkContent(t),new st(this,this.computeAttrs(e),t,P.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=w.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let r=this.contentMatch.matchFragment(t),s=r&&r.fillBefore(w.empty,!0);return s?new st(this,e,t.append(s),P.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){Ks(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:P.none:e}static compile(e,t){let i=Object.create(null);e.forEach((s,o)=>i[s]=new za(s,t,o));let r=t.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let s in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function md(n,e,t){let i=t.split("|");return r=>{let s=r===null?"null":typeof r;if(i.indexOf(s)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${n}, got ${s}`)}}class gd{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?md(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Wn{constructor(e,t,i,r){this.name=e,this.rank=t,this.schema=i,this.spec=r,this.attrs=Js(e,r.attrs),this.excluded=null;let s=_s(this.attrs);this.instance=s?new P(this,s):null}create(e=null){return!e&&this.instance?this.instance:new P(this,qs(this.attrs,e))}static compile(e,t){let i=Object.create(null),r=0;return e.forEach((s,o)=>i[s]=new Wn(s,r++,t,o)),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){Ks(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class yd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=W.from(e.nodes),t.marks=W.from(e.marks||{}),this.nodes=js.compile(this.spec.nodes,this),this.marks=Wn.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let s=this.nodes[r],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=i[o]||(i[o]=ot.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Gs(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let r in this.marks){let s=this.marks[r],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Gs(this,o.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,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof js){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,r)}text(e,t){let i=this.nodes.text;return new $n(i,i.defaultAttrs,e,P.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return st.fromJSON(this,e)}markFromJSON(e){return P.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Gs(n,e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],s=n.marks[r],o=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function bd(n){return n.tag!=null}function wd(n){return n.style!=null}class Rt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(r=>{if(bd(r))this.tags.push(r);else if(wd(r)){let s=/[^=]*/.exec(r.style)[0];i.indexOf(s)<0&&i.push(s),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let i=new Ys(this,t,!1);return i.addAll(e,P.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new Ys(this,t,!0);return i.addAll(e,P.none,t.from,t.to),v.maxOpen(i.finish())}matchTag(e,t,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let s=this.tags[r];if(vd(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,i,r){for(let s=r?this.styles.indexOf(r)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!i.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function i(r){let s=r.priority==null?50:r.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,r)}for(let r in e.marks){let s=e.marks[r].spec.parseDOM;s&&s.forEach(o=>{i(o=Qs(o)),o.mark||o.ignore||o.clearMark||(o.mark=r)})}for(let r in e.nodes){let s=e.nodes[r].spec.parseDOM;s&&s.forEach(o=>{i(o=Qs(o)),o.node||o.ignore||o.mark||(o.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Rt(e,Rt.schemaRules(e)))}}const Us={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},Sd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zs={ol:!0,ul:!0},_n=1,qn=2,en=4;function Xs(n,e,t){return e!=null?(e?_n:0)|(e==="full"?qn:0):n&&n.whitespace=="pre"?_n|qn:t&~en}class Kn{constructor(e,t,i,r,s,o){this.type=e,this.attrs=t,this.marks=i,this.solid=r,this.options=o,this.content=[],this.activeMarks=P.none,this.match=s||(o&en?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,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&_n)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let s=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-r[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&&!Us.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ys{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0;let r=t.topNode,s,o=Xs(null,t.preserveWhitespace,0)|(i?en:0);r?s=new Kn(r.type,r.attrs,P.none,!0,t.topMatch||r.type.contentMatch,o):i?s=new Kn(null,null,P.none,!0,null,o):s=new Kn(e.schema.topNodeType,null,P.none,!0,null,o),this.nodes=[s],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,r=this.top;if(r.options&qn||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r.options&_n)r.options&qn?i=i.replace(/\r\n?/g,`
120
- `):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 s=r.content[r.content.length-1],o=e.previousSibling;(!s||o&&o.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.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 r=e.nodeName.toLowerCase(),s;Zs.hasOwnProperty(r)&&this.parser.normalizeLists&&xd(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,i));if(o?o.ignore:Sd.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e,t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let l,a=this.top,c=this.needsBlock;if(Us.hasOwnProperty(r))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=o&&o.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,o,l,o.consuming===!1?s:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
121
- `),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 r=0;r<this.parser.matchedStyles.length;r++){let s=this.parser.matchedStyles[r],o=i.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,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,r){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),i)||this.leafFallback(e,i);else{let a=this.enter(o,t.attrs||null,i,t.preserveWhitespace);a&&(s=!0,i=a)}else{let a=this.parser.schema.marks[t.mark];i=i.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);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)}s&&this.sync(l)&&this.open--}addAll(e,t,i,r){let s=i||0;for(let o=i?e.childNodes[i]:e.firstChild,l=r==null?null:e.childNodes[r];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t){let i,r;for(let s=this.open;s>=0;s--){let o=this.nodes[s],l=o.findWrapping(e);if(l&&(!i||i.length>l.length)&&(i=l,r=o,!l.length)||o.solid)break}if(!i)return null;this.sync(r);for(let s=0;s<i.length;s++)t=this.enterInner(i[s],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}let i=this.findPlace(e,t);if(i){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let s=P.none;for(let o of i.concat(e.marks))(r.type?r.type.allowsMarkType(o.type):eo(o.type,e.type))&&(s=o.addToSet(s));return r.content.push(e.mark(s)),!0}return!1}enter(e,t,i,r){let s=this.findPlace(e.create(t),i);return s&&(s=this.enterInner(e,t,i,!0,r)),s}enterInner(e,t,i,r=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Xs(e,s,o.options);o.options&en&&o.content.length==0&&(l|=en);let a=P.none;return i=i.filter(c=>(o.type?o.type.allowsMarkType(c.type):eo(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Kn(e,t,a,r,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 r=i.length-1;r>=0;r--)e+=i[r].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 r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].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,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),s=-(i?i.depth+1:0)+(r?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:i&&a>=s?i.node(a-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return o(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 xd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&Zs.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function vd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Qs(n){let e={};for(let t in n)e[t]=n[t];return e}function eo(n,e){let t=e.schema.nodes;for(let i in t){let r=t[i];if(!r.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:d}=l.edge(a);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(r.contentMatch))return!0}}class lt{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=Vi(t).createDocumentFragment());let r=i,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)r=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(o,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:r}=Jn(Vi(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let s=this.serializeMark(e.marks[r],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(i),i=s.dom)}return i}serializeMark(e,t,i={}){let r=this.marks[e.type.name];return r&&Jn(Vi(i),r(e,t),null,e.attrs)}static renderSpec(e,t,i=null,r){return Jn(e,t,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new lt(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=to(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return to(e.marks)}}function to(n){let e={};for(let t in n){let i=n[t].spec.toDOM;i&&(e[t]=i)}return e}function Vi(n){return n.document||window.document}const no=new WeakMap;function Cd(n){let e=no.get(n);return e===void 0&&no.set(n,e=kd(n)),e}function kd(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 r=0;r<i.length;r++)t(i[r]);else for(let r in i)t(i[r])}return t(n),e}function Jn(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 r=e[0],s;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(s=Cd(i))&&s.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 o=r.indexOf(" ");o>0&&(t=r.slice(0,o),r=r.slice(o+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),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 f=h.indexOf(" ");f>0?a.setAttributeNS(h.slice(0,f),h.slice(f+1),c[h]):a.setAttribute(h,c[h])}}for(let h=d;h<e.length;h++){let f=e[h];if(f===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:u,contentDOM:p}=Jn(n,f,t,i);if(a.appendChild(u),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const io=65535,ro=Math.pow(2,16);function Md(n,e){return n+e*ro}function so(n){return n&io}function Td(n){return(n-(n&io))/ro}const oo=1,lo=2,jn=4,ao=8;class zi{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&ao)>0}get deletedBefore(){return(this.delInfo&(oo|jn))>0}get deletedAfter(){return(this.delInfo&(lo|jn))>0}get deletedAcross(){return(this.delInfo&jn)>0}}class re{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&re.empty)return re.empty}recover(e){let t=0,i=so(e);if(!this.inverted)for(let r=0;r<i;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+t+Td(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 r=0,s=this.inverted?2:1,o=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+s],d=this.ranges[l+o],h=a+c;if(e<=h){let f=c?e==a?-1:e==h?1:t:t,u=a+r+(f<0?0:d);if(i)return u;let p=e==(t<0?a:h)?null:Md(l/3,e-a),m=e==a?lo:e==h?oo:jn;return(t<0?e!=a:e!=h)&&(m|=ao),new zi(u,m,p)}r+=d-c}return i?e+r:new zi(e+r,0,null)}touches(e,t){let i=0,r=so(t),s=this.inverted?2:1,o=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+s],d=a+c;if(e<=d&&l==r*3)return!0;i+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[r+t],d=this.ranges[r+i];e(l,l+c,a,a+d),s+=d-c}}invert(){return new re(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?re.empty:new re(e<0?[0,-e,0]:[0,0,e])}}re.empty=new re([]);class It{constructor(e=[],t,i=0,r=e.length){this.maps=e,this.mirror=t,this.from=i,this.to=r}slice(e=0,t=this.maps.length){return new It(this.maps,this.mirror,e,t)}copy(){return new It(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 r=e.getMirror(t);this.appendMap(e.maps[t],r!=null&&r<t?i+r: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 r=e.getMirror(t);this.appendMap(e.maps[t].invert(),r!=null&&r>t?i-r-1:void 0)}}invert(){let e=new It;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 r=0;for(let s=this.from;s<this.to;s++){let o=this.maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return i?e:new zi(e,r,null)}}const Bi=Object.create(null);class J{getMap(){return re.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Bi[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 Bi)throw new RangeError("Duplicate use of step JSON ID "+e);return Bi[e]=t,t.prototype.jsonID=e,t}}class L{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new L(e,null)}static fail(e){return new L(null,e)}static fromReplace(e,t,i,r){try{return L.ok(e.replace(t,i,r))}catch(s){if(s instanceof Ln)return L.fail(s.message);throw s}}}function Li(n,e,t){let i=[];for(let r=0;r<n.childCount;r++){let s=n.child(r);s.content.size&&(s=s.copy(Li(s.content,e,s))),s.isInline&&(s=e(s,t,r)),i.push(s)}return w.fromArray(i)}class Ie extends J{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),r=i.node(i.sharedDepth(this.to)),s=new v(Li(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,s)}invert(){return new Se(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 Ie(t.pos,i.pos,this.mark)}merge(e){return e instanceof Ie&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ie(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 Ie(t.from,t.to,e.markFromJSON(t.mark))}}J.jsonID("addMark",Ie);class Se extends J{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 v(Li(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,i)}invert(){return new Ie(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 Se(t.pos,i.pos,this.mark)}merge(e){return e instanceof Se&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Se(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 Se(t.from,t.to,e.markFromJSON(t.mark))}}J.jsonID("removeMark",Se);class Ve extends J{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return L.fromReplace(e,this.pos,this.pos+1,new v(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 r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(i))return new Ve(this.pos,t.marks[r]);return new Ve(this.pos,this.mark)}}return new Vt(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ve(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 Ve(t.pos,e.markFromJSON(t.mark))}}J.jsonID("addNodeMark",Ve);class Vt extends J{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return L.fromReplace(e,this.pos,this.pos+1,new v(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 Ve(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Vt(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 Vt(t.pos,e.markFromJSON(t.mark))}}J.jsonID("removeNodeMark",Vt);class j extends J{constructor(e,t,i,r=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=r}apply(e){return this.structure&&Hi(e,this.from,this.to)?L.fail("Structure replace would overwrite content"):L.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new re([this.from,this.to-this.from,this.slice.size])}invert(e){return new j(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 j(t.pos,Math.max(t.pos,i.pos),this.slice)}merge(e){if(!(e instanceof j)||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?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new j(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?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new j(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 j(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}J.jsonID("replace",j);class _ extends J{constructor(e,t,i,r,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=r,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Hi(e,this.from,this.gapFrom)||Hi(e,this.gapTo,this.to)))return L.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return L.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?L.fromReplace(e,this.from,this.to,i):L.fail("Content does not fit in gap")}getMap(){return new re([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 _(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),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||r<t.pos||s>i.pos?null:new _(t.pos,i.pos,r,s,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 _(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}J.jsonID("replaceAround",_);function Hi(n,e,t){let i=n.resolve(e),r=t-e,s=i.depth;for(;r>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,r--;if(r>0){let o=i.node(s).maybeChild(i.indexAfter(s));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function Ad(n,e,t,i){let r=[],s=[],o,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 f=Math.max(c,e),u=Math.min(c+a.nodeSize,t),p=i.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(h[m])?o.to=u:r.push(o=new Se(f,u,h[m])));l&&l.to==f?l.to=u:s.push(l=new Ie(f,u,i))}}),r.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function Od(n,e,t,i){let r=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(i instanceof Wn){let c=o.marks,d;for(;d=i.isInSet(c);)(a||(a=[])).push(d),c=d.removeFromSet(c)}else i?i.isInSet(o.marks)&&(a=[i]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let d=0;d<a.length;d++){let h=a[d],f;for(let u=0;u<r.length;u++){let p=r[u];p.step==s-1&&h.eq(r[u].style)&&(f=p)}f?(f.to=c,f.step=s):r.push({style:h,from:Math.max(l,e),to:c,step:s})}}}),r.forEach(o=>n.step(new Se(o.from,o.to,o.style)))}function Fi(n,e,t,i=t.contentMatch,r=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),d=l+c.nodeSize,h=i.matchType(c.type);if(!h)o.push(new j(l,d,v.empty));else{i=h;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Se(l,d,c.marks[f]));if(r&&c.isText&&t.whitespace!="pre"){let f,u=/\r?\n|\r/g,p;for(;f=u.exec(c.text);)p||(p=new v(w.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new j(l+f.index,l+f.index+f[0].length,p))}}l=d}if(!i.validEnd){let a=i.fillBefore(w.empty,!0);n.replace(l,l,new v(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function Nd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Gn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let i=n.depth;;--i){let r=n.$from.node(i),s=n.$from.index(i),o=n.$to.indexAfter(i);if(i<n.depth&&r.canReplace(s,o,t))return i;if(i==0||r.type.spec.isolating||!Nd(r,s,o))break}return null}function Ed(n,e,t){let{$from:i,$to:r,depth:s}=e,o=i.before(s+1),l=r.after(s+1),a=o,c=l,d=w.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.index(p)>0?(m=!0,d=w.from(i.node(p).copy(d)),h++):a--;let f=w.empty,u=0;for(let p=s,m=!1;p>t;p--)m||r.after(p+1)<r.end(p)?(m=!0,f=w.from(r.node(p).copy(f)),u++):c++;n.step(new _(a,c,o,l,new v(d.append(f),h,u),d.size-h,!0))}function co(n,e,t=null,i=n){let r=Dd(n,e),s=r&&Pd(i,e);return s?r.map(ho).concat({type:e,attrs:t}).concat(s.map(ho)):null}function ho(n){return{type:n,attrs:null}}function Dd(n,e){let{parent:t,startIndex:i,endIndex:r}=n,s=t.contentMatchAt(i).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(i,r,o)?s:null}function Pd(n,e){let{parent:t,startIndex:i,endIndex:r}=n,s=t.child(i),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=i;a&&c<r;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Rd(n,e,t){let i=w.empty;for(let o=t.length-1;o>=0;o--){if(i.size){let l=t[o].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[o].type.create(t[o].attrs,i))}let r=e.start,s=e.end;n.step(new _(r,s,r,s,new v(i,0,0),t.length,!0))}function Id(n,e,t,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(i,a)&&Vd(n.doc,n.mapping.slice(s).map(l),i)){let c=null;if(i.schema.linebreakReplacement){let u=i.whitespace=="pre",p=!!i.contentMatch.matchType(i.schema.linebreakReplacement);u&&!p?c=!1:!u&&p&&(c=!0)}c===!1&&uo(n,o,l,s),Fi(n,n.mapping.slice(s).map(l,1),i,void 0,c===null);let d=n.mapping.slice(s),h=d.map(l,1),f=d.map(l+o.nodeSize,1);return n.step(new _(h,f,h+1,f-1,new v(w.from(i.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fo(n,o,l,s),!1}})}function fo(n,e,t,i){e.forEach((r,s)=>{if(r.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(r.text);){let a=n.mapping.slice(i).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function uo(n,e,t,i){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let o=n.mapping.slice(i).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
122
- `))}})}function Vd(n,e,t){let i=n.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,t)}function zd(n,e,t,i,r){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(i,null,r||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new _(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new v(w.from(o),0,0),1,!0))}function zt(n,e,t=1,i){let r=n.resolve(e),s=r.depth-t,o=i&&i[i.length-1]||r.parent;if(s<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,d=t-2;c>s;c--,d--){let h=r.node(c),f=r.index(c);if(h.type.spec.isolating)return!1;let u=h.content.cutByIndex(f,h.childCount),p=i&&i[d+1];p&&(u=u.replaceChild(0,p.type.create(p.attrs)));let m=i&&i[d]||h;if(!h.canReplace(f+1,h.childCount)||!m.type.validContent(u))return!1}let l=r.indexAfter(s),a=i&&i[0];return r.node(s).canReplaceWith(l,l,a?a.type:r.node(s+1).type)}function Bd(n,e,t=1,i){let r=n.doc.resolve(e),s=w.empty,o=w.empty;for(let l=r.depth,a=r.depth-t,c=t-1;l>a;l--,c--){s=w.from(r.node(l).copy(s));let d=i&&i[c];o=w.from(d?d.type.create(d.attrs,o):r.node(l).copy(o))}n.step(new j(e,e,new v(s.append(o),t,t),!0))}function Un(n,e){let t=n.resolve(e),i=t.index();return Hd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(i,i+1)}function Ld(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:i}=n.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==i?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Hd(n,e){return!!(n&&e&&!n.isLeaf&&Ld(n,e))}function Fd(n,e,t){let i=null,{linebreakReplacement:r}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(r&&o.inlineContent){let d=o.whitespace=="pre",h=!!o.contentMatch.matchType(r);d&&!h?i=!1:!d&&h&&(i=!0)}let l=n.steps.length;if(i===!1){let d=n.doc.resolve(e+t);uo(n,d.node(),d.before(),l)}o.inlineContent&&Fi(n,e+t-1,o,s.node().contentMatchAt(s.index()),i==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new j(c,a.map(e+t,-1),v.empty,!0)),i===!0){let d=n.doc.resolve(c);fo(n,d.node(),d.before(),n.steps.length)}return n}function $d(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 r=i.depth-1;r>=0;r--){let s=i.index(r);if(i.node(r).canReplaceWith(s,s,t))return i.before(r+1);if(s>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let s=i.indexAfter(r);if(i.node(r).canReplaceWith(s,s,t))return i.after(r+1);if(s<i.node(r).childCount)return null}return null}function Wd(n,e,t){let i=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let s=0;s<t.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=i.depth;o>=0;o--){let l=o==i.depth?0:i.pos<=(i.start(o+1)+i.end(o+1))/2?-1:1,a=i.index(o)+(l>0?1:0),c=i.node(o),d=!1;if(s==1)d=c.canReplace(a,a,r);else{let h=c.contentMatchAt(a).findWrapping(r.firstChild.type);d=h&&c.canReplaceWith(a,a,h[0])}if(d)return l==0?i.pos:l<0?i.before(o+1):i.after(o+1)}return null}function $i(n,e,t=e,i=v.empty){if(e==t&&!i.size)return null;let r=n.resolve(e),s=n.resolve(t);return po(r,s,i)?new j(e,t,i):new _d(r,s,i).fit()}function po(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class _d{constructor(e,t,i){this.$from=e,this.$to=t,this.unplaced=i,this.frontier=[],this.placed=w.empty;for(let r=0;r<=e.depth;r++){let s=e.node(r);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=w.from(e.node(r).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,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let s=this.placed,o=i.depth,l=r.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new v(s,o,l);return e>-1?new _(i.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||i.pos!=this.$to.pos?new j(i.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let s=t.firstChild;if(t.childCount>1&&(r=0),s.type.spec.isolating&&r<=i){e=i;break}t=s.content}for(let t=1;t<=2;t++)for(let i=t==1?e:this.unplaced.openStart;i>=0;i--){let r,s=null;i?(s=Wi(this.unplaced.content,i-1).firstChild,r=s.content):r=this.unplaced.content;let o=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,h=null;if(t==1&&(o?c.matchType(o.type)||(h=c.fillBefore(w.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:i,frontierDepth:l,parent:s,inject:h};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:i,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:i}=this.unplaced,r=Wi(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new v(e,t+1,Math.max(i,r.size+t>=e.size-i?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:i}=this.unplaced,r=Wi(e,t);if(r.childCount<=1&&t>0){let s=e.size-t<=t+r.size;this.unplaced=new v(tn(e,t-1,1),t-1,s?t-1:i)}else this.unplaced=new v(tn(e,t,1),t,i)}placeNodes({sliceDepth:e,frontierDepth:t,parent:i,inject:r,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=i?i.content:o.content,a=o.openStart-e,c=0,d=[],{match:h,type:f}=this.frontier[t];if(r){for(let m=0;m<r.childCount;m++)d.push(r.child(m));h=h.matchFragment(r)}let u=l.size+e-(o.content.size-o.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(mo(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?u:-1)))}let p=c==l.childCount;p||(u=-1),this.placed=nn(this.placed,t,w.from(d)),this.frontier[t].match=h,p&&u<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<u;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?v.empty:new v(tn(o.content,e-1,1),e-1,u<0?o.openEnd:e-1):new v(tn(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!_i(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,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:i,type:r}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=_i(e,t,r,i,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],d=_i(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?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=nn(this.placed,t.depth,t.fit)),e=t.move;for(let i=t.depth+1;i<=e.depth;i++){let r=e.node(i),s=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,s)}return e}openFrontierNode(e,t=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=nn(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=nn(this.placed,this.frontier.length,t))}}function tn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(tn(n.firstChild.content,e-1,t)))}function nn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(nn(n.lastChild.content,e-1,t)))}function Wi(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function mo(n,e,t){if(e<=0)return n;let i=n.content;return e>1&&(i=i.replaceChild(0,mo(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 _i(n,e,t,i,r){let s=n.node(e),o=r?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=i.fillBefore(s.content,!0,o);return l&&!qd(t,s.content,o)?l:null}function qd(n,e,t){for(let i=t;i<e.childCount;i++)if(!n.allowsMarks(e.child(i).marks))return!0;return!1}function Kd(n){return n.spec.defining||n.spec.definingForContent}function Jd(n,e,t,i){if(!i.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),s=n.doc.resolve(t);if(po(r,s,i))return n.step(new j(e,t,i));let o=yo(r,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(r.depth+1);o.unshift(l);for(let f=r.depth,u=r.pos-1;f>0;f--,u--){let p=r.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:r.before(f)==u&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],d=i.openStart;for(let f=i.content,u=0;;u++){let p=f.firstChild;if(c.push(p),u==i.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let u=c[f],p=Kd(u.type);if(p&&!u.sameMarkup(r.node(Math.abs(l)-1)))d=f;else if(p||!u.type.isTextblock)break}for(let f=i.openStart;f>=0;f--){let u=(f+d+1)%(i.openStart+1),p=c[u];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],b=!0;g<0&&(b=!1,g=-g);let C=r.node(g-1),y=r.index(g-1);if(C.canReplaceWith(y,y,p.type,p.marks))return n.replace(r.before(g),b?s.after(g):t,new v(go(i.content,0,i.openStart,u),u,i.openEnd))}}let h=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,i),!(n.steps.length>h));f--){let u=o[f];u<0||(e=r.before(u),t=s.after(u))}}function go(n,e,t,i,r){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(go(s.content,e+1,t,i,s)))}if(e>i){let s=r.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(w.empty,!0))}return n}function jd(n,e,t,i){if(!i.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=$d(n.doc,e,i.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new v(w.from(i),0,0))}function Gd(n,e,t){let i=n.doc.resolve(e),r=n.doc.resolve(t),s=yo(i,r);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||i.node(l).type.contentMatch.validEnd)return n.delete(i.start(l),r.end(l));if(l>0&&(a||i.node(l-1).canReplace(i.index(l-1),r.indexAfter(l-1))))return n.delete(i.before(l),r.after(l))}for(let o=1;o<=i.depth&&o<=r.depth;o++)if(e-i.start(o)==i.depth-o&&t>i.end(o)&&r.end(o)-t!=r.depth-o&&i.start(o-1)==r.start(o-1)&&i.node(o-1).canReplace(i.index(o-1),r.index(o-1)))return n.delete(i.before(o),t);n.delete(e,t)}function yo(n,e){let t=[],i=Math.min(n.depth,e.depth);for(let r=i;r>=0;r--){let s=n.start(r);if(s<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(s==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==s-1)&&t.push(r)}return t}class Bt extends J{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 L.fail("No node at attribute step's position");let i=Object.create(null);for(let s in t.attrs)i[s]=t.attrs[s];i[this.attr]=this.value;let r=t.type.create(i,null,t.marks);return L.fromReplace(e,this.pos,this.pos+1,new v(w.from(r),0,t.isLeaf?0:1))}getMap(){return re.empty}invert(e){return new Bt(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 Bt(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 Bt(t.pos,t.attr,t.value)}}J.jsonID("attr",Bt);class rn extends J{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let i=e.type.create(t,e.content,e.marks);return L.ok(i)}getMap(){return re.empty}invert(e){return new rn(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 rn(t.attr,t.value)}}J.jsonID("docAttr",rn);let Lt=class extends Error{};Lt=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Lt.prototype=Object.create(Error.prototype),Lt.prototype.constructor=Lt,Lt.prototype.name="TransformError";class bo{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new It}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Lt(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=v.empty){let r=$i(this.doc,e,t,i);return r&&this.step(r),this}replaceWith(e,t,i){return this.replace(e,t,new v(w.from(i),0,0))}delete(e,t){return this.replace(e,t,v.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,i){return Jd(this,e,t,i),this}replaceRangeWith(e,t,i){return jd(this,e,t,i),this}deleteRange(e,t){return Gd(this,e,t),this}lift(e,t){return Ed(this,e,t),this}join(e,t=1){return Fd(this,e,t),this}wrap(e,t){return Rd(this,e,t),this}setBlockType(e,t=e,i,r=null){return Id(this,e,t,i,r),this}setNodeMarkup(e,t,i=null,r){return zd(this,e,t,i,r),this}setNodeAttribute(e,t,i){return this.step(new Bt(e,t,i)),this}setDocAttribute(e,t){return this.step(new rn(e,t)),this}addNodeMark(e,t){return this.step(new Ve(e,t)),this}removeNodeMark(e,t){if(!(t instanceof P)){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 Vt(e,t)),this}split(e,t=1,i){return Bd(this,e,t,i),this}addMark(e,t,i){return Ad(this,e,t,i),this}removeMark(e,t,i){return Od(this,e,t,i),this}clearIncompatible(e,t,i){return Fi(this,e,t,i),this}}const qi=Object.create(null);class O{constructor(e,t,i){this.$anchor=e,this.$head=t,this.ranges=i||[new wo(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=v.empty){let i=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=i,i=i.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(c.pos),l?v.empty:t),l==0&&vo(e,s,(i?i.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let i=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:o,$to:l}=r[s],a=e.mapping.slice(i),c=a.map(o.pos),d=a.map(l.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),vo(e,i,t.isInline?-1:1))}}static findFrom(e,t,i=!1){let r=e.parent.inlineContent?new E(e):Ht(e.node(0),e.parent,e.pos,e.index(),t,i);if(r)return r;for(let s=e.depth-1;s>=0;s--){let o=t<0?Ht(e.node(0),e.node(s),e.before(s+1),e.index(s),t,i):Ht(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,i);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new se(e.node(0))}static atStart(e){return Ht(e,e,0,0,1)||new se(e)}static atEnd(e){return Ht(e,e,e.content.size,e.childCount,-1)||new se(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=qi[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 qi)throw new RangeError("Duplicate use of selection JSON ID "+e);return qi[e]=t,t.prototype.jsonID=e,t}getBookmark(){return E.between(this.$anchor,this.$head).getBookmark()}}O.prototype.visible=!0;class wo{constructor(e,t){this.$from=e,this.$to=t}}let So=!1;function xo(n){!So&&!n.parent.inlineContent&&(So=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class E extends O{constructor(e,t=e){xo(e),xo(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 O.near(i);let r=e.resolve(t.map(this.anchor));return new E(r.parent.inlineContent?r:i,i)}replace(e,t=v.empty){if(super.replace(e,t),t==v.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof E&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Zn(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 E(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){let r=e.resolve(t);return new this(r,i==t?r:e.resolve(i))}static between(e,t,i){let r=e.pos-t.pos;if((!i||r)&&(i=r>=0?1:-1),!t.parent.inlineContent){let s=O.findFrom(t,i,!0)||O.findFrom(t,-i,!0);if(s)t=s.$head;else return O.near(t,i)}return e.parent.inlineContent||(r==0?e=t:(e=(O.findFrom(e,-i,!0)||O.findFrom(e,i,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new E(e,t)}}O.jsonID("text",E);class Zn{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Zn(e.map(this.anchor),e.map(this.head))}resolve(e){return E.between(e.resolve(this.anchor),e.resolve(this.head))}}class A extends O{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:r}=t.mapResult(this.anchor),s=e.resolve(r);return i?O.near(s):new A(s)}content(){return new v(w.from(this.node),0,0)}eq(e){return e instanceof A&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ki(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new A(e.resolve(t.anchor))}static create(e,t){return new A(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}A.prototype.visible=!1,O.jsonID("node",A);class Ki{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:i}=e.mapResult(this.anchor);return t?new Zn(i,i):new Ki(i)}resolve(e){let t=e.resolve(this.anchor),i=t.nodeAfter;return i&&A.isSelectable(i)?new A(t):O.near(t)}}class se extends O{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=v.empty){if(t==v.empty){e.delete(0,e.doc.content.size);let i=O.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new se(e)}map(e){return new se(e)}eq(e){return e instanceof se}getBookmark(){return Ud}}O.jsonID("all",se);const Ud={map(){return this},resolve(n){return new se(n)}};function Ht(n,e,t,i,r,s=!1){if(e.inlineContent)return E.create(n,t);for(let o=i-(r>0?0:1);r>0?o<e.childCount:o>=0;o+=r){let l=e.child(o);if(l.isAtom){if(!s&&A.isSelectable(l))return A.create(n,t-(r<0?l.nodeSize:0))}else{let a=Ht(n,l,t+r,r<0?l.childCount:0,r,s);if(a)return a}t+=l.nodeSize*r}return null}function vo(n,e,t){let i=n.steps.length-1;if(i<e)return;let r=n.steps[i];if(!(r instanceof j||r instanceof _))return;let s=n.mapping.maps[i],o;s.forEach((l,a,c,d)=>{o==null&&(o=d)}),n.setSelection(O.near(n.doc.resolve(o),t))}const Co=1,Xn=2,ko=4;class Zd extends bo{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|Co)&~Xn,this.storedMarks=null,this}get selectionSet(){return(this.updated&Co)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xn,this}ensureMarks(e){return P.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&Xn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xn,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)||P.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,i){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(i==null&&(i=t),i=i??t,!e)return this.deleteRange(t,i);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=i==t?o.marks():o.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(t,i,r.text(e,s)),this.selection.empty||this.setSelection(O.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|=ko,this}get scrolledIntoView(){return(this.updated&ko)>0}}function Mo(n,e){return!e||!n?n:n.bind(e)}class sn{constructor(e,t,i){this.name=e,this.init=Mo(t.init,i),this.apply=Mo(t.apply,i)}}const Xd=[new sn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sn("selection",{init(n,e){return n.selection||O.atStart(e.doc)},apply(n){return n.selection}}),new sn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,i){return i.selection.$cursor?n.storedMarks:null}}),new sn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ji{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Xd.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 sn(i.key,i.spec.state,i))})}}class Ft{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 r=this.config.plugins[i];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],i=this.applyInner(e),r=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=r?r[o].n:0,c=r?r[o].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,i);if(d&&i.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let h=0;h<this.config.plugins.length;h++)r.push(h<o?{state:i,n:t.length}:{state:this,n:0})}t.push(d),i=i.applyInner(d),s=!0}r&&(r[o]={state:i,n:t.length})}}if(!s)return{state:i,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ft(this.config),i=this.config.fields;for(let r=0;r<i.length;r++){let s=i[r];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Zd(this)}static create(e){let t=new Ji(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new Ft(t);for(let r=0;r<t.fields.length;r++)i[t.fields[r].name]=t.fields[r].init(e,i);return i}reconfigure(e){let t=new Ji(this.schema,e.plugins),i=t.fields,r=new Ft(t);for(let s=0;s<i.length;s++){let o=i[s].name;r[o]=this.hasOwnProperty(o)?this[o]:i[s].init(e,r)}return r}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 r=e[i],s=r.spec.state;s&&s.toJSON&&(t[i]=s.toJSON.call(r,this[r.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 r=new Ji(e.schema,e.plugins),s=new Ft(r);return r.fields.forEach(o=>{if(o.name=="doc")s.doc=st.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=O.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.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==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function To(n,e,t){for(let i in n){let r=n[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=To(r,e,{})),t[i]=r}return t}class on{constructor(e){this.spec=e,this.props={},e.props&&To(e.props,this,this.props),this.key=e.key?e.key.key:Ao("plugin")}getState(e){return e[this.key]}}const ji=Object.create(null);function Ao(n){return n in ji?n+"$"+ ++ji[n]:(ji[n]=0,n+"$")}class ln{constructor(e="key"){this.key=Ao(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oo=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Yd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Qd=(n,e,t)=>{let i=Yd(n,t);if(!i)return!1;let r=No(i);if(!r){let o=i.blockRange(),l=o&&Gn(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=r.nodeBefore;if(Vo(n,r,e,-1))return!0;if(i.parent.content.size==0&&($t(s,"end")||A.isSelectable(s)))for(let o=i.depth;;o--){let l=$i(n.doc,i.before(o),i.after(o),v.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection($t(s,"end")?O.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):A.create(a.doc,r.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||i.node(o-1).childCount>1)break}return s.isAtom&&r.depth==i.depth-1?(e&&e(n.tr.delete(r.pos-s.nodeSize,r.pos).scrollIntoView()),!0):!1};function $t(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 eh=(n,e,t)=>{let{$head:i,empty:r}=n.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):i.parentOffset>0)return!1;s=No(i)}let o=s&&s.nodeBefore;return!o||!A.isSelectable(o)?!1:(e&&e(n.tr.setSelection(A.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function No(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 th(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const nh=(n,e,t)=>{let i=th(n,t);if(!i)return!1;let r=Eo(i);if(!r)return!1;let s=r.nodeAfter;if(Vo(n,r,e,1))return!0;if(i.parent.content.size==0&&($t(s,"start")||A.isSelectable(s))){let o=$i(n.doc,i.before(),i.after(),v.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection($t(s,"start")?O.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):A.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&r.depth==i.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+s.nodeSize).scrollIntoView()),!0):!1},ih=(n,e,t)=>{let{$head:i,empty:r}=n.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):i.parentOffset<i.parent.content.size)return!1;s=Eo(i)}let o=s&&s.nodeAfter;return!o||!A.isSelectable(o)?!1:(e&&e(n.tr.setSelection(A.create(n.doc,s.pos)).scrollIntoView()),!0)};function Eo(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 rh=(n,e)=>{let{$head:t,$anchor:i}=n.selection;return!t.parent.type.spec.code||!t.sameParent(i)?!1:(e&&e(n.tr.insertText(`
123
- `).scrollIntoView()),!0)};function Gi(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 Do=(n,e)=>{let{$head:t,$anchor:i}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(i))return!1;let r=t.node(-1),s=t.indexAfter(-1),o=Gi(r.contentMatchAt(s));if(!o||!r.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(O.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},sh=(n,e)=>{let t=n.selection,{$from:i,$to:r}=t;if(t instanceof se||i.parent.inlineContent||r.parent.inlineContent)return!1;let s=Gi(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!i.parentOffset&&r.index()<r.parent.childCount?i:r).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(E.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Po=(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 s=t.before();if(zt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let i=t.blockRange(),r=i&&Gn(i);return r==null?!1:(e&&e(n.tr.lift(i,r).scrollIntoView()),!0)};function Ro(n){return(e,t)=>{let{$from:i,$to:r}=e.selection;if(e.selection instanceof A&&e.selection.node.isBlock)return!i.parentOffset||!zt(e.doc,i.pos)?!1:(t&&t(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let u=i.depth;;u--)if(i.node(u).isBlock){a=i.end(u)==i.pos+(i.depth-u),c=i.start(u)==i.pos-(i.depth-u),l=Gi(i.node(u-1).contentMatchAt(i.indexAfter(u-1)));let m=n&&n(r.parent,a,i);s.unshift(m||(a&&l?{type:l}:null)),o=u;break}else{if(u==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof E||e.selection instanceof se)&&d.deleteSelection();let h=d.mapping.map(i.pos),f=zt(d.doc,h,s.length,s);if(f||(s[0]=l?{type:l}:null,f=zt(d.doc,h,s.length,s)),d.split(h,s.length,s),!a&&c&&i.node(o).type!=l){let u=d.mapping.map(i.before(o)),p=d.doc.resolve(u);l&&i.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(i.before(o)),l)}return t&&t(d.scrollIntoView()),!0}}const oh=Ro(),Io=(n,e)=>(e&&e(n.tr.setSelection(new se(n.doc))),!0);function lh(n,e,t){let i=e.nodeBefore,r=e.nodeAfter,s=e.index();return!i||!r||!i.type.compatibleContent(r.type)?!1:!i.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(r.isTextblock||Un(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Vo(n,e,t,i){let r=e.nodeBefore,s=e.nodeAfter,o,l,a=r.type.spec.isolating||s.type.spec.isolating;if(!a&&lh(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=r.contentMatchAt(r.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let u=e.pos+s.nodeSize,p=w.empty;for(let b=o.length-1;b>=0;b--)p=w.from(o[b].create(null,p));p=w.from(r.copy(p));let m=n.tr.step(new _(e.pos-1,u,e.pos,u,new v(p,1,0),o.length,!0)),g=m.doc.resolve(u+2*o.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Un(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||i>0&&a?null:O.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),f=h&&Gn(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(c&&$t(s,"start",!0)&&$t(r,"end")){let u=r,p=[];for(;p.push(u),!u.isTextblock;)u=u.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(u.canReplace(u.childCount,u.childCount,m.content)){if(t){let b=w.empty;for(let y=p.length-1;y>=0;y--)b=w.from(p[y].copy(b));let C=n.tr.step(new _(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new v(b,p.length,0),0,!0));t(C.scrollIntoView())}return!0}}return!1}function zo(n){return function(e,t){let i=e.selection,r=n<0?i.$from:i.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return!1;s--}return r.node(s).isTextblock?(t&&t(e.tr.setSelection(E.create(e.doc,n<0?r.start(s):r.end(s)))),!0):!1}}const ah=zo(-1),ch=zo(1);function dh(n,e=null){return function(t,i){let r=!1;for(let s=0;s<t.selection.ranges.length&&!r;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(c),h=d.index();r=d.parent.canReplaceWith(h,h+1,n)}})}if(!r)return!1;if(i){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}i(s.scrollIntoView())}return!0}}function hh(n,e,t,i){for(let r=0;r<e.length;r++){let{$from:s,$to:o}=e[r],l=s.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(s.pos,o.pos,(a,c)=>{if(l||!i)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function at(n,e=null,t){let i=t!==!1;return function(r,s){let{empty:o,$cursor:l,ranges:a}=r.selection;if(o&&!l||!hh(r.doc,a,n,i))return!1;if(s)if(l)n.isInSet(r.storedMarks||l.marks())?s(r.tr.removeStoredMark(n)):s(r.tr.addStoredMark(n.create(e)));else{let c,d=r.tr;c=!a.some(h=>r.doc.rangeHasMark(h.$from.pos,h.$to.pos,n));for(let h=0;h<a.length;h++){let{$from:f,$to:u}=a[h];if(!c)d.removeMark(f.pos,u.pos,n);else{let p=f.pos,m=u.pos,g=f.nodeAfter,b=u.nodeBefore,C=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,y=b&&b.isText?/\s*$/.exec(b.text)[0].length:0;p+C<m&&(p+=C,m-=y),d.addMark(p,m,n.create(e))}}s(d.scrollIntoView())}return!0}}function an(...n){return function(e,t,i){for(let r=0;r<n.length;r++)if(n[r](e,t,i))return!0;return!1}}let Ui=an(Oo,Qd,eh),Bo=an(Oo,nh,ih);const Me={Enter:an(rh,sh,Po,oh),"Mod-Enter":Do,Backspace:Ui,"Mod-Backspace":Ui,"Shift-Backspace":Ui,Delete:Bo,"Mod-Delete":Bo,"Mod-a":Io},Lo={"Ctrl-h":Me.Backspace,"Alt-Backspace":Me["Mod-Backspace"],"Ctrl-d":Me.Delete,"Ctrl-Alt-Backspace":Me["Mod-Delete"],"Alt-Delete":Me["Mod-Delete"],"Alt-d":Me["Mod-Delete"],"Ctrl-a":ah,"Ctrl-e":ch};for(let n in Me)Lo[n]=Me[n];const fh=(typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1)?Lo:Me;var Yn=200,F=function(){};F.prototype.append=function(e){return e.length?(e=F.from(e),!this.length&&e||e.length<Yn&&this.leafAppend(e)||this.length<Yn&&e.leafPrepend(this)||this.appendInner(e)):this},F.prototype.prepend=function(e){return e.length?F.from(e).append(this):this},F.prototype.appendInner=function(e){return new uh(this,e)},F.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?F.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},F.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},F.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)},F.prototype.map=function(e,t,i){t===void 0&&(t=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(s,o){return r.push(e(s,o))},t,i),r},F.from=function(e){return e instanceof F?e:e&&e.length?new Ho(e):F.empty};var Ho=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(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,o,l){for(var a=s;a<o;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,l){for(var a=s-1;a>=o;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Yn)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Yn)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(F);F.empty=new Ho([]);var uh=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,r,s,o){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,s,o){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(i,Math.min(r,l),s,o)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(i,r):i>=s?this.right.slice(i-s,r-s):this.left.slice(i,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,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}(F);const ph=500;class me{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 r,s;t&&(r=this.remapping(i,this.items.length),s=r.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((h,f)=>{if(!h.step){r||(r=this.remapping(i,f+1),s=r.maps.length),s--,d.push(h);return}if(r){d.push(new xe(h.map));let u=h.step.map(r.slice(s)),p;u&&o.maybeStep(u).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new xe(p,void 0,void 0,c.length+d.length))),s--,p&&r.appendMap(p,s)}else o.maybeStep(h.step);if(h.selection)return l=r?h.selection.map(r.slice(s)):h.selection,a=new me(this.items.slice(0,i).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,i,r){let s=[],o=this.eventCount,l=this.items,a=!r&&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]),f=new xe(e.mapping.maps[d],h,t),u;(u=a&&a.merge(f))&&(f=u,d?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),r||(a=f)}let c=o-i.depth;return c>gh&&(l=mh(l,c),o-=c),new me(l.append(s),o)}remapping(e,t){let i=new It;return this.items.forEach((r,s)=>{let o=r.mirrorOffset!=null&&s-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,o)},e,t),i}addMaps(e){return this.eventCount==0?this:new me(this.items.append(e.map(t=>new xe(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},r);let a=t;this.items.forEach(f=>{let u=s.getMirror(--a);if(u==null)return;o=Math.min(o,u);let p=s.maps[u];if(f.step){let m=e.steps[u].invert(e.docs[u]),g=f.selection&&f.selection.map(s.slice(a+1,u));g&&l++,i.push(new xe(p,m,g))}else i.push(new xe(p))},r);let c=[];for(let f=t;f<o;f++)c.push(new xe(s.maps[f]));let d=this.items.slice(0,r).append(c).append(i),h=new me(d,l);return h.emptyItemCount()>ph&&(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,r=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)r.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(i)),c=a&&a.getMap();if(i--,c&&t.appendMap(c,i),a){let d=o.selection&&o.selection.map(t.slice(i));d&&s++;let h=new xe(c.invert(),a,d),f,u=r.length-1;(f=r.length&&r[u].merge(h))?r[u]=f:r.push(h)}}else o.map&&i--},this.items.length,0),new me(F.from(r.reverse()),s)}}me.empty=new me(F.empty,0);function mh(n,e){let t;return n.forEach((i,r)=>{if(i.selection&&e--==0)return t=r,!1}),n.slice(t)}class xe{constructor(e,t,i,r){this.map=e,this.step=t,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new xe(t.getMap().invert(),t,this.selection)}}}class ze{constructor(e,t,i,r,s){this.done=e,this.undone=t,this.prevRanges=i,this.prevTime=r,this.prevComposition=s}}const gh=20;function yh(n,e,t,i){let r=t.getMeta(ct),s;if(r)return r.historyState;t.getMeta(Sh)&&(n=new ze(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(ct))return o.getMeta(ct).redo?new ze(n.done.addTransform(t,void 0,i,Qn(e)),n.undone,Fo(t.mapping.maps),n.prevTime,n.prevComposition):new ze(n.done,n.undone.addTransform(t,void 0,i,Qn(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-i.newGroupDelay||!bh(t,n.prevRanges)),c=o?Zi(n.prevRanges,t.mapping):Fo(t.mapping.maps);return new ze(n.done.addTransform(t,a?e.selection.getBookmark():void 0,i,Qn(e)),me.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new ze(n.done.rebased(t,s),n.undone.rebased(t,s),Zi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ze(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Zi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function bh(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((i,r)=>{for(let s=0;s<e.length;s+=2)i<=e[s+1]&&r>=e[s]&&(t=!0)}),t}function Fo(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((i,r,s,o)=>e.push(s,o));return e}function Zi(n,e){if(!n)return null;let t=[];for(let i=0;i<n.length;i+=2){let r=e.map(n[i],1),s=e.map(n[i+1],-1);r<=s&&t.push(r,s)}return t}function wh(n,e,t){let i=Qn(e),r=ct.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,i);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),r,i),a=new ze(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(ct,{redo:t,historyState:a})}let Xi=!1,$o=null;function Qn(n){let e=n.plugins;if($o!=e){Xi=!1,$o=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Xi=!0;break}}return Xi}const ct=new ln("history"),Sh=new ln("closeHistory");function xh(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new on({key:ct,state:{init(){return new ze(me.empty,me.empty,null,0,-1)},apply(e,t,i){return yh(t,i,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let i=t.inputType,r=i=="historyUndo"?_o:i=="historyRedo"?Yi:null;return r?(t.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function Wo(n,e){return(t,i)=>{let r=ct.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(i){let s=wh(r,t,n);s&&i(e?s.scrollIntoView():s)}return!0}}const _o=Wo(!1,!0),Yi=Wo(!0,!0);for(var Be={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:"'"},ei={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vh=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ch=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),q=0;q<10;q++)Be[48+q]=Be[96+q]=String(q);for(var q=1;q<=24;q++)Be[q+111]="F"+q;for(var q=65;q<=90;q++)Be[q]=String.fromCharCode(q+32),ei[q]=String.fromCharCode(q);for(var Qi in Be)ei.hasOwnProperty(Qi)||(ei[Qi]=Be[Qi]);function kh(n){var e=vh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ch&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ei:Be)[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 Mh=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Th(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let i,r,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Mh?o=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return i&&(t="Alt-"+t),r&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Ah(n){let e=Object.create(null);for(let t in n)e[Th(t)]=n[t];return e}function er(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 tr(n){return new on({props:{handleKeyDown:qo(n)}})}function qo(n){let e=Ah(n);return function(t,i){let r=kh(i),s,o=e[er(r,i)];if(o&&o(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(i.shiftKey){let l=e[er(r,i,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((i.shiftKey||i.altKey||i.metaKey||r.charCodeAt(0)>127)&&(s=Be[i.keyCode])&&s!=r){let l=e[er(s,i)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}function Ko(n,e=null){return function(t,i){let{$from:r,$to:s}=t.selection,o=r.blockRange(s),l=!1,a=o;if(!o)return!1;if(o.depth>=2&&r.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(r.index(o.depth-1)==0)return!1;let d=t.doc.resolve(o.start-2);a=new Fn(d,d,o.depth),o.endIndex<o.parent.childCount&&(o=new Fn(r,t.doc.resolve(s.end(o.depth)),o.depth)),l=!0}let c=co(a,n,e,o);return c?(i&&i(Oh(t.tr,o,c,l,n).scrollIntoView()),!0):!1}}function Oh(n,e,t,i,r){let s=w.empty;for(let d=t.length-1;d>=0;d--)s=w.from(t[d].type.create(t[d].attrs,s));n.step(new _(e.start-(i?2:0),e.end,e.start,e.end,new v(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==r&&(o=d+1);let l=t.length-o,a=e.start+t.length-(i?2:0),c=e.parent;for(let d=e.startIndex,h=e.endIndex,f=!0;d<h;d++,f=!1)!f&&zt(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(d).nodeSize;return n}function Nh(n,e){return function(t,i){let{$from:r,$to:s,node:o}=t.selection;if(o&&o.isBlock||r.depth<2||!r.sameParent(s))return!1;let l=r.node(-1);if(l.type!=n)return!1;if(r.parent.content.size==0&&r.node(-1).childCount==r.indexAfter(-1)){if(r.depth==3||r.node(-3).type!=n||r.index(-2)!=r.node(-2).childCount-1)return!1;if(i){let h=w.empty,f=r.index(-1)?1:r.index(-2)?2:3;for(let b=r.depth-f;b>=r.depth-3;b--)h=w.from(r.node(b).copy(h));let u=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;h=h.append(w.from(n.createAndFill()));let p=r.before(r.depth-(f-1)),m=t.tr.replace(p,r.after(-u),new v(h,4-f,0)),g=-1;m.doc.nodesBetween(p,m.doc.content.size,(b,C)=>{if(g>-1)return!1;b.isTextblock&&b.content.size==0&&(g=C+1)}),g>-1&&m.setSelection(O.near(m.doc.resolve(g))),i(m.scrollIntoView())}return!0}let a=s.pos==r.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(r.pos,s.pos),d=a?[null,{type:a}]:void 0;return zt(c.doc,r.pos,2,d)?(i&&i(c.split(r.pos,2,d).scrollIntoView()),!0):!1}}function nr(n){return function(e,t){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,o=>o.childCount>0&&o.firstChild.type==n);return s?t?i.node(s.depth-1).type==n?Eh(e,t,n,s):Dh(e,t,s):!0:!1}}function Eh(n,e,t,i){let r=n.tr,s=i.end,o=i.$to.end(i.depth);s<o&&(r.step(new _(s-1,o,s,o,new v(w.from(t.create(null,i.parent.copy())),1,0),1,!0)),i=new Fn(r.doc.resolve(i.$from.pos),r.doc.resolve(o),i.depth));const l=Gn(i);if(l==null)return!1;r.lift(i,l);let a=r.mapping.map(s,-1)-1;return Un(r.doc,a)&&r.join(a),e(r.scrollIntoView()),!0}function Dh(n,e,t){let i=n.tr,r=t.parent;for(let u=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)u-=r.child(p).nodeSize,i.delete(u-1,u+1);let s=i.doc.resolve(t.start),o=s.nodeAfter;if(i.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(l?0:1),d+1,o.content.append(a?w.empty:w.from(r))))return!1;let h=s.pos,f=h+o.nodeSize;return i.step(new _(h-(l?1:0),f+(a?1:0),h+1,f-1,new v((l?w.empty:w.from(r.copy(w.empty))).append(a?w.empty:w.from(r.copy(w.empty))),l?0:1,a?0:1),l?0:1)),e(i.scrollIntoView()),!0}function Ph(n){return function(e,t){let{$from:i,$to:r}=e.selection,s=i.blockRange(r,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-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 v(w.from(n.create(null,w.from(l.type.create(null,d)))),c?3:1,0),f=s.start,u=s.end;t(e.tr.step(new _(f-(c?3:1),u,f,u,h,1,!0)).scrollIntoView())}return!0}}const K=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},cn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ir=null;const Te=function(n,e,t){let i=ir||(ir=document.createRange());return i.setEnd(n,t??n.nodeValue.length),i.setStart(n,e||0),i},Rh=function(){ir=null},dt=function(n,e,t,i){return t&&(Jo(n,e,t,i,-1)||Jo(n,e,t,i,1))},Ih=/^(img|br|input|textarea|hr)$/i;function Jo(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:ce(n))){let s=n.parentNode;if(!s||s.nodeType!=1||dn(n)||Ih.test(n.nodeName)||n.contentEditable=="false")return!1;e=K(n)+(r<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.contentEditable=="false")return!1;e=r<0?ce(n):0}else return!1}}function ce(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Vh(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=ce(n)}else if(n.parentNode&&!dn(n))e=K(n),n=n.parentNode;else return null}}function zh(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&&!dn(n))e=K(n)+1,n=n.parentNode;else return null}}function Bh(n,e,t){for(let i=e==0,r=e==ce(n);i||r;){if(n==t)return!0;let s=K(n);if(n=n.parentNode,!n)return!1;i=i&&s==0,r=r&&s==ce(n)}}function dn(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 ti=function(n){return n.focusNode&&dt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ht(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Lh(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Hh(n,e,t){if(n.caretPositionFromPoint)try{let i=n.caretPositionFromPoint(e,t);if(i)return{node:i.offsetNode,offset:Math.min(ce(i.offsetNode),i.offset)}}catch{}if(n.caretRangeFromPoint){let i=n.caretRangeFromPoint(e,t);if(i)return{node:i.startContainer,offset:Math.min(ce(i.startContainer),i.startOffset)}}}const ve=typeof navigator<"u"?navigator:null,jo=typeof document<"u"?document:null,Le=ve&&ve.userAgent||"",rr=/Edge\/(\d+)/.exec(Le),Go=/MSIE \d/.exec(Le),sr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Le),ne=!!(Go||sr||rr),He=Go?document.documentMode:sr?+sr[1]:rr?+rr[1]:0,ge=!ne&&/gecko\/(\d+)/i.test(Le);ge&&+(/Firefox\/(\d+)/.exec(Le)||[0,0])[1];const or=!ne&&/Chrome\/(\d+)/.exec(Le),G=!!or,Uo=or?+or[1]:0,Y=!ne&&!!ve&&/Apple Computer/.test(ve.vendor),Wt=Y&&(/Mobile\/\w+/.test(Le)||!!ve&&ve.maxTouchPoints>2),de=Wt||(ve?/Mac/.test(ve.platform):!1),Fh=ve?/Win/.test(ve.platform):!1,ye=/Android \d/.test(Le),hn=!!jo&&"webkitFontSmoothing"in jo.documentElement.style,$h=hn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Wh(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 Ae(n,e){return typeof n=="number"?n:n[e]}function _h(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 Zo(n,e,t){let i=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=cn(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?Wh(s):_h(l),d=0,h=0;if(e.top<c.top+Ae(i,"top")?h=-(c.top-e.top+Ae(r,"top")):e.bottom>c.bottom-Ae(i,"bottom")&&(h=e.bottom-e.top>c.bottom-c.top?e.top+Ae(r,"top")-c.top:e.bottom-c.bottom+Ae(r,"bottom")),e.left<c.left+Ae(i,"left")?d=-(c.left-e.left+Ae(r,"left")):e.right>c.right-Ae(i,"right")&&(d=e.right-c.right+Ae(r,"right")),d||h)if(a)s.defaultView.scrollBy(d,h);else{let f=l.scrollLeft,u=l.scrollTop;h&&(l.scrollTop+=h),d&&(l.scrollLeft+=d);let p=l.scrollLeft-f,m=l.scrollTop-u;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function qh(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),i,r;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){i=l,r=a.top;break}}return{refDOM:i,refTop:r,stack:Xo(n.dom)}}function Xo(n){let e=[],t=n.ownerDocument;for(let i=n;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),n!=t);i=cn(i));return e}function Kh({refDOM:n,refTop:e,stack:t}){let i=n?n.getBoundingClientRect().top:0;Yo(t,i==0?0:i-e)}function Yo(n,e){for(let t=0;t<n.length;t++){let{dom:i,top:r,left:s}=n[t];i.scrollTop!=r+e&&(i.scrollTop=r+e),i.scrollLeft!=s&&(i.scrollLeft=s)}}let _t=null;function Jh(n){if(n.setActive)return n.setActive();if(_t)return n.focus(_t);let e=Xo(n);n.focus(_t==null?{get preventScroll(){return _t={preventScroll:!0},!0}}:void 0),_t||(_t=!1,Yo(e,0))}function Qo(n,e){let t,i=2e8,r,s=0,o=e.top,l=e.top,a,c;for(let d=n.firstChild,h=0;d;d=d.nextSibling,h++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=Te(d).getClientRects();else continue;for(let u=0;u<f.length;u++){let p=f[u];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),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,r=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,d.nodeType==1&&m&&(s=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)&&(s=h+1)}}return!t&&a&&(t=a,r=c,i=0),t&&t.nodeType==3?jh(t,r):!t||i&&t.nodeType==1?{node:n,offset:s}:Qo(t,r)}function jh(n,e){let t=n.nodeValue.length,i=document.createRange();for(let r=0;r<t;r++){i.setEnd(n,r+1),i.setStart(n,r);let s=Fe(i,1);if(s.top!=s.bottom&&lr(e,s))return{node:n,offset:r+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function lr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Gh(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Uh(n,e,t){let{node:i,offset:r}=Qo(e,t),s=-1;if(i.nodeType==1&&!i.firstChild){let o=i.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(i,r,s)}function Zh(n,e,t,i){let r=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!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&&(!o&&a.left>i.left||a.top>i.top?r=l.posBefore:(!o&&a.right<i.left||a.bottom<i.top)&&(r=l.posAfter),o=!0),!l.contentDOM&&r<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}s=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function el(n,e,t){let i=n.childNodes.length;if(i&&t.top<t.bottom)for(let r=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-t.top)/(t.bottom-t.top))-2)),s=r;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(lr(e,c))return el(o,e,c)}}if((s=(s+1)%i)==r)break}return n}function Xh(n,e){let t=n.dom.ownerDocument,i,r=0,s=Hh(t,e.left,e.top);s&&({node:i,offset:r}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!lr(e,c)||(o=el(n.dom,e,c),!o))return null}if(Y)for(let c=o;i&&c;c=cn(c))c.draggable&&(i=void 0);if(o=Gh(o,e),i){if(ge&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let d=i.childNodes[r],h;d.nodeName=="IMG"&&(h=d.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&r++}let c;hn&&r&&i.nodeType==1&&(c=i.childNodes[r-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&r--,i==n.dom&&r==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||i.nodeType!=1||i.childNodes[r-1].nodeName!="BR")&&(l=Zh(n,i,r,e))}l==null&&(l=Uh(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function tl(n){return n.top<n.bottom||n.left<n.right}function Fe(n,e){let t=n.getClientRects();if(t.length){let i=t[e<0?0:t.length-1];if(tl(i))return i}return Array.prototype.find.call(t,tl)||n.getBoundingClientRect()}const Yh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function nl(n,e,t){let{node:i,offset:r,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=hn||ge;if(i.nodeType==3)if(o&&(Yh.test(i.nodeValue)||(t<0?!r:r==i.nodeValue.length))){let a=Fe(Te(i,r,r),t);if(ge&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let c=Fe(Te(i,r-1,r-1),-1);if(c.top==a.top){let d=Fe(Te(i,r,r+1),-1);if(d.top!=a.top)return fn(d,d.left<c.left)}}return a}else{let a=r,c=r,d=t<0?1:-1;return t<0&&!r?(c++,d=-1):t>=0&&r==i.nodeValue.length?(a--,d=1):t<0?a--:c++,fn(Fe(Te(i,a,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&r&&(t<0||r==ce(i))){let a=i.childNodes[r-1];if(a.nodeType==1)return ar(a.getBoundingClientRect(),!1)}if(s==null&&r<ce(i)){let a=i.childNodes[r];if(a.nodeType==1)return ar(a.getBoundingClientRect(),!0)}return ar(i.getBoundingClientRect(),t>=0)}if(s==null&&r&&(t<0||r==ce(i))){let a=i.childNodes[r-1],c=a.nodeType==3?Te(a,ce(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return fn(Fe(c,1),!1)}if(s==null&&r<ce(i)){let a=i.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Te(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return fn(Fe(c,-1),!0)}return fn(Fe(i.nodeType==3?Te(i):i,-t),t>=0)}function fn(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 ar(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 il(n,e,t){let i=n.state,r=n.root.activeElement;i!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{i!=e&&n.updateState(i),r!=n.dom&&r&&r.focus()}}function Qh(n,e,t){let i=e.selection,r=t=="up"?i.$from:i.$to;return il(n,e,()=>{let{node:s}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=nl(n,r.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Te(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"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const ef=/[\u0590-\u08ac]/;function tf(n,e,t){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,s=!r,o=r==i.parent.content.size,l=n.domSelection();return l?!ef.test(i.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:il(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:h}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let u=i.depth?n.docView.domAfterPos(i.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!u.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 f!=null&&(l.caretBidiLevel=f),g}):i.pos==i.start()||i.pos==i.end()}let rl=null,sl=null,ol=!1;function nf(n,e,t){return rl==e&&sl==t?ol:(rl=e,sl=t,ol=t=="up"||t=="down"?Qh(n,e,t):tf(n,e,t))}const he=0,ll=1,ft=2,Ce=3;class un{constructor(e,t,i,r){this.parent=e,this.children=t,this.dom=i,this.contentDOM=r,this.dirty=he,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 r=this.children[t];if(r==e)return i;i+=r.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 s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>K(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!1;break}if(s.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){r=!0;break}if(s.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let i=!0,r=e;r;r=r.parentNode){let s=this.getDesc(r),o;if(s&&(!t||s.node))if(i&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))i=!1;else return s}}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 r=e;r;r=r.parentNode){let s=this.getDesc(r);if(s)return s.localPosFromDOM(e,t,i)}return-1}descAt(e){for(let t=0,i=0;t<this.children.length;t++){let r=this.children[t],s=i+r.size;if(i==e&&s!=i){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<s)return r.descAt(e-i-r.border);i=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,r=0;for(let s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.size;if(l>e||o instanceof dl){r=e-s;break}s=l}if(r)return this.children[i].domFromPos(r-this.children[i].border,t);for(let s;i&&!(s=this.children[i-1]).size&&s instanceof al&&s.side>=0;i--);if(t<=0){let s,o=!0;for(;s=i?this.children[i-1]:null,!(!s||s.dom.parentNode==this.contentDOM);i--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?K(s.dom)+1:0}}else{let s,o=!0;for(;s=i<this.children.length?this.children[i]:null,!(!s||s.dom.parentNode==this.contentDOM);i++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?K(s.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 r=-1,s=-1;for(let o=i,l=0;;l++){let a=this.children[l],c=o+a.size;if(r==-1&&e<=c){let d=o+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=o;for(let h=l;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){r=K(f.dom)+1;break}e-=f.size}r==-1&&(r=0)}if(r>-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)){s=K(h.dom);break}t+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:s}}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,r=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let u=0,p=0;u<this.children.length;u++){let m=this.children[u],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,t-p-m.border,i,r);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((ge||Y)&&e==t){let{node:u,offset:p}=l;if(u.nodeType==3){if(h=!!(p&&u.nodeValue[p-1]==`
124
- `),h&&p==u.nodeValue.length)for(let m=u,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:K(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=u.childNodes[p-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(ge&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let u=d.focusNode.childNodes[d.focusOffset];u&&u.contentEditable=="false"&&(r=!0)}if(!(r||h&&Y)&&dt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&dt(a.node,a.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==t)&&!h){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let u=document.createRange();u.setEnd(a.node,a.offset),u.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(u)}}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,r=0;r<this.children.length;r++){let s=this.children[r],o=i+s.size;if(i==o?e<=o&&t>=i:e<o&&t>i){let l=i+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==i||t==o?ft:ll,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ce:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ft:Ce}i=o}this.dirty=ft}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let i=e==1?ft:ll;t.dirty<i&&(t.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class al extends un{constructor(e,t,i,r){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(i,()=>{if(!s)return r;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==he&&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 rf extends un{constructor(e,t,i,r){super(e,[],t,null),this.textDOM=i,this.text=r}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 ut extends un{constructor(e,t,i,r,s){super(e,[],i,r),this.mark=t,this.spec=s}static create(e,t,i,r){let s=r.nodeViews[t.type.name],o=s&&s(t,r,i);return(!o||!o.dom)&&(o=lt.renderSpec(document,t.type.spec.toDOM(t,i),null,t.attrs)),new ut(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ce||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ce&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=he){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=he}}slice(e,t,i){let r=ut.create(this.parent,this.mark,!0,i),s=this.children,o=this.size;t<o&&(s=dr(s,t,o,i)),e>0&&(s=dr(s,0,e,i));for(let l=0;l<s.length;l++)s[l].parent=r;return r.children=s,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class $e extends un{constructor(e,t,i,r,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=l}static create(e,t,i,r,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},i,r),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}=lt.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 f=d;return d=ul(d,i,t),c?a=new sf(e,t,i,r,d,h||null,f,c,s,o+1):t.isText?new ni(e,t,i,r,d,f,s):new $e(e,t,i,r,d,h||null,f,s,o+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==he&&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,r=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new lf(this,o&&o.node,e);df(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?P.none:this.node.child(d).marks,i,e),a.placeWidget(c,e,r)},(c,d,h,f)=>{a.syncToMarks(c.marks,i,e);let u;a.findNodeMatch(c,d,h,f)||l&&e.state.selection.from>r&&e.state.selection.to<r+c.nodeSize&&(u=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,d,h,u,e)||a.updateNextNode(c,d,h,e,f,r)||a.addNode(c,d,h,e,r),r+=c.nodeSize}),a.syncToMarks([],i,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ft)&&(o&&this.protectLocalComposition(e,o),hl(this.contentDOM,this.children,e),Wt&&hf(this.dom))}localCompositionInfo(e,t){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof E)||i<t||r>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=ff(this.node.content,o,i-t,r-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:i,text:r}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new rf(this,s,t,r);e.input.compositionNodes.push(o),this.children=dr(this.children,i,i+r.length,e,o)}update(e,t,i,r){return this.dirty==Ce||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,i,r),!0)}updateInner(e,t,i,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=he}updateOuterDeco(e){if(ii(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=fl(this.dom,this.nodeDOM,cr(this.outerDeco,this.node,t),cr(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 cl(n,e,t,i,r){ul(i,e,n);let s=new $e(void 0,n,e,t,i,i,i,r,0);return s.contentDOM&&s.updateChildren(r,0),s}class ni extends $e{constructor(e,t,i,r,s,o,l){super(e,t,i,r,s,null,o,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,r){return this.dirty==Ce||this.dirty!=he&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=he||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=he,!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 r=this.node.cut(e,t),s=document.createTextNode(r.text);return new ni(this.parent,r,this.outerDeco,this.innerDeco,s,s,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ce)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dl extends un{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==he&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class sf extends $e{constructor(e,t,i,r,s,o,l,a,c,d){super(e,t,i,r,s,o,l,c,d),this.spec=a}update(e,t,i,r){if(this.dirty==Ce)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,i);return s&&this.updateInner(e,t,i,r),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,i,r){this.spec.setSelection?this.spec.setSelection(e,t,i.root):super.setSelection(e,t,i,r)}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 hl(n,e,t){let i=n.firstChild,r=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=i;)i=pl(i),r=!0;i=i.nextSibling}else r=!0,n.insertBefore(l,i);if(o instanceof ut){let a=i?i.previousSibling:n.lastChild;hl(o.contentDOM,o.children,t),i=a?a.nextSibling:n.firstChild}}for(;i;)i=pl(i),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const pn=function(n){n&&(this.nodeName=n)};pn.prototype=Object.create(null);const pt=[new pn];function cr(n,e,t){if(n.length==0)return pt;let i=t?pt[0]:new pn,r=[i];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&r.push(i=new pn(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&r.length==1&&r.push(i=new pn(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 r}function fl(n,e,t,i){if(t==pt&&i==pt)return e;let r=e;for(let s=0;s<i.length;s++){let o=i[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=pt[0]),r=a}of(r,l||pt[0],o)}return r}function of(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):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.remove(i[s]);for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.add(r[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=i.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function ul(n,e,t){return fl(n,n,pt,cr(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 pl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class lf{constructor(e,t,i){this.lock=t,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=af(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 r=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;r<o&&(r==s-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<s;)this.destroyRest(),this.top.dirty=he,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<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[s])&&!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=ut.create(this.top,e[s],t,i);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,i,r){let s=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,i))s=this.top.children.indexOf(o,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)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,i,r,s){let o=this.top.children[r];return o.dirty==Ce&&o.dom==o.contentDOM&&(o.dirty=ft),o.update(e,t,i,s)?(this.destroyBetween(this.index,r),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 r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==i)return r}return-1}e=t}}updateNextNode(e,t,i,r,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof $e){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let d=a.dom,h,f=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Ce&&ii(t,a.outerDeco));if(!f&&a.update(e,t,i,r))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(a,e,t,i,r,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ft,h.updateChildren(r,o+1),h.dirty=he),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,i,r,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ii(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=$e.create(this.top,t,i,r,s,o);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,r,s){let o=$e.create(this.top,e,t,i,r,s);o.contentDOM&&o.updateChildren(r,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let s=new al(this.top,e,t,i);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof ut;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ni)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Y||G)&&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 r=new dl(this.top,[],i,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function af(n,e){let t=e,i=t.children.length,r=n.childCount,s=new Map,o=[];e:for(;r>0;){let l;for(;;)if(i){let c=t.children[i-1];if(c instanceof ut)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(r-1))break;--r,s.set(l,r),o.push(l)}}return{index:r,matched:s,matches:o.reverse()}}function cf(n,e){return n.type.side-e.type.side}function df(n,e,t,i){let r=e.locals(n),s=0;if(r.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);i(d,r,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let d,h;for(;o<r.length&&r[o].to==s;){let g=r[o++];g.widget&&(d?(h||(h=[d])).push(g):d=g)}if(d)if(h){h.sort(cf);for(let g=0;g<h.length;g++)t(h[g],c,!!a)}else t(d,c,!!a);let f,u;if(a)u=-1,f=a,a=null;else if(c<n.childCount)u=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<r.length&&r[o].from<=s&&r[o].to>s;)l.push(r[o++]);let p=s+f.nodeSize;if(f.isText){let g=p;o<r.length&&r[o].from<g&&(g=r[o].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=f.cut(g-s),f=f.cut(0,g-s),p=g,u=-1)}else for(;o<r.length&&r[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();i(f,m,e.forChild(s,f),u),s=p}}function hf(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 ff(n,e,t,i){for(let r=0,s=0;r<n.childCount&&s<=i;){let o=n.child(r++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;r<n.childCount;){let c=n.child(r++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=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 dr(n,e,t,i,r){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,d=l+=a.size;c>=t||d<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,i)),r&&(s.push(r),r=void 0),d>t&&s.push(a.slice(t-c,a.size,i)))}return s}function hr(n,e=null){let t=n.domSelectionRange(),i=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),s=r&&r.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=i.resolve(o),a,c;if(ti(t)){for(a=o;r&&!r.node;)r=r.parent;let h=r.node;if(r&&h.isAtom&&A.isSelectable(h)&&r.parent&&!(h.isInline&&Bh(t.focusNode,t.focusOffset,r.dom))){let f=r.posBefore;c=new A(o==f?l:i.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let u=0;u<t.rangeCount;u++){let p=t.getRangeAt(u);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,o]=f==n.state.selection.anchor?[f,h]:[h,f],l=i.resolve(o)}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&&!s?1:-1;c=ur(n,d,l,h)}return c}function ml(n){return n.editable?n.hasFocus():vl(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Oe(n,e=!1){let t=n.state.selection;if(wl(n,t),!!ml(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&G){let i=n.domSelectionRange(),r=n.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&dt(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)pf(n);else{let{anchor:i,head:r}=t,s,o;gl&&!(t instanceof E)&&(t.$from.parent.inlineContent||(s=yl(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=yl(n,t.to))),n.docView.setSelection(i,r,n,e),gl&&(s&&bl(s),o&&bl(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&uf(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const gl=Y||G&&Uo<63;function yl(n,e){let{node:t,offset:i}=n.docView.domFromPos(e,0),r=i<t.childNodes.length?t.childNodes[i]:null,s=i?t.childNodes[i-1]:null;if(Y&&r&&r.contentEditable=="false")return fr(r);if((!r||r.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(r)return fr(r);if(s)return fr(s)}}function fr(n){return n.contentEditable="true",Y&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function bl(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function uf(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),i=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=i||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!ml(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function pf(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let i=n.cursorWrapper.dom,r=i.nodeName=="IMG";r?t.setStart(i.parentNode,K(i)+1):t.setStart(i,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!r&&!n.state.selection.visible&&ne&&He<=11&&(i.disabled=!0,i.disabled=!1)}function wl(n,e){if(e instanceof A){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Sl(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Sl(n)}function Sl(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ur(n,e,t,i){return n.someProp("createSelectionBetween",r=>r(n,e,t))||E.between(e,t,i)}function xl(n){return n.editable&&!n.hasFocus()?!1:vl(n)}function vl(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 mf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return dt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function pr(n,e){let{$anchor:t,$head:i}=n.selection,r=e>0?t.max(i):t.min(i),s=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return s&&O.findFrom(s,e)}function We(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Cl(n,e,t){let i=n.state.selection;if(i instanceof E)if(t.indexOf("s")>-1){let{$head:r}=i,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(r.pos+s.nodeSize*(e<0?-1:1));return We(n,new E(i.$anchor,o))}else if(i.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=pr(n.state,e);return r&&r instanceof A?We(n,r):!1}else if(!(de&&t.indexOf("m")>-1)){let r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?A.isSelectable(s)?We(n,new A(e<0?n.state.doc.resolve(r.pos-s.nodeSize):r)):hn?We(n,new E(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(i instanceof A&&i.node.isInline)return We(n,new E(e>0?i.$to:i.$from));{let r=pr(n.state,e);return r?We(n,r):!1}}}function ri(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function mn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function qt(n,e){return e<0?gf(n):yf(n)}function gf(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let r,s,o=!1;for(ge&&t.nodeType==1&&i<ri(t)&&mn(t.childNodes[i],-1)&&(o=!0);;)if(i>0){if(t.nodeType!=1)break;{let l=t.childNodes[i-1];if(mn(l,-1))r=t,s=--i;else if(l.nodeType==3)t=l,i=t.nodeValue.length;else break}}else{if(kl(t))break;{let l=t.previousSibling;for(;l&&mn(l,-1);)r=t.parentNode,s=K(l),l=l.previousSibling;if(l)t=l,i=ri(t);else{if(t=t.parentNode,t==n.dom)break;i=0}}}o?mr(n,t,i):r&&mr(n,r,s)}function yf(n){let e=n.domSelectionRange(),t=e.focusNode,i=e.focusOffset;if(!t)return;let r=ri(t),s,o;for(;;)if(i<r){if(t.nodeType!=1)break;let l=t.childNodes[i];if(mn(l,1))s=t,o=++i;else break}else{if(kl(t))break;{let l=t.nextSibling;for(;l&&mn(l,1);)s=l.parentNode,o=K(l)+1,l=l.nextSibling;if(l)t=l,i=0,r=ri(t);else{if(t=t.parentNode,t==n.dom)break;i=r=0}}}s&&mr(n,s,o)}function kl(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function bf(n,e){for(;n&&e==n.childNodes.length&&!dn(n);)e=K(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 wf(n,e){for(;n&&!e&&!dn(n);)e=K(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 mr(n,e,t){if(e.nodeType!=3){let s,o;(o=bf(e,t))?(e=o,t=0):(s=wf(e,t))&&(e=s,t=s.nodeValue.length)}let i=n.domSelection();if(!i)return;if(ti(i)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Oe(n)},50)}function Ml(n,e){let t=n.state.doc.resolve(e);if(!(G||Fh)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Tl(n,e,t){let i=n.state.selection;if(i instanceof E&&!i.empty||t.indexOf("s")>-1||de&&t.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=pr(n.state,e);if(o&&o instanceof A)return We(n,o)}if(!r.parent.inlineContent){let o=e<0?r:s,l=i instanceof se?O.near(o,e):O.findFrom(o,e);return l?We(n,l):!1}return!1}function Al(n,e){if(!(n.state.selection instanceof E))return!0;let{$head:t,$anchor:i,empty:r}=n.state.selection;if(!t.sameParent(i))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function Ol(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Sf(n){if(!Y||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;Ol(n,i,"true"),setTimeout(()=>Ol(n,i,"false"),20)}return!1}function xf(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function vf(n,e){let t=e.keyCode,i=xf(e);if(t==8||de&&t==72&&i=="c")return Al(n,-1)||qt(n,-1);if(t==46&&!e.shiftKey||de&&t==68&&i=="c")return Al(n,1)||qt(n,1);if(t==13||t==27)return!0;if(t==37||de&&t==66&&i=="c"){let r=t==37?Ml(n,n.state.selection.from)=="ltr"?-1:1:-1;return Cl(n,r,i)||qt(n,r)}else if(t==39||de&&t==70&&i=="c"){let r=t==39?Ml(n,n.state.selection.from)=="ltr"?1:-1:1;return Cl(n,r,i)||qt(n,r)}else{if(t==38||de&&t==80&&i=="c")return Tl(n,-1,i)||qt(n,-1);if(t==40||de&&t==78&&i=="c")return Sf(n)||Tl(n,1,i)||qt(n,1);if(i==(de?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Nl(n,e){n.someProp("transformCopied",u=>{e=u(e,n)});let t=[],{content:i,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,s--;let u=i.firstChild;t.push(u.type.name,u.attrs!=u.type.defaultAttrs?u.attrs:null),i=u.content}let o=n.someProp("clipboardSerializer")||lt.fromSchema(n.state.schema),l=Bl(),a=l.createElement("div");a.appendChild(o.serializeFragment(i,{document:l}));let c=a.firstChild,d,h=0;for(;c&&c.nodeType==1&&(d=Vl[c.nodeName.toLowerCase()]);){for(let u=d.length-1;u>=0;u--){let p=l.createElement(d[u]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${r} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",u=>u(e,n))||e.content.textBetween(0,e.content.size,`
118
+ `}}}),()=>{e.removeType(Ei)}},Av="Scrollbar",Ld=`${_i}scrollbar`,Tv=t=>{const{Components:e}=t;return e.addType(ho,{isComponent:n=>Ar(n,Ld),model:{defaults:{name:Av,classes:Ld,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{e.removeType(ho)}},Mv="Slide",Rd=`${_i}slide`,Nv=t=>{const{Components:e}=t;return e.addType(po,{isComponent:n=>Ar(n,Rd),model:{defaults:{name:Mv,classes:Rd,icon:ot.slider,draggable:(n,r)=>r.is(Ci)}}}),()=>{e.removeType(po)}},Pv="Wrapper",jd=`${_i}wrapper`,Vv=t=>{const{Components:e}=t,{events:n}=e;return e.addType(Ci,{isComponent:r=>Ar(r,jd),model:{defaults:{name:Pv,icon:ot.slider,classes:jd,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:r=>r.is(po)},init(){const r=this.components();this.listenTo(r,"add remove",this.updateSlider)},updateSlider(r){const i=this.closestType(Zt);if(i){const o=i.getView();i.reloadSlider();const s=n.scriptMount;s&&this.em.once(s,()=>{setTimeout(()=>{var a;return(a=o.getSwiper())==null?void 0:a.slideTo(r.index())},100)})}}}}),()=>{e.removeType(Ci)}},Dv="swiperComponent",Lv=Jn(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=[Cv(t,n),_v(t),Vv(t),Nv(t),kv(t),Tv(t)];Yn({editor:t,plan:vt.startup,licenseKey:n.licenseKey,pluginName:Dv,cleanup:()=>{r.forEach(i=>i())}})}),Rv=t=>t.dispatchEvent(new CustomEvent("input"));function jv(t,e){if(!e)return()=>{};const n=t.Components.events,r=u=>t.getSelectedAll().includes(u),i=u=>u.isInstanceOf("text")&&!u.isChildOf("text"),o=u=>u.isChildOf("text"),s=u=>t.getEditing()===u,a=(u,f={})=>{u.trigger("focus",f.event)},l=(u,f)=>{r(u)&&i(u)&&!s(u)&&a(u,f)},c=(u,f)=>{if(r(u)&&!i(u)&&o(u)){const d=u.parents().find(p=>p.isInstanceOf("text"));d&&(a(d,f),setTimeout(()=>t.select(d),0))}};return t.on(n.select,l),t.on(n.selectBefore,c),()=>{t.off(n.select,l),t.off(n.selectBefore,c)}}function Gl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kl={exports:{}},mo={};/**
119
+ * @license React
120
+ * react-jsx-runtime.production.min.js
121
+ *
122
+ * Copyright (c) Facebook, Inc. and its affiliates.
123
+ *
124
+ * This source code is licensed under the MIT license found in the
125
+ * LICENSE file in the root directory of this source tree.
126
+ */var Hd;function Hv(){if(Hd)return mo;Hd=1;var t=C,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,c){var u,f={},d=null,p=null;c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!o.hasOwnProperty(u)&&(f[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)f[u]===void 0&&(f[u]=l[u]);return{$$typeof:e,type:a,key:d,ref:p,props:f,_owner:i.current}}return mo.Fragment=n,mo.jsx=s,mo.jsxs=s,mo}var go={},Id;function Iv(){if(Id)return go;Id=1;var t={};/**
127
+ * @license React
128
+ * react-jsx-runtime.development.js
129
+ *
130
+ * Copyright (c) Facebook, Inc. and its affiliates.
131
+ *
132
+ * This source code is licensed under the MIT license found in the
133
+ * LICENSE file in the root directory of this source tree.
134
+ */return t.NODE_ENV!=="production"&&function(){var e=C,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator,g="@@iterator";function y(b){if(b===null||typeof b!="object")return null;var k=m&&b[m]||b[g];return typeof k=="function"?k:null}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(b){{for(var k=arguments.length,L=new Array(k>1?k-1:0),q=1;q<k;q++)L[q-1]=arguments[q];O("error",b,L)}}function O(b,k,L){{var q=w.ReactDebugCurrentFrame,X=q.getStackAddendum();X!==""&&(k+="%s",L=L.concat([X]));var ee=L.map(function(le){return String(le)});ee.unshift("Warning: "+k),Function.prototype.apply.call(console[b],console,ee)}}var v=!1,E=!1,A=!1,B=!1,T=!1,V;V=Symbol.for("react.module.reference");function I(b){return!!(typeof b=="string"||typeof b=="function"||b===i||b===s||T||b===o||b===u||b===f||B||b===h||v||E||A||typeof b=="object"&&b!==null&&(b.$$typeof===p||b.$$typeof===d||b.$$typeof===a||b.$$typeof===l||b.$$typeof===c||b.$$typeof===V||b.getModuleId!==void 0))}function z(b,k,L){var q=b.displayName;if(q)return q;var X=k.displayName||k.name||"";return X!==""?L+"("+X+")":L}function K(b){return b.displayName||"Context"}function te(b){if(b==null)return null;if(typeof b.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof b=="function")return b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case i:return"Fragment";case r:return"Portal";case s:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case f:return"SuspenseList"}if(typeof b=="object")switch(b.$$typeof){case l:var k=b;return K(k)+".Consumer";case a:var L=b;return K(L._context)+".Provider";case c:return z(b,b.render,"ForwardRef");case d:var q=b.displayName||null;return q!==null?q:te(b.type)||"Memo";case p:{var X=b,ee=X._payload,le=X._init;try{return te(le(ee))}catch{return null}}}return null}var H=Object.assign,Y=0,re,oe,me,pe,_,N,G;function W(){}W.__reactDisabledLog=!0;function U(){{if(Y===0){re=console.log,oe=console.info,me=console.warn,pe=console.error,_=console.group,N=console.groupCollapsed,G=console.groupEnd;var b={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:b,log:b,warn:b,error:b,group:b,groupCollapsed:b,groupEnd:b})}Y++}}function se(){{if(Y--,Y===0){var b={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},b,{value:re}),info:H({},b,{value:oe}),warn:H({},b,{value:me}),error:H({},b,{value:pe}),group:H({},b,{value:_}),groupCollapsed:H({},b,{value:N}),groupEnd:H({},b,{value:G})})}Y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=w.ReactCurrentDispatcher,Q;function ie(b,k,L){{if(Q===void 0)try{throw Error()}catch(X){var q=X.stack.trim().match(/\n( *(at )?)/);Q=q&&q[1]||""}return`
135
+ `+Q+b}}var ue=!1,ae;{var Ae=typeof WeakMap=="function"?WeakMap:Map;ae=new Ae}function $(b,k){if(!b||ue)return"";{var L=ae.get(b);if(L!==void 0)return L}var q;ue=!0;var X=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ee;ee=J.current,J.current=null,U();try{if(k){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(bt){q=bt}Reflect.construct(b,[],le)}else{try{le.call()}catch(bt){q=bt}b.call(le.prototype)}}else{try{throw Error()}catch(bt){q=bt}b()}}catch(bt){if(bt&&q&&typeof bt.stack=="string"){for(var ne=bt.stack.split(`
136
+ `),ve=q.stack.split(`
137
+ `),ye=ne.length-1,Me=ve.length-1;ye>=1&&Me>=0&&ne[ye]!==ve[Me];)Me--;for(;ye>=1&&Me>=0;ye--,Me--)if(ne[ye]!==ve[Me]){if(ye!==1||Me!==1)do if(ye--,Me--,Me<0||ne[ye]!==ve[Me]){var ct=`
138
+ `+ne[ye].replace(" at new "," at ");return b.displayName&&ct.includes("<anonymous>")&&(ct=ct.replace("<anonymous>",b.displayName)),typeof b=="function"&&ae.set(b,ct),ct}while(ye>=1&&Me>=0);break}}}finally{ue=!1,J.current=ee,se(),Error.prepareStackTrace=X}var it=b?b.displayName||b.name:"",pi=it?ie(it):"";return typeof b=="function"&&ae.set(b,pi),pi}function Pe(b,k,L){return $(b,!1)}function rt(b){var k=b.prototype;return!!(k&&k.isReactComponent)}function Ye(b,k,L){if(b==null)return"";if(typeof b=="function")return $(b,rt(b));if(typeof b=="string")return ie(b);switch(b){case u:return ie("Suspense");case f:return ie("SuspenseList")}if(typeof b=="object")switch(b.$$typeof){case c:return Pe(b.render);case d:return Ye(b.type,k,L);case p:{var q=b,X=q._payload,ee=q._init;try{return Ye(ee(X),k,L)}catch{}}}return""}var gt=Object.prototype.hasOwnProperty,_n={},Gt=w.ReactDebugCurrentFrame;function Te(b){if(b){var k=b._owner,L=Ye(b.type,b._source,k?k.type:null);Gt.setExtraStackFrame(L)}else Gt.setExtraStackFrame(null)}function Ie(b,k,L,q,X){{var ee=Function.call.bind(gt);for(var le in b)if(ee(b,le)){var ne=void 0;try{if(typeof b[le]!="function"){var ve=Error((q||"React class")+": "+L+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof b[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ve.name="Invariant Violation",ve}ne=b[le](k,le,q,L,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ye){ne=ye}ne&&!(ne instanceof Error)&&(Te(X),x("%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).",q||"React class",L,le,typeof ne),Te(null)),ne instanceof Error&&!(ne.message in _n)&&(_n[ne.message]=!0,Te(X),x("Failed %s type: %s",L,ne.message),Te(null))}}}var Er=Array.isArray;function _r(b){return Er(b)}function ui(b){{var k=typeof Symbol=="function"&&Symbol.toStringTag,L=k&&b[Symbol.toStringTag]||b.constructor.name||"Object";return L}}function fi(b){try{return kr(b),!1}catch{return!0}}function kr(b){return""+b}function ln(b){if(fi(b))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ui(b)),kr(b)}var kn=w.ReactCurrentOwner,Sl={key:!0,ref:!0,__self:!0,__source:!0},ws,lo,xs;xs={};function Pf(b){if(gt.call(b,"ref")){var k=Object.getOwnPropertyDescriptor(b,"ref").get;if(k&&k.isReactWarning)return!1}return b.ref!==void 0}function Vf(b){if(gt.call(b,"key")){var k=Object.getOwnPropertyDescriptor(b,"key").get;if(k&&k.isReactWarning)return!1}return b.key!==void 0}function Df(b,k){if(typeof b.ref=="string"&&kn.current&&k&&kn.current.stateNode!==k){var L=te(kn.current.type);xs[L]||(x('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',te(kn.current.type),b.ref),xs[L]=!0)}}function Lf(b,k){{var L=function(){ws||(ws=!0,x("%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)",k))};L.isReactWarning=!0,Object.defineProperty(b,"key",{get:L,configurable:!0})}}function Rf(b,k){{var L=function(){lo||(lo=!0,x("%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)",k))};L.isReactWarning=!0,Object.defineProperty(b,"ref",{get:L,configurable:!0})}}var jf=function(b,k,L,q,X,ee,le){var ne={$$typeof:n,type:b,key:k,ref:L,props:le,_owner:ee};return ne._store={},Object.defineProperty(ne._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ne,"_self",{configurable:!1,enumerable:!1,writable:!1,value:q}),Object.defineProperty(ne,"_source",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.freeze&&(Object.freeze(ne.props),Object.freeze(ne)),ne};function Ss(b,k,L,q,X){{var ee,le={},ne=null,ve=null;L!==void 0&&(ln(L),ne=""+L),Vf(k)&&(ln(k.key),ne=""+k.key),Pf(k)&&(ve=k.ref,Df(k,X));for(ee in k)gt.call(k,ee)&&!Sl.hasOwnProperty(ee)&&(le[ee]=k[ee]);if(b&&b.defaultProps){var ye=b.defaultProps;for(ee in ye)le[ee]===void 0&&(le[ee]=ye[ee])}if(ne||ve){var Me=typeof b=="function"?b.displayName||b.name||"Unknown":b;ne&&Lf(le,Me),ve&&Rf(le,Me)}return jf(b,ne,ve,X,q,kn.current,le)}}var co=w.ReactCurrentOwner,Kn=w.ReactDebugCurrentFrame;function An(b){if(b){var k=b._owner,L=Ye(b.type,b._source,k?k.type:null);Kn.setExtraStackFrame(L)}else Kn.setExtraStackFrame(null)}var di;di=!1;function uo(b){return typeof b=="object"&&b!==null&&b.$$typeof===n}function Cl(){{if(co.current){var b=te(co.current.type);if(b)return`
139
+
140
+ Check the render method of \``+b+"`."}return""}}function Ol(b){return""}var El={};function _l(b){{var k=Cl();if(!k){var L=typeof b=="string"?b:b.displayName||b.name;L&&(k=`
141
+
142
+ Check the top-level render call using <`+L+">.")}return k}}function Cs(b,k){{if(!b._store||b._store.validated||b.key!=null)return;b._store.validated=!0;var L=_l(k);if(El[L])return;El[L]=!0;var q="";b&&b._owner&&b._owner!==co.current&&(q=" It was passed a child from "+te(b._owner.type)+"."),An(b),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',L,q),An(null)}}function kl(b,k){{if(typeof b!="object")return;if(_r(b))for(var L=0;L<b.length;L++){var q=b[L];uo(q)&&Cs(q,k)}else if(uo(b))b._store&&(b._store.validated=!0);else if(b){var X=y(b);if(typeof X=="function"&&X!==b.entries)for(var ee=X.call(b),le;!(le=ee.next()).done;)uo(le.value)&&Cs(le.value,k)}}}function Hf(b){{var k=b.type;if(k==null||typeof k=="string")return;var L;if(typeof k=="function")L=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===c||k.$$typeof===d))L=k.propTypes;else return;if(L){var q=te(k);Ie(L,b.props,"prop",q,b)}else if(k.PropTypes!==void 0&&!di){di=!0;var X=te(k);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",X||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Al(b){{for(var k=Object.keys(b.props),L=0;L<k.length;L++){var q=k[L];if(q!=="children"&&q!=="key"){An(b),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",q),An(null);break}}b.ref!==null&&(An(b),x("Invalid attribute `ref` supplied to `React.Fragment`."),An(null))}}var Tl={};function Ml(b,k,L,q,X,ee){{var le=I(b);if(!le){var ne="";(b===void 0||typeof b=="object"&&b!==null&&Object.keys(b).length===0)&&(ne+=" 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 ve=Ol();ve?ne+=ve:ne+=Cl();var ye;b===null?ye="null":_r(b)?ye="array":b!==void 0&&b.$$typeof===n?(ye="<"+(te(b.type)||"Unknown")+" />",ne=" Did you accidentally export a JSX literal instead of a component?"):ye=typeof b,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ye,ne)}var Me=Ss(b,k,L,X,ee);if(Me==null)return Me;if(le){var ct=k.children;if(ct!==void 0)if(q)if(_r(ct)){for(var it=0;it<ct.length;it++)kl(ct[it],b);Object.freeze&&Object.freeze(ct)}else x("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 kl(ct,b)}if(gt.call(k,"key")){var pi=te(b),bt=Object.keys(k).filter(function(U4){return U4!=="key"}),$f=bt.length>0?"{key: someKey, "+bt.join(": ..., ")+": ...}":"{key: someKey}";if(!Tl[pi+$f]){var W4=bt.length>0?"{"+bt.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
143
+ let props = %s;
144
+ <%s {...props} />
145
+ React keys must be passed directly to JSX without using spread:
146
+ let props = %s;
147
+ <%s key={someKey} {...props} />`,$f,pi,W4,pi),Tl[pi+$f]=!0}}return b===i?Al(Me):Hf(Me),Me}}function If(b,k,L){return Ml(b,k,L,!0)}function Bf(b,k,L){return Ml(b,k,L,!1)}var S=Bf,j=If;go.Fragment=i,go.jsx=S,go.jsxs=j}(),go}var Bv={};Bv.NODE_ENV==="production"?Kl.exports=Hv():Kl.exports=Iv();var P=Kl.exports,$v="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",zv="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",Fv="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",Wv="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",Uv="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",qv="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",Gv="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",Kv="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",Zv="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",Jv="M3,21V3H21V21H3M5,5V19H19V5H5Z",Yv="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",Xv="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",Qv="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",ey="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",ty="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",ny="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",ry="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",iy="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",oy="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",sy="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",ay="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",ly="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",cy="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",uy="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",fy="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",dy="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",py="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",hy="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",my="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",gy="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",by="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",vy="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",yy="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",wy="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",xy="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",Sy="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",Cy="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",Oy="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",Ey="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",_y="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",ky="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",Ay="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",Ty="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",My="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",Ny="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",Py="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",Vy="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",Dy="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",Ly="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",Ry="M7,10L12,15L17,10H7Z",jy="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",Hy="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",Iy="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",By="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",$y="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",zy="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",Fy="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",Wy="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",Uy="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",qy="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",Gy="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",Ky="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",Zy="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",Jy="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",Yy="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",Xy="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",Qy="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",e2="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",t2="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",n2="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",Hs={exports:{}},Is={exports:{}},Ce={};/** @license React v16.13.1
148
+ * react-is.production.min.js
149
+ *
150
+ * Copyright (c) Facebook, Inc. and its affiliates.
151
+ *
152
+ * This source code is licensed under the MIT license found in the
153
+ * LICENSE file in the root directory of this source tree.
154
+ */var Bd;function r2(){if(Bd)return Ce;Bd=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,i=t?Symbol.for("react.strict_mode"):60108,o=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,c=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,f=t?Symbol.for("react.suspense"):60113,d=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,h=t?Symbol.for("react.lazy"):60116,m=t?Symbol.for("react.block"):60121,g=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,w=t?Symbol.for("react.scope"):60119;function x(v){if(typeof v=="object"&&v!==null){var E=v.$$typeof;switch(E){case e:switch(v=v.type,v){case l:case c:case r:case o:case i:case f:return v;default:switch(v=v&&v.$$typeof,v){case a:case u:case h:case p:case s:return v;default:return E}}case n:return E}}}function O(v){return x(v)===c}return Ce.AsyncMode=l,Ce.ConcurrentMode=c,Ce.ContextConsumer=a,Ce.ContextProvider=s,Ce.Element=e,Ce.ForwardRef=u,Ce.Fragment=r,Ce.Lazy=h,Ce.Memo=p,Ce.Portal=n,Ce.Profiler=o,Ce.StrictMode=i,Ce.Suspense=f,Ce.isAsyncMode=function(v){return O(v)||x(v)===l},Ce.isConcurrentMode=O,Ce.isContextConsumer=function(v){return x(v)===a},Ce.isContextProvider=function(v){return x(v)===s},Ce.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},Ce.isForwardRef=function(v){return x(v)===u},Ce.isFragment=function(v){return x(v)===r},Ce.isLazy=function(v){return x(v)===h},Ce.isMemo=function(v){return x(v)===p},Ce.isPortal=function(v){return x(v)===n},Ce.isProfiler=function(v){return x(v)===o},Ce.isStrictMode=function(v){return x(v)===i},Ce.isSuspense=function(v){return x(v)===f},Ce.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===c||v===o||v===i||v===f||v===d||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===p||v.$$typeof===s||v.$$typeof===a||v.$$typeof===u||v.$$typeof===g||v.$$typeof===y||v.$$typeof===w||v.$$typeof===m)},Ce.typeOf=x,Ce}var Oe={},$d;function i2(){if($d)return Oe;$d=1;var t={};/** @license React v16.13.1
155
+ * react-is.development.js
156
+ *
157
+ * Copyright (c) Facebook, Inc. and its affiliates.
158
+ *
159
+ * This source code is licensed under the MIT license found in the
160
+ * LICENSE file in the root directory of this source tree.
161
+ */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,i=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,l=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function O($){return typeof $=="string"||typeof $=="function"||$===i||$===u||$===s||$===o||$===d||$===p||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===h||$.$$typeof===a||$.$$typeof===l||$.$$typeof===f||$.$$typeof===y||$.$$typeof===w||$.$$typeof===x||$.$$typeof===g)}function v($){if(typeof $=="object"&&$!==null){var Pe=$.$$typeof;switch(Pe){case n:var rt=$.type;switch(rt){case c:case u:case i:case s:case o:case d:return rt;default:var Ye=rt&&rt.$$typeof;switch(Ye){case l:case f:case m:case h:case a:return Ye;default:return Pe}}case r:return Pe}}}var E=c,A=u,B=l,T=a,V=n,I=f,z=i,K=m,te=h,H=r,Y=s,re=o,oe=d,me=!1;function pe($){return me||(me=!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.")),_($)||v($)===c}function _($){return v($)===u}function N($){return v($)===l}function G($){return v($)===a}function W($){return typeof $=="object"&&$!==null&&$.$$typeof===n}function U($){return v($)===f}function se($){return v($)===i}function J($){return v($)===m}function Q($){return v($)===h}function ie($){return v($)===r}function ue($){return v($)===s}function ae($){return v($)===o}function Ae($){return v($)===d}Oe.AsyncMode=E,Oe.ConcurrentMode=A,Oe.ContextConsumer=B,Oe.ContextProvider=T,Oe.Element=V,Oe.ForwardRef=I,Oe.Fragment=z,Oe.Lazy=K,Oe.Memo=te,Oe.Portal=H,Oe.Profiler=Y,Oe.StrictMode=re,Oe.Suspense=oe,Oe.isAsyncMode=pe,Oe.isConcurrentMode=_,Oe.isContextConsumer=N,Oe.isContextProvider=G,Oe.isElement=W,Oe.isForwardRef=U,Oe.isFragment=se,Oe.isLazy=J,Oe.isMemo=Q,Oe.isPortal=ie,Oe.isProfiler=ue,Oe.isStrictMode=ae,Oe.isSuspense=Ae,Oe.isValidElementType=O,Oe.typeOf=v}(),Oe}var zd;function Fd(){if(zd)return Is.exports;zd=1;var t={};return t.NODE_ENV==="production"?Is.exports=r2():Is.exports=i2(),Is.exports}/*
162
+ object-assign
163
+ (c) Sindre Sorhus
164
+ @license MIT
165
+ */var Zl,Wd;function o2(){if(Wd)return Zl;Wd=1;var t=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(l.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 Zl=i()?Object.assign:function(o,s){for(var a,l=r(o),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var f in a)e.call(a,f)&&(l[f]=a[f]);if(t){c=t(a);for(var d=0;d<c.length;d++)n.call(a,c[d])&&(l[c[d]]=a[c[d]])}}return l},Zl}var Jl,Ud;function Yl(){if(Ud)return Jl;Ud=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Jl=t,Jl}var Xl,qd;function Gd(){return qd||(qd=1,Xl=Function.call.bind(Object.prototype.hasOwnProperty)),Xl}var Ql,Kd;function s2(){if(Kd)return Ql;Kd=1;var t={},e=function(){};if(t.NODE_ENV!=="production"){var n=Yl(),r={},i=Gd();e=function(s){var a="Warning: "+s;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function o(s,a,l,c,u){if(t.NODE_ENV!=="production"){for(var f in s)if(i(s,f)){var d;try{if(typeof s[f]!="function"){var p=Error((c||"React class")+": "+l+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}d=s[f](a,f,c,l,null,n)}catch(m){d=m}if(d&&!(d instanceof Error)&&e((c||"React class")+": type specification of "+l+" `"+f+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var h=u?u():"";e("Failed "+l+" type: "+d.message+(h??""))}}}}return o.resetWarningCache=function(){t.NODE_ENV!=="production"&&(r={})},Ql=o,Ql}var ec,Zd;function a2(){if(Zd)return ec;Zd=1;var t={},e=Fd(),n=o2(),r=Yl(),i=Gd(),o=s2(),s=function(){};t.NODE_ENV!=="production"&&(s=function(l){var c="Warning: "+l;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function a(){return null}return ec=function(l,c){var u=typeof Symbol=="function"&&Symbol.iterator,f="@@iterator";function d(_){var N=_&&(u&&_[u]||_[f]);if(typeof N=="function")return N}var p="<<anonymous>>",h={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:x(),arrayOf:O,element:v(),elementType:E(),instanceOf:A,node:I(),objectOf:T,oneOf:B,oneOfType:V,shape:K,exact:te};function m(_,N){return _===N?_!==0||1/_===1/N:_!==_&&N!==N}function g(_,N){this.message=_,this.data=N&&typeof N=="object"?N:{},this.stack=""}g.prototype=Error.prototype;function y(_){if(t.NODE_ENV!=="production")var N={},G=0;function W(se,J,Q,ie,ue,ae,Ae){if(ie=ie||p,ae=ae||Q,Ae!==r){if(c){var $=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 $.name="Invariant Violation",$}else if(t.NODE_ENV!=="production"&&typeof console<"u"){var Pe=ie+":"+Q;!N[Pe]&&G<3&&(s("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+ie+"`. 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."),N[Pe]=!0,G++)}}return J[Q]==null?se?J[Q]===null?new g("The "+ue+" `"+ae+"` is marked as required "+("in `"+ie+"`, but its value is `null`.")):new g("The "+ue+" `"+ae+"` is marked as required in "+("`"+ie+"`, but its value is `undefined`.")):null:_(J,Q,ie,ue,ae)}var U=W.bind(null,!1);return U.isRequired=W.bind(null,!0),U}function w(_){function N(G,W,U,se,J,Q){var ie=G[W],ue=re(ie);if(ue!==_){var ae=oe(ie);return new g("Invalid "+se+" `"+J+"` of type "+("`"+ae+"` supplied to `"+U+"`, expected ")+("`"+_+"`."),{expectedType:_})}return null}return y(N)}function x(){return y(a)}function O(_){function N(G,W,U,se,J){if(typeof _!="function")return new g("Property `"+J+"` of component `"+U+"` has invalid PropType notation inside arrayOf.");var Q=G[W];if(!Array.isArray(Q)){var ie=re(Q);return new g("Invalid "+se+" `"+J+"` of type "+("`"+ie+"` supplied to `"+U+"`, expected an array."))}for(var ue=0;ue<Q.length;ue++){var ae=_(Q,ue,U,se,J+"["+ue+"]",r);if(ae instanceof Error)return ae}return null}return y(N)}function v(){function _(N,G,W,U,se){var J=N[G];if(!l(J)){var Q=re(J);return new g("Invalid "+U+" `"+se+"` of type "+("`"+Q+"` supplied to `"+W+"`, expected a single ReactElement."))}return null}return y(_)}function E(){function _(N,G,W,U,se){var J=N[G];if(!e.isValidElementType(J)){var Q=re(J);return new g("Invalid "+U+" `"+se+"` of type "+("`"+Q+"` supplied to `"+W+"`, expected a single ReactElement type."))}return null}return y(_)}function A(_){function N(G,W,U,se,J){if(!(G[W]instanceof _)){var Q=_.name||p,ie=pe(G[W]);return new g("Invalid "+se+" `"+J+"` of type "+("`"+ie+"` supplied to `"+U+"`, expected ")+("instance of `"+Q+"`."))}return null}return y(N)}function B(_){if(!Array.isArray(_))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.")),a;function N(G,W,U,se,J){for(var Q=G[W],ie=0;ie<_.length;ie++)if(m(Q,_[ie]))return null;var ue=JSON.stringify(_,function(Ae,$){var Pe=oe($);return Pe==="symbol"?String($):$});return new g("Invalid "+se+" `"+J+"` of value `"+String(Q)+"` "+("supplied to `"+U+"`, expected one of "+ue+"."))}return y(N)}function T(_){function N(G,W,U,se,J){if(typeof _!="function")return new g("Property `"+J+"` of component `"+U+"` has invalid PropType notation inside objectOf.");var Q=G[W],ie=re(Q);if(ie!=="object")return new g("Invalid "+se+" `"+J+"` of type "+("`"+ie+"` supplied to `"+U+"`, expected an object."));for(var ue in Q)if(i(Q,ue)){var ae=_(Q,ue,U,se,J+"."+ue,r);if(ae instanceof Error)return ae}return null}return y(N)}function V(_){if(!Array.isArray(_))return t.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var N=0;N<_.length;N++){var G=_[N];if(typeof G!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+me(G)+" at index "+N+"."),a}function W(U,se,J,Q,ie){for(var ue=[],ae=0;ae<_.length;ae++){var Ae=_[ae],$=Ae(U,se,J,Q,ie,r);if($==null)return null;$.data&&i($.data,"expectedType")&&ue.push($.data.expectedType)}var Pe=ue.length>0?", expected one of type ["+ue.join(", ")+"]":"";return new g("Invalid "+Q+" `"+ie+"` supplied to "+("`"+J+"`"+Pe+"."))}return y(W)}function I(){function _(N,G,W,U,se){return H(N[G])?null:new g("Invalid "+U+" `"+se+"` supplied to "+("`"+W+"`, expected a ReactNode."))}return y(_)}function z(_,N,G,W,U){return new g((_||"React class")+": "+N+" type `"+G+"."+W+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+U+"`.")}function K(_){function N(G,W,U,se,J){var Q=G[W],ie=re(Q);if(ie!=="object")return new g("Invalid "+se+" `"+J+"` of type `"+ie+"` "+("supplied to `"+U+"`, expected `object`."));for(var ue in _){var ae=_[ue];if(typeof ae!="function")return z(U,se,J,ue,oe(ae));var Ae=ae(Q,ue,U,se,J+"."+ue,r);if(Ae)return Ae}return null}return y(N)}function te(_){function N(G,W,U,se,J){var Q=G[W],ie=re(Q);if(ie!=="object")return new g("Invalid "+se+" `"+J+"` of type `"+ie+"` "+("supplied to `"+U+"`, expected `object`."));var ue=n({},G[W],_);for(var ae in ue){var Ae=_[ae];if(i(_,ae)&&typeof Ae!="function")return z(U,se,J,ae,oe(Ae));if(!Ae)return new g("Invalid "+se+" `"+J+"` key `"+ae+"` supplied to `"+U+"`.\nBad object: "+JSON.stringify(G[W],null," ")+`
166
+ Valid keys: `+JSON.stringify(Object.keys(_),null," "));var $=Ae(Q,ae,U,se,J+"."+ae,r);if($)return $}return null}return y(N)}function H(_){switch(typeof _){case"number":case"string":case"undefined":return!0;case"boolean":return!_;case"object":if(Array.isArray(_))return _.every(H);if(_===null||l(_))return!0;var N=d(_);if(N){var G=N.call(_),W;if(N!==_.entries){for(;!(W=G.next()).done;)if(!H(W.value))return!1}else for(;!(W=G.next()).done;){var U=W.value;if(U&&!H(U[1]))return!1}}else return!1;return!0;default:return!1}}function Y(_,N){return _==="symbol"?!0:N?N["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&N instanceof Symbol:!1}function re(_){var N=typeof _;return Array.isArray(_)?"array":_ instanceof RegExp?"object":Y(N,_)?"symbol":N}function oe(_){if(typeof _>"u"||_===null)return""+_;var N=re(_);if(N==="object"){if(_ instanceof Date)return"date";if(_ instanceof RegExp)return"regexp"}return N}function me(_){var N=oe(_);switch(N){case"array":case"object":return"an "+N;case"boolean":case"date":case"regexp":return"a "+N;default:return N}}function pe(_){return!_.constructor||!_.constructor.name?p:_.constructor.name}return h.checkPropTypes=o,h.resetWarningCache=o.resetWarningCache,h.PropTypes=h,h},ec}var tc,Jd;function l2(){if(Jd)return tc;Jd=1;var t=Yl();function e(){}function n(){}return n.resetWarningCache=e,tc=function(){function r(s,a,l,c,u,f){if(f!==t){var d=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 d.name="Invariant Violation",d}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:e};return o.PropTypes=o,o},tc}var Yd;function c2(){if(Yd)return Hs.exports;Yd=1;var t={};if(t.NODE_ENV!=="production"){var e=Fd(),n=!0;Hs.exports=a2()(e.isElement,n)}else Hs.exports=l2()();return Hs.exports}var u2=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},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,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var s in r)n.d(o,s,(function(a){return r[a]}).bind(null,s));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=2)}([function(t,e){t.exports=c2()},function(t,e){t.exports=C},function(t,e,n){n.r(e);var r=n(1),i=n(0),o=function(){return(o=Object.assign||function(h){for(var m,g=1,y=arguments.length;g<y;g++)for(var w in m=arguments[g])Object.prototype.hasOwnProperty.call(m,w)&&(h[w]=m[w]);return h}).apply(this,arguments)},s=function(h,m){var g={};for(var y in h)Object.prototype.hasOwnProperty.call(h,y)&&m.indexOf(y)<0&&(g[y]=h[y]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(y=Object.getOwnPropertySymbols(h);w<y.length;w++)m.indexOf(y[w])<0&&Object.prototype.propertyIsEnumerable.call(h,y[w])&&(g[y[w]]=h[y[w]])}return g},a=0,l=r.forwardRef(function(h,m){var g=h.title,y=g===void 0?null:g,w=h.description,x=w===void 0?null:w,O=h.size,v=O===void 0?null:O,E=h.color,A=E===void 0?"currentColor":E,B=h.horizontal,T=B===void 0?null:B,V=h.vertical,I=V===void 0?null:V,z=h.rotate,K=z===void 0?null:z,te=h.spin,H=te===void 0?null:te,Y=h.style,re=Y===void 0?{}:Y,oe=h.children,me=s(h,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var pe,_=H!==null&&H,N=r.Children.map(oe,function(se){var J=se;_!==!0&&(_=(H===null?J.props.spin:H)===!0);var Q=J.props.size;typeof v=="number"&&typeof J.props.size=="number"&&(Q=J.props.size/v);var ie={size:Q,color:A===null?J.props.color:A,horizontal:T===null?J.props.horizontal:T,vertical:I===null?J.props.vertical:I,rotate:K===null?J.props.rotate:K,spin:H===null?J.props.spin:H,inStack:!0};return r.cloneElement(J,ie)});v!==null&&(re.width=typeof v=="string"?v:1.5*v+"rem");var G,W="stack_labelledby_"+a,U="stack_describedby_"+a;if(y)pe=x?W+" "+U:W;else if(G="presentation",x)throw new Error("title attribute required when description is set");return r.createElement("svg",o({ref:m,viewBox:"0 0 24 24",style:re,role:G,"aria-labelledby":pe},me),y&&r.createElement("title",{id:W},y),x&&r.createElement("desc",{id:U},x),_&&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) } }"),N)});l.displayName="Stack",l.propTypes={size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),children:i.oneOfType([i.arrayOf(i.node),i.node]).isRequired,className:i.string,style:i.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var c=l;n.d(e,"Icon",function(){return p}),n.d(e,"Stack",function(){return c});var u=function(){return(u=Object.assign||function(h){for(var m,g=1,y=arguments.length;g<y;g++)for(var w in m=arguments[g])Object.prototype.hasOwnProperty.call(m,w)&&(h[w]=m[w]);return h}).apply(this,arguments)},f=function(h,m){var g={};for(var y in h)Object.prototype.hasOwnProperty.call(h,y)&&m.indexOf(y)<0&&(g[y]=h[y]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(y=Object.getOwnPropertySymbols(h);w<y.length;w++)m.indexOf(y[w])<0&&Object.prototype.propertyIsEnumerable.call(h,y[w])&&(g[y[w]]=h[y[w]])}return g},d=0,p=r.forwardRef(function(h,m){var g=h.path,y=h.id,w=y===void 0?++d:y,x=h.title,O=x===void 0?null:x,v=h.description,E=v===void 0?null:v,A=h.size,B=A===void 0?null:A,T=h.color,V=T===void 0?"currentColor":T,I=h.horizontal,z=I!==void 0&&I,K=h.vertical,te=K!==void 0&&K,H=h.rotate,Y=H===void 0?0:H,re=h.spin,oe=re!==void 0&&re,me=h.style,pe=me===void 0?{}:me,_=h.inStack,N=_!==void 0&&_,G=f(h,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),W={},U=[];B!==null&&(N?U.push("scale("+B+")"):(pe.width=typeof B=="string"?B:1.5*B+"rem",pe.height=pe.width)),z&&U.push("scaleX(-1)"),te&&U.push("scaleY(-1)"),Y!==0&&U.push("rotate("+Y+"deg)"),V!==null&&(W.fill=V);var se=r.createElement("path",u({d:g,style:W},N?G:{})),J=se;U.length>0&&(pe.transform=U.join(" "),pe.transformOrigin="center",N&&(J=r.createElement("g",{style:pe},se,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var Q,ie=J,ue=oe===!0||typeof oe!="number"?2:oe,ae=!N&&(z||te);if(ue<0&&(ae=!ae),oe&&(ie=r.createElement("g",{style:{animation:"spin"+(ae?"-inverse":"")+" linear "+Math.abs(ue)+"s infinite",transformOrigin:"center"}},J,!(z||te||Y!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),N)return ie;var Ae,$="icon_labelledby_"+w,Pe="icon_describedby_"+w;if(O)Q=E?$+" "+Pe:$;else if(Ae="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",u({ref:m,viewBox:"0 0 24 24",style:pe,role:Ae,"aria-labelledby":Q},G),O&&r.createElement("title",{id:$},O),E&&r.createElement("desc",{id:Pe},E),!N&&oe&&(ae?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) } }")),ie)});p.displayName="Icon",p.propTypes={path:i.string.isRequired,size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),style:i.object,inStack:i.bool,className:i.string},p.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},e.default=p}]);const f2=Gl(u2);var Xd={exports:{}};/*!
167
+ Copyright (c) 2018 Jed Watson.
168
+ Licensed under the MIT License (MIT), see
169
+ http://jedwatson.github.io/classnames
170
+ */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)e.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(Xd);var d2=Xd.exports;const ki=Gl(d2);var M={},p2={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"},h2=M.NODE_ENV!=="production"?p2:{};function Z(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(M.NODE_ENV!=="production"){var i=typeof t=="string"?t:h2[t];throw typeof i=="function"&&(i=i.apply(null,n)),new Error("[MobX] "+i)}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 m2={};function Bs(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:m2}var Qd=Object.assign,$s=Object.getOwnPropertyDescriptor,un=Object.defineProperty,zs=Object.prototype,Fs=[];Object.freeze(Fs);var ep={};Object.freeze(ep);var g2=typeof Proxy<"u",b2=Object.toString();function tp(){g2||Z(M.NODE_ENV!=="production"?"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`":"Proxy not available")}function bo(t){M.NODE_ENV!=="production"&&R.verifyProxies&&Z("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+t)}function Jt(){return++R.mobxGuid}function nc(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}var Ai=function(){};function Be(t){return typeof t=="function"}function Vr(t){var e=typeof t;switch(e){case"string":case"symbol":case"number":return!0}return!1}function Ws(t){return t!==null&&typeof t=="object"}function fn(t){if(!Ws(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()===b2}function np(t){var e=t==null?void 0:t.constructor;return e?e.name==="GeneratorFunction"||e.displayName==="GeneratorFunction":!1}function Us(t,e,n){un(t,e,{enumerable:!1,writable:!0,configurable:!0,value:n})}function rp(t,e,n){un(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Dr(t,e){var n="isMobX"+t;return e.prototype[n]=!0,function(r){return Ws(r)&&r[n]===!0}}function Ti(t){return t!=null&&Object.prototype.toString.call(t)==="[object Map]"}function v2(t){var e=Object.getPrototypeOf(t),n=Object.getPrototypeOf(e),r=Object.getPrototypeOf(n);return r===null}function Tn(t){return t!=null&&Object.prototype.toString.call(t)==="[object Set]"}var ip=typeof Object.getOwnPropertySymbols<"u";function y2(t){var e=Object.keys(t);if(!ip)return e;var n=Object.getOwnPropertySymbols(t);return n.length?[].concat(e,n.filter(function(r){return zs.propertyIsEnumerable.call(t,r)})):e}var qs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:ip?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function rc(t){return typeof t=="string"?t:typeof t=="symbol"?t.toString():new String(t).toString()}function op(t){return t===null?null:typeof t=="object"?""+t:t}function Nt(t,e){return zs.hasOwnProperty.call(t,e)}var w2=Object.getOwnPropertyDescriptors||function(e){var n={};return qs(e).forEach(function(r){n[r]=$s(e,r)}),n};function yt(t,e){return!!(t&e)}function wt(t,e,n){return n?t|=e:t&=~e,t}function sp(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 x2(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,C2(r.key),r)}}function Mi(t,e,n){return e&&x2(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ni(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=O2(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.
171
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mn(){return Mn=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},Mn.apply(null,arguments)}function ap(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,ic(t,e)}function ic(t,e){return ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ic(t,e)}function S2(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 C2(t){var e=S2(t,"string");return typeof e=="symbol"?e:e+""}function O2(t,e){if(t){if(typeof t=="string")return sp(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)?sp(t,e):void 0}}var ft=Symbol("mobx-stored-annotations");function dn(t){function e(n,r){if(yo(r))return t.decorate_20223_(n,r);vo(n,r,t)}return Object.assign(e,t)}function vo(t,e,n){if(Nt(t,ft)||Us(t,ft,Mn({},t[ft])),M.NODE_ENV!=="production"&&Js(n)&&!Nt(t[ft],e)){var r=t.constructor.name+".prototype."+e.toString();Z("'"+r+"' is decorated with 'override', but no such decorated member was found on prototype.")}E2(t,n,e),Js(n)||(t[ft][e]=n)}function E2(t,e,n){if(M.NODE_ENV!=="production"&&!Js(e)&&Nt(t[ft],n)){var r=t.constructor.name+".prototype."+n.toString(),i=t[ft][n].annotationType_,o=e.annotationType_;Z("Cannot apply '@"+o+"' to '"+r+"':"+(`
172
+ The field is already decorated with '@`+i+"'.")+`
173
+ Re-decorating fields is not allowed.
174
+ Use '@override' decorator for methods overridden by subclass.`)}}function _2(t){return Nt(t,ft)||Us(t,ft,Mn({},t[ft])),t[ft]}function yo(t){return typeof t=="object"&&typeof t.kind=="string"}function Gs(t,e){M.NODE_ENV!=="production"&&!e.includes(t.kind)&&Z("The decorator applied to '"+String(t.name)+"' cannot be used on a "+t.kind+" element")}var fe=Symbol("mobx administration"),Qn=function(){function t(n){n===void 0&&(n=M.NODE_ENV!=="production"?"Atom@"+Jt():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=we.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 _p(this)},e.reportChanged=function(){Dt(),kp(this),Lt()},e.toString=function(){return this.name_},Mi(t,[{key:"isBeingObserved",get:function(){return yt(this.flags_,t.isBeingObservedMask_)},set:function(r){this.flags_=wt(this.flags_,t.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return yt(this.flags_,t.isPendingUnobservationMask_)},set:function(r){this.flags_=wt(this.flags_,t.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,t.diffValueMask_,r===1)}}])}();Qn.isBeingObservedMask_=1,Qn.isPendingUnobservationMask_=2,Qn.diffValueMask_=4;var oc=Dr("Atom",Qn);function lp(t,e,n){e===void 0&&(e=Ai),n===void 0&&(n=Ai);var r=new Qn(t);return e!==Ai&&Bw(r,e),n!==Ai&&Dp(r,n),r}function k2(t,e){return t===e}function A2(t,e){return Cc(t,e)}function T2(t,e){return Cc(t,e,1)}function M2(t,e){return Object.is?Object.is(t,e):t===e?t!==0||1/t===1/e:t!==t&&e!==e}var Ks={identity:k2,structural:A2,default:M2,shallow:T2};function Lr(t,e,n){return Oo(t)?t:Array.isArray(t)?We.array(t,{name:n}):fn(t)?We.object(t,void 0,{name:n}):Ti(t)?We.map(t,{name:n}):Tn(t)?We.set(t,{name:n}):typeof t=="function"&&!Vi(t)&&!Co(t)?np(t)?Di(t):So(n,t):t}function N2(t,e,n){if(t==null||ko(t)||ua(t)||tr(t)||hn(t))return t;if(Array.isArray(t))return We.array(t,{name:n,deep:!1});if(fn(t))return We.object(t,void 0,{name:n,deep:!1});if(Ti(t))return We.map(t,{name:n,deep:!1});if(Tn(t))return We.set(t,{name:n,deep:!1});M.NODE_ENV!=="production"&&Z("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Zs(t){return t}function P2(t,e){return M.NODE_ENV!=="production"&&Oo(t)&&Z("observable.struct should not be used with observable values"),Cc(t,e)?e:t}var V2="override";function Js(t){return t.annotationType_===V2}function wo(t,e){return{annotationType_:t,options_:e,make_:D2,extend_:L2,decorate_20223_:R2}}function D2(t,e,n,r){var i;if((i=this.options_)!=null&&i.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(Vi(n.value))return 1;var o=cp(t,this,e,n,!1);return un(r,e,o),2}function L2(t,e,n,r){var i=cp(t,this,e,n);return t.defineProperty_(e,i,r)}function R2(t,e){M.NODE_ENV!=="production"&&Gs(e,["method","field"]);var n=e.kind,r=e.name,i=e.addInitializer,o=this,s=function(c){var u,f,d,p;return Rr((u=(f=o.options_)==null?void 0:f.name)!=null?u:r.toString(),c,(d=(p=o.options_)==null?void 0:p.autoAction)!=null?d:!1)};if(n=="field")return function(l){var c,u=l;return Vi(u)||(u=s(u)),(c=o.options_)!=null&&c.bound&&(u=u.bind(this),u.isMobxAction=!0),u};if(n=="method"){var a;return Vi(t)||(t=s(t)),(a=this.options_)!=null&&a.bound&&i(function(){var l=this,c=l[r].bind(l);c.isMobxAction=!0,l[r]=c}),t}Z("Cannot apply '"+o.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
175
+ '`+o.annotationType_+"' can only be used on properties with a function value."))}function j2(t,e,n,r){var i=e.annotationType_,o=r.value;M.NODE_ENV!=="production"&&!Be(o)&&Z("Cannot apply '"+i+"' to '"+t.name_+"."+n.toString()+"':"+(`
176
+ '`+i+"' can only be used on properties with a function value."))}function cp(t,e,n,r,i){var o,s,a,l,c,u,f;i===void 0&&(i=R.safeDescriptors),j2(t,e,n,r);var d=r.value;if((o=e.options_)!=null&&o.bound){var p;d=d.bind((p=t.proxy_)!=null?p:t.target_)}return{value:Rr((s=(a=e.options_)==null?void 0:a.name)!=null?s:n.toString(),d,(l=(c=e.options_)==null?void 0:c.autoAction)!=null?l:!1,(u=e.options_)!=null&&u.bound?(f=t.proxy_)!=null?f:t.target_:void 0),configurable:i?t.isPlainObject_:!0,enumerable:!1,writable:!i}}function up(t,e){return{annotationType_:t,options_:e,make_:H2,extend_:I2,decorate_20223_:B2}}function H2(t,e,n,r){var i;if(r===t.target_)return this.extend_(t,e,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Nt(t.target_,e)||!Co(t.target_[e]))&&this.extend_(t,e,n,!1)===null)return 0;if(Co(n.value))return 1;var o=fp(t,this,e,n,!1,!1);return un(r,e,o),2}function I2(t,e,n,r){var i,o=fp(t,this,e,n,(i=this.options_)==null?void 0:i.bound);return t.defineProperty_(e,o,r)}function B2(t,e){var n;M.NODE_ENV!=="production"&&Gs(e,["method"]);var r=e.name,i=e.addInitializer;return Co(t)||(t=Di(t)),(n=this.options_)!=null&&n.bound&&i(function(){var o=this,s=o[r].bind(o);s.isMobXFlow=!0,o[r]=s}),t}function $2(t,e,n,r){var i=e.annotationType_,o=r.value;M.NODE_ENV!=="production"&&!Be(o)&&Z("Cannot apply '"+i+"' to '"+t.name_+"."+n.toString()+"':"+(`
177
+ '`+i+"' can only be used on properties with a generator function value."))}function fp(t,e,n,r,i,o){o===void 0&&(o=R.safeDescriptors),$2(t,e,n,r);var s=r.value;if(Co(s)||(s=Di(s)),i){var a;s=s.bind((a=t.proxy_)!=null?a:t.target_),s.isMobXFlow=!0}return{value:s,configurable:o?t.isPlainObject_:!0,enumerable:!1,writable:!o}}function sc(t,e){return{annotationType_:t,options_:e,make_:z2,extend_:F2,decorate_20223_:W2}}function z2(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function F2(t,e,n,r){return U2(t,this,e,n),t.defineComputedProperty_(e,Mn({},this.options_,{get:n.get,set:n.set}),r)}function W2(t,e){M.NODE_ENV!=="production"&&Gs(e,["getter"]);var n=this,r=e.name,i=e.addInitializer;return i(function(){var o=Li(this)[fe],s=Mn({},n.options_,{get:t,context:this});s.name||(s.name=M.NODE_ENV!=="production"?o.name_+"."+r.toString():"ObservableObject."+r.toString()),o.values_.set(r,new Pt(s))}),function(){return this[fe].getObservablePropValue_(r)}}function U2(t,e,n,r){var i=e.annotationType_,o=r.get;M.NODE_ENV!=="production"&&!o&&Z("Cannot apply '"+i+"' to '"+t.name_+"."+n.toString()+"':"+(`
178
+ '`+i+"' can only be used on getter(+setter) properties."))}function Ys(t,e){return{annotationType_:t,options_:e,make_:q2,extend_:G2,decorate_20223_:K2}}function q2(t,e,n){return this.extend_(t,e,n,!1)===null?0:1}function G2(t,e,n,r){var i,o;return Z2(t,this,e,n),t.defineObservableProperty_(e,n.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:Lr,r)}function K2(t,e){if(M.NODE_ENV!=="production"){if(e.kind==="field")throw Z("Please use `@observable accessor "+String(e.name)+"` instead of `@observable "+String(e.name)+"`");Gs(e,["accessor"])}var n=this,r=e.kind,i=e.name,o=new WeakSet;function s(a,l){var c,u,f=Li(a)[fe],d=new jr(l,(c=(u=n.options_)==null?void 0:u.enhancer)!=null?c:Lr,M.NODE_ENV!=="production"?f.name_+"."+i.toString():"ObservableObject."+i.toString(),!1);f.values_.set(i,d),o.add(a)}if(r=="accessor")return{get:function(){return o.has(this)||s(this,t.get.call(this)),this[fe].getObservablePropValue_(i)},set:function(l){return o.has(this)||s(this,l),this[fe].setObservablePropValue_(i,l)},init:function(l){return o.has(this)||s(this,l),l}}}function Z2(t,e,n,r){var i=e.annotationType_;M.NODE_ENV!=="production"&&!("value"in r)&&Z("Cannot apply '"+i+"' to '"+t.name_+"."+n.toString()+"':"+(`
179
+ '`+i+"' cannot be used on getter/setter properties"))}var J2="true",Y2=dp();function dp(t){return{annotationType_:J2,options_:t,make_:X2,extend_:Q2,decorate_20223_:ew}}function X2(t,e,n,r){var i,o;if(n.get)return ea.make_(t,e,n,r);if(n.set){var s=Rr(e.toString(),n.set);return r===t.target_?t.defineProperty_(e,{configurable:R.safeDescriptors?t.isPlainObject_:!0,set:s})===null?0:2:(un(r,e,{configurable:!0,set:s}),2)}if(r!==t.target_&&typeof n.value=="function"){var a;if(np(n.value)){var l,c=(l=this.options_)!=null&&l.autoBind?Di.bound:Di;return c.make_(t,e,n,r)}var u=(a=this.options_)!=null&&a.autoBind?So.bound:So;return u.make_(t,e,n,r)}var f=((i=this.options_)==null?void 0:i.deep)===!1?We.ref:We;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var d;n.value=n.value.bind((d=t.proxy_)!=null?d:t.target_)}return f.make_(t,e,n,r)}function Q2(t,e,n,r){var i,o;if(n.get)return ea.extend_(t,e,n,r);if(n.set)return t.defineProperty_(e,{configurable:R.safeDescriptors?t.isPlainObject_:!0,set:Rr(e.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=t.proxy_)!=null?s:t.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?We.ref:We;return a.extend_(t,e,n,r)}function ew(t,e){Z("'"+this.annotationType_+"' cannot be used as a decorator")}var tw="observable",nw="observable.ref",rw="observable.shallow",iw="observable.struct",pp={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(pp);function Xs(t){return t||pp}var ac=Ys(tw),ow=Ys(nw,{enhancer:Zs}),sw=Ys(rw,{enhancer:N2}),aw=Ys(iw,{enhancer:P2}),hp=dn(ac);function Qs(t){return t.deep===!0?Lr:t.deep===!1?Zs:cw(t.defaultDecorator)}function lw(t){var e;return t?(e=t.defaultDecorator)!=null?e:dp(t):void 0}function cw(t){var e,n;return t&&(e=(n=t.options_)==null?void 0:n.enhancer)!=null?e:Lr}function mp(t,e,n){if(yo(e))return ac.decorate_20223_(t,e);if(Vr(e)){vo(t,e,ac);return}return Oo(t)?t:fn(t)?We.object(t,e,n):Array.isArray(t)?We.array(t,e):Ti(t)?We.map(t,e):Tn(t)?We.set(t,e):typeof t=="object"&&t!==null?t:We.box(t,e)}Qd(mp,hp);var uw={box:function(e,n){var r=Xs(n);return new jr(e,Qs(r),r.name,!0,r.equals)},array:function(e,n){var r=Xs(n);return(R.useProxies===!1||r.proxy===!1?dx:nx)(e,Qs(r),r.name)},map:function(e,n){var r=Xs(n);return new zp(e,Qs(r),r.name)},set:function(e,n){var r=Xs(n);return new Wp(e,Qs(r),r.name)},object:function(e,n,r){return $r(function(){return Ww(R.useProxies===!1||(r==null?void 0:r.proxy)===!1?Li({},r):Xw({},r),e,n)})},ref:dn(ow),shallow:dn(sw),deep:hp,struct:dn(aw)},We=Qd(mp,uw),gp="computed",fw="computed.struct",lc=sc(gp),dw=sc(fw,{equals:Ks.structural}),ea=function(e,n){if(yo(n))return lc.decorate_20223_(e,n);if(Vr(n))return vo(e,n,lc);if(fn(e))return dn(sc(gp,e));M.NODE_ENV!=="production"&&(Be(e)||Z("First argument to `computed` should be an expression."),Be(n)&&Z("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var r=fn(n)?n:{};return r.get=e,r.name||(r.name=e.name||""),new Pt(r)};Object.assign(ea,lc),ea.struct=dn(dw);var bp,vp,ta=0,pw=1,hw=(bp=(vp=$s(function(){},"name"))==null?void 0:vp.configurable)!=null?bp:!1,yp={value:"action",configurable:!0,writable:!1,enumerable:!1};function Rr(t,e,n,r){n===void 0&&(n=!1),M.NODE_ENV!=="production"&&(Be(e)||Z("`action` can only be invoked on functions"),(typeof t!="string"||!t)&&Z("actions should have valid names, got: '"+t+"'"));function i(){return mw(t,n,e,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return e.toString()},hw&&(yp.value=t,un(i,"name",yp)),i}function mw(t,e,n,r,i){var o=gw(t,e,r,i);try{return n.apply(r,i)}catch(s){throw o.error_=s,s}finally{bw(o)}}function gw(t,e,n,r){var i=M.NODE_ENV!=="production"&&Ue()&&!!t,o=0;if(M.NODE_ENV!=="production"&&i){o=Date.now();var s=r?Array.from(r):Fs;xt({type:mc,name:t,object:n,arguments:s})}var a=R.trackingDerivation,l=!e||!a;Dt();var c=R.allowStateChanges;l&&(Hr(),c=cc(!0));var u=pc(!0),f={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:i,startTime_:o,actionId_:pw++,parentActionId_:ta};return ta=f.actionId_,f}function bw(t){ta!==t.actionId_&&Z(30),ta=t.parentActionId_,t.error_!==void 0&&(R.suppressReactionErrors=!0),uc(t.prevAllowStateChanges_),xo(t.prevAllowStateReads_),Lt(),t.runAsAction_&&Nn(t.prevDerivation_),M.NODE_ENV!=="production"&&t.notifySpy_&&St({time:Date.now()-t.startTime_}),R.suppressReactionErrors=!1}function cc(t){var e=R.allowStateChanges;return R.allowStateChanges=t,e}function uc(t){R.allowStateChanges=t}var vw="create",jr=function(t){function e(r,i,o,s,a){var l;return o===void 0&&(o=M.NODE_ENV!=="production"?"ObservableValue@"+Jt():"ObservableValue"),s===void 0&&(s=!0),a===void 0&&(a=Ks.default),l=t.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=o,l.equals=a,l.value_=i(r,void 0,o),M.NODE_ENV!=="production"&&s&&Ue()&&Ir({type:vw,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}ap(e,t);var n=e.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){var o=this.value_;if(i=this.prepareNewValue_(i),i!==R.UNCHANGED){var s=Ue();M.NODE_ENV!=="production"&&s&&xt({type:Qt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),M.NODE_ENV!=="production"&&s&&St()}},n.prepareNewValue_=function(i){if(pn(this),Rt(this)){var o=jt(this,{object:this,type:Qt,newValue:i});if(!o)return R.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?R.UNCHANGED:i},n.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Yt(this)&&Xt(this,{type:Qt,object:this,newValue:i,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return Eo(this,i)},n.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Qt,newValue:this.value_,oldValue:void 0}),_o(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return op(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},e}(Qn),Pt=function(){function t(n){this.dependenciesState_=we.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=we.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ra(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Vt.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||Z(31),this.derivation=n.get,this.name_=n.name||(M.NODE_ENV!=="production"?"ComputedValue@"+Jt():"ComputedValue"),n.set&&(this.setter_=Rr(M.NODE_ENV!=="production"?this.name_+"-setter":"ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Ks.structural:Ks.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var e=t.prototype;return e.onBecomeStale_=function(){Ew(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&&Z(32,this.name_,this.derivation),R.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)fc(this)&&(this.warnAboutUntrackedRead_(),Dt(),this.value_=this.computeValue_(!1),Lt());else if(_p(this),fc(this)){var r=R.trackingContext;this.keepAlive_&&!r&&(R.trackingContext=this),this.trackAndCompute()&&Ow(this),R.trackingContext=r}var i=this.value_;if(ia(i))throw i.cause;return i},e.set=function(r){if(this.setter_){this.isRunningSetter&&Z(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else Z(34,this.name_)},e.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===we.NOT_TRACKING_,o=this.computeValue_(!0),s=i||ia(r)||ia(o)||!this.equals_(r,o);return s&&(this.value_=o,M.NODE_ENV!=="production"&&Ue()&&Ir({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:o})),s},e.computeValue_=function(r){this.isComputing=!0;var i=cc(!1),o;if(r)o=wp(this,this.derivation,this.scope_);else if(R.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new ra(s)}return uc(i),this.isComputing=!1,o},e.suspend_=function(){this.keepAlive_||(dc(this),this.value_=void 0,M.NODE_ENV!=="production"&&this.isTracing_!==Vt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},e.observe_=function(r,i){var o=this,s=!0,a=void 0;return Lw(function(){var l=o.get();if(!s||i){var c=Hr();r({observableKind:"computed",debugObjectName:o.name_,type:Qt,object:o,newValue:l,oldValue:a}),Nn(c)}s=!1,a=l})},e.warnAboutUntrackedRead_=function(){M.NODE_ENV!=="production"&&(this.isTracing_!==Vt.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_:R.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 op(this.get())},e[Symbol.toPrimitive]=function(){return this.valueOf()},Mi(t,[{key:"isComputing",get:function(){return yt(this.flags_,t.isComputingMask_)},set:function(r){this.flags_=wt(this.flags_,t.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return yt(this.flags_,t.isRunningSetterMask_)},set:function(r){this.flags_=wt(this.flags_,t.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return yt(this.flags_,t.isBeingObservedMask_)},set:function(r){this.flags_=wt(this.flags_,t.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return yt(this.flags_,t.isPendingUnobservationMask_)},set:function(r){this.flags_=wt(this.flags_,t.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,t.diffValueMask_,r===1)}}])}();Pt.isComputingMask_=1,Pt.isRunningSetterMask_=2,Pt.isBeingObservedMask_=4,Pt.isPendingUnobservationMask_=8,Pt.diffValueMask_=16;var na=Dr("ComputedValue",Pt),we;(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_"})(we||(we={}));var Vt;(function(t){t[t.NONE=0]="NONE",t[t.LOG=1]="LOG",t[t.BREAK=2]="BREAK"})(Vt||(Vt={}));var ra=function(e){this.cause=void 0,this.cause=e};function ia(t){return t instanceof ra}function fc(t){switch(t.dependenciesState_){case we.UP_TO_DATE_:return!1;case we.NOT_TRACKING_:case we.STALE_:return!0;case we.POSSIBLY_STALE_:{for(var e=pc(!0),n=Hr(),r=t.observing_,i=r.length,o=0;o<i;o++){var s=r[o];if(na(s)){if(R.disableErrorBoundaries)s.get();else try{s.get()}catch{return Nn(n),xo(e),!0}if(t.dependenciesState_===we.STALE_)return Nn(n),xo(e),!0}}return Sp(t),Nn(n),xo(e),!1}}}function pn(t){if(M.NODE_ENV!=="production"){var e=t.observers_.size>0;!R.allowStateChanges&&(e||R.enforceActions==="always")&&console.warn("[MobX] "+(R.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 yw(t){M.NODE_ENV!=="production"&&!R.allowStateReads&&R.observableRequiresReaction&&console.warn("[mobx] Observable '"+t.name_+"' being read outside a reactive context.")}function wp(t,e,n){var r=pc(!0);Sp(t),t.newObserving_=new Array(t.runId_===0?100:t.observing_.length),t.unboundDepsCount_=0,t.runId_=++R.runId;var i=R.trackingDerivation;R.trackingDerivation=t,R.inBatch++;var o;if(R.disableErrorBoundaries===!0)o=e.call(n);else try{o=e.call(n)}catch(s){o=new ra(s)}return R.inBatch--,R.trackingDerivation=i,xw(t),ww(t),xo(r),o}function ww(t){M.NODE_ENV!=="production"&&t.observing_.length===0&&(typeof t.requiresObservable_=="boolean"?t.requiresObservable_:R.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+t.name_+"' is created/updated without reading any observable value.")}function xw(t){for(var e=t.observing_,n=t.observing_=t.newObserving_,r=we.UP_TO_DATE_,i=0,o=t.unboundDepsCount_,s=0;s<o;s++){var a=n[s];a.diffValue===0&&(a.diffValue=1,i!==s&&(n[i]=a),i++),a.dependenciesState_>r&&(r=a.dependenciesState_)}for(n.length=i,t.newObserving_=null,o=e.length;o--;){var l=e[o];l.diffValue===0&&Op(l,t),l.diffValue=0}for(;i--;){var c=n[i];c.diffValue===1&&(c.diffValue=0,Cw(c,t))}r!==we.UP_TO_DATE_&&(t.dependenciesState_=r,t.onBecomeStale_())}function dc(t){var e=t.observing_;t.observing_=[];for(var n=e.length;n--;)Op(e[n],t);t.dependenciesState_=we.NOT_TRACKING_}function xp(t){var e=Hr();try{return t()}finally{Nn(e)}}function Hr(){var t=R.trackingDerivation;return R.trackingDerivation=null,t}function Nn(t){R.trackingDerivation=t}function pc(t){var e=R.allowStateReads;return R.allowStateReads=t,e}function xo(t){R.allowStateReads=t}function Sp(t){if(t.dependenciesState_!==we.UP_TO_DATE_){t.dependenciesState_=we.UP_TO_DATE_;for(var e=t.observing_,n=e.length;n--;)e[n].lowestObserverState_=we.UP_TO_DATE_}}var oa=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},sa=!0,Cp=!1,R=function(){var t=Bs();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(sa=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==new oa().version&&(sa=!1),sa?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new oa):(setTimeout(function(){Cp||Z(35)},1),new oa)}();function Sw(){if((R.pendingReactions.length||R.inBatch||R.isRunningReactions)&&Z(36),Cp=!0,sa){var t=Bs();--t.__mobxInstanceCount===0&&(t.__mobxGlobals=void 0),R=new oa}}function Cw(t,e){t.observers_.add(e),t.lowestObserverState_>e.dependenciesState_&&(t.lowestObserverState_=e.dependenciesState_)}function Op(t,e){t.observers_.delete(e),t.observers_.size===0&&Ep(t)}function Ep(t){t.isPendingUnobservation===!1&&(t.isPendingUnobservation=!0,R.pendingUnobservations.push(t))}function Dt(){R.inBatch++}function Lt(){if(--R.inBatch===0){Np();for(var t=R.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 Pt&&n.suspend_())}R.pendingUnobservations=[]}}function _p(t){yw(t);var e=R.trackingDerivation;return e!==null?(e.runId_!==t.lastAccessedBy_&&(t.lastAccessedBy_=e.runId_,e.newObserving_[e.unboundDepsCount_++]=t,!t.isBeingObserved&&R.trackingContext&&(t.isBeingObserved=!0,t.onBO())),t.isBeingObserved):(t.observers_.size===0&&R.inBatch>0&&Ep(t),!1)}function kp(t){t.lowestObserverState_!==we.STALE_&&(t.lowestObserverState_=we.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===we.UP_TO_DATE_&&(M.NODE_ENV!=="production"&&e.isTracing_!==Vt.NONE&&Ap(e,t),e.onBecomeStale_()),e.dependenciesState_=we.STALE_}))}function Ow(t){t.lowestObserverState_!==we.STALE_&&(t.lowestObserverState_=we.STALE_,t.observers_.forEach(function(e){e.dependenciesState_===we.POSSIBLY_STALE_?(e.dependenciesState_=we.STALE_,M.NODE_ENV!=="production"&&e.isTracing_!==Vt.NONE&&Ap(e,t)):e.dependenciesState_===we.UP_TO_DATE_&&(t.lowestObserverState_=we.UP_TO_DATE_)}))}function Ew(t){t.lowestObserverState_===we.UP_TO_DATE_&&(t.lowestObserverState_=we.POSSIBLY_STALE_,t.observers_.forEach(function(e){e.dependenciesState_===we.UP_TO_DATE_&&(e.dependenciesState_=we.POSSIBLY_STALE_,e.onBecomeStale_())}))}function Ap(t,e){if(console.log("[mobx.trace] '"+t.name_+"' is invalidated due to a change in: '"+e.name_+"'"),t.isTracing_===Vt.BREAK){var n=[];Tp(Rp(t),n,1),new Function(`debugger;
180
+ /*
181
+ Tracing '`+t.name_+`'
182
+
183
+ You are entering this break point because derivation '`+t.name_+"' is being traced and '"+e.name_+`' is now forcing it to update.
184
+ Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
185
+ The stackframe you are looking for is at least ~6-8 stack-frames up.
186
+
187
+ `+(t instanceof Pt?t.derivation.toString().replace(/[*]\//g,"/"):"")+`
188
+
189
+ The dependencies for this derivation are:
190
+
191
+ `+n.join(`
192
+ `)+`
193
+ */
194
+ `)()}}function Tp(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 Tp(r,e,n+1)})}var Pn=function(){function t(n,r,i,o){n===void 0&&(n=M.NODE_ENV!=="production"?"Reaction@"+Jt():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=we.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Vt.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=o}var e=t.prototype;return e.onBecomeStale_=function(){this.schedule_()},e.schedule_=function(){this.isScheduled||(this.isScheduled=!0,R.pendingReactions.push(this),Np())},e.runReaction_=function(){if(!this.isDisposed){Dt(),this.isScheduled=!1;var r=R.trackingContext;if(R.trackingContext=this,fc(this)){this.isTrackPending=!0;try{this.onInvalidate_(),M.NODE_ENV!=="production"&&this.isTrackPending&&Ue()&&Ir({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}R.trackingContext=r,Lt()}},e.track=function(r){if(!this.isDisposed){Dt();var i=Ue(),o;M.NODE_ENV!=="production"&&i&&(o=Date.now(),xt({name:this.name_,type:"reaction"})),this.isRunning=!0;var s=R.trackingContext;R.trackingContext=this;var a=wp(this,r,void 0);R.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&dc(this),ia(a)&&this.reportExceptionInDerivation_(a.cause),M.NODE_ENV!=="production"&&i&&St({time:Date.now()-o}),Lt()}},e.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(R.disableErrorBoundaries)throw r;var o=M.NODE_ENV!=="production"?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";R.suppressReactionErrors?M.NODE_ENV!=="production"&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,r),M.NODE_ENV!=="production"&&Ue()&&Ir({type:"error",name:this.name_,message:o,error:""+r}),R.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},e.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Dt(),dc(this),Lt()))},e.getDisposer_=function(r){var i=this,o=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",o),o[fe]=this,o},e.toString=function(){return"Reaction["+this.name_+"]"},e.trace=function(r){r===void 0&&(r=!1),Zw(this,r)},Mi(t,[{key:"isDisposed",get:function(){return yt(this.flags_,t.isDisposedMask_)},set:function(r){this.flags_=wt(this.flags_,t.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return yt(this.flags_,t.isScheduledMask_)},set:function(r){this.flags_=wt(this.flags_,t.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return yt(this.flags_,t.isTrackPendingMask_)},set:function(r){this.flags_=wt(this.flags_,t.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return yt(this.flags_,t.isRunningMask_)},set:function(r){this.flags_=wt(this.flags_,t.isRunningMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,t.diffValueMask_)?1:0},set:function(r){this.flags_=wt(this.flags_,t.diffValueMask_,r===1)}}])}();Pn.isDisposedMask_=1,Pn.isScheduledMask_=2,Pn.isTrackPendingMask_=4,Pn.isRunningMask_=8,Pn.diffValueMask_=16;var Mp=100,hc=function(e){return e()};function Np(){R.inBatch>0||R.isRunningReactions||hc(_w)}function _w(){R.isRunningReactions=!0;for(var t=R.pendingReactions,e=0;t.length>0;){++e===Mp&&(console.error(M.NODE_ENV!=="production"?"Reaction doesn't converge to a stable state after "+Mp+" 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,i=n.length;r<i;r++)n[r].runReaction_()}R.isRunningReactions=!1}var aa=Dr("Reaction",Pn);function kw(t){var e=hc;hc=function(r){return t(function(){return e(r)})}}function Ue(){return M.NODE_ENV!=="production"&&!!R.spyListeners.length}function Ir(t){if(M.NODE_ENV!=="production"&&R.spyListeners.length)for(var e=R.spyListeners,n=0,r=e.length;n<r;n++)e[n](t)}function xt(t){if(M.NODE_ENV!=="production"){var e=Mn({},t,{spyReportStart:!0});Ir(e)}}var Aw={type:"report-end",spyReportEnd:!0};function St(t){M.NODE_ENV!=="production"&&Ir(t?Mn({},t,{type:"report-end",spyReportEnd:!0}):Aw)}function Tw(t){return M.NODE_ENV==="production"?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(R.spyListeners.push(t),nc(function(){R.spyListeners=R.spyListeners.filter(function(e){return e!==t})}))}var mc="action",Mw="action.bound",Pp="autoAction",Nw="autoAction.bound",Pw="<unnamed action>",gc=wo(mc),Vw=wo(Mw,{bound:!0}),bc=wo(Pp,{autoAction:!0}),Dw=wo(Nw,{autoAction:!0,bound:!0});function Vp(t){var e=function(r,i){if(Be(r))return Rr(r.name||Pw,r,t);if(Be(i))return Rr(r,i,t);if(yo(i))return(t?bc:gc).decorate_20223_(r,i);if(Vr(i))return vo(r,i,t?bc:gc);if(Vr(r))return dn(wo(t?Pp:mc,{name:r,autoAction:t}));M.NODE_ENV!=="production"&&Z("Invalid arguments for `action`")};return e}var Pi=Vp(!1);Object.assign(Pi,gc);var So=Vp(!0);Object.assign(So,bc),Pi.bound=dn(Vw),So.bound=dn(Dw);function Vi(t){return Be(t)&&t.isMobxAction===!0}function Lw(t,e){var n,r,i,o;e===void 0&&(e=ep),M.NODE_ENV!=="production"&&(Be(t)||Z("Autorun expects a function as first argument"),Vi(t)&&Z("Autorun does not accept actions since actions are untrackable"));var s=(n=(r=e)==null?void 0:r.name)!=null?n:M.NODE_ENV!=="production"?t.name||"Autorun@"+Jt():"Autorun",a=!e.scheduler&&!e.delay,l;if(a)l=new Pn(s,function(){this.track(f)},e.onError,e.requiresObservable);else{var c=jw(e),u=!1;l=new Pn(s,function(){u||(u=!0,c(function(){u=!1,l.isDisposed||l.track(f)}))},e.onError,e.requiresObservable)}function f(){t(l)}return(i=e)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((o=e)==null?void 0:o.signal)}var Rw=function(e){return e()};function jw(t){return t.scheduler?t.scheduler:t.delay?function(e){return setTimeout(e,t.delay)}:Rw}var Hw="onBO",Iw="onBUO";function Bw(t,e,n){return Lp(Hw,t,e,n)}function Dp(t,e,n){return Lp(Iw,t,e,n)}function Lp(t,e,n,r){var i=Ri(e),o=Be(r)?r:n,s=t+"L";return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var a=i[s];a&&(a.delete(o),a.size===0&&delete i[s])}}var $w="never",la="always",zw="observed";function Fw(t){t.isolateGlobalState===!0&&Sw();var e=t.useProxies,n=t.enforceActions;if(e!==void 0&&(R.useProxies=e===la?!0:e===$w?!1:typeof Proxy<"u"),e==="ifavailable"&&(R.verifyProxies=!0),n!==void 0){var r=n===la?la:n===zw;R.enforceActions=r,R.allowStateChanges=!(r===!0||r===la)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in t&&(R[i]=!!t[i])}),R.allowStateReads=!R.observableRequiresReaction,M.NODE_ENV!=="production"&&R.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),t.reactionScheduler&&kw(t.reactionScheduler)}function Ww(t,e,n,r){M.NODE_ENV!=="production"&&(arguments.length>4&&Z("'extendObservable' expected 2-4 arguments"),typeof t!="object"&&Z("'extendObservable' expects an object as first argument"),tr(t)&&Z("'extendObservable' should not be used on maps, use map.merge instead"),fn(e)||Z("'extendObservable' only accepts plain objects as second argument"),(Oo(e)||Oo(n))&&Z("Extending an object with another observable (object) is not supported"));var i=w2(e);return $r(function(){var o=Li(t,r)[fe];qs(i).forEach(function(s){o.extend_(s,i[s],n&&s in n?n[s]:!0)})}),t}function Rp(t,e){return jp(Ri(t,e))}function jp(t){var e={name:t.name_};return t.observing_&&t.observing_.length>0&&(e.dependencies=Uw(t.observing_).map(jp)),e}function Uw(t){return Array.from(new Set(t))}var qw=0;function Hp(){this.message="FLOW_CANCELLED"}Hp.prototype=Object.create(Error.prototype);var vc=up("flow"),Gw=up("flow.bound",{bound:!0}),Di=Object.assign(function(e,n){if(yo(n))return vc.decorate_20223_(e,n);if(Vr(n))return vo(e,n,vc);M.NODE_ENV!=="production"&&arguments.length!==1&&Z("Flow expects single argument with generator function");var r=e,i=r.name||"<unnamed flow>",o=function(){var a=this,l=arguments,c=++qw,u=Pi(i+" - runid: "+c+" - init",r).apply(a,l),f,d=void 0,p=new Promise(function(h,m){var g=0;f=m;function y(O){d=void 0;var v;try{v=Pi(i+" - runid: "+c+" - yield "+g++,u.next).call(u,O)}catch(E){return m(E)}x(v)}function w(O){d=void 0;var v;try{v=Pi(i+" - runid: "+c+" - yield "+g++,u.throw).call(u,O)}catch(E){return m(E)}x(v)}function x(O){if(Be(O==null?void 0:O.then)){O.then(x,m);return}return O.done?h(O.value):(d=Promise.resolve(O.value),d.then(y,w))}y(void 0)});return p.cancel=Pi(i+" - runid: "+c+" - cancel",function(){try{d&&Ip(d);var h=u.return(void 0),m=Promise.resolve(h.value);m.then(Ai,Ai),Ip(m),f(new Hp)}catch(g){f(g)}}),p};return o.isMobXFlow=!0,o},vc);Di.bound=dn(Gw);function Ip(t){Be(t.cancel)&&t.cancel()}function Co(t){return(t==null?void 0:t.isMobXFlow)===!0}function Kw(t,e){return t?ko(t)||!!t[fe]||oc(t)||aa(t)||na(t):!1}function Oo(t){return M.NODE_ENV!=="production"&&arguments.length!==1&&Z("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Kw(t)}function Zw(){if(M.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 i=Jw(n);if(!i)return Z("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Vt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=t?Vt.BREAK:Vt.LOG}}function Jw(t){switch(t.length){case 0:return R.trackingDerivation;case 1:return Ri(t[0]);case 2:return Ri(t[0],t[1])}}function Vn(t,e){e===void 0&&(e=void 0),Dt();try{return t.apply(e)}finally{Lt()}}function Br(t){return t[fe]}var Yw={has:function(e,n){return M.NODE_ENV!=="production"&&R.trackingDerivation&&bo("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Br(e).has_(n)},get:function(e,n){return Br(e).get_(n)},set:function(e,n,r){var i;return Vr(n)?(M.NODE_ENV!=="production"&&!Br(e).values_.has(n)&&bo("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=Br(e).set_(n,r,!0))!=null?i:!0):!1},deleteProperty:function(e,n){var r;return M.NODE_ENV!=="production"&&bo("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Vr(n)?(r=Br(e).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(e,n,r){var i;return M.NODE_ENV!=="production"&&bo("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=Br(e).defineProperty_(n,r))!=null?i:!0},ownKeys:function(e){return M.NODE_ENV!=="production"&&R.trackingDerivation&&bo("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Br(e).ownKeys_()},preventExtensions:function(e){Z(13)}};function Xw(t,e){var n,r;return tp(),t=Li(t,e),(r=(n=t[fe]).proxy_)!=null?r:n.proxy_=new Proxy(t,Yw)}function Rt(t){return t.interceptors_!==void 0&&t.interceptors_.length>0}function Eo(t,e){var n=t.interceptors_||(t.interceptors_=[]);return n.push(e),nc(function(){var r=n.indexOf(e);r!==-1&&n.splice(r,1)})}function jt(t,e){var n=Hr();try{for(var r=[].concat(t.interceptors_||[]),i=0,o=r.length;i<o&&(e=r[i](e),e&&!e.type&&Z(14),!!e);i++);return e}finally{Nn(n)}}function Yt(t){return t.changeListeners_!==void 0&&t.changeListeners_.length>0}function _o(t,e){var n=t.changeListeners_||(t.changeListeners_=[]);return n.push(e),nc(function(){var r=n.indexOf(e);r!==-1&&n.splice(r,1)})}function Xt(t,e){var n=Hr(),r=t.changeListeners_;if(r){r=r.slice();for(var i=0,o=r.length;i<o;i++)r[i](e);Nn(n)}}function Qw(t,e,n){return $r(function(){var r,i=Li(t,n)[fe];M.NODE_ENV!=="production"&&e&&t[ft]&&Z("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(r=e)!=null||(e=_2(t)),qs(e).forEach(function(o){return i.make_(o,e[o])})}),t}var Bp="splice",Qt="update",ex=1e4,tx={get:function(e,n){var r=e[fe];return n===fe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):Nt(ca,n)?ca[n]:e[n]},set:function(e,n,r){var i=e[fe];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?e[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){Z(15)}},yc=function(){function t(n,r,i,o){n===void 0&&(n=M.NODE_ENV!=="production"?"ObservableArray@"+Jt():"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_=i,this.legacyMode_=o,this.atom_=new Qn(n),this.enhancer_=function(s,a){return r(s,a,M.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 Eo(this,r)},e.observe_=function(r,i){return i===void 0&&(i=!1),i&&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}),_o(this,r)},e.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},e.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&Z("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var o=new Array(r-i),s=0;s<r-i;s++)o[s]=void 0;this.spliceWithArray_(i,0,o)}else this.spliceWithArray_(r,i-r)},e.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&Z(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&Qp(r+i+1)},e.spliceWithArray_=function(r,i,o){var s=this;pn(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?i=a-r:i==null?i=0:i=Math.max(0,Math.min(i,a-r)),o===void 0&&(o=Fs),Rt(this)){var l=jt(this,{object:this.proxy_,type:Bp,index:r,removedCount:i,added:o});if(!l)return Fs;i=l.removedCount,o=l.added}if(o=o.length===0?o:o.map(function(f){return s.enhancer_(f,void 0)}),this.legacyMode_||M.NODE_ENV!=="production"){var c=o.length-i;this.updateArrayLength_(a,c)}var u=this.spliceItemsIntoValues_(r,i,o);return(i!==0||o.length!==0)&&this.notifyArraySplice_(r,o,u),this.dehanceValues_(u)},e.spliceItemsIntoValues_=function(r,i,o){if(o.length<ex){var s;return(s=this.values_).splice.apply(s,[r,i].concat(o))}else{var a=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=o.length-i;for(var c=0;c<o.length;c++)this.values_[r+c]=o[c];for(var u=0;u<l.length;u++)this.values_[r+o.length+u]=l[u];return a}},e.notifyArrayChildUpdate_=function(r,i,o){var s=!this.owned_&&Ue(),a=Yt(this),l=a||s?{observableKind:"array",object:this.proxy_,type:Qt,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:o}:null;M.NODE_ENV!=="production"&&s&&xt(l),this.atom_.reportChanged(),a&&Xt(this,l),M.NODE_ENV!=="production"&&s&&St()},e.notifyArraySplice_=function(r,i,o){var s=!this.owned_&&Ue(),a=Yt(this),l=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Bp,index:r,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;M.NODE_ENV!=="production"&&s&&xt(l),this.atom_.reportChanged(),a&&Xt(this,l),M.NODE_ENV!=="production"&&s&&St()},e.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn(M.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,i){var o=this.values_;if(this.legacyMode_&&r>o.length&&Z(17,r,o.length),r<o.length){pn(this.atom_);var s=o[r];if(Rt(this)){var a=jt(this,{type:Qt,object:this.proxy_,index:r,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(o[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var c=new Array(r+1-o.length),u=0;u<c.length-1;u++)c[u]=void 0;c[c.length-1]=i,this.spliceWithArray_(o.length,0,c)}},t}();function nx(t,e,n,r){return n===void 0&&(n=M.NODE_ENV!=="production"?"ObservableArray@"+Jt():"ObservableArray"),r===void 0&&(r=!1),tp(),$r(function(){var i=new yc(n,e,r,!1);rp(i.values_,fe,i);var o=new Proxy(i.values_,tx);return i.proxy_=o,t&&t.length&&i.spliceWithArray_(0,0,t),o})}var ca={clear:function(){return this.splice(0)},replace:function(e){var n=this[fe];return n.spliceWithArray_(0,n.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];var s=this[fe];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(e);case 2:return s.spliceWithArray_(e,n)}return s.spliceWithArray_(e,n,i)},spliceWithArray:function(e,n,r){return this[fe].spliceWithArray_(e,n,r)},push:function(){for(var e=this[fe],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[fe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[fe],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return R.trackingDerivation&&Z(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){R.trackingDerivation&&Z(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var n=this[fe],r=n.dehanceValues_(n.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ne("at",Ct),Ne("concat",Ct),Ne("flat",Ct),Ne("includes",Ct),Ne("indexOf",Ct),Ne("join",Ct),Ne("lastIndexOf",Ct),Ne("slice",Ct),Ne("toString",Ct),Ne("toLocaleString",Ct),Ne("toSorted",Ct),Ne("toSpliced",Ct),Ne("with",Ct),Ne("every",en),Ne("filter",en),Ne("find",en),Ne("findIndex",en),Ne("findLast",en),Ne("findLastIndex",en),Ne("flatMap",en),Ne("forEach",en),Ne("map",en),Ne("some",en),Ne("toReversed",en),Ne("reduce",$p),Ne("reduceRight",$p);function Ne(t,e){typeof Array.prototype[t]=="function"&&(ca[t]=e(t))}function Ct(t){return function(){var e=this[fe];e.atom_.reportObserved();var n=e.dehanceValues_(e.values_);return n[t].apply(n,arguments)}}function en(t){return function(e,n){var r=this,i=this[fe];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[t](function(s,a){return e.call(n,s,a,r)})}}function $p(t){return function(){var e=this,n=this[fe];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(o,s,a){return i(o,s,a,e)},r[t].apply(r,arguments)}}var rx=Dr("ObservableArrayAdministration",yc);function ua(t){return Ws(t)&&rx(t[fe])}var ix={},er="add",fa="delete",zp=function(){function t(n,r,i){var o=this;r===void 0&&(r=Lr),i===void 0&&(i=M.NODE_ENV!=="production"?"ObservableMap@"+Jt():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[fe]=ix,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_=i,Be(Map)||Z(18),$r(function(){o.keysAtom_=lp(M.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var e=t.prototype;return e.has_=function(r){return this.data_.has(r)},e.has=function(r){var i=this;if(!R.trackingDerivation)return this.has_(r);var o=this.hasMap_.get(r);if(!o){var s=o=new jr(this.has_(r),Zs,M.NODE_ENV!=="production"?this.name_+"."+rc(r)+"?":"ObservableMap.key?",!1);this.hasMap_.set(r,s),Dp(s,function(){return i.hasMap_.delete(r)})}return o.get()},e.set=function(r,i){var o=this.has_(r);if(Rt(this)){var s=jt(this,{type:o?Qt:er,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return o?this.updateValue_(r,i):this.addValue_(r,i),this},e.delete=function(r){var i=this;if(pn(this.keysAtom_),Rt(this)){var o=jt(this,{type:fa,object:this,name:r});if(!o)return!1}if(this.has_(r)){var s=Ue(),a=Yt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:fa,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return M.NODE_ENV!=="production"&&s&&xt(l),Vn(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(r))==null||c.setNewValue_(!1);var u=i.data_.get(r);u.setNewValue_(void 0),i.data_.delete(r)}),a&&Xt(this,l),M.NODE_ENV!=="production"&&s&&St(),!0}return!1},e.updateValue_=function(r,i){var o=this.data_.get(r);if(i=o.prepareNewValue_(i),i!==R.UNCHANGED){var s=Ue(),a=Yt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:Qt,object:this,oldValue:o.value_,name:r,newValue:i}:null;M.NODE_ENV!=="production"&&s&&xt(l),o.setNewValue_(i),a&&Xt(this,l),M.NODE_ENV!=="production"&&s&&St()}},e.addValue_=function(r,i){var o=this;pn(this.keysAtom_),Vn(function(){var c,u=new jr(i,o.enhancer_,M.NODE_ENV!=="production"?o.name_+"."+rc(r):"ObservableMap.key",!1);o.data_.set(r,u),i=u.value_,(c=o.hasMap_.get(r))==null||c.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=Ue(),a=Yt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:er,object:this,name:r,newValue:i}:null;M.NODE_ENV!=="production"&&s&&xt(l),a&&Xt(this,l),M.NODE_ENV!=="production"&&s&&St()},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,i=this.keys();return Fp({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:r.get(l)}}})},e.entries=function(){var r=this,i=this.keys();return Fp({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:[l,r.get(l)]}}})},e[Symbol.iterator]=function(){return this.entries()},e.forEach=function(r,i){for(var o=Ni(this),s;!(s=o()).done;){var a=s.value,l=a[0],c=a[1];r.call(i,c,l,this)}},e.merge=function(r){var i=this;return tr(r)&&(r=new Map(r)),Vn(function(){fn(r)?y2(r).forEach(function(o){return i.set(o,r[o])}):Array.isArray(r)?r.forEach(function(o){var s=o[0],a=o[1];return i.set(s,a)}):Ti(r)?(v2(r)||Z(19,r),r.forEach(function(o,s){return i.set(s,o)})):r!=null&&Z(20,r)}),this},e.clear=function(){var r=this;Vn(function(){xp(function(){for(var i=Ni(r.keys()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},e.replace=function(r){var i=this;return Vn(function(){for(var o=ox(r),s=new Map,a=!1,l=Ni(i.data_.keys()),c;!(c=l()).done;){var u=c.value;if(!o.has(u)){var f=i.delete(u);if(f)a=!0;else{var d=i.data_.get(u);s.set(u,d)}}}for(var p=Ni(o.entries()),h;!(h=p()).done;){var m=h.value,g=m[0],y=m[1],w=i.data_.has(g);if(i.set(g,y),i.data_.has(g)){var x=i.data_.get(g);s.set(g,x),w||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var O=i.data_.keys(),v=s.keys(),E=O.next(),A=v.next();!E.done;){if(E.value!==A.value){i.keysAtom_.reportChanged();break}E=O.next(),A=v.next()}i.data_=s}),this},e.toString=function(){return"[object ObservableMap]"},e.toJSON=function(){return Array.from(this)},e.observe_=function(r,i){return M.NODE_ENV!=="production"&&i===!0&&Z("`observe` doesn't support fireImmediately=true in combination with maps."),_o(this,r)},e.intercept_=function(r){return Eo(this,r)},Mi(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),tr=Dr("ObservableMap",zp);function Fp(t){return t[Symbol.toStringTag]="MapIterator",Ec(t)}function ox(t){if(Ti(t)||tr(t))return t;if(Array.isArray(t))return new Map(t);if(fn(t)){var e=new Map;for(var n in t)e.set(n,t[n]);return e}else return Z(21,t)}var sx={},Wp=function(){function t(n,r,i){var o=this;r===void 0&&(r=Lr),i===void 0&&(i=M.NODE_ENV!=="production"?"ObservableSet@"+Jt():"ObservableSet"),this.name_=void 0,this[fe]=sx,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_=i,Be(Set)||Z(22),this.enhancer_=function(s,a){return r(s,a,i)},$r(function(){o.atom_=lp(o.name_),n&&o.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;Vn(function(){xp(function(){for(var i=Ni(r.data_.values()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},e.forEach=function(r,i){for(var o=Ni(this),s;!(s=o()).done;){var a=s.value;r.call(i,a,a,this)}},e.add=function(r){var i=this;if(pn(this.atom_),Rt(this)){var o=jt(this,{type:er,object:this,newValue:r});if(!o)return this}if(!this.has(r)){Vn(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=M.NODE_ENV!=="production"&&Ue(),a=Yt(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:er,object:this,newValue:r}:null;s&&M.NODE_ENV!=="production"&&xt(l),a&&Xt(this,l),s&&M.NODE_ENV!=="production"&&St()}return this},e.delete=function(r){var i=this;if(Rt(this)){var o=jt(this,{type:fa,object:this,oldValue:r});if(!o)return!1}if(this.has(r)){var s=M.NODE_ENV!=="production"&&Ue(),a=Yt(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:fa,object:this,oldValue:r}:null;return s&&M.NODE_ENV!=="production"&&xt(l),Vn(function(){i.atom_.reportChanged(),i.data_.delete(r)}),a&&Xt(this,l),s&&M.NODE_ENV!=="production"&&St(),!0}return!1},e.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},e.entries=function(){var r=0,i=Array.from(this.keys()),o=Array.from(this.values());return Up({next:function(){var a=r;return r+=1,a<o.length?{value:[i[a],o[a]],done:!1}:{value:void 0,done:!0}}})},e.keys=function(){return this.values()},e.values=function(){this.atom_.reportObserved();var r=this,i=0,o=Array.from(this.data_.values());return Up({next:function(){return i<o.length?{value:r.dehanceValue_(o[i++]),done:!1}:{value:void 0,done:!0}}})},e.intersection=function(r){if(Tn(r)&&!hn(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},e.union=function(r){if(Tn(r)&&!hn(r))return r.union(this);var i=new Set(this);return i.union(r)},e.difference=function(r){return new Set(this).difference(r)},e.symmetricDifference=function(r){if(Tn(r)&&!hn(r))return r.symmetricDifference(this);var i=new Set(this);return i.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(Tn(r)&&!hn(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},e.replace=function(r){var i=this;return hn(r)&&(r=new Set(r)),Vn(function(){Array.isArray(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):Tn(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):r!=null&&Z("Cannot initialize set from "+r)}),this},e.observe_=function(r,i){return M.NODE_ENV!=="production"&&i===!0&&Z("`observe` doesn't support fireImmediately=true in combination with sets."),_o(this,r)},e.intercept_=function(r){return Eo(this,r)},e.toJSON=function(){return Array.from(this)},e.toString=function(){return"[object ObservableSet]"},e[Symbol.iterator]=function(){return this.values()},Mi(t,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),hn=Dr("ObservableSet",Wp);function Up(t){return t[Symbol.toStringTag]="SetIterator",Ec(t)}var qp=Object.create(null),Gp="remove",wc=function(){function t(n,r,i,o){r===void 0&&(r=new Map),o===void 0&&(o=Y2),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_=i,this.defaultAnnotation_=o,this.keysAtom_=new Qn(M.NODE_ENV!=="production"?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=fn(this.target_),M.NODE_ENV!=="production"&&!ih(this.defaultAnnotation_)&&Z("defaultAnnotation must be valid annotation"),M.NODE_ENV!=="production"&&(this.appliedAnnotations_={})}var e=t.prototype;return e.getObservablePropValue_=function(r){return this.values_.get(r).get()},e.setObservablePropValue_=function(r,i){var o=this.values_.get(r);if(o instanceof Pt)return o.set(i),!0;if(Rt(this)){var s=jt(this,{type:Qt,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==R.UNCHANGED){var a=Yt(this),l=M.NODE_ENV!=="production"&&Ue(),c=a||l?{type:Qt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:r,newValue:i}:null;M.NODE_ENV!=="production"&&l&&xt(c),o.setNewValue_(i),a&&Xt(this,c),M.NODE_ENV!=="production"&&l&&St()}return!0},e.get_=function(r){return R.trackingDerivation&&!Nt(this.target_,r)&&this.has_(r),this.target_[r]},e.set_=function(r,i,o){return o===void 0&&(o=!1),Nt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):o?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},e.has_=function(r){if(!R.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new jr(r in this.target_,Zs,M.NODE_ENV!=="production"?this.name_+"."+rc(r)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(r,i)),i.get()},e.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(Jp(this,i,r),!(r in this.target_)){var o;if((o=this.target_[ft])!=null&&o[r])return;Z(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==zs;){var a=$s(s,r);if(a){var l=i.make_(this,r,a,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}Zp(this,i,r)}},e.extend_=function(r,i,o,s){if(s===void 0&&(s=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(r,i,s);Jp(this,o,r);var a=o.extend_(this,r,i,s);return a&&Zp(this,o,r),a},e.defineProperty_=function(r,i,o){o===void 0&&(o=!1),pn(this.keysAtom_);try{Dt();var s=this.delete_(r);if(!s)return s;if(Rt(this)){var a=jt(this,{object:this.proxy_||this.target_,name:r,type:er,newValue:i.value});if(!a)return null;var l=a.newValue;i.value!==l&&(i=Mn({},i,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,r,i))return!1}else un(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{Lt()}return!0},e.defineObservableProperty_=function(r,i,o,s){s===void 0&&(s=!1),pn(this.keysAtom_);try{Dt();var a=this.delete_(r);if(!a)return a;if(Rt(this)){var l=jt(this,{object:this.proxy_||this.target_,name:r,type:er,newValue:i});if(!l)return null;i=l.newValue}var c=Kp(r),u={configurable:R.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else un(this.target_,r,u);var f=new jr(i,o,M.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Lt()}return!0},e.defineComputedProperty_=function(r,i,o){o===void 0&&(o=!1),pn(this.keysAtom_);try{Dt();var s=this.delete_(r);if(!s)return s;if(Rt(this)){var a=jt(this,{object:this.proxy_||this.target_,name:r,type:er,newValue:void 0});if(!a)return null}i.name||(i.name=M.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),i.context=this.proxy_||this.target_;var l=Kp(r),c={configurable:R.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,r,c))return!1}else un(this.target_,r,c);this.values_.set(r,new Pt(i)),this.notifyPropertyAddition_(r,void 0)}finally{Lt()}return!0},e.delete_=function(r,i){if(i===void 0&&(i=!1),pn(this.keysAtom_),!Nt(this.target_,r))return!0;if(Rt(this)){var o=jt(this,{object:this.proxy_||this.target_,name:r,type:Gp});if(!o)return null}try{var s;Dt();var a=Yt(this),l=M.NODE_ENV!=="production"&&Ue(),c=this.values_.get(r),u=void 0;if(!c&&(a||l)){var f;u=(f=$s(this.target_,r))==null?void 0:f.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(M.NODE_ENV!=="production"&&delete this.appliedAnnotations_[r],c&&(this.values_.delete(r),c instanceof jr&&(u=c.value_),kp(c)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),a||l){var d={type:Gp,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:u,name:r};M.NODE_ENV!=="production"&&l&&xt(d),a&&Xt(this,d),M.NODE_ENV!=="production"&&l&&St()}}finally{Lt()}return!0},e.observe_=function(r,i){return M.NODE_ENV!=="production"&&i===!0&&Z("`observe` doesn't support the fire immediately property for observable objects."),_o(this,r)},e.intercept_=function(r){return Eo(this,r)},e.notifyPropertyAddition_=function(r,i){var o,s=Yt(this),a=M.NODE_ENV!=="production"&&Ue();if(s||a){var l=s||a?{type:er,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;M.NODE_ENV!=="production"&&a&&xt(l),s&&Xt(this,l),M.NODE_ENV!=="production"&&a&&St()}(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},e.ownKeys_=function(){return this.keysAtom_.reportObserved(),qs(this.target_)},e.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},t}();function Li(t,e){var n;if(M.NODE_ENV!=="production"&&e&&ko(t)&&Z("Options can't be provided for already observable objects."),Nt(t,fe))return M.NODE_ENV!=="production"&&!(eh(t)instanceof wc)&&Z("Cannot convert '"+da(t)+`' into observable object:
195
+ The target is already observable of different type.
196
+ Extending builtins is not supported.`),t;M.NODE_ENV!=="production"&&!Object.isExtensible(t)&&Z("Cannot make the designated object observable; it is not extensible");var r=(n=e==null?void 0:e.name)!=null?n:M.NODE_ENV!=="production"?(fn(t)?"ObservableObject":t.constructor.name)+"@"+Jt():"ObservableObject",i=new wc(t,new Map,String(r),lw(e));return Us(t,fe,i),t}var ax=Dr("ObservableObjectAdministration",wc);function Kp(t){return qp[t]||(qp[t]={get:function(){return this[fe].getObservablePropValue_(t)},set:function(n){return this[fe].setObservablePropValue_(t,n)}})}function ko(t){return Ws(t)?ax(t[fe]):!1}function Zp(t,e,n){var r;M.NODE_ENV!=="production"&&(t.appliedAnnotations_[n]=e),(r=t.target_[ft])==null||delete r[n]}function Jp(t,e,n){if(M.NODE_ENV!=="production"&&!ih(e)&&Z("Cannot annotate '"+t.name_+"."+n.toString()+"': Invalid annotation."),M.NODE_ENV!=="production"&&!Js(e)&&Nt(t.appliedAnnotations_,n)){var r=t.name_+"."+n.toString(),i=t.appliedAnnotations_[n].annotationType_,o=e.annotationType_;Z("Cannot apply '"+o+"' to '"+r+"':"+(`
197
+ The field is already annotated with '`+i+"'.")+`
198
+ Re-annotating fields is not allowed.
199
+ Use 'override' annotation for methods overridden by subclass.`)}}var lx=Xp(0),cx=function(){var t=!1,e={};return Object.defineProperty(e,"0",{set:function(){t=!0}}),Object.create(e)[0]=1,t===!1}(),xc=0,Yp=function(){};function ux(t,e){Object.setPrototypeOf?Object.setPrototypeOf(t.prototype,e):t.prototype.__proto__!==void 0?t.prototype.__proto__=e:t.prototype=e}ux(Yp,Array.prototype);var Sc=function(t){function e(r,i,o,s){var a;return o===void 0&&(o=M.NODE_ENV!=="production"?"ObservableArray@"+Jt():"ObservableArray"),s===void 0&&(s=!1),a=t.call(this)||this,$r(function(){var l=new yc(o,i,s,!0);l.proxy_=a,rp(a,fe,l),r&&r.length&&a.spliceWithArray(0,0,r),cx&&Object.defineProperty(a,"0",lx)}),a}ap(e,t);var n=e.prototype;return n.concat=function(){this[fe].atom_.reportObserved();for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return ua(a)?a.slice():a}))},n[Symbol.iterator]=function(){var r=this,i=0;return Ec({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},Mi(e,[{key:"length",get:function(){return this[fe].getArrayLength_()},set:function(i){this[fe].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Yp);Object.entries(ca).forEach(function(t){var e=t[0],n=t[1];e!=="concat"&&Us(Sc.prototype,e,n)});function Xp(t){return{enumerable:!1,configurable:!0,get:function(){return this[fe].get_(t)},set:function(n){this[fe].set_(t,n)}}}function fx(t){un(Sc.prototype,""+t,Xp(t))}function Qp(t){if(t>xc){for(var e=xc;e<t+100;e++)fx(e);xc=t}}Qp(1e3);function dx(t,e,n){return new Sc(t,e,n)}function Ri(t,e){if(typeof t=="object"&&t!==null){if(ua(t))return e!==void 0&&Z(23),t[fe].atom_;if(hn(t))return t.atom_;if(tr(t)){if(e===void 0)return t.keysAtom_;var n=t.data_.get(e)||t.hasMap_.get(e);return n||Z(25,e,da(t)),n}if(ko(t)){if(!e)return Z(26);var r=t[fe].values_.get(e);return r||Z(27,e,da(t)),r}if(oc(t)||na(t)||aa(t))return t}else if(Be(t)&&aa(t[fe]))return t[fe];Z(28)}function eh(t,e){if(t||Z(29),oc(t)||na(t)||aa(t)||tr(t)||hn(t))return t;if(t[fe])return t[fe];Z(24,t)}function da(t,e){var n;if(e!==void 0)n=Ri(t,e);else{if(Vi(t))return t.name;ko(t)||tr(t)||hn(t)?n=eh(t):n=Ri(t)}return n.name_}function $r(t){var e=Hr(),n=cc(!0);Dt();try{return t()}finally{Lt(),uc(n),Nn(e)}}var th=zs.toString;function Cc(t,e,n){return n===void 0&&(n=-1),Oc(t,e,n)}function Oc(t,e,n,r,i){if(t===e)return t!==0||1/t===1/e;if(t==null||e==null)return!1;if(t!==t)return e!==e;var o=typeof t;if(o!=="function"&&o!=="object"&&typeof e!="object")return!1;var s=th.call(t);if(s!==th.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=nh(t),e=nh(e);var a=s==="[object Array]";if(!a){if(typeof t!="object"||typeof e!="object")return!1;var l=t.constructor,c=e.constructor;if(l!==c&&!(Be(l)&&l instanceof l&&Be(c)&&c instanceof c)&&"constructor"in t&&"constructor"in e)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var u=r.length;u--;)if(r[u]===t)return i[u]===e;if(r.push(t),i.push(e),a){if(u=t.length,u!==e.length)return!1;for(;u--;)if(!Oc(t[u],e[u],n-1,r,i))return!1}else{var f=Object.keys(t),d;if(u=f.length,Object.keys(e).length!==u)return!1;for(;u--;)if(d=f[u],!(Nt(e,d)&&Oc(t[d],e[d],n-1,r,i)))return!1}return r.pop(),i.pop(),!0}function nh(t){return ua(t)?t.slice():Ti(t)||tr(t)||Tn(t)||hn(t)?Array.from(t.entries()):t}var rh,px=((rh=Bs().Iterator)==null?void 0:rh.prototype)||{};function Ec(t){return t[Symbol.iterator]=hx,Object.assign(Object.create(px),t)}function hx(){return this}function ih(t){return t instanceof Object&&typeof t.annotationType_=="string"&&Be(t.make_)&&Be(t.extend_)}if(["Symbol","Map","Set"].forEach(function(t){var e=Bs();typeof e[t]>"u"&&Z("MobX requires global '"+t+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Tw,extras:{getDebugName:da},$mobx:fe}),!C.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Qw)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var mx={};function gx(t){t()}function bx(t){t||(t=gx,mx.NODE_ENV!=="production"&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),Fw({reactionScheduler:t})}function vx(t){return Rp(t)}var yx=1e4,wx=1e4,xx=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=yx),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(o,s){i-o.registeredAt>=r&&(n.finalize(o.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,wx))}}),t}(),Sx=typeof FinalizationRegistry<"u"?FinalizationRegistry:xx,_c=new Sx(function(t){var e;(e=t.reaction)===null||e===void 0||e.dispose(),t.reaction=null}),kc={exports:{}},Ac={};/**
200
+ * @license React
201
+ * use-sync-external-store-shim.production.min.js
202
+ *
203
+ * Copyright (c) Facebook, Inc. and its affiliates.
204
+ *
205
+ * This source code is licensed under the MIT license found in the
206
+ * LICENSE file in the root directory of this source tree.
207
+ */var oh;function Cx(){if(oh)return Ac;oh=1;var t=C;function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function a(f,d){var p=d(),h=r({inst:{value:p,getSnapshot:d}}),m=h[0].inst,g=h[1];return o(function(){m.value=p,m.getSnapshot=d,l(m)&&g({inst:m})},[f,p,d]),i(function(){return l(m)&&g({inst:m}),f(function(){l(m)&&g({inst:m})})},[f]),s(p),p}function l(f){var d=f.getSnapshot;f=f.value;try{var p=d();return!n(f,p)}catch{return!0}}function c(f,d){return d()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ac.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ac}var Tc={},sh;function Ox(){if(sh)return Tc;sh=1;var t={};/**
208
+ * @license React
209
+ * use-sync-external-store-shim.development.js
210
+ *
211
+ * Copyright (c) Facebook, Inc. and its affiliates.
212
+ *
213
+ * This source code is licensed under the MIT license found in the
214
+ * LICENSE file in the root directory of this source tree.
215
+ */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=C,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(O){{for(var v=arguments.length,E=new Array(v>1?v-1:0),A=1;A<v;A++)E[A-1]=arguments[A];i("error",O,E)}}function i(O,v,E){{var A=n.ReactDebugCurrentFrame,B=A.getStackAddendum();B!==""&&(v+="%s",E=E.concat([B]));var T=E.map(function(V){return String(V)});T.unshift("Warning: "+v),Function.prototype.apply.call(console[O],console,T)}}function o(O,v){return O===v&&(O!==0||1/O===1/v)||O!==O&&v!==v}var s=typeof Object.is=="function"?Object.is:o,a=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue,f=!1,d=!1;function p(O,v,E){f||e.startTransition!==void 0&&(f=!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 A=v();if(!d){var B=v();s(A,B)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var T=a({inst:{value:A,getSnapshot:v}}),V=T[0].inst,I=T[1];return c(function(){V.value=A,V.getSnapshot=v,h(V)&&I({inst:V})},[O,A,v]),l(function(){h(V)&&I({inst:V});var z=function(){h(V)&&I({inst:V})};return O(z)},[O]),u(A),A}function h(O){var v=O.getSnapshot,E=O.value;try{var A=v();return!s(E,A)}catch{return!0}}function m(O,v,E){return v()}var g=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y=!g,w=y?m:p,x=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:w;Tc.useSyncExternalStore=x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),Tc}var Ex={};Ex.NODE_ENV==="production"?kc.exports=Cx():kc.exports=Ox();var _x=kc.exports;function ah(t){t.reaction=new Pn("observer".concat(t.name),function(){var e;t.stateVersion=Symbol(),(e=t.onStoreChange)===null||e===void 0||e.call(t)})}function kx(t,e){e===void 0&&(e="observed");var n=C.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe:function(a){return _c.unregister(r),r.onStoreChange=a,r.reaction||(ah(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(ah(i),_c.register(n,i,i)),C.useDebugValue(i.reaction,vx),_x.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var o,s;if(i.reaction.track(function(){try{o=t()}catch(a){s=a}}),s)throw s;return o}var lh={},Mc,Nc,ch=!0,uh=typeof Symbol=="function"&&Symbol.for,Ax=(Nc=(Mc=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Mc===void 0?void 0:Mc.configurable)!==null&&Nc!==void 0?Nc:!1,fh=uh?Symbol.for("react.forward_ref"):typeof C.forwardRef=="function"&&C.forwardRef(function(t){return null}).$$typeof,dh=uh?Symbol.for("react.memo"):typeof C.memo=="function"&&C.memo(function(t){return null}).$$typeof;function Ao(t,e){var n;if(lh.NODE_ENV!=="production"&&ch&&e&&(ch=!1,console.warn("[mobx-react-lite] `observer(fn, { forwardRef: true })` is deprecated, use `observer(React.forwardRef(fn))`")),dh&&t.$$typeof===dh)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,i=t,o=t.displayName||t.name;if(fh&&t.$$typeof===fh&&(r=!0,i=t.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(a,l){return kx(function(){return i(a,l)},o)};return s.displayName=t.displayName,Ax&&Object.defineProperty(s,"name",{value:t.name,writable:!0,configurable:!0}),t.contextTypes&&(s.contextTypes=t.contextTypes),r&&(s=C.forwardRef(s)),s=C.memo(s),Mx(t,s),lh.NODE_ENV!=="production"&&Object.defineProperty(s,"contextTypes",{set:function(){var a,l;throw new Error("[mobx-react-lite] `".concat(this.displayName||((a=this.type)===null||a===void 0?void 0:a.displayName)||((l=this.type)===null||l===void 0?void 0:l.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),s}var Tx={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Mx(t,e){Object.keys(t).forEach(function(n){Tx[n]||Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}var Pc;bx(Es.unstable_batchedUpdates),Pc=_c.finalizeAllImmediately;const ph=new Set,Ot=new WeakMap,ji=new WeakMap,zr=new WeakMap,Vc=new WeakMap,Nx=new WeakMap,Hi=new WeakMap,pa=new WeakMap;let nr;const Fr="__aa_tgt",Dc="__aa_del",Px=t=>{const e=jx(t);e&&e.forEach(n=>Hx(n))},Vx=t=>{t.forEach(e=>{e.target===nr&&Lx(),Ot.has(e.target)&&Wr(e.target)})};function Dx(t){const e=Vc.get(t);e==null||e.disconnect();let n=Ot.get(t),r=0;const i=5;n||(n=Bi(t),Ot.set(t,n));const{offsetWidth:o,offsetHeight:s}=nr,l=[n.top-i,o-(n.left+i+n.width),s-(n.top+i+n.height),n.left-i].map(u=>`${-1*Math.floor(u)}px`).join(" "),c=new IntersectionObserver(()=>{++r>1&&Wr(t)},{root:nr,threshold:1,rootMargin:l});c.observe(t),Vc.set(t,c)}function Wr(t){clearTimeout(pa.get(t));const e=ha(t),n=typeof e=="function"?500:e.duration;pa.set(t,setTimeout(()=>{const r=zr.get(t);(!r||r.finished)&&(Ot.set(t,Bi(t)),Dx(t))},n))}function Lx(){clearTimeout(pa.get(nr)),pa.set(nr,setTimeout(()=>{ph.forEach(t=>gh(t,e=>hh(()=>Wr(e))))},100))}function Rx(t){setTimeout(()=>{Nx.set(t,setInterval(()=>hh(Wr.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function hh(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Lc,Ii;typeof window<"u"&&(nr=document.documentElement,Lc=new MutationObserver(Px),Ii=new ResizeObserver(Vx),Ii.observe(nr));function jx(t){return t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(Rc(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const i=n.target.children.item(r);if(i){if(Dc in i)return!1;Rc(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const i=n.removedNodes[r];if(Dc in i)return!1;i instanceof Element&&(e.add(i),Rc(n.target,i),ji.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function Rc(t,e){!e&&!(Fr in t)?Object.defineProperty(t,Fr,{value:t}):e&&!(Fr in e)&&Object.defineProperty(e,Fr,{value:t})}function Hx(t){var e;const n=nr.contains(t),r=Ot.has(t);n&&ji.has(t)&&ji.delete(t),zr.has(t)&&((e=zr.get(t))===null||e===void 0||e.cancel()),r&&n?Ix(t):r&&!n?$x(t):Bx(t)}function mn(t){return Number(t.replace(/[^0-9.\-]/g,""))}function Bi(t){const e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height}}function mh(t,e,n){let r=e.width,i=e.height,o=n.width,s=n.height;const a=getComputedStyle(t);if(a.getPropertyValue("box-sizing")==="content-box"){const c=mn(a.paddingTop)+mn(a.paddingBottom)+mn(a.borderTopWidth)+mn(a.borderBottomWidth),u=mn(a.paddingLeft)+mn(a.paddingRight)+mn(a.borderRightWidth)+mn(a.borderLeftWidth);r-=u,o-=u,i-=c,s-=c}return[r,o,i,s].map(Math.round)}function ha(t){return Fr in t&&Hi.has(t[Fr])?Hi.get(t[Fr]):{duration:250,easing:"ease-in-out"}}function gh(t,...e){e.forEach(n=>n(t,Hi.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,Hi.has(r)))}}function Ix(t){const e=Ot.get(t),n=Bi(t);let r;if(!e)return;const i=ha(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,c,u]=mh(t,e,n),f={transform:`translate(${o}px, ${s}px)`},d={transform:"translate(0, 0)"};a!==l&&(f.width=`${a}px`,d.width=`${l}px`),c!==u&&(f.height=`${c}px`,d.height=`${u}px`),r=t.animate([f,d],i)}else r=new Animation(i(t,"remain",e,n)),r.play();zr.set(t,r),Ot.set(t,n),r.addEventListener("finish",Wr.bind(null,t))}function Bx(t){const e=Bi(t);Ot.set(t,e);const n=ha(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()),zr.set(t,r),r.addEventListener("finish",Wr.bind(null,t))}function $x(t){if(!ji.has(t)||!Ot.has(t))return;const[e,n]=ji.get(t);Object.defineProperty(t,Dc,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(t,n):e&&e.parentNode&&e.parentNode.appendChild(t);const[r,i,o,s]=zx(t),a=ha(t),l=Ot.get(t);let c;Object.assign(t.style,{position:"absolute",top:`${r}px`,left:`${i}px`,width:`${o}px`,height:`${s}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof a!="function"?c=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:a.duration,easing:"ease-out"}):(c=new Animation(a(t,"remove",l)),c.play()),zr.set(t,c),c.addEventListener("finish",()=>{var u;t.remove(),Ot.delete(t),ji.delete(t),zr.delete(t),(u=Vc.get(t))===null||u===void 0||u.disconnect()})}function zx(t){const e=Ot.get(t),[n,,r]=mh(t,e,Bi(t));let i=t.parentElement;for(;i&&(getComputedStyle(i).position==="static"||i instanceof HTMLBodyElement);)i=i.parentElement;i||(i=document.body);const o=getComputedStyle(i),s=Ot.get(i)||Bi(i),a=Math.round(e.top-s.top)-mn(o.borderTopWidth),l=Math.round(e.left-s.left)-mn(o.borderLeftWidth);return[a,l,n,r]}function Fx(t,e={}){Lc&&Ii&&(getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),gh(t,Wr,Rx,n=>Ii==null?void 0:Ii.observe(n)),typeof e=="function"?Hi.set(t,e):Hi.set(t,{duration:250,easing:"ease-in-out",...e}),Lc.observe(t,{childList:!0}),ph.add(t))}function Wx(t){const e=C.useRef(null);return C.useEffect(()=>{e.current instanceof HTMLElement&&Fx(e.current,t)},[e]),e}const Ee=xe;function xe(...t){return(Array.isArray(t[0])?t[0]:[...t]).filter(Boolean).flatMap(i=>typeof i=="string"?i.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const s=o.split(":"),a=s.pop(),l=s.join(":"),c=a==null?void 0:a.startsWith("!"),f=`gs-utl-${c?a==null?void 0:a.slice(1):a}`,d=c?`!${f}`:f;return l?`${l}:${d}`:d}return o}):i).join(" ")}const Le=C.forwardRef(function({as:e,children:n,className:r,col:i,revert:o,full:s,nowrap:a,space:l,justify:c,items:u,...f},d){const p=e||"div";return P.jsx(p,{ref:d,className:xe(["gs-utl-flex",r,i&&!o&&"gs-utl-flex-col",i&&o&&"gs-utl-flex-col-reverse",!i&&o&&"gs-utl-flex-row-reverse",s&&!i&&"gs-utl-w-full",s&&i&&"gs-utl-h-full",a?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(i?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(i?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(i?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(i?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(i?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(i?"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"]),...f,children:n})}),he=C.forwardRef(function({children:e,className:n,grow:r,...i},o){return P.jsx("div",{ref:o,className:xe([n,r&&"flex-1"]),...i,children:e})}),Ux=150,ke={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"},qx={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"},Gx={...{enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},...{leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"}},jc={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"},Kx={bg:ke.bg,bgH:ke.bgH},bh={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"},Ht={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"},Zx={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"},To={s3x:"13px",s2x:"14px",sx:"16px",s:"18px"},vh={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"},Jx={link:xe(ke.tAo),inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},Yx=({variant:t,size:e="m",className:n,active:r,border:i=!0,rounded:o=!0,disabled:s=!1,withBg:a,block:l,full:c})=>{const u=t==="pr",f=t==="out",d=t==="out-clear",p=t==="warn",h=t==="danger",m=i&&(f||d||!t);return["gs-utl-transition-colors gs-utl-cursor-pointer",l&&"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,o&&Ht.rnd,m&&`${Ht.b} ${ke.br}`,a&&ke.bg,m&&xe(Ht.b,f&&ke.bA,f&&ke.tAo,!s&&ke.hBgH),p&&xe(ke.bgW,ke.hBgW,!s&&ke.hBgW,"text-white"),h&&xe(ke.bgRed,!s&&ke.hBgRed,"text-white"),u&&xe(ke.bgA2,!s&&ke.hBgAct),r&&ke.bgA,s&&"disabled:gs-utl-opacity-80 cursor-not-allowed",c&&"w-full",Zx.focus]};function Hc({children:t,...e}){const{variant:n,size:r,active:i,border:o,rounded:s,block:a,full:l,className:c,icon:u,loading:f,withBg:d,...p}=e,h=f?{icon:Vy,size:"18px",className:xe("animate-spin-fast")}:Yf(u)?{icon:u,size:"18px"}:u;return P.jsx("button",{className:xe(Yx(e)),disabled:e.disabled,...p,children:h?P.jsxs(Le,{className:xe("gap-2"),items:"center",nowrap:!0,children:[P.jsx(he,{children:P.jsx(Kr,{...h})}),t&&P.jsx(he,{children:t})]}):t})}var Xx=Object.defineProperty,Qx=(t,e,n)=>e in t?Xx(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ic=(t,e,n)=>(Qx(t,typeof e!="symbol"?e+"":e,n),n);let eS=class{constructor(){Ic(this,"current",this.detect()),Ic(this,"handoffState","pending"),Ic(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"}},ma=new eS,Mo=(t,e)=>{ma.isServer?C.useEffect(t,e):C.useLayoutEffect(t,e)};function $i(t){let e=C.useRef(t);return Mo(()=>{e.current=t},[t]),e}let Dn=function(t){let e=$i(t);return C.useCallback((...n)=>e.current(...n),[e])};function tS(t){typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t).catch(e=>setTimeout(()=>{throw e}))}function No(){let t=[],e={addEventListener(n,r,i,o){return n.addEventListener(r,i,o),e.add(()=>n.removeEventListener(r,i,o))},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 tS(()=>{r.current&&n[0]()}),e.add(()=>{r.current=!1})},style(n,r,i){let o=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:i}),this.add(()=>{Object.assign(n.style,{[r]:o})})},group(n){let r=No();return n(r),this.add(()=>r.dispose())},add(n){return t.push(n),()=>{let r=t.indexOf(n);if(r>=0)for(let i of t.splice(r,1))i()}},dispose(){for(let n of t.splice(0))n()}};return e}function yh(){let[t]=C.useState(No);return C.useEffect(()=>()=>t.dispose(),[t]),t}function nS(){let t=typeof document>"u";return"useSyncExternalStore"in Mt?(e=>e.useSyncExternalStore)(Mt)(()=>()=>{},()=>!1,()=>!t):!1}function wh(){let t=nS(),[e,n]=Mt.useState(ma.isHandoffComplete);return e&&ma.isHandoffComplete===!1&&n(!1),Mt.useEffect(()=>{e!==!0&&n(!0)},[e]),Mt.useEffect(()=>ma.handoff(),[]),t?!1:e}function gn(t,e,...n){if(t in e){let i=e[t];return typeof i=="function"?i(...n):i}let r=new Error(`Tried to handle "${t}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,gn),r}let rS=Symbol();function xh(...t){let e=C.useRef(t);C.useEffect(()=>{e.current=t},[t]);let n=Dn(r=>{for(let i of e.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return t.every(r=>r==null||(r==null?void 0:r[rS]))?void 0:n}function ga(...t){return Array.from(new Set(t.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}var Sh=(t=>(t[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t))(Sh||{}),rr=(t=>(t[t.Unmount=0]="Unmount",t[t.Hidden=1]="Hidden",t))(rr||{});function Ch({ourProps:t,theirProps:e,slot:n,defaultTag:r,features:i,visible:o=!0,name:s,mergeRefs:a}){a=a??iS;let l=Oh(e,t);if(o)return ba(l,n,r,s,a);let c=i??0;if(c&2){let{static:u=!1,...f}=l;if(u)return ba(f,n,r,s,a)}if(c&1){let{unmount:u=!0,...f}=l;return gn(u?0:1,{0(){return null},1(){return ba({...f,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return ba(l,n,r,s,a)}function ba(t,e={},n,r,i){let{as:o=n,children:s,refName:a="ref",...l}=$c(t,["unmount","static"]),c=t.ref!==void 0?{[a]:t.ref}:{},u=typeof s=="function"?s(e):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(e));let f={};if(e){let d=!1,p=[];for(let[h,m]of Object.entries(e))typeof m=="boolean"&&(d=!0),m===!0&&p.push(h);d&&(f["data-headlessui-state"]=p.join(" "))}if(o===C.Fragment&&Object.keys(Eh(l)).length>0){if(!C.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(l).map(m=>` - ${m}`).join(`
216
+ `),"","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(m=>` - ${m}`).join(`
217
+ `)].join(`
218
+ `));let d=u.props,p=typeof(d==null?void 0:d.className)=="function"?(...m)=>ga(d==null?void 0:d.className(...m),l.className):ga(d==null?void 0:d.className,l.className),h=p?{className:p}:{};return C.cloneElement(u,Object.assign({},Oh(u.props,Eh($c(l,["ref"]))),f,c,{ref:i(u.ref,c.ref)},h))}return C.createElement(o,Object.assign({},$c(l,["ref"]),o!==C.Fragment&&c,o!==C.Fragment&&f),u)}function iS(...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 Oh(...t){if(t.length===0)return{};if(t.length===1)return t[0];let e={},n={};for(let r of t)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):e[i]=r[i];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](i,...o){let s=n[r];for(let a of s){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...o)}}});return e}function Bc(t){var e;return Object.assign(C.forwardRef(t),{displayName:(e=t.displayName)!=null?e:t.name})}function Eh(t){let e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function $c(t,e=[]){let n=Object.assign({},t);for(let r of e)r in n&&delete n[r];return n}let zc=C.createContext(null);zc.displayName="OpenClosedContext";var Ln=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(Ln||{});function _h(){return C.useContext(zc)}function oS({value:t,children:e}){return C.createElement(zc.Provider,{value:t},e)}function Fc(){let t=C.useRef(!1);return Mo(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function sS(t=0){let[e,n]=C.useState(t),r=Fc(),i=C.useCallback(l=>{r.current&&n(c=>c|l)},[e,r]),o=C.useCallback(l=>!!(e&l),[e]),s=C.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=C.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:e,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}function aS(t){let e={called:!1};return(...n)=>{if(!e.called)return e.called=!0,t(...n)}}function Wc(t,...e){t&&e.length>0&&t.classList.add(...e)}function Uc(t,...e){t&&e.length>0&&t.classList.remove(...e)}function lS(t,e){let n=No();if(!t)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(t),[o,s]=[r,i].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,f)=>f-u);return c}),a=o+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{e(),c.dispose()},a),c.addEventListener(t,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(t,"transitionend",c=>{c.target===c.currentTarget&&(e(),l())})}else e();return n.add(()=>e()),n.dispose}function cS(t,e,n,r){let i=n?"enter":"leave",o=No(),s=r!==void 0?aS(r):()=>{};i==="enter"&&(t.removeAttribute("hidden"),t.style.display="");let a=gn(i,{enter:()=>e.enter,leave:()=>e.leave}),l=gn(i,{enter:()=>e.enterTo,leave:()=>e.leaveTo}),c=gn(i,{enter:()=>e.enterFrom,leave:()=>e.leaveFrom});return Uc(t,...e.base,...e.enter,...e.enterTo,...e.enterFrom,...e.leave,...e.leaveFrom,...e.leaveTo,...e.entered),Wc(t,...e.base,...a,...c),o.nextFrame(()=>{Uc(t,...e.base,...a,...c),Wc(t,...e.base,...a,...l),lS(t,()=>(Uc(t,...e.base,...a),Wc(t,...e.base,...e.entered),s()))}),o.dispose}function uS({immediate:t,container:e,direction:n,classes:r,onStart:i,onStop:o}){let s=Fc(),a=yh(),l=$i(n);Mo(()=>{t&&(l.current="enter")},[t]),Mo(()=>{let c=No();a.add(c.dispose);let u=e.current;if(u&&l.current!=="idle"&&s.current)return c.dispose(),i.current(l.current),c.add(cS(u,r.current,l.current==="enter",()=>{c.dispose(),o.current(l.current)})),c.dispose},[n])}function ir(t=""){return t.split(/\s+/).filter(e=>e.length>1)}let va=C.createContext(null);va.displayName="TransitionContext";var fS=(t=>(t.Visible="visible",t.Hidden="hidden",t))(fS||{});function dS(){let t=C.useContext(va);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}function pS(){let t=C.useContext(ya);if(t===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}let ya=C.createContext(null);ya.displayName="NestingContext";function wa(t){return"children"in t?wa(t.children):t.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function kh(t,e){let n=$i(t),r=C.useRef([]),i=Fc(),o=yh(),s=Dn((p,h=rr.Hidden)=>{let m=r.current.findIndex(({el:g})=>g===p);m!==-1&&(gn(h,{[rr.Unmount](){r.current.splice(m,1)},[rr.Hidden](){r.current[m].state="hidden"}}),o.microTask(()=>{var g;!wa(r)&&i.current&&((g=n.current)==null||g.call(n))}))}),a=Dn(p=>{let h=r.current.find(({el:m})=>m===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,rr.Unmount)}),l=C.useRef([]),c=C.useRef(Promise.resolve()),u=C.useRef({enter:[],leave:[],idle:[]}),f=Dn((p,h,m)=>{l.current.splice(0),e&&(e.chains.current[h]=e.chains.current[h].filter(([g])=>g!==p)),e==null||e.chains.current[h].push([p,new Promise(g=>{l.current.push(g)})]),e==null||e.chains.current[h].push([p,new Promise(g=>{Promise.all(u.current[h].map(([y,w])=>w)).then(()=>g())})]),h==="enter"?c.current=c.current.then(()=>e==null?void 0:e.wait.current).then(()=>m(h)):m(h)}),d=Dn((p,h,m)=>{Promise.all(u.current[h].splice(0).map(([g,y])=>y)).then(()=>{var g;(g=l.current.shift())==null||g()}).then(()=>m(h))});return C.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:d,wait:c,chains:u}),[a,s,r,f,d,u,c])}function hS(){}let mS=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Ah(t){var e;let n={};for(let r of mS)n[r]=(e=t[r])!=null?e:hS;return n}function gS(t){let e=C.useRef(Ah(t));return C.useEffect(()=>{e.current=Ah(t)},[t]),e}let bS="div",Th=Sh.RenderStrategy;function vS(t,e){var n,r;let{beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:f,leave:d,leaveFrom:p,leaveTo:h,...m}=t,g=C.useRef(null),y=xh(g,e),w=(n=m.unmount)==null||n?rr.Unmount:rr.Hidden,{show:x,appear:O,initial:v}=dS(),[E,A]=C.useState(x?"visible":"hidden"),B=pS(),{register:T,unregister:V}=B;C.useEffect(()=>T(g),[T,g]),C.useEffect(()=>{if(w===rr.Hidden&&g.current){if(x&&E!=="visible"){A("visible");return}return gn(E,{hidden:()=>V(g),visible:()=>T(g)})}},[E,g,T,V,x,w]);let I=$i({base:ir(m.className),enter:ir(l),enterFrom:ir(c),enterTo:ir(u),entered:ir(f),leave:ir(d),leaveFrom:ir(p),leaveTo:ir(h)}),z=gS({beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a}),K=wh();C.useEffect(()=>{if(K&&E==="visible"&&g.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[g,E,K]);let te=v&&!O,H=O&&x&&v,Y=!K||te?"idle":x?"enter":"leave",re=sS(0),oe=Dn(W=>gn(W,{enter:()=>{re.addFlag(Ln.Opening),z.current.beforeEnter()},leave:()=>{re.addFlag(Ln.Closing),z.current.beforeLeave()},idle:()=>{}})),me=Dn(W=>gn(W,{enter:()=>{re.removeFlag(Ln.Opening),z.current.afterEnter()},leave:()=>{re.removeFlag(Ln.Closing),z.current.afterLeave()},idle:()=>{}})),pe=kh(()=>{A("hidden"),V(g)},B),_=C.useRef(!1);uS({immediate:H,container:g,classes:I,direction:Y,onStart:$i(W=>{_.current=!0,pe.onStart(g,W,oe)}),onStop:$i(W=>{_.current=!1,pe.onStop(g,W,me),W==="leave"&&!wa(pe)&&(A("hidden"),V(g))})});let N=m,G={ref:y};return H?N={...N,className:ga(m.className,...I.current.enter,...I.current.enterFrom)}:_.current&&(N.className=ga(m.className,(r=g.current)==null?void 0:r.className),N.className===""&&delete N.className),C.createElement(ya.Provider,{value:pe},C.createElement(oS,{value:gn(E,{visible:Ln.Open,hidden:Ln.Closed})|re.flags},Ch({ourProps:G,theirProps:N,defaultTag:bS,features:Th,visible:E==="visible",name:"Transition.Child"})))}function yS(t,e){let{show:n,appear:r=!1,unmount:i=!0,...o}=t,s=C.useRef(null),a=xh(s,e);wh();let l=_h();if(n===void 0&&l!==null&&(n=(l&Ln.Open)===Ln.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=C.useState(n?"visible":"hidden"),f=kh(()=>{u("hidden")}),[d,p]=C.useState(!0),h=C.useRef([n]);Mo(()=>{d!==!1&&h.current[h.current.length-1]!==n&&(h.current.push(n),p(!1))},[h,n]);let m=C.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);C.useEffect(()=>{if(n)u("visible");else if(!wa(f))u("hidden");else{let x=s.current;if(!x)return;let O=x.getBoundingClientRect();O.x===0&&O.y===0&&O.width===0&&O.height===0&&u("hidden")}},[n,f]);let g={unmount:i},y=Dn(()=>{var x;d&&p(!1),(x=t.beforeEnter)==null||x.call(t)}),w=Dn(()=>{var x;d&&p(!1),(x=t.beforeLeave)==null||x.call(t)});return C.createElement(ya.Provider,{value:f},C.createElement(va.Provider,{value:m},Ch({ourProps:{...g,as:C.Fragment,children:C.createElement(Mh,{ref:a,...g,...o,beforeEnter:y,beforeLeave:w})},theirProps:{},defaultTag:C.Fragment,features:Th,visible:c==="visible",name:"Transition"})))}function wS(t,e){let n=C.useContext(va)!==null,r=_h()!==null;return C.createElement(C.Fragment,null,!n&&r?C.createElement(qc,{ref:e,...t}):C.createElement(Mh,{ref:e,...t}))}let qc=Bc(yS),Mh=Bc(vS),xS=Bc(wS),Nh=Object.assign(qc,{Child:xS,Root:qc});var Ph=function(e){return e.reduce(function(n,r){var i=r[0],o=r[1];return n[i]=o,n},{})},Vh=typeof window<"u"&&window.document&&window.document.createElement?Mt.useLayoutEffect:Mt.useEffect,dt="top",It="bottom",Bt="right",pt="left",Gc="auto",Po=[dt,It,Bt,pt],zi="start",Vo="end",SS="clippingParents",Dh="viewport",Do="popper",CS="reference",Lh=Po.reduce(function(t,e){return t.concat([e+"-"+zi,e+"-"+Vo])},[]),Rh=[].concat(Po,[Gc]).reduce(function(t,e){return t.concat([e,e+"-"+zi,e+"-"+Vo])},[]),OS="beforeRead",ES="read",_S="afterRead",kS="beforeMain",AS="main",TS="afterMain",MS="beforeWrite",NS="write",PS="afterWrite",VS=[OS,ES,_S,kS,AS,TS,MS,NS,PS];function bn(t){return t?(t.nodeName||"").toLowerCase():null}function Et(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ur(t){var e=Et(t).Element;return t instanceof e||t instanceof Element}function $t(t){var e=Et(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Kc(t){if(typeof ShadowRoot>"u")return!1;var e=Et(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function DS(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},o=e.elements[n];!$t(o)||!bn(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(s){var a=i[s];a===!1?o.removeAttribute(s):o.setAttribute(s,a===!0?"":a)}))})}function LS(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 i=e.elements[r],o=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!$t(i)||!bn(i)||(Object.assign(i.style,a),Object.keys(o).forEach(function(l){i.removeAttribute(l)}))})}}const RS={name:"applyStyles",enabled:!0,phase:"write",fn:DS,effect:LS,requires:["computeStyles"]};function vn(t){return t.split("-")[0]}var qr=Math.max,xa=Math.min,Fi=Math.round;function Zc(){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 jh(){return!/^((?!chrome|android).)*safari/i.test(Zc())}function Wi(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&$t(t)&&(i=t.offsetWidth>0&&Fi(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Fi(r.height)/t.offsetHeight||1);var s=Ur(t)?Et(t):window,a=s.visualViewport,l=!jh()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/i,u=(r.top+(l&&a?a.offsetTop:0))/o,f=r.width/i,d=r.height/o;return{width:f,height:d,top:u,right:c+f,bottom:u+d,left:c,x:c,y:u}}function Jc(t){var e=Wi(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 Hh(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Kc(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Rn(t){return Et(t).getComputedStyle(t)}function jS(t){return["table","td","th"].indexOf(bn(t))>=0}function or(t){return((Ur(t)?t.ownerDocument:t.document)||window.document).documentElement}function Sa(t){return bn(t)==="html"?t:t.assignedSlot||t.parentNode||(Kc(t)?t.host:null)||or(t)}function Ih(t){return!$t(t)||Rn(t).position==="fixed"?null:t.offsetParent}function HS(t){var e=/firefox/i.test(Zc()),n=/Trident/i.test(Zc());if(n&&$t(t)){var r=Rn(t);if(r.position==="fixed")return null}var i=Sa(t);for(Kc(i)&&(i=i.host);$t(i)&&["html","body"].indexOf(bn(i))<0;){var o=Rn(i);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||e&&o.willChange==="filter"||e&&o.filter&&o.filter!=="none")return i;i=i.parentNode}return null}function Lo(t){for(var e=Et(t),n=Ih(t);n&&jS(n)&&Rn(n).position==="static";)n=Ih(n);return n&&(bn(n)==="html"||bn(n)==="body"&&Rn(n).position==="static")?e:n||HS(t)||e}function Yc(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ro(t,e,n){return qr(t,xa(e,n))}function IS(t,e,n){var r=Ro(t,e,n);return r>n?n:r}function Bh(){return{top:0,right:0,bottom:0,left:0}}function $h(t){return Object.assign({},Bh(),t)}function zh(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var BS=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,$h(typeof e!="number"?e:zh(e,Po))};function $S(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=vn(n.placement),l=Yc(a),c=[pt,Bt].indexOf(a)>=0,u=c?"height":"width";if(!(!o||!s)){var f=BS(i.padding,n),d=Jc(o),p=l==="y"?dt:pt,h=l==="y"?It:Bt,m=n.rects.reference[u]+n.rects.reference[l]-s[l]-n.rects.popper[u],g=s[l]-n.rects.reference[l],y=Lo(o),w=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,x=m/2-g/2,O=f[p],v=w-d[u]-f[h],E=w/2-d[u]/2+x,A=Ro(O,E,v),B=l;n.modifiersData[r]=(e={},e[B]=A,e.centerOffset=A-E,e)}}function zS(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Hh(e.elements.popper,i)&&(e.elements.arrow=i))}const FS={name:"arrow",enabled:!0,phase:"main",fn:$S,effect:zS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ui(t){return t.split("-")[1]}var WS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function US(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Fi(n*i)/i||0,y:Fi(r*i)/i||0}}function Fh(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,f=t.isFixed,d=s.x,p=d===void 0?0:d,h=s.y,m=h===void 0?0:h,g=typeof u=="function"?u({x:p,y:m}):{x:p,y:m};p=g.x,m=g.y;var y=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),x=pt,O=dt,v=window;if(c){var E=Lo(n),A="clientHeight",B="clientWidth";if(E===Et(n)&&(E=or(n),Rn(E).position!=="static"&&a==="absolute"&&(A="scrollHeight",B="scrollWidth")),E=E,i===dt||(i===pt||i===Bt)&&o===Vo){O=It;var T=f&&E===v&&v.visualViewport?v.visualViewport.height:E[A];m-=T-r.height,m*=l?1:-1}if(i===pt||(i===dt||i===It)&&o===Vo){x=Bt;var V=f&&E===v&&v.visualViewport?v.visualViewport.width:E[B];p-=V-r.width,p*=l?1:-1}}var I=Object.assign({position:a},c&&WS),z=u===!0?US({x:p,y:m},Et(n)):{x:p,y:m};if(p=z.x,m=z.y,l){var K;return Object.assign({},I,(K={},K[O]=w?"0":"",K[x]=y?"0":"",K.transform=(v.devicePixelRatio||1)<=1?"translate("+p+"px, "+m+"px)":"translate3d("+p+"px, "+m+"px, 0)",K))}return Object.assign({},I,(e={},e[O]=w?m+"px":"",e[x]=y?p+"px":"",e.transform="",e))}function qS(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:vn(e.placement),variation:Ui(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Fh(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Fh(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const GS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:qS,data:{}};var Ca={passive:!0};function KS(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,o=i===void 0?!0:i,s=r.resize,a=s===void 0?!0:s,l=Et(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach(function(u){u.addEventListener("scroll",n.update,Ca)}),a&&l.addEventListener("resize",n.update,Ca),function(){o&&c.forEach(function(u){u.removeEventListener("scroll",n.update,Ca)}),a&&l.removeEventListener("resize",n.update,Ca)}}const ZS={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:KS,data:{}};var JS={left:"right",right:"left",bottom:"top",top:"bottom"};function Oa(t){return t.replace(/left|right|bottom|top/g,function(e){return JS[e]})}var YS={start:"end",end:"start"};function Wh(t){return t.replace(/start|end/g,function(e){return YS[e]})}function Xc(t){var e=Et(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Qc(t){return Wi(or(t)).left+Xc(t).scrollLeft}function XS(t,e){var n=Et(t),r=or(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=jh();(c||!c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+Qc(t),y:l}}function QS(t){var e,n=or(t),r=Xc(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=qr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=qr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Qc(t),l=-r.scrollTop;return Rn(i||n).direction==="rtl"&&(a+=qr(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}function eu(t){var e=Rn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Uh(t){return["html","body","#document"].indexOf(bn(t))>=0?t.ownerDocument.body:$t(t)&&eu(t)?t:Uh(Sa(t))}function jo(t,e){var n;e===void 0&&(e=[]);var r=Uh(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=Et(r),s=i?[o].concat(o.visualViewport||[],eu(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(jo(Sa(s)))}function tu(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function eC(t,e){var n=Wi(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 qh(t,e,n){return e===Dh?tu(XS(t,n)):Ur(e)?eC(e,n):tu(QS(or(t)))}function tC(t){var e=jo(Sa(t)),n=["absolute","fixed"].indexOf(Rn(t).position)>=0,r=n&&$t(t)?Lo(t):t;return Ur(r)?e.filter(function(i){return Ur(i)&&Hh(i,r)&&bn(i)!=="body"}):[]}function nC(t,e,n,r){var i=e==="clippingParents"?tC(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce(function(l,c){var u=qh(t,c,r);return l.top=qr(u.top,l.top),l.right=xa(u.right,l.right),l.bottom=xa(u.bottom,l.bottom),l.left=qr(u.left,l.left),l},qh(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Gh(t){var e=t.reference,n=t.element,r=t.placement,i=r?vn(r):null,o=r?Ui(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case dt:l={x:s,y:e.y-n.height};break;case It:l={x:s,y:e.y+e.height};break;case Bt:l={x:e.x+e.width,y:a};break;case pt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var c=i?Yc(i):null;if(c!=null){var u=c==="y"?"height":"width";switch(o){case zi:l[c]=l[c]-(e[u]/2-n[u]/2);break;case Vo:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function Ho(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,o=n.strategy,s=o===void 0?t.strategy:o,a=n.boundary,l=a===void 0?SS:a,c=n.rootBoundary,u=c===void 0?Dh:c,f=n.elementContext,d=f===void 0?Do:f,p=n.altBoundary,h=p===void 0?!1:p,m=n.padding,g=m===void 0?0:m,y=$h(typeof g!="number"?g:zh(g,Po)),w=d===Do?CS:Do,x=t.rects.popper,O=t.elements[h?w:d],v=nC(Ur(O)?O:O.contextElement||or(t.elements.popper),l,u,s),E=Wi(t.elements.reference),A=Gh({reference:E,element:x,strategy:"absolute",placement:i}),B=tu(Object.assign({},x,A)),T=d===Do?B:E,V={top:v.top-T.top+y.top,bottom:T.bottom-v.bottom+y.bottom,left:v.left-T.left+y.left,right:T.right-v.right+y.right},I=t.modifiersData.offset;if(d===Do&&I){var z=I[i];Object.keys(V).forEach(function(K){var te=[Bt,It].indexOf(K)>=0?1:-1,H=[dt,It].indexOf(K)>=0?"y":"x";V[K]+=z[H]*te})}return V}function rC(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?Rh:l,u=Ui(r),f=u?a?Lh:Lh.filter(function(h){return Ui(h)===u}):Po,d=f.filter(function(h){return c.indexOf(h)>=0});d.length===0&&(d=f);var p=d.reduce(function(h,m){return h[m]=Ho(t,{placement:m,boundary:i,rootBoundary:o,padding:s})[vn(m)],h},{});return Object.keys(p).sort(function(h,m){return p[h]-p[m]})}function iC(t){if(vn(t)===Gc)return[];var e=Oa(t);return[Wh(t),e,Wh(e)]}function oC(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,f=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,h=p===void 0?!0:p,m=n.allowedAutoPlacements,g=e.options.placement,y=vn(g),w=y===g,x=l||(w||!h?[Oa(g)]:iC(g)),O=[g].concat(x).reduce(function(W,U){return W.concat(vn(U)===Gc?rC(e,{placement:U,boundary:u,rootBoundary:f,padding:c,flipVariations:h,allowedAutoPlacements:m}):U)},[]),v=e.rects.reference,E=e.rects.popper,A=new Map,B=!0,T=O[0],V=0;V<O.length;V++){var I=O[V],z=vn(I),K=Ui(I)===zi,te=[dt,It].indexOf(z)>=0,H=te?"width":"height",Y=Ho(e,{placement:I,boundary:u,rootBoundary:f,altBoundary:d,padding:c}),re=te?K?Bt:pt:K?It:dt;v[H]>E[H]&&(re=Oa(re));var oe=Oa(re),me=[];if(o&&me.push(Y[z]<=0),a&&me.push(Y[re]<=0,Y[oe]<=0),me.every(function(W){return W})){T=I,B=!1;break}A.set(I,me)}if(B)for(var pe=h?3:1,_=function(U){var se=O.find(function(J){var Q=A.get(J);if(Q)return Q.slice(0,U).every(function(ie){return ie})});if(se)return T=se,"break"},N=pe;N>0;N--){var G=_(N);if(G==="break")break}e.placement!==T&&(e.modifiersData[r]._skip=!0,e.placement=T,e.reset=!0)}}const sC={name:"flip",enabled:!0,phase:"main",fn:oC,requiresIfExists:["offset"],data:{_skip:!1}};function Kh(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 Zh(t){return[dt,Bt,It,pt].some(function(e){return t[e]>=0})}function aC(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Ho(e,{elementContext:"reference"}),a=Ho(e,{altBoundary:!0}),l=Kh(s,r),c=Kh(a,i,o),u=Zh(l),f=Zh(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const lC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:aC};function cC(t,e,n){var r=vn(t),i=[pt,dt].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[pt,Bt].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function uC(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=i===void 0?[0,0]:i,s=Rh.reduce(function(u,f){return u[f]=cC(f,e.rects,o),u},{}),a=s[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}const fC={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:uC};function dC(t){var e=t.state,n=t.name;e.modifiersData[n]=Gh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const pC={name:"popperOffsets",enabled:!0,phase:"read",fn:dC,data:{}};function hC(t){return t==="x"?"y":"x"}function mC(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=i===void 0?!0:i,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,f=n.padding,d=n.tether,p=d===void 0?!0:d,h=n.tetherOffset,m=h===void 0?0:h,g=Ho(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:u}),y=vn(e.placement),w=Ui(e.placement),x=!w,O=Yc(y),v=hC(O),E=e.modifiersData.popperOffsets,A=e.rects.reference,B=e.rects.popper,T=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,V=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),I=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,z={x:0,y:0};if(E){if(o){var K,te=O==="y"?dt:pt,H=O==="y"?It:Bt,Y=O==="y"?"height":"width",re=E[O],oe=re+g[te],me=re-g[H],pe=p?-B[Y]/2:0,_=w===zi?A[Y]:B[Y],N=w===zi?-B[Y]:-A[Y],G=e.elements.arrow,W=p&&G?Jc(G):{width:0,height:0},U=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Bh(),se=U[te],J=U[H],Q=Ro(0,A[Y],W[Y]),ie=x?A[Y]/2-pe-Q-se-V.mainAxis:_-Q-se-V.mainAxis,ue=x?-A[Y]/2+pe+Q+J+V.mainAxis:N+Q+J+V.mainAxis,ae=e.elements.arrow&&Lo(e.elements.arrow),Ae=ae?O==="y"?ae.clientTop||0:ae.clientLeft||0:0,$=(K=I==null?void 0:I[O])!=null?K:0,Pe=re+ie-$-Ae,rt=re+ue-$,Ye=Ro(p?xa(oe,Pe):oe,re,p?qr(me,rt):me);E[O]=Ye,z[O]=Ye-re}if(a){var gt,_n=O==="x"?dt:pt,Gt=O==="x"?It:Bt,Te=E[v],Ie=v==="y"?"height":"width",Er=Te+g[_n],_r=Te-g[Gt],ui=[dt,pt].indexOf(y)!==-1,fi=(gt=I==null?void 0:I[v])!=null?gt:0,kr=ui?Er:Te-A[Ie]-B[Ie]-fi+V.altAxis,ln=ui?Te+A[Ie]+B[Ie]-fi-V.altAxis:_r,kn=p&&ui?IS(kr,Te,ln):Ro(p?kr:Er,Te,p?ln:_r);E[v]=kn,z[v]=kn-Te}e.modifiersData[r]=z}}const gC={name:"preventOverflow",enabled:!0,phase:"main",fn:mC,requiresIfExists:["offset"]};function bC(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function vC(t){return t===Et(t)||!$t(t)?Xc(t):bC(t)}function yC(t){var e=t.getBoundingClientRect(),n=Fi(e.width)/t.offsetWidth||1,r=Fi(e.height)/t.offsetHeight||1;return n!==1||r!==1}function wC(t,e,n){n===void 0&&(n=!1);var r=$t(e),i=$t(e)&&yC(e),o=or(e),s=Wi(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((bn(e)!=="body"||eu(o))&&(a=vC(e)),$t(e)?(l=Wi(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=Qc(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function xC(t){var e=new Map,n=new Set,r=[];t.forEach(function(o){e.set(o.name,o)});function i(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(o)}return t.forEach(function(o){n.has(o.name)||i(o)}),r}function SC(t){var e=xC(t);return VS.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function CC(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function OC(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Jh={placement:"bottom",modifiers:[],strategy:"absolute"};function Yh(){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 EC(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,i=e.defaultOptions,o=i===void 0?Jh:i;return function(a,l,c){c===void 0&&(c=o);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Jh,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],d=!1,p={state:u,setOptions:function(y){var w=typeof y=="function"?y(u.options):y;m(),u.options=Object.assign({},o,u.options,w),u.scrollParents={reference:Ur(a)?jo(a):a.contextElement?jo(a.contextElement):[],popper:jo(l)};var x=SC(OC([].concat(r,u.options.modifiers)));return u.orderedModifiers=x.filter(function(O){return O.enabled}),h(),p.update()},forceUpdate:function(){if(!d){var y=u.elements,w=y.reference,x=y.popper;if(Yh(w,x)){u.rects={reference:wC(w,Lo(x),u.options.strategy==="fixed"),popper:Jc(x)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(V){return u.modifiersData[V.name]=Object.assign({},V.data)});for(var O=0;O<u.orderedModifiers.length;O++){if(u.reset===!0){u.reset=!1,O=-1;continue}var v=u.orderedModifiers[O],E=v.fn,A=v.options,B=A===void 0?{}:A,T=v.name;typeof E=="function"&&(u=E({state:u,options:B,name:T,instance:p})||u)}}}},update:CC(function(){return new Promise(function(g){p.forceUpdate(),g(u)})}),destroy:function(){m(),d=!0}};if(!Yh(a,l))return p;p.setOptions(c).then(function(g){!d&&c.onFirstUpdate&&c.onFirstUpdate(g)});function h(){u.orderedModifiers.forEach(function(g){var y=g.name,w=g.options,x=w===void 0?{}:w,O=g.effect;if(typeof O=="function"){var v=O({state:u,name:y,instance:p,options:x}),E=function(){};f.push(v||E)}})}function m(){f.forEach(function(g){return g()}),f=[]}return p}}var _C=[ZS,pC,GS,RS,fC,sC,gC,FS,lC],kC=EC({defaultModifiers:_C}),AC=typeof Element<"u",TC=typeof Map=="function",MC=typeof Set=="function",NC=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Ea(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,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Ea(t[r],e[r]))return!1;return!0}var o;if(TC&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o=t.entries();!(r=o.next()).done;)if(!e.has(r.value[0]))return!1;for(o=t.entries();!(r=o.next()).done;)if(!Ea(r.value[1],e.get(r.value[0])))return!1;return!0}if(MC&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o=t.entries();!(r=o.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(NC&&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(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(AC&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!Ea(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var PC=function(e,n){try{return Ea(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 VC=Gl(PC);var DC=[],Xh=function(e,n,r){r===void 0&&(r={});var i=Mt.useRef(null),o={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||DC},s=Mt.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=s[0],l=s[1],c=Mt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(p){var h=p.state,m=Object.keys(h.elements);gb.flushSync(function(){l({styles:Ph(m.map(function(g){return[g,h.styles[g]||{}]})),attributes:Ph(m.map(function(g){return[g,h.attributes[g]]}))})})},requires:["computeStyles"]}},[]),u=Mt.useMemo(function(){var d={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[c,{name:"applyStyles",enabled:!1}])};return VC(i.current,d)?i.current||d:(i.current=d,d)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,c]),f=Mt.useRef();return Vh(function(){f.current&&f.current.setOptions(u)},[u]),Vh(function(){if(!(e==null||n==null)){var d=r.createPopper||kC,p=d(e,n,u);return f.current=p,function(){p.destroy(),f.current=null}}},[e,n,r.createPopper]),{state:f.current?f.current.state:null,styles:a.styles,attributes:a.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const Qh=t=>typeof t<"u";var nu=(t=>(t.web="web",t.email="email",t))(nu||{});const ru=C.forwardRef(function({children:e,title:n,onClose:r,icon:i,shadow:o=!0,padding:s=!0,border:a=!0,round:l=!0,className:c,classNameBody:u,size:f="m",titleClass:d=xe("gs-utl-mb-2 gs-utl-mt-0.5"),style:p,bg:h,...m},g){return P.jsxs("div",{...m,ref:g,style:p,className:xe([c,h||Kx.bg,Ht.b,l&&Ht.rnd,a?ke.br:Ht.bT,"gs-utl-card gs-utl-overflow-auto",o&&"gs-utl-shadow-md",s&&f==="l"&&"gs-utl-p-5",s&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",s&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",s&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",s&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&P.jsxs(Le,{className:xe("gs-utl-card-title",d),items:"center",children:[P.jsx(he,{className:xe("truncate"),grow:!0,children:n}),(r||i)&&P.jsx(he,{onClick:r,className:xe("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:P.jsx(Kr,{icon:i||Bn.close,size:"18px"})})]}),P.jsx("div",{className:xe("gs-utl-card-body",u),children:e})]})}),LC=()=>Go().contextMenu;var RC={},iu=Es;RC.NODE_ENV==="production"?(iu.createRoot,iu.hydrateRoot):iu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function jC({action:t,icon:e,label:n,className:r,items:i,...o}){const s=C.useRef(null),[a,l]=C.useState(),c=s.current,u=xe([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",ke.br,jc.xy,Ht.bb,o.disabled&&vh.disabled,...t?[ke.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),f=p=>hi(t)&&t({event:p});C.useEffect(()=>{if(!c)return;const p=setTimeout(()=>l(c.getBoundingClientRect()),o.active?0:Ux);return()=>clearTimeout(p)},[c,o.active]);const d=()=>{var p;return(p=o.onActive)==null?void 0:p.call(o)};return P.jsxs(Le,{ref:s,items:"center",nowrap:!0,className:u,onClick:f,onPointerEnter:d,children:[e&&P.jsx(he,{children:P.jsx(Kr,{icon:e,size:To.s})}),P.jsx(he,{className:xe(o.classNameLabel,vh.txtEllips),grow:!0,children:n}),!!(i!=null&&i.length)&&P.jsxs(P.Fragment,{children:[P.jsx(he,{children:P.jsx(Kr,{icon:Bn.chevronRight,size:To.s,className:xe("-gs-utl-mr-2")})}),a&&o.active&&P.jsx(BC,{items:i,x:a.left,y:a.top,w:a.width,h:a.height,open:!0})]})]})}function _a({className:t,as:e="label",bold:n,m:r="gjs-mb-1",size:i="m",capitalize:o=!0,children:s,tip:a,...l}){const c=e;return P.jsxs(c,{className:xe(t,r,a?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"block",o&&"capitalize",n&&"font-semibold",i==="s"&&"text-sm"),...l,children:[!!a&&P.jsx(n1,{classNameWrp:"gs-utl-normal-case",classNameContent:"gs-utl-max-w-60",title:a,children:P.jsx(Kr,{icon:Bn.information,size:To.s2x})}),s]})}xe("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full");const HC={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},e1=Kf()&&document.body,t1=(t={})=>({...HC,placement:"right-start",modifiers:[{name:"offset",options:{offset:t.offset||[0,5]}},{name:"flip",options:{boundary:t.boundary??e1}},{name:"preventOverflow",options:{boundary:t.boundary??e1}}]}),IC=t1(),ka="gs-ctx-menu-list",BC=Ao(function({open:e,items:n,x:r,y:i,w:o,h:s}){const a=LC(),[l,c]=C.useState(),[u,f]=C.useState(null),d=C.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,i,o,s)}),[r,i,o,s,e]),{styles:p,attributes:h}=Xh(d,u,IC),m=ki(`${ka}-wrp gs-utl-z-20`),g=ki(`${ka} gs-utl-z-20`),y=ki(`${ka}-body gs-utl-max-w-56`),w=ki(`${ka}-item`),x="gs-utl-max-w-40",O=v=>{const{action:E,onClick:A}=v;if(E||A)return B=>{const T={editor:a.store.appEditorStore.editor,...B};hi(E)?(E(T),a.hide()):hi(A)&&(A(T),a.hide())}};return P.jsx("div",{className:m,ref:f,style:p.popper,...h.popper,children:P.jsx(Nh,{show:!!e,...Gx,unmount:!1,children:P.jsx(ru,{padding:!1,className:g,classNameBody:y,children:n.map((v,E)=>C.createElement(jC,{...v,key:v.id??E,className:w,classNameLabel:x,action:O(v),onActive:()=>c(v),active:l===v}))})})})}),ou="gs-cmp-tooltip";function n1({className:t,classNameWrp:e,classNameContent:n,children:r,title:i,onClick:o,inline:s,size:a}){const[l,c]=C.useState(!1),[u,f]=C.useState(!1),d=Qh(a),[p,h]=C.useState(null),[m,g]=C.useState(null),y=Xh(p,m,{...t1(),placement:"bottom"}),w=xe(`${ou}-target`,!s&&"block",t,!o&&"cursor-auto"),x=xe(`${ou}-content`,n,"fixed z-30 text-sm",!d&&!n&&"whitespace-nowrap",a==="s"&&"w-60");return C.useEffect(()=>{var O;l&&((O=y.update)==null||O.call(y))},[l,y.update]),C.useEffect(()=>{const O=setTimeout(()=>c(u),10);return()=>clearTimeout(O)},[u]),P.jsxs("div",{className:xe(ou,"relative",e),children:[P.jsx("span",{ref:h,className:w,onMouseEnter:()=>i&&f(!0),onMouseLeave:()=>f(!1),children:P.jsx("div",{className:xe(s&&"inline-block"),onClick:()=>{f(!1),o==null||o()},children:r})}),!!u&&P.jsx("div",{className:x,ref:g,style:y.styles.popper,...y.attributes.popper,children:P.jsx(Nh,{show:!!l,unmount:!1,...qx,children:P.jsx(ru,{className:xe(bh.txt),bg:bh.bg,size:"s",border:!1,children:i})})})]})}function $C({children:t,title:e,classNameWrp:n,...r}){return P.jsx(n1,{title:e,classNameWrp:n,children:P.jsx(Hc,{...r,children:t})})}const zC={info:ke.bgA,error:"bg-red-500",success:"bg-green-500",warning:"bg-orange-400"},FC=C.forwardRef(function(e,n){const r={info:Bn.informationVariant,error:Bn.fire,success:Bn.checkBold,warning:Bn.alertRhombus},{children:i,className:o,content:s,id:a,buttons:l=[],variant:c="info",autoHideTimeout:u=3e3}=e,f=C.useRef(null),d=C.useRef(),p=r[c],h=zC[c];C.useImperativeHandle(n,()=>f.current,[]);const m=()=>{var x;return(x=e.onDismiss)==null?void 0:x.call(e,a)},g=()=>{u&&(d.current=setTimeout(m,u))},y=()=>d.current&&clearTimeout(d.current);C.useEffect(()=>(g(),y),[]);const w=s||i;return P.jsx(ru,{className:Ee(o,"overflow-hidden relative"),ref:f,onPointerEnter:y,onPointerLeave:g,children:P.jsxs(Le,{space:"m",items:"center",className:Ee(jc.y),children:[P.jsx(he,{className:Ee(h,Ht.pill,"text-white gjs-p-1"),children:P.jsx(Kr,{icon:p,size:To.s})}),P.jsx(he,{grow:!0,className:Ee("gjs-pr-3"),children:P.jsxs(Le,{col:!0,space:"xs",children:[P.jsx(he,{className:Ee("text-lg font-medium leading-6"),children:e.header}),w&&P.jsx(he,{className:Ee(ke.txtLowEmphasis),children:w}),!!l.length&&P.jsx(Le,{space:"m",justify:"end",children:l.map(({id:x,...O})=>P.jsx(Hc,{...O},x))})]})}),P.jsx(he,{className:Ee("absolute top-1 right-1"),children:P.jsx($C,{onClick:m,border:!1,children:P.jsx(Kr,{icon:Bn.close,size:To.s})})})]})})});Ao(C.forwardRef(function({className:e,toasts:n,onDismiss:r,...i},o){const s=Wx({});return P.jsx("div",{className:Ee(e,"w-80 gs-utl-z-30"),...i,ref:s,children:n.map(a=>P.jsx(FC,{...a,className:Ee("gjs-mb-2"),onDismiss:r},a.uuid||a.id))})}));const r1=new Map,WC=C.forwardRef(function({svg:e,iconSize:n,...r},i){let o=r1.get(e);return o||(o=yb(e,n),r1.set(e,o)),P.jsx("div",{...r,ref:i,dangerouslySetInnerHTML:{__html:o}})}),UC=t=>t.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),i1=(t,e,n="html")=>{const{Pages:r}=t,i=Aa({page:e,key:"slug"});return`${r.getMain()===e?"index":Eb(i||e.getName())}.${n}`},qC="custom-html-body",o1="data-custom-html-body",Re={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"}},GC=t=>{for(const e in Re){const n=e;if(Re[n]({cmp:t}))return n}},KC=(t,e,n)=>{const r=[];let i=n;return t.getMainComponent().findType(qC).forEach(o=>{r.push(o),i=(i||"")+o.getInnerHTML()}),{components:r,html:i,changed:i!==e}},ZC=t=>{const e={...t.get("settings")??{}},n=t.getMainComponent(),{head:r}=n;if(r){const i=[];r.components().forEach(o=>{const{content:s,href:a}=o.getAttributes({noClass:!0,noStyle:!0});Re.title({cmp:o})?e.title=o.getInnerHTML():Re.favicon({cmp:o})?e.favicon=a:Re.description({cmp:o})?e.description=s:Re.keywords({cmp:o})?e.keywords=s:Re.socialTitle({cmp:o})?e.socialTitle=s:Re.socialDescription({cmp:o})?e.socialDescription=s:Re.socialImage({cmp:o})?e.socialImage=s:GC(o)||i.push(o.toHTML())}),i.length&&(e.customCodeHead=i.join(`
219
+ `))}return e.customCodeBody=KC(t,e.customCodeBody).html,e},s1=t=>t.getModel().get("customData")??{},JC=t=>(t==null?void 0:t.projectDataCustom.globalPageSettings)??{},Aa=t=>{const{page:e,key:n,appEditorStore:r,def:i="",defPage:o=""}=t;return(e?ZC(e)[n]??o:JC(r)[n])??i},Gr=(t,e)=>{const n=t.em.getEditor(),i=s1(n).globalPageSettings||{};return Aa({page:t,key:e})||i[e]},YC=()=>Go().i18nStore,a1="gs-custom-layout",XC=C.forwardRef(function({className:e,component:n,noWrapper:r,id:i,render:o,...s},a){const{editor:l}=wu(),c=C.useRef(null),u=n,f=u&&l?P.jsx(u,{editor:l}):null,d=ki(a1,i&&`${a1}__${i}`,e),p=c.current,h=r&&!o;return C.useImperativeHandle(a,()=>c.current,[]),C.useEffect(()=>{if(!o||!p)return;const m=w=>p.appendChild(w),g=w=>p.removeChild(w),y=o({editor:l,addEl:m,removeEl:g});if(Yf(y))p.innerHTML=y;else{if(y instanceof HTMLElement)return m(y),()=>{g(y)};if(hi(y))return()=>{y()}}},[o,l,p]),h?f:P.jsx("div",{className:d,ref:c,...s,children:f})});Ao(XC);var l1=(t=>(t.gjs="gjs",t.gjsStudio="gjs-studio",t))(l1||{});const QC=()=>Go().localSettingsStore,e5=()=>Go().modalStore;function t5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function u1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c1(Object(n),!0).forEach(function(r){t5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c1(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function n5(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function r5(t,e){if(t==null)return{};var n=n5(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function i5(t,e){return o5(t)||s5(t,e)||a5(t,e)||l5()}function o5(t){if(Array.isArray(t))return t}function s5(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),a;!(r=(a=s.next()).done)&&(n.push(a.value),!(e&&n.length===e));r=!0);}catch(l){i=!0,o=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function a5(t,e){if(t){if(typeof t=="string")return f1(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 f1(t,e)}}function f1(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 l5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
220
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function p1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?d1(Object(n),!0).forEach(function(r){c5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d1(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function u5(){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(i,o){return o(i)},r)}}function Io(t){return function e(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=t.length?t.apply(this,i):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return e.apply(n,[].concat(i,a))}}}function Ta(t){return{}.toString.call(t).includes("Object")}function f5(t){return!Object.keys(t).length}function Bo(t){return typeof t=="function"}function d5(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function p5(t,e){return Ta(e)||sr("changeType"),Object.keys(e).some(function(n){return!d5(t,n)})&&sr("changeField"),e}function h5(t){Bo(t)||sr("selectorType")}function m5(t){Bo(t)||Ta(t)||sr("handlerType"),Ta(t)&&Object.values(t).some(function(e){return!Bo(e)})&&sr("handlersType")}function g5(t){t||sr("initialIsRequired"),Ta(t)||sr("initialType"),f5(t)&&sr("initialContent")}function b5(t,e){throw new Error(t[e]||t.default)}var v5={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"},sr=Io(b5)(v5),Ma={changes:p5,selector:h5,handler:m5,initial:g5};function y5(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ma.initial(t),Ma.handler(e);var n={current:t},r=Io(S5)(n,e),i=Io(x5)(n),o=Io(Ma.changes)(t),s=Io(w5)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Ma.selector(c),c(n.current)}function l(c){u5(r,i,o,s)(c)}return[a,l]}function w5(t,e){return Bo(e)?e(t.current):e}function x5(t,e){return t.current=p1(p1({},t.current),e),e}function S5(t,e,n){return Bo(e)?e(t.current):Object.keys(n).forEach(function(r){var i;return(i=e[r])===null||i===void 0?void 0:i.call(e,t.current[r])}),n}var C5={create:y5},O5={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function E5(t){return function e(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=t.length?t.apply(this,i):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return e.apply(n,[].concat(i,a))}}}function _5(t){return{}.toString.call(t).includes("Object")}function k5(t){return t||m1("configIsRequired"),_5(t)||m1("configType"),t.urls?(A5(),{paths:{vs:t.urls.monacoBase}}):t}function A5(){console.warn(h1.deprecation)}function T5(t,e){throw new Error(t[e]||t.default)}var h1={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!
221
+ You are using deprecated way of configuration.
222
+
223
+ Instead of using
224
+ monaco.config({ urls: { monacoBase: '...' } })
225
+ use
226
+ monaco.config({ paths: { vs: '...' } })
227
+
228
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
229
+ `},m1=E5(T5)(h1),M5={config:k5},N5=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(i){return n.reduceRight(function(o,s){return s(o)},i)}};function g1(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],g1(t[n],e[n]))}),u1(u1({},t),e)}var P5={type:"cancelation",msg:"operation is manually canceled"};function su(t){var e=!1,n=new Promise(function(r,i){t.then(function(o){return e?i(P5):r(o)}),t.catch(i)});return n.cancel=function(){return e=!0},n}var V5=C5.create({config:O5,isInitialized:!1,resolve:null,reject:null,monaco:null}),b1=i5(V5,2),$o=b1[0],Na=b1[1];function D5(t){var e=M5.config(t),n=e.monaco,r=r5(e,["monaco"]);Na(function(i){return{config:g1(i.config,r),monaco:n}})}function L5(){var t=$o(function(e){var n=e.monaco,r=e.isInitialized,i=e.resolve;return{monaco:n,isInitialized:r,resolve:i}});if(!t.isInitialized){if(Na({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),su(au);if(window.monaco&&window.monaco.editor)return v1(window.monaco),t.resolve(window.monaco),su(au);N5(R5,H5)(I5)}return su(au)}function R5(t){return document.body.appendChild(t)}function j5(t){var e=document.createElement("script");return t&&(e.src=t),e}function H5(t){var e=$o(function(r){var i=r.config,o=r.reject;return{config:i,reject:o}}),n=j5("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function I5(){var t=$o(function(n){var r=n.config,i=n.resolve,o=n.reject;return{config:r,resolve:i,reject:o}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){v1(n),t.resolve(n)},function(n){t.reject(n)})}function v1(t){$o().monaco||Na({monaco:t})}function B5(){return $o(function(t){var e=t.monaco;return e})}var au=new Promise(function(t,e){return Na({resolve:t,reject:e})}),y1={config:D5,init:L5,__getMonacoInstance:B5},$5={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},lu=$5,z5={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},F5=z5;function W5({children:t}){return C.createElement("div",{style:F5.container},t)}var U5=W5,q5=U5;function G5({width:t,height:e,isEditorReady:n,loading:r,_ref:i,className:o,wrapperProps:s}){return C.createElement("section",{style:{...lu.wrapper,width:t,height:e},...s},!n&&C.createElement(q5,null,r),C.createElement("div",{ref:i,style:{...lu.fullWidth,...!n&&lu.hide},className:o}))}var K5=G5,w1=C.memo(K5);function Z5(t){C.useEffect(t,[])}var x1=Z5;function J5(t,e,n=!0){let r=C.useRef(!0);C.useEffect(r.current||!n?()=>{r.current=!1}:t,e)}var _t=J5;function zo(){}function qi(t,e,n,r){return Y5(t,r)||X5(t,e,n,r)}function Y5(t,e){return t.editor.getModel(S1(t,e))}function X5(t,e,n,r){return t.editor.createModel(e,n,r?S1(t,r):void 0)}function S1(t,e){return t.Uri.parse(e)}function Q5({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:o,modifiedModelPath:s,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:f={},height:d="100%",width:p="100%",className:h,wrapperProps:m={},beforeMount:g=zo,onMount:y=zo}){let[w,x]=C.useState(!1),[O,v]=C.useState(!0),E=C.useRef(null),A=C.useRef(null),B=C.useRef(null),T=C.useRef(y),V=C.useRef(g),I=C.useRef(!1);x1(()=>{let H=y1.init();return H.then(Y=>(A.current=Y)&&v(!1)).catch(Y=>(Y==null?void 0:Y.type)!=="cancelation"&&console.error("Monaco initialization: error:",Y)),()=>E.current?te():H.cancel()}),_t(()=>{if(E.current&&A.current){let H=E.current.getOriginalEditor(),Y=qi(A.current,t||"",r||n||"text",o||"");Y!==H.getModel()&&H.setModel(Y)}},[o],w),_t(()=>{if(E.current&&A.current){let H=E.current.getModifiedEditor(),Y=qi(A.current,e||"",i||n||"text",s||"");Y!==H.getModel()&&H.setModel(Y)}},[s],w),_t(()=>{let H=E.current.getModifiedEditor();H.getOption(A.current.editor.EditorOption.readOnly)?H.setValue(e||""):e!==H.getValue()&&(H.executeEdits("",[{range:H.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),H.pushUndoStop())},[e],w),_t(()=>{var H,Y;(Y=(H=E.current)==null?void 0:H.getModel())==null||Y.original.setValue(t||"")},[t],w),_t(()=>{let{original:H,modified:Y}=E.current.getModel();A.current.editor.setModelLanguage(H,r||n||"text"),A.current.editor.setModelLanguage(Y,i||n||"text")},[n,r,i],w),_t(()=>{var H;(H=A.current)==null||H.editor.setTheme(c)},[c],w),_t(()=>{var H;(H=E.current)==null||H.updateOptions(f)},[f],w);let z=C.useCallback(()=>{var re;if(!A.current)return;V.current(A.current);let H=qi(A.current,t||"",r||n||"text",o||""),Y=qi(A.current,e||"",i||n||"text",s||"");(re=E.current)==null||re.setModel({original:H,modified:Y})},[n,e,i,t,r,o,s]),K=C.useCallback(()=>{var H;!I.current&&B.current&&(E.current=A.current.editor.createDiffEditor(B.current,{automaticLayout:!0,...f}),z(),(H=A.current)==null||H.editor.setTheme(c),x(!0),I.current=!0)},[f,c,z]);C.useEffect(()=>{w&&T.current(E.current,A.current)},[w]),C.useEffect(()=>{!O&&!w&&K()},[O,w,K]);function te(){var Y,re,oe,me;let H=(Y=E.current)==null?void 0:Y.getModel();a||((re=H==null?void 0:H.original)==null||re.dispose()),l||((oe=H==null?void 0:H.modified)==null||oe.dispose()),(me=E.current)==null||me.dispose()}return C.createElement(w1,{width:p,height:d,isEditorReady:w,loading:u,_ref:B,className:h,wrapperProps:m})}var eO=Q5;C.memo(eO);function tO(t){let e=C.useRef();return C.useEffect(()=>{e.current=t},[t]),e.current}var nO=tO,Pa=new Map;function rO({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:i,path:o,theme:s="light",line:a,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:f=!0,keepCurrentModel:d=!1,width:p="100%",height:h="100%",className:m,wrapperProps:g={},beforeMount:y=zo,onMount:w=zo,onChange:x,onValidate:O=zo}){let[v,E]=C.useState(!1),[A,B]=C.useState(!0),T=C.useRef(null),V=C.useRef(null),I=C.useRef(null),z=C.useRef(w),K=C.useRef(y),te=C.useRef(),H=C.useRef(r),Y=nO(o),re=C.useRef(!1),oe=C.useRef(!1);x1(()=>{let _=y1.init();return _.then(N=>(T.current=N)&&B(!1)).catch(N=>(N==null?void 0:N.type)!=="cancelation"&&console.error("Monaco initialization: error:",N)),()=>V.current?pe():_.cancel()}),_t(()=>{var N,G,W,U;let _=qi(T.current,t||r||"",e||i||"",o||n||"");_!==((N=V.current)==null?void 0:N.getModel())&&(f&&Pa.set(Y,(G=V.current)==null?void 0:G.saveViewState()),(W=V.current)==null||W.setModel(_),f&&((U=V.current)==null||U.restoreViewState(Pa.get(o))))},[o],v),_t(()=>{var _;(_=V.current)==null||_.updateOptions(c)},[c],v),_t(()=>{!V.current||r===void 0||(V.current.getOption(T.current.editor.EditorOption.readOnly)?V.current.setValue(r):r!==V.current.getValue()&&(oe.current=!0,V.current.executeEdits("",[{range:V.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),V.current.pushUndoStop(),oe.current=!1))},[r],v),_t(()=>{var N,G;let _=(N=V.current)==null?void 0:N.getModel();_&&i&&((G=T.current)==null||G.editor.setModelLanguage(_,i))},[i],v),_t(()=>{var _;a!==void 0&&((_=V.current)==null||_.revealLine(a))},[a],v),_t(()=>{var _;(_=T.current)==null||_.editor.setTheme(s)},[s],v);let me=C.useCallback(()=>{var _;if(!(!I.current||!T.current)&&!re.current){K.current(T.current);let N=o||n,G=qi(T.current,r||t||"",e||i||"",N||"");V.current=(_=T.current)==null?void 0:_.editor.create(I.current,{model:G,automaticLayout:!0,...c},u),f&&V.current.restoreViewState(Pa.get(N)),T.current.editor.setTheme(s),a!==void 0&&V.current.revealLine(a),E(!0),re.current=!0}},[t,e,n,r,i,o,c,u,f,s,a]);C.useEffect(()=>{v&&z.current(V.current,T.current)},[v]),C.useEffect(()=>{!A&&!v&&me()},[A,v,me]),H.current=r,C.useEffect(()=>{var _,N;v&&x&&((_=te.current)==null||_.dispose(),te.current=(N=V.current)==null?void 0:N.onDidChangeModelContent(G=>{oe.current||x(V.current.getValue(),G)}))},[v,x]),C.useEffect(()=>{if(v){let _=T.current.editor.onDidChangeMarkers(N=>{var W;let G=(W=V.current.getModel())==null?void 0:W.uri;if(G&&N.find(U=>U.path===G.path)){let U=T.current.editor.getModelMarkers({resource:G});O==null||O(U)}});return()=>{_==null||_.dispose()}}return()=>{}},[v,O]);function pe(){var _,N;(_=te.current)==null||_.dispose(),d?f&&Pa.set(o,V.current.saveViewState()):(N=V.current.getModel())==null||N.dispose(),V.current.dispose()}return C.createElement(w1,{width:p,height:h,isEditorReady:v,loading:l,_ref:I,className:m,wrapperProps:g})}var iO=rO,oO=C.memo(iO),sO=oO;const aO=t=>{var e;(e=t.getAction("editor.action.formatDocument"))==null||e.run()},lO="gs-field-code",cO={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 uO({size:t,value:e,label:n,language:r,onChange:i,clean:o,padding:s,isDarkTheme:a,className:l,containerClassName:c,noMinHeight:u,onMount:f,readOnly:d,description:p}){const h=typeof e=="string"?e:JSON.stringify(e,null,2);return P.jsxs("div",{className:Ee(lO,"flex flex-col w-full h-full",c),children:[!!n&&P.jsx(_a,{children:n}),!!p&&P.jsx(_a,{as:"span",size:t,className:Ee(ke.txtLowEmphasis),capitalize:!1,children:p}),P.jsx("div",{className:Ee("flex-grow","w-full","h-full",!u&&"gs-utl-min-h-48"),style:{position:"relative",width:"100%",height:"100%"},children:P.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:P.jsx(sO,{defaultLanguage:r,defaultValue:h,theme:a?"vs-dark":"light",className:Ee(Ht.b,Ht.rnd,ke.br,l),options:{...cO,readOnly:d,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Jf(s)&&{lineDecorationsWidth:s*2,padding:{top:s,bottom:s}}},onChange:i,onMount:(m,g)=>{let y=!1;const w=()=>aO(m);m.onDidChangeModelLanguageConfiguration(w),m.onDidScrollChange(()=>{y||(y=!0,w())}),setTimeout(w,10),f==null||f(m,g)}})})})]})}const fO=t=>t.Assets.getAll().reduce((r,i)=>{const o=i.getSrc(),s=o.match(/^data:([^;]+);/);if(s){const a=o.split(",")[1],l=UC(i.get("name"));r[o]={mime:s[1],name:l,base64:a}}return r},{}),dO=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),C1=(t,e,n={})=>{let r=t;const i=n.pathPfx||"";for(const o in e)if(r.includes(o)){const s=e[o];r=r.replace(new RegExp(dO(o),"g"),`${i}${s.name}`),s.found=!0}return r},pO=(t,e)=>`${e||""}${t||""}`,hO=(t,e)=>{const n=t?`<div ${o1}>${t}</div>`:"",r=e?`<div ${o1} data-gjs-global>${e}</div>`:"";return`${n}${r}`},mO=async(t,e={})=>{const{page:n,skipProject:r,assetsFolder:i="assets",filenameCss:o="style.css",styles:s,isMJML:a}=e,l=[],c=n?[n]:t.Pages.getAll(),u=fO(t),f=`${i}/`,d=t.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent()})||"",p=C1(d,u,{pathPfx:f}),h=s==="inline",m=s==="skip",g=s1(t).globalPageSettings||{},y=c.map(w=>{var gt,_n,Gt;const x=w.getName(),O=Gr(w,"title")||x,v=Gr(w,"favicon"),E=Gr(w,"description"),A=Gr(w,"keywords"),B=Gr(w,"socialTitle"),T=Gr(w,"socialDescription"),V=Gr(w,"socialImage"),I=Aa({page:w,key:"customCodeHead"}),z=pO(I,g.customCodeHead),K=Aa({page:w,key:"customCodeBody"}),te=hO(K,g.customCodeBody),H=w.getMainComponent(),Y=t.getJs({component:H}),re=Y?`<script>${Y}<\/script>`:"",oe=[],me=[],pe=H.toHTML({asDocument:!1}).replace("</body>",`${te}${re}</body>`),_=H.head;let N=O&&`<title>${O}</title>`,G=v&&`<link rel="icon" href="${v}"/>`,W=E&&`<meta name="description" content="${E}"/>`,U=A&&`<meta name="keywords" content="${A}"/>`,se=B&&`<meta property="og:title" content="${B}"/>`,J=T&&`<meta property="og:description" content="${T}"/>`,Q=V&&`<meta property="og:image" content="${V}"/>`,ie='<meta charset="utf-8">',ue='<meta name="viewport" content="width=device-width,initial-scale=1">',ae='<meta name="robots" content="index,follow">',Ae='<meta name="generator" content="GrapesJS Studio">';_.components().forEach(Te=>{const Ie=Te.toHTML();Re.title({cmp:Te})?N=Ie:Re.favicon({cmp:Te})?G=Ie:Re.description({cmp:Te})?W=Ie:Re.keywords({cmp:Te})?U=Ie:Re.socialTitle({cmp:Te})?se=Ie:Re.socialDescription({cmp:Te})?J=Ie:Re.socialImage({cmp:Te})?Q=Ie:Re.charset({cmp:Te})?ie=Ie:Re.viewport({cmp:Te})?ue=Ie:Re.robots({cmp:Te})?ae=Ie:Re.generator({cmp:Te})&&(Ae=Ie)}),N&&oe.push(N),ie&&oe.push(ie),ue&&oe.push(ue),ae&&oe.push(ae),Ae&&oe.push(Ae),W&&oe.push(W),U&&oe.push(U),se&&oe.push(se),J&&oe.push(J),Q&&oe.push(Q),G&&oe.push(G),me.length&&oe.push(...me),z&&oe.push(z),p&&!m&&oe.push(h?`<style>${p}</style>`:`<link rel="stylesheet" href="./${o}">`);const $=H.doctype||"<!DOCTYPE html>",Pe=(_n=(gt=H.docEl).__attrToString)==null?void 0:_n.call(gt),rt=(Gt=_.__attrToString)==null?void 0:Gt.call(_),Ye=a?t.runCommand("mjml-code-to-html").html:`${$}
230
+ <html${Pe?` ${Pe}`:""}>
231
+ <head${rt?` ${rt}`:""}>
232
+ ${oe.join(`
233
+ `)}
234
+ </head>
235
+ ${pe}
236
+ </html>
237
+ `;return{filename:i1(t,w),content:C1(Ye,u,{pathPfx:f}),mimeType:"text/html"}});l.push(...y),a&&c.forEach(w=>{l.push({filename:i1(t,w,"mjml"),content:w.getMainComponent().toHTML(),mimeType:"text/mjml"})});for(const w in u){const x=u[w];x.found&&l.push({path:i,filename:x.name,content:atob(x.base64),mimeType:x.mime})}return p&&!h&&!m&&l.push({filename:o,content:p,mimeType:"text/css"}),r||l.push({filename:"gjs-project.grapesjs",content:JSON.stringify(t.getProjectData()),mimeType:"application/json"}),l};Ao(function({buttonProps:e,content:n,code:r,onAction:i}){const o=e5(),s=YC(),a=wu(),{isProjectTypeEmail:l}=a,c=a.editor,{isDarkTheme:u}=QC(),[f,d]=C.useState(),p=()=>{const m=(f||"").trim();i?i(m):c.setComponents(m),o.close()};C.useEffect(()=>{r?d(r):(async()=>{if(l)d(c.getHtml());else{const y=(await mO(c,{page:c.Pages.getSelected(),skipProject:!0,styles:"inline"})).find(w=>w.mimeType==="text/html");y&&d(y.content)}})()},[]);const h=(e==null?void 0:e.children)||s.t("actions.importCode.button");return P.jsxs(Le,{col:!0,space:"m",children:[P.jsx(he,{children:n??s.t("actions.importCode.content")}),P.jsx(he,{className:xe("h-96"),children:f!==void 0&&P.jsx(uO,{value:f,onChange:m=>d(m||""),isDarkTheme:u,language:"html"})}),P.jsx(Le,{justify:"end",children:P.jsx(Hc,{size:"m2",variant:"pr",onClick:p,...e,children:h})})]})});function gO(t){const{Blocks:e}=t,n="Content",r="Layout",i={className:"h-7",full:!0,space:"s",nowrap:!0},o={category:r,full:!0},s="gjs-border-2 gjs-border-current gjs-rounded-sm",a=(l,c)=>{e.add(l,{select:!0,category:n,...c})};a("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
238
+ <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" />
239
+ </svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),a("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
240
+ <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" />
241
+ </svg>`,content:"<mj-button>Button</mj-button>"}),a("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
242
+ <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" />
243
+ </svg>`,content:`<mj-image src="${xb}"/>`,activate:!0}),a("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
244
+ <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" />
245
+ </svg>`,content:"<mj-divider/>"}),a("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
246
+ <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" />
247
+ </svg>`,content:`<mj-social font-size="12px" icon-size="24px" border-radius="12px" mode="horizontal">
248
+ <mj-social-element name="facebook"></mj-social-element>
249
+ <mj-social-element name="linkedin"></mj-social-element>
250
+ <mj-social-element name="twitter"></mj-social-element>
251
+ </mj-social>`}),a("mj-social-element",{label:"Social Element",media:`<svg viewBox="0 0 24 24">
252
+ <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" />
253
+ </svg>`,content:'<mj-social-element name="facebook">Facebook</mj-social-element>'}),a("mj-spacer",{label:"Spacer",media:`<svg viewBox="0 0 24 24">
254
+ <path fill="currentColor" d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
255
+ </svg>`,content:"<mj-spacer/>"}),a("mj-navbar",{label:"Navbar",media:`<svg viewBox="0 0 24 24">
256
+ <path fill="currentColor" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" />
257
+ </svg>`,content:`<mj-navbar>
258
+ <mj-navbar-link>HOME</mj-navbar-link>
259
+ <mj-navbar-link>ABOUT</mj-navbar-link>
260
+ <mj-navbar-link>CONTACT</mj-navbar-link>
261
+ <mj-navbar-link>BLOG</mj-navbar-link>
262
+ </mj-navbar>`}),a("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
263
+ <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" />
264
+ </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${Zf({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
265
+ <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
266
+ Heading title
267
+ </mj-text>
268
+ <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center">
269
+ Place here your hero content text
270
+ </mj-text>
271
+ <mj-button href="https://mjml.io/" align="center">
272
+ Call to action!
273
+ </mj-button>
274
+ </mj-hero>`}),a("mj-raw",{label:"HTML block",activate:!0,media:`<svg viewBox="0 0 24 24">
275
+ <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" />
276
+ </svg>`,content:`<mj-raw>
277
+ <span>Insert here you custom HTML</span>
278
+ </mj-raw>`}),a("mj-1-column",{...o,label:"1 Column",mediaReact:P.jsx(Le,{...i,children:P.jsx(he,{className:s,grow:!0})}),content:`<mj-section>
279
+ <mj-column></mj-column>
280
+ </mj-section>`}),a("mj-2-columns-50-50",{...o,label:"2 Columns 50/50",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0})]}),content:`<mj-section>
281
+ <mj-column></mj-column>
282
+ <mj-column></mj-column>
283
+ </mj-section>`}),a("mj-2-columns-25-75",{...o,label:"2 Columns 25/75",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-3/4")})]}),content:`<mj-section>
284
+ <mj-column width="25%"></mj-column>
285
+ <mj-column width="75%"></mj-column>
286
+ </mj-section>`}),a("mj-2-columns-33-67",{...o,label:"2 Columns 33/67",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-1/3")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-2/3")})]}),content:`<mj-section>
287
+ <mj-column width="33%"></mj-column>
288
+ <mj-column width="67%"></mj-column>
289
+ </mj-section>`}),a("mj-2-columns-67-33",{...o,label:"2 Columns 67/33",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-2/3")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/3")})]}),content:`<mj-section>
290
+ <mj-column width="67%"></mj-column>
291
+ <mj-column width="33%"></mj-column>
292
+ </mj-section>`}),a("mj-2-columns-75-25",{...o,label:"2 Columns 75/25",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-3/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
293
+ <mj-column width="75%"></mj-column>
294
+ <mj-column width="25%"></mj-column>
295
+ </mj-section>`}),a("mj-3-columns",{...o,label:"3 Columns",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0})]}),content:`<mj-section>
296
+ <mj-column></mj-column>
297
+ <mj-column></mj-column>
298
+ <mj-column></mj-column>
299
+ </mj-section>`}),a("mj-3-columns-25-25-50",{...o,label:"3 Columns 25/25/50",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-2/4")})]}),content:`<mj-section>
300
+ <mj-column width="25%"></mj-column>
301
+ <mj-column width="25%"></mj-column>
302
+ <mj-column width="50%"></mj-column>
303
+ </mj-section>`}),a("mj-3-columns-25-50-25",{...o,label:"3 Columns 25/50/25",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-2/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
304
+ <mj-column width="25%"></mj-column>
305
+ <mj-column width="50%"></mj-column>
306
+ <mj-column width="25%"></mj-column>
307
+ </mj-section>`}),a("mj-3-columns-50-25-25",{...o,label:"3 Columns 50/25/25",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:Ee(s,"gs-utl-basis-2/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")}),P.jsx(he,{className:Ee(s,"gs-utl-basis-1/4")})]}),content:`<mj-section>
308
+ <mj-column width="50%"></mj-column>
309
+ <mj-column width="25%"></mj-column>
310
+ <mj-column width="25%"></mj-column>
311
+ </mj-section>`}),a("mj-4-columns",{...o,label:"4 Columns",mediaReact:P.jsxs(Le,{...i,children:[P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0}),P.jsx(he,{className:s,grow:!0})]}),content:`<mj-section>
312
+ <mj-column></mj-column>
313
+ <mj-column></mj-column>
314
+ <mj-column></mj-column>
315
+ <mj-column></mj-column>
316
+ </mj-section>`})}nu.email+"",nu.web+"";const bO=/\s(?![^(]*\))/,O1=/^-?[0-9]+[a-zA-Z%]{0,}$/;function E1(t){const e=t.split(bO),n=e.indexOf("inset")>=0,r=e.filter(u=>u!=="inset"),i=r.filter(u=>!O1.test(u))[0]||"currentColor",o=r.filter(u=>O1.test(u)),[s="0",a="0",l="0",c="0"]=o;return{x:s,y:a,blur:l,spread:c,inset:n,color:i}}function cu(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 _1={},uu={exports:{}},Fo={};/**
317
+ * @license React
318
+ * react-jsx-runtime.production.min.js
319
+ *
320
+ * Copyright (c) Facebook, Inc. and its affiliates.
321
+ *
322
+ * This source code is licensed under the MIT license found in the
323
+ * LICENSE file in the root directory of this source tree.
324
+ */var k1;function vO(){if(k1)return Fo;k1=1;var t=C,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,c){var u,f={},d=null,p=null;c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!o.hasOwnProperty(u)&&(f[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)f[u]===void 0&&(f[u]=l[u]);return{$$typeof:e,type:a,key:d,ref:p,props:f,_owner:i.current}}return Fo.Fragment=n,Fo.jsx=s,Fo.jsxs=s,Fo}var Va={};/**
325
+ * @license React
326
+ * react-jsx-runtime.development.js
327
+ *
328
+ * Copyright (c) Facebook, Inc. and its affiliates.
329
+ *
330
+ * This source code is licensed under the MIT license found in the
331
+ * LICENSE file in the root directory of this source tree.
332
+ */var A1;function yO(){return A1||(A1=1,_1.NODE_ENV!=="production"&&function(){var t=C,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function g(S){if(S===null||typeof S!="object")return null;var j=h&&S[h]||S[m];return typeof j=="function"?j:null}var y=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(S){{for(var j=arguments.length,b=new Array(j>1?j-1:0),k=1;k<j;k++)b[k-1]=arguments[k];x("error",S,b)}}function x(S,j,b){{var k=y.ReactDebugCurrentFrame,L=k.getStackAddendum();L!==""&&(j+="%s",b=b.concat([L]));var q=b.map(function(X){return String(X)});q.unshift("Warning: "+j),Function.prototype.apply.call(console[S],console,q)}}var O=!1,v=!1,E=!1,A=!1,B=!1,T;T=Symbol.for("react.module.reference");function V(S){return!!(typeof S=="string"||typeof S=="function"||S===r||S===o||B||S===i||S===c||S===u||A||S===p||O||v||E||typeof S=="object"&&S!==null&&(S.$$typeof===d||S.$$typeof===f||S.$$typeof===s||S.$$typeof===a||S.$$typeof===l||S.$$typeof===T||S.getModuleId!==void 0))}function I(S,j,b){var k=S.displayName;if(k)return k;var L=j.displayName||j.name||"";return L!==""?b+"("+L+")":b}function z(S){return S.displayName||"Context"}function K(S){if(S==null)return null;if(typeof S.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case r:return"Fragment";case n:return"Portal";case o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof S=="object")switch(S.$$typeof){case a:var j=S;return z(j)+".Consumer";case s:var b=S;return z(b._context)+".Provider";case l:return I(S,S.render,"ForwardRef");case f:var k=S.displayName||null;return k!==null?k:K(S.type)||"Memo";case d:{var L=S,q=L._payload,X=L._init;try{return K(X(q))}catch{return null}}}return null}var te=Object.assign,H=0,Y,re,oe,me,pe,_,N;function G(){}G.__reactDisabledLog=!0;function W(){{if(H===0){Y=console.log,re=console.info,oe=console.warn,me=console.error,pe=console.group,_=console.groupCollapsed,N=console.groupEnd;var S={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}H++}}function U(){{if(H--,H===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:te({},S,{value:Y}),info:te({},S,{value:re}),warn:te({},S,{value:oe}),error:te({},S,{value:me}),group:te({},S,{value:pe}),groupCollapsed:te({},S,{value:_}),groupEnd:te({},S,{value:N})})}H<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=y.ReactCurrentDispatcher,J;function Q(S,j,b){{if(J===void 0)try{throw Error()}catch(L){var k=L.stack.trim().match(/\n( *(at )?)/);J=k&&k[1]||""}return`
333
+ `+J+S}}var ie=!1,ue;{var ae=typeof WeakMap=="function"?WeakMap:Map;ue=new ae}function Ae(S,j){if(!S||ie)return"";{var b=ue.get(S);if(b!==void 0)return b}var k;ie=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var q;q=se.current,se.current=null,W();try{if(j){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(it){k=it}Reflect.construct(S,[],X)}else{try{X.call()}catch(it){k=it}S.call(X.prototype)}}else{try{throw Error()}catch(it){k=it}S()}}catch(it){if(it&&k&&typeof it.stack=="string"){for(var ee=it.stack.split(`
334
+ `),le=k.stack.split(`
335
+ `),ne=ee.length-1,ve=le.length-1;ne>=1&&ve>=0&&ee[ne]!==le[ve];)ve--;for(;ne>=1&&ve>=0;ne--,ve--)if(ee[ne]!==le[ve]){if(ne!==1||ve!==1)do if(ne--,ve--,ve<0||ee[ne]!==le[ve]){var ye=`
336
+ `+ee[ne].replace(" at new "," at ");return S.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",S.displayName)),typeof S=="function"&&ue.set(S,ye),ye}while(ne>=1&&ve>=0);break}}}finally{ie=!1,se.current=q,U(),Error.prepareStackTrace=L}var Me=S?S.displayName||S.name:"",ct=Me?Q(Me):"";return typeof S=="function"&&ue.set(S,ct),ct}function $(S,j,b){return Ae(S,!1)}function Pe(S){var j=S.prototype;return!!(j&&j.isReactComponent)}function rt(S,j,b){if(S==null)return"";if(typeof S=="function")return Ae(S,Pe(S));if(typeof S=="string")return Q(S);switch(S){case c:return Q("Suspense");case u:return Q("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case l:return $(S.render);case f:return rt(S.type,j,b);case d:{var k=S,L=k._payload,q=k._init;try{return rt(q(L),j,b)}catch{}}}return""}var Ye=Object.prototype.hasOwnProperty,gt={},_n=y.ReactDebugCurrentFrame;function Gt(S){if(S){var j=S._owner,b=rt(S.type,S._source,j?j.type:null);_n.setExtraStackFrame(b)}else _n.setExtraStackFrame(null)}function Te(S,j,b,k,L){{var q=Function.call.bind(Ye);for(var X in S)if(q(S,X)){var ee=void 0;try{if(typeof S[X]!="function"){var le=Error((k||"React class")+": "+b+" type `"+X+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof S[X]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw le.name="Invariant Violation",le}ee=S[X](j,X,k,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ne){ee=ne}ee&&!(ee instanceof Error)&&(Gt(L),w("%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).",k||"React class",b,X,typeof ee),Gt(null)),ee instanceof Error&&!(ee.message in gt)&&(gt[ee.message]=!0,Gt(L),w("Failed %s type: %s",b,ee.message),Gt(null))}}}var Ie=Array.isArray;function Er(S){return Ie(S)}function _r(S){{var j=typeof Symbol=="function"&&Symbol.toStringTag,b=j&&S[Symbol.toStringTag]||S.constructor.name||"Object";return b}}function ui(S){try{return fi(S),!1}catch{return!0}}function fi(S){return""+S}function kr(S){if(ui(S))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_r(S)),fi(S)}var ln=y.ReactCurrentOwner,kn={key:!0,ref:!0,__self:!0,__source:!0},Sl,ws,lo;lo={};function xs(S){if(Ye.call(S,"ref")){var j=Object.getOwnPropertyDescriptor(S,"ref").get;if(j&&j.isReactWarning)return!1}return S.ref!==void 0}function Pf(S){if(Ye.call(S,"key")){var j=Object.getOwnPropertyDescriptor(S,"key").get;if(j&&j.isReactWarning)return!1}return S.key!==void 0}function Vf(S,j){if(typeof S.ref=="string"&&ln.current&&j&&ln.current.stateNode!==j){var b=K(ln.current.type);lo[b]||(w('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',K(ln.current.type),S.ref),lo[b]=!0)}}function Df(S,j){{var b=function(){Sl||(Sl=!0,w("%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)",j))};b.isReactWarning=!0,Object.defineProperty(S,"key",{get:b,configurable:!0})}}function Lf(S,j){{var b=function(){ws||(ws=!0,w("%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)",j))};b.isReactWarning=!0,Object.defineProperty(S,"ref",{get:b,configurable:!0})}}var Rf=function(S,j,b,k,L,q,X){var ee={$$typeof:e,type:S,key:j,ref:b,props:X,_owner:q};return ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee};function jf(S,j,b,k,L){{var q,X={},ee=null,le=null;b!==void 0&&(kr(b),ee=""+b),Pf(j)&&(kr(j.key),ee=""+j.key),xs(j)&&(le=j.ref,Vf(j,L));for(q in j)Ye.call(j,q)&&!kn.hasOwnProperty(q)&&(X[q]=j[q]);if(S&&S.defaultProps){var ne=S.defaultProps;for(q in ne)X[q]===void 0&&(X[q]=ne[q])}if(ee||le){var ve=typeof S=="function"?S.displayName||S.name||"Unknown":S;ee&&Df(X,ve),le&&Lf(X,ve)}return Rf(S,ee,le,L,k,ln.current,X)}}var Ss=y.ReactCurrentOwner,co=y.ReactDebugCurrentFrame;function Kn(S){if(S){var j=S._owner,b=rt(S.type,S._source,j?j.type:null);co.setExtraStackFrame(b)}else co.setExtraStackFrame(null)}var An;An=!1;function di(S){return typeof S=="object"&&S!==null&&S.$$typeof===e}function uo(){{if(Ss.current){var S=K(Ss.current.type);if(S)return`
337
+
338
+ Check the render method of \``+S+"`."}return""}}function Cl(S){return""}var Ol={};function El(S){{var j=uo();if(!j){var b=typeof S=="string"?S:S.displayName||S.name;b&&(j=`
339
+
340
+ Check the top-level render call using <`+b+">.")}return j}}function _l(S,j){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var b=El(j);if(Ol[b])return;Ol[b]=!0;var k="";S&&S._owner&&S._owner!==Ss.current&&(k=" It was passed a child from "+K(S._owner.type)+"."),Kn(S),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,k),Kn(null)}}function Cs(S,j){{if(typeof S!="object")return;if(Er(S))for(var b=0;b<S.length;b++){var k=S[b];di(k)&&_l(k,j)}else if(di(S))S._store&&(S._store.validated=!0);else if(S){var L=g(S);if(typeof L=="function"&&L!==S.entries)for(var q=L.call(S),X;!(X=q.next()).done;)di(X.value)&&_l(X.value,j)}}}function kl(S){{var j=S.type;if(j==null||typeof j=="string")return;var b;if(typeof j=="function")b=j.propTypes;else if(typeof j=="object"&&(j.$$typeof===l||j.$$typeof===f))b=j.propTypes;else return;if(b){var k=K(j);Te(b,S.props,"prop",k,S)}else if(j.PropTypes!==void 0&&!An){An=!0;var L=K(j);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof j.getDefaultProps=="function"&&!j.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Hf(S){{for(var j=Object.keys(S.props),b=0;b<j.length;b++){var k=j[b];if(k!=="children"&&k!=="key"){Kn(S),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",k),Kn(null);break}}S.ref!==null&&(Kn(S),w("Invalid attribute `ref` supplied to `React.Fragment`."),Kn(null))}}function Al(S,j,b,k,L,q){{var X=V(S);if(!X){var ee="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(ee+=" 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 le=Cl();le?ee+=le:ee+=uo();var ne;S===null?ne="null":Er(S)?ne="array":S!==void 0&&S.$$typeof===e?(ne="<"+(K(S.type)||"Unknown")+" />",ee=" Did you accidentally export a JSX literal instead of a component?"):ne=typeof S,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ne,ee)}var ve=jf(S,j,b,L,q);if(ve==null)return ve;if(X){var ye=j.children;if(ye!==void 0)if(k)if(Er(ye)){for(var Me=0;Me<ye.length;Me++)Cs(ye[Me],S);Object.freeze&&Object.freeze(ye)}else w("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 Cs(ye,S)}return S===r?Hf(ve):kl(ve),ve}}function Tl(S,j,b){return Al(S,j,b,!0)}function Ml(S,j,b){return Al(S,j,b,!1)}var If=Ml,Bf=Tl;Va.Fragment=r,Va.jsx=If,Va.jsxs=Bf}()),Va}_1.NODE_ENV==="production"?uu.exports=vO():uu.exports=yO();var qe=uu.exports;const T1=C.createContext(null),wO=({children:t})=>{const[e,n]=C.useState({setEditor:r=>{n(i=>({...i,editor:r}))}});return qe.jsx(T1.Provider,{value:e,children:t})},yn=()=>{const t=C.useContext(T1);if(!t)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return t},M1=C.createContext(null),xO=({children:t})=>{const[e,n]=C.useState(()=>({setRefCanvas(r){n(i=>({...i,refCanvas:r}))},setCustomModal(r){n(i=>({...i,customModal:r}))},setCustomAssets(r){n(i=>({...i,customAssets:r}))},setCustomBlocks(r){n(i=>({...i,customBlocks:r}))},setCustomRte(r){n(i=>({...i,customRte:r}))},setCustomStyles(r){n(i=>({...i,customStyles:r}))},setCustomLayers(r){n(i=>({...i,customLayers:r}))},setCustomSelectors(r){n(i=>({...i,customSelectors:r}))},setCustomTraits(r){n(i=>({...i,customTraits:r}))},setReady(r){n(i=>({...i,ready:r}))}}));return qe.jsx(M1.Provider,{value:e,children:t})},jn=()=>{const t=C.useContext(M1);if(!t)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return t};function SO(...t){return(Array.isArray(t[0])?t[0]:[...t]).filter(Boolean).join(" ")}function ar(t){return typeof t=="function"}function tn(){}const N1=t=>typeof t=="string",CO=async t=>{const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)},P1=t=>{const e=N1(t)?{id:t,src:t}:t;return new Promise((n,r)=>{const i=document.createElement("script");if(document.querySelector(`script[src="${e.src}"]`))return n(e.id);i.src=e.src,i.onload=()=>n(e.id),i.onerror=()=>r(e.id),document.head.appendChild(i)})},OO=t=>{const e=t.map(n=>P1(n));return Promise.allSettled(e)},V1=t=>function(){const e=C.useRef(null);return C.useEffect(()=>{const{current:n}=e;n&&(N1(t)?n.innerHTML=t:n.appendChild(t))},[e.current]),qe.jsx("div",{ref:e})},D1=new WeakMap;function Gi(t){if(!t)return()=>null;const e=D1.get(t);if(e)return e;const n=function({children:r}){return Es.createPortal(r,t)};return D1.set(t,n),n}C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(!1),[o,s]=C.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>null});return C.useEffect(()=>{if(!e)return;const a=e.Assets.events.custom,l=({open:c,assets:u,types:f,select:d,close:p,container:h})=>{c&&s({assets:u,types:f,select:d,close:p,Container:Gi(h)}),i(c)};return e.on(a,l),()=>{e.off(a,l)}},[e]),C.useEffect(()=>n.setCustomAssets(!0),[]),e&&ar(t)?t({open:r,...o}):null}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(()=>({blocks:[],dragStart:tn,dragStop:tn,mapCategoryBlocks:new Map,Container:()=>null}));return C.useEffect(()=>{if(!e)return;const o=e.Blocks.events.custom,s=({blocks:a,container:l,dragStart:c,dragStop:u})=>{const f=a.reduce((d,p)=>{const h=p.getCategoryLabel(),m=d.get(h);return m?m.push(p):d.set(h,[p]),d},new Map);i({blocks:a,dragStart:c,dragStop:u,mapCategoryBlocks:f,Container:Gi(l)})};return e.on(o,s),e.Blocks.__trgCustom(),()=>{e.off(o,s)}},[e]),C.useEffect(()=>n.setCustomBlocks(!0),[]),e&&ar(t)?t(r):null}),C.memo(function({children:t}){const{editor:e}=yn(),[n,r]=C.useState(()=>({devices:[],selected:"",select:tn}));return C.useEffect(()=>{if(!e)return;const{Devices:i}=e,o=i.events.all,s=()=>{var a;r({devices:i.getDevices(),selected:(a=i.getSelected())==null?void 0:a.id,select:l=>i.select(l)})};return e.on(o,s),s(),()=>{e.off(o,s)}},[e]),e&&ar(t)?t(n):null});const EO=t=>!!(t&&!Array.isArray(t)&&typeof t=="object");async function _O(t){const e=t.map(({id:o,src:s})=>({id:o,src:s})),n=t.reduce((o,s)=>(o[s.id]=s,o),{}),r=[],i=[];return(await OO(e)).forEach(o=>{o.status==="fulfilled"?r.push(n[o.value]):i.push(n[o.reason])}),{loaded:r,failed:i}}const kO=async t=>{const e=[...t],n={};if(e.length){const r={},i=[];if(e.forEach((o,s)=>{EO(o)&&(r[o.id]={index:s},i.push(o))}),i.length){const{loaded:o}=await _O(i);o.forEach(({id:s,options:a})=>{r[s].loaded=!0,n[s]=a||{}})}Object.keys(r).forEach(o=>{const s=r[o];s.loaded?e[s.index]=o:e[s.index]=!1})}return{plugins:e.filter(Boolean),pluginOptions:n}},AO=C.memo(function({children:t,className:e,style:n,options:r={},plugins:i=[],grapesjs:o,grapesjsCss:s,onEditor:a=tn,onReady:l,onUpdate:c,waitReady:u,...f}){const{setEditor:d}=yn(),p=jn(),[h,m]=C.useState(!1),g=C.useRef(null);C.useEffect(()=>{if(!p.ready||!g.current)return;const A=g.current,B=p.refCanvas;let T,V={},I=[];const z=K=>{const te={height:"100%",...r,plugins:[...I,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...V},modal:{...r.modal,custom:!!p.customModal},assetManager:{...r.assetManager,custom:!!p.customAssets},styleManager:{...r.styleManager,custom:!!p.customStyles},blockManager:{...r.blockManager,custom:!!p.customBlocks},richTextEditor:{...r.richTextEditor,custom:!!p.customRte},layerManager:{...r.layerManager,custom:!!p.customLayers},traitManager:{...r.traitManager,custom:!!p.customTraits},selectorManager:{...r.selectorManager,custom:!!p.customSelectors},container:B||A,customUI:!!B,...B?{panels:{defaults:[]}}:{}};T=K.init(te),d(T),a(T),c&&T.on("update",()=>{c(T.getProjectData(),T)}),T.onReady(()=>{m(!0),l==null||l(T)})};return(async()=>{s&&await CO(s);const K=await kO(i);I=K.plugins,V=K.pluginOptions,typeof o=="string"?(await P1(o),z(window.grapesjs)):z(o)})(),()=>T==null?void 0:T.destroy()},[p.ready]);const y=r.height??"100%",w=r.width??"100%",x=SO("gjs-editor-wrapper",e),O=u&&!h,v=C.useMemo(()=>({...n,height:y,width:w}),[y,w,n]),E=C.useMemo(()=>({...v,...O?{opacity:0,width:0,height:0}:{}}),[v,O]);return qe.jsxs(qe.Fragment,{children:[u&&!h?qe.jsx("div",{className:x,style:v,children:u}):null,qe.jsx("div",{...f,ref:g,className:x,style:E,children:t})]})}),TO=C.memo(function(){const t=jn();return C.useEffect(()=>t.setReady(!0),[]),qe.jsx(qe.Fragment,{})});C.memo(function({children:t,...e}){return qe.jsx(wO,{children:qe.jsx(xO,{children:qe.jsxs(AO,{...e,children:[t,qe.jsx(TO,{})]})})})}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(()=>({root:void 0,Container:()=>null}));return C.useEffect(()=>{if(!e)return;const{Layers:o}=e,s=o.events.custom,a=({container:l})=>{i({root:o.getRoot(),Container:Gi(l)})};return e.on(s,a),o.__trgCustom({}),()=>{e.off(s,a)}},[e]),C.useEffect(()=>n.setCustomLayers(!0),[]),e&&ar(t)?t(r):null}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(!1),[o,s]=C.useState({title:qe.jsx(qe.Fragment,{}),content:qe.jsx(qe.Fragment,{}),attributes:{},close:tn});return C.useEffect(()=>{if(!e)return;const a="modal",l=({open:c,title:u,content:f,close:d,attributes:p})=>{c&&s({title:C.createElement(V1(u)),content:C.createElement(V1(f)),attributes:p,close:d}),i(c)};return e.on(a,l),()=>{e.off(a,l)}},[e]),C.useEffect(()=>n.setCustomModal(!0),[]),e&&typeof t=="function"?t({open:r,...o}):null}),C.memo(function({children:t}){const{editor:e}=yn(),[n,r]=C.useState(()=>({pages:[],selected:void 0,select:tn,add:tn,remove:tn}));return C.useEffect(()=>{if(!e)return;const{Pages:i}=e,o=i.events.all,s=()=>{r({pages:i.getAll(),selected:i.getSelected(),select:(...a)=>i.select(...a),add:(...a)=>i.add(...a),remove:(...a)=>i.remove(...a)})};return e.on(o,s),s(),()=>{e.off(o,s)}},[e]),e&&ar(t)?t(n):null}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:tn,removeSelector:tn,setState:tn,Container:()=>null}));return C.useEffect(()=>{if(!e)return;const{Selectors:o}=e,s=o.events.custom,a=({container:l})=>{i({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(c=>c.getSelectorsString()),addSelector:(...c)=>o.addSelected(...c),removeSelector:(...c)=>o.removeSelected(...c),setState:(...c)=>o.setState(...c),Container:Gi(l)})};return e.on(s,a),()=>{e.off(s,a)}},[e]),C.useEffect(()=>n.setCustomSelectors(!0),[]),e&&ar(t)?t(r):null}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(()=>({sectors:[],Container:()=>null}));return C.useEffect(()=>{if(!e)return;const{Styles:o}=e,s=o.events.custom,a=({container:l})=>{i({sectors:o.getSectors({visible:!0}),Container:Gi(l)})};return e.on(s,a),()=>{e.off(s,a)}},[e]),C.useEffect(()=>n.setCustomStyles(!0),[]),e&&ar(t)?t(r):null}),C.memo(function({children:t}){const{editor:e}=yn(),n=jn(),[r,i]=C.useState(()=>({traits:[],Container:()=>null}));return C.useEffect(()=>{if(!e)return;const{Traits:o}=e,s=o.events.custom,a=({container:l})=>{i({traits:o.getCurrent(),Container:Gi(l)})};return e.on(s,a),o.__trgCustom(),()=>{e.off(s,a)}},[e]),C.useEffect(()=>n.setCustomTraits(!0),[]),e&&ar(t)?t(r):null});var MO={grad:.9,turn:360,rad:360/(2*Math.PI)},Hn=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},$e=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},zt=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},L1=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},R1=function(t){return{r:zt(t.r,0,255),g:zt(t.g,0,255),b:zt(t.b,0,255),a:zt(t.a)}},fu=function(t){return{r:$e(t.r),g:$e(t.g),b:$e(t.b),a:$e(t.a,3)}},NO=/^#([0-9a-f]{3,8})$/i,Da=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},j1=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),a=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},H1=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),a=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},I1=function(t){return{h:L1(t.h),s:zt(t.s,0,100),l:zt(t.l,0,100),a:zt(t.a)}},B1=function(t){return{h:$e(t.h),s:$e(t.s),l:$e(t.l),a:$e(t.a,3)}},$1=function(t){return H1((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},Wo=function(t){return{h:(e=j1(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},PO=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,VO=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DO=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,LO=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,du={string:[[function(t){var e=NO.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?$e(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?$e(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=DO.exec(t)||LO.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:R1({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=PO.exec(t)||VO.exec(t);if(!e)return null;var n,r,i=I1({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(MO[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return $1(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i===void 0?1:i;return Hn(e)&&Hn(n)&&Hn(r)?R1({r:Number(e),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,o=i===void 0?1:i;if(!Hn(e)||!Hn(n)||!Hn(r))return null;var s=I1({h:Number(e),s:Number(n),l:Number(r),a:Number(o)});return $1(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,o=i===void 0?1:i;if(!Hn(e)||!Hn(n)||!Hn(r))return null;var s=function(a){return{h:L1(a.h),s:zt(a.s,0,100),v:zt(a.v,0,100),a:zt(a.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(o)});return H1(s)},"hsv"]]},z1=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]},RO=function(t){return typeof t=="string"?z1(t.trim(),du.string):typeof t=="object"&&t!==null?z1(t,du.object):[null,void 0]},pu=function(t,e){var n=Wo(t);return{h:n.h,s:zt(n.s+100*e,0,100),l:n.l,a:n.a}},hu=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},F1=function(t,e){var n=Wo(t);return{h:n.h,s:n.s,l:zt(n.l+100*e,0,100),a:n.a}},mu=function(){function t(e){this.parsed=RO(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 $e(hu(this.rgba),2)},t.prototype.isDark=function(){return hu(this.rgba)<.5},t.prototype.isLight=function(){return hu(this.rgba)>=.5},t.prototype.toHex=function(){return e=fu(this.rgba),n=e.r,r=e.g,i=e.b,s=(o=e.a)<1?Da($e(255*o)):"","#"+Da(n)+Da(r)+Da(i)+s;var e,n,r,i,o,s},t.prototype.toRgb=function(){return fu(this.rgba)},t.prototype.toRgbString=function(){return e=fu(this.rgba),n=e.r,r=e.g,i=e.b,(o=e.a)<1?"rgba("+n+", "+r+", "+i+", "+o+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,o},t.prototype.toHsl=function(){return B1(Wo(this.rgba))},t.prototype.toHslString=function(){return e=B1(Wo(this.rgba)),n=e.h,r=e.s,i=e.l,(o=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+o+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,o},t.prototype.toHsv=function(){return e=j1(this.rgba),{h:$e(e.h),s:$e(e.s),v:$e(e.v),a:$e(e.a,3)};var e},t.prototype.invert=function(){return In({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),In(pu(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),In(pu(this.rgba,-e))},t.prototype.grayscale=function(){return In(pu(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),In(F1(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),In(F1(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"?In({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):$e(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=Wo(this.rgba);return typeof e=="number"?In({h:e,s:n.s,l:n.l,a:n.a}):$e(n.h)},t.prototype.isEqual=function(e){return this.toHex()===In(e).toHex()},t}(),In=function(t){return t instanceof mu?t:new mu(t)},W1=[],jO=function(t){t.forEach(function(e){W1.indexOf(e)<0&&(e(mu,du),W1.push(e))})};function HO(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 i in n)r[n[i]]=i;var o={};t.prototype.toName=function(s){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(s!=null&&s.closest){var u=this.toRgb(),f=1/0,d="black";if(!o.length)for(var p in n)o[p]=new t(n[p]).toRgb();for(var h in n){var m=(a=u,l=o[h],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));m<f&&(f=m,d=h)}return d}},e.string.push([function(s){var a=s.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new t(l).toRgb():null},"name"])}const U1=t=>Qh(t)?t:"",IO=(t={})=>xe("w-full placeholder:italic",ke.bgTr,Jx.inputText,t.disabled&&ke.txtLowEmphasis),BO="gs-input-field";C.forwardRef(function(e,n){const{className:r,value:i,label:o,size:s="m",type:a,placeholder:l,required:c,disabled:u,readOnly:f,description:d,name:p,style:h,tip:m,onInput:g,onChange:y,onBlur:w}=e,[x,O]=C.useState(U1(i)),v=IO(e),E=C.useRef(null);C.useImperativeHandle(n,()=>E.current,[]),C.useEffect(()=>{O(U1(i))},[i]);const A=(I,z)=>{y==null||y(I,z)},B=I=>{const{key:z}=I;switch(z){case"Escape":return O(i);case"Enter":return A(x)}},T=()=>{A(x),w==null||w()},V=I=>{const z=I.target.value;O(z),g==null||g(z)};return P.jsxs("div",{className:xe(BO,r),style:h,ref:E,children:[!!o&&P.jsx(_a,{size:s,children:o}),!!d&&P.jsx(_a,{size:s,tip:m,as:"span",className:xe(ke.txtLowEmphasis),capitalize:!1,children:d}),P.jsx(Le,{className:xe(ke.bg,Ht.b,Ht.rnd,ke.br,s==="m"&&jc.xy,s==="s"&&"gjs-px-3 gjs-py-1"),items:"center",space:"x2s",children:P.jsx(he,{grow:!0,children:P.jsx("input",{className:v,name:p,value:x,onChange:V,placeholder:l,required:c,onBlur:T,onKeyDown:B,readOnly:f,disabled:u,type:a})})})]})}),jO([HO]);function q1(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function $O(t){return"nodeType"in t}function zO(t){var e,n;return t?q1(t)?t:$O(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function FO(t){return q1(t)?!1:t instanceof zO(t).HTMLElement}var G1;(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"})(G1||(G1={}));const K1=Object.freeze({x:0,y:0});var Z1;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Z1||(Z1={}));function J1(t,e,n=K1){if(!t||!FO(t))return n;const r={x:n.x+t.offsetLeft,y:n.y+t.offsetTop};return t.offsetParent===e?r:J1(t.offsetParent,e,r)}function WO(t){const{offsetWidth:e,offsetHeight:n}=t,{x:r,y:i}=J1(t,null);return{width:e,height:n,offsetTop:i,offsetLeft:r}}var Y1;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Y1||(Y1={}));var X1;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(X1||(X1={}));var gu;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(gu||(gu={}));var bu;(function(t){t.Optimized="optimized"})(bu||(bu={})),gu.WhileDragging,bu.Optimized;var Q1;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Q1||(Q1={}));var nn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter"})(nn||(nn={})),nn.Space,nn.Enter,nn.Esc,nn.Space,nn.Enter;var em;(function(t){t[t.RightClick=2]="RightClick"})(em||(em={})),{...K1},nn.Down,nn.Right,nn.Up,nn.Left;const UO=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,qO=/,(?![^(]*\))/,vu=/\s(?![^(]*\))/,GO=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,yu=/^circle|ellipse/i,KO=t=>{var u;const e=[],{name:n,value:r}=cu(t),[i,...o]=r.split(qO).map(f=>f.trim()).filter(Boolean),s=o.length>1,a=s?i:"",l={type:"none"},c=s?o:[i,...o];if(UO.test(a))l.type="angle",l.value=a;else if(/^to\s/.test(a))l.type="side-or-corner",l.value=a;else if(GO.test(a))l.type="size",l.value=a;else if(yu.test(a)||/^at\s/.test(a)||/\sat\s/.test(a)){l.type="at",l.value=a;const f=((u=a.match(yu))==null?void 0:u[0])||"circle";l.shape=f;const d={x:"0%",y:"0%"},p={x:"0%",y:"0%"},[h,m]=a.replace(yu,"").trim().split("at").map(g=>g.trim());if(h){const[g,y]=h.split(vu);d.x=g,d.y=y||g}if(m){const[g,y]=m.split(vu);p.x=g,p.y=y||g}l.size=d,l.position=p}return c.forEach(f=>{const[d,p]=f.split(vu);e.push({color:d,hint:p?parseFloat(p):null})}),e.forEach((f,d)=>{f.hint===null&&(f.hint=d/(e.length-1)*100)}),{name:n,orientation:l,colorStops:e}};var lr=(t=>(t.Image="image",t.Gradient="gradient",t.Color="color",t))(lr||{});const La="background-image",cr="__background-type",Uo=La,Ra=["%"],ja=["s","ms"],qo=["deg","rad","grad"],wn=["px","%","em","rem","vw","vh"],tm={type:"select",options:["visible","hidden","scroll","auto"].map(t=>({id:t})),default:"visible"},ZO=t=>`linear-gradient(${t} 1%, ${t} 100%)`,Ha=t=>({id:t,label:t.split("-").map(Pl).join(" ")}),nm=t=>({property:e,to:n})=>{if(n.value){const r=e.getOption(),i=e.getParent().getProperty(t),o=i.getUnit(),s={units:r.units||[],min:r.min,max:r.max,unit:""};(!o||(s==null?void 0:s.units.indexOf(o))<0)&&(s.unit=(s==null?void 0:s.units[0])||""),i.up(s)}},JO=t=>{const e=`${t}-name`,n=`${t}-value`;return(r,{separatorLayers:i})=>{const o=r[t]||"";return o?o.split(i).map(s=>{const{name:a,value:l}=cu(s);return{[e]:a,[n]:l}}):[]}},rm=t=>{const e={[Uo]:t};if(t.indexOf("url(")>-1)e[cr]=lr.Image;else if(t.indexOf("gradient(")>-1){const n=KO(t),r=n.colorStops,i=n.name.indexOf("linear")>=0;r.length===2&&i&&r[0].color===r[1].color?e[cr]=lr.Color:e[cr]=lr.Gradient}else e[cr]=lr.Color,e[Uo]=ZO(t);return e},im=(t="filter")=>{const e=`${t}-name`,n=`${t}-value`;return{property:t,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:i}){const o=r[t]||"";return o?o.split(i).map(s=>{const{name:a,value:l}=cu(s);return{[e]:a,[n]:l}}):[]},toStyle(r,{name:i}){return{[i]:`${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:nm(n)},{property:n,type:"integer"}]}},Ia=(t,{x:e,y:n,mergable:r}={})=>{const i={property:`${t}-x`,type:"integer",units:wn,...e},o={property:`${t}-y`,type:"integer",units:wn,...n};return{property:t,type:"composite",properties:[i,o],...r&&{fromStyle(s,{name:a,separator:l,property:c}){const[u,f]=c.getProperties(),[d,p]=(s[a]||"").split(l);return{[u.getId()]:s[u.getName()]||d||"",[f.getId()]:s[f.getName()]||p||d||""}},toStyle(s,{name:a,property:l}){const[c,u]=l.getProperties(),f=s[c.getId()],d=s[u.getId()];return{[a]:f===d?f:`${f} ${d}`}}}}},YO=(t,e="")=>{const n=`${t}-name`,r=`${t}-value`;return(i,{name:o})=>({[o]:`${i[n]}(${i[r]||e})`})};["top","middle","bottom"].map(Ha),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Ha),Ia("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Ha),new RegExp("(?<!\\(.*[^)]),(?![^(]*\\))"),lr.Image,lr.Gradient,lr.Color,["background-position-x","background-position-y"].map(t=>({type:"integer",property:t,units:wn,default:"0px"})),["background-size-x","background-size-y"].map(t=>({type:"integer",property:t,units:wn,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(t=>({type:"integer",property:t,default:"0",units:wn})),["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"})),Ia("overflow",{x:tm,y:tm,mergable:!0}),im(),im("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(Ha),ja[0],ja[0],JO("transform"),YO("transform","0"),nm("transform-value"),Ia("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Ia("perspective-origin",{x:{default:"50%"},y:{default:"50%"}}),l1.gjsStudio;const XO=C.createContext(void 0),Go=()=>{const t=C.useContext(XO);if(!t)throw new Error("useStore must be used inside of StoreProvider");return t},Ba=({icon:t,layout:e,tooltip:n,className:r,forceRemove:i,removeLayouts:o})=>({type:"button",icon:t,tooltip:n,className:r,size:"s",editorEvents:{[`${nd.layoutToggleId}${e.id}`]:({fromEvent:s,setState:a})=>{a({active:s.isOpen})}},onClick:({editor:s})=>{o==null||o.forEach(a=>s.runCommand(Kt.layoutRemove,{id:a,force:i})),s.runCommand(Kt.layoutToggle,{...e})}}),om={type:"static",layoutId:"leftPanelsContainer"},sm={width:240,overflow:"hidden"};Ba({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:sm,placer:om}}),Ba({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:sm,placer:om}}),Ba({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Ba({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:()=>P.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const wu=()=>Go().appEditorStore,QO=()=>{try{return wu()}catch{}};var Bn=(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))(Bn||{});const xu={alertRhombus:$v,alignHorizontalCenter:zv,alignHorizontalLeft:Fv,alignHorizontalRight:Wv,applicationBracketsOutline:Uv,arrowDown:qv,arrowRight:Gv,arrowULeftTop:Kv,arrowURightTop:Zv,borderAllVariant:Jv,borderRadius:Yv,borderStyle:Xv,cellphoneLink:Qv,check:ey,checkBold:ty,checkboxBlank:ny,chevronUp:sy,chevronDown:ry,chevronLeft:iy,chevronRight:oy,close:ay,codeBraces:ly,cog:cy,contentCopy:uy,contentSave:fy,delete:dy,dotsVertical:py,email:hy,emailOutline:my,eye:gy,eyedropperVariant:wy,eyeOff:by,eyeOffOutline:vy,eyeOutline:yy,fire:xy,flare:Sy,floppy:Cy,folder:Oy,fullscreen:Ey,gradientVertical:_y,helpCircle:ky,image:Ay,information:Ty,informationVariant:My,layers:Ny,link:Py,lock:Dy,lockOpenVariant:Ly,menuDown:Ry,newspaperVariantOutline:jy,paletteSwatch:Hy,panVertical:Iy,phone:By,plus:$y,plusBox:zy,powerPlug:Fy,refresh:Wy,rhombusOutline:Uy,tag:qy,target:Gy,targetVariant:Ky,textBoxMultiple:Zy,trayArrowDown:Jy,unfoldLessHorizontal:Yy,unfoldMoreHorizontal:Xy,viewDayOutline:Qy,viewGridPlus:e2,web:t2,xml:n2},eE="gs-cmp-icon",Kr=Ao(function({className:e,icon:n,size:r,rotate:i,horizontal:o,vertical:s}){var f;const a=(f=QO())==null?void 0:f.sdkCustomIcons,l=(a==null?void 0:a[n])||(xu==null?void 0:xu[n])||n,c=[o&&"scaleX(-1)",s&&"scaleY(-1)",i&&`rotate(${i}deg)`].filter(d=>!!d).join(" ");if(!l)return null;const u=ki(eE,e);return l.startsWith("<svg")||l.startsWith("<?xml")?P.jsx(WC,{className:u,style:{transform:c||void 0},svg:l,iconSize:r}):P.jsx(f2,{className:u,path:l,size:r,rotate:i,horizontal:o,vertical:s})});var am=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(am||{});const Su=new WeakMap,tE=(t,e)=>{Su.set(t,e)},nE=t=>{Su.delete(t)},Cu=t=>Su.get(t),$a=t=>{const e=t.target,n=e.closest(".tox"),r=e.matches(".ephox-snooker-resizer-bar");(n||r)&&t.stopPropagation()},lm=t=>{t.stopPropagation(),t.preventDefault()},rE=(t,e)=>{const n=t.getDoc(),r=t.getWin();if(e!=null&&e.event){const{event:i}=e,{clientX:o,clientY:s}=i;let a;if(n.caretRangeFromPoint)a=n.caretRangeFromPoint(o,s);else if(n.caretPositionFromPoint){const l=n.caretPositionFromPoint(o,s);a=n.createRange(),a==null||a.setStart(l.offsetNode,l.offset)}if(a){const l=r.getSelection();l==null||l.removeAllRanges(),l==null||l.addRange(a),t.selection.setRng(a)}}else t.execCommand("SelectAll")},iE=t=>{var c,u;const{el:e,editor:n,componentView:r}=t,i=n.runCommand(Kt.getStateTheme),o=r.model,s={target:e,inline:!0,skin:(i==null?void 0:i.theme)===am.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"},a=((u=(c=t.pluginOpts)==null?void 0:c.loadConfig)==null?void 0:u.call(c,{config:s,editor:n,componentView:r,component:o}))||{};return{...s,...a}},cm=(t,e=document)=>new Promise((n,r)=>{const i=Array.isArray(t)?[...t]:[t],{head:o}=e,s=a=>{if(a.length){const l=e.createElement("script");l.src=a.shift(),l.onload=s.bind(null,a),l.onerror=r,o.appendChild(l)}else n()};s(i)}),oE="rteTinyMce",sE=Jn(function(t,e={}){const n={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...e},{cdnScript:r}=n,i=t.Canvas.events,o=async(l,c)=>{const u=l.ownerDocument,f=u.defaultView,d=c==null?void 0:c.view;if(!f||!d){console.warn("Missing required data",{win:f,componentView:d});return}const p=iE({el:l,editor:t,componentView:d,pluginOpts:n}),m=(await f.tinymce.init(p))[0];if(!m)return;const y=(await window.tinymce.init({...p,target:document.createElement("div")}))[0];return m.ui.show(),u.body.addEventListener("mousedown",$a),document.body.addEventListener("mousedown",$a),m.on("Change",()=>Rv(l)),m.on("blur",()=>m.ui.show()),m.on("OpenWindow",function(){var O;const w=(O=u.querySelector(".tox-dialog"))==null?void 0:O.closest(".tox");w&&(w==null?void 0:w.ownerDocument)!==document&&(document.body.appendChild(w),m.once("CloseWindow",()=>{w&&w.ownerDocument===document&&u.body.appendChild(w)}))}),l.addEventListener("dragstart",lm,{capture:!0}),t.runCommand(Kt.setStateContextMenu,{enabled:!1}),rE(m,c),{rteEditor:m,rteEditorShallow:y}},s=(l,c)=>{l.ownerDocument.body.removeEventListener("mousedown",$a),document.body.removeEventListener("mousedown",$a),l.removeEventListener("dragstart",lm,{capture:!0}),t.runCommand(Kt.setStateContextMenu,{enabled:!0}),c.rteEditor.destroy(),c.rteEditorShallow.destroy()};t.on(i.frameLoad,async({window:l})=>{cm(r,l.document)}),t.onReady(()=>{cm(r,document)}),t.setCustomRte({parseContent:!0,async enable(l,c,u){const f=Cu(l);if(f)return f.rteEditor;const d=await o(l,u);return d&&tE(l,d),d==null?void 0:d.rteEditor},disable(l){const c=Cu(l);c&&(nE(l),s(l,c))},getContent(l){var u,f;const c=Cu(l);return c?(f=(u=c.rteEditor).getContent)==null?void 0:f.call(u):l.innerHTML}});const a=jv(t,n.enableOnClick);Yn({editor:t,licenseKey:n.licenseKey,plan:vt.startup,pluginName:oE,cleanup:()=>{t.RichTextEditor.customRte=void 0,a()}})});function Ge(t){this.content=t}Ge.prototype={constructor:Ge,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,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Ge(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ge(n)},addToStart:function(t,e){return new Ge([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ge(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Ge(i)},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=Ge.from(t),t.size?new Ge(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ge.from(t),t.size?new Ge(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ge.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}},Ge.from=function(t){if(t instanceof Ge)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ge(e)};function um(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=um(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function fm(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=fm(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class D{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,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new D(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new D(r,i)}cutByIndex(e,n){return e==n?D.empty:e==0&&n==this.content.length?this:new D(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new D(i,o)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(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 i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return um(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return fm(this,e,n,r)}findIndex(e,n=-1){if(e==0)return za(0,e);if(e==this.size)return za(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?za(r+1,s):za(r,i);i=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 D.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new D(n||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Ou={index:0,offset:0};function za(t,e){return Ou.index=t,Ou.offset=e,Ou}function Fa(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(!Fa(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Fa(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class _e{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}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&&Fa(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 i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}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 _e.none;if(e instanceof _e)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}_e.none=[];class Wa extends Error{}class F{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=pm(this.content,e+this.openStart,n);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(dm(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 F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(D.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new F(e,r,i)}}F.empty=new F(D.empty,0,0);function dm(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=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,o.copy(dm(o.content,e-i-1,n-i-1)))}function pm(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=pm(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function aE(t,e,n){if(n.openStart>t.depth)throw new Wa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Wa("Inconsistent open depths");return hm(t,e,n,0)}function hm(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=hm(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Jr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=lE(n,t);return Jr(o,gm(t,s,a,e,r))}else return Jr(o,Ua(t,e,r))}function mm(t,e){if(!e.type.compatibleContent(t.type))throw new Wa("Cannot join "+e.type.name+" onto "+t.type.name)}function Eu(t,e,n){let r=t.node(n);return mm(r,e.node(n)),r}function Zr(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 Ko(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Zr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Zr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Zr(e.nodeBefore,r)}function Jr(t,e){return t.type.checkContent(e),t.copy(e)}function gm(t,e,n,r,i){let o=t.depth>i&&Eu(t,e,i+1),s=r.depth>i&&Eu(n,r,i+1),a=[];return Ko(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(mm(o,s),Zr(Jr(o,gm(t,e,n,r,i+1)),a)):(o&&Zr(Jr(o,Ua(t,e,i+1)),a),Ko(e,n,i,a),s&&Zr(Jr(s,Ua(n,r,i+1)),a)),Ko(r,null,i,a),new D(a)}function Ua(t,e,n){let r=[];if(Ko(null,t,n,r),t.depth>n){let i=Eu(t,e,n+1);Zr(Jr(i,Ua(t,e,n+1)),r)}return Ko(e,null,n,r),new D(r)}function lE(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(D.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Zo{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],i=e.child(n);return r?e.child(n).cut(r):i}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],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return _e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 qa(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=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new Zo(n,r,o)}static resolveCached(e,n){let r=bm.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else bm.set(e,r=new cE);let i=r.elts[r.i]=Zo.resolve(e,n);return r.i=(r.i+1)%uE,i}}class cE{constructor(){this.elts=[],this.i=0}}const uE=12,bm=new WeakMap;class qa{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 fE=Object.create(null);let Yr=class zf{constructor(e,n,r,i=_e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||D.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,i=0){this.content.nodesBetween(e,n,r,i,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,i){return this.content.textBetween(e,n,r,i)}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&&Fa(this.attrs,n||e.defaultAttrs||fE)&&_e.sameSet(this.marks,r||_e.none)}copy(e=null){return e==this.content?this:new zf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new zf(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 F.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new F(c,i.depth-s,o.depth-s)}replace(e,n,r){return aE(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+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 i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Zo.resolveCached(this,e)}resolveNoCache(e){return Zo.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),vm(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=D.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.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=_e.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(!_e.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 i=D.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Yr.prototype.text=void 0;class Ga extends Yr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vm(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 Ga(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ga(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 vm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new dE(e,n);if(r.next==null)return Xr.empty;let i=ym(r);r.next&&r.err("Unexpected trailing text");let o=yE(vE(i));return wE(o,r),o}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 i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}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 i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return D.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=o(f,a.concat(u));if(d)return d}}return null}return o(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 i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.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 i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
341
+ `)}}Xr.empty=new Xr(!0);class dE{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 ym(t){let e=[];do e.push(pE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function pE(t){let e=[];do e.push(hE(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function hE(t){let e=bE(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=mE(t,e);else break;return e}function wm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function mE(t,e){let n=wm(t),r=n;return t.eat(",")&&(t.next!="}"?r=wm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function gE(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function bE(t){if(t.eat("(")){let e=ym(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=gE(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 vE(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();i(o(s.expr,l),u),l=u}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),i(o(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function xm(t,e){return e-t}function Sm(t,e){let n=[];return r(e),n.sort(xm);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function yE(t){let e=Object.create(null);return n(Sm(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Sm(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Xr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(xm);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function wE(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Cm(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 Om(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Em(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function _m(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new SE(t,r,e[r]);return n}let km=class hb{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=_m(e,r.attrs),this.defaultAttrs=Cm(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==Xr.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:Om(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yr(this,this.computeAttrs(e),D.from(n),_e.setFrom(r))}createChecked(e=null,n,r){return n=D.from(n),this.checkContent(n),new Yr(this,this.computeAttrs(e),n,_e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=D.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(D.empty,!0);return o?new Yr(this,e,n.append(o),_e.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){Em(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:_e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new hb(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function xE(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class SE{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?xE(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ka{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=_m(e,i.attrs),this.excluded=null;let o=Cm(this.attrs);this.instance=o?new _e(this,o):null}create(e=null){return!e&&this.instance?this.instance:new _e(this,Om(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ka(o,i++,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){Em(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class CE{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ge.from(e.nodes),n.marks=Ge.from(e.marks||{}),this.nodes=km.compile(this.spec.nodes,this),this.marks=Ka.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Xr.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Am(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Am(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,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof km){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,i)}text(e,n){let r=this.nodes.text;return new Ga(r,r.defaultAttrs,e,_e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Yr.fromJSON(this,e)}markFromJSON(e){return _e.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Am(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function OE(t){return t.tag!=null}function EE(t){return t.style!=null}let _u=class Ff{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(OE(i))this.tags.push(i);else if(EE(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Pm(this,n,!1);return r.addAll(e,_e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Pm(this,n,!0);return r.addAll(e,_e.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(AE(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vm(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vm(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ff(e,Ff.schemaRules(e)))}};const Tm={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},_E={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Mm={ol:!0,ul:!0},Za=1,Ja=2,Jo=4;function Nm(t,e,n){return e!=null?(e?Za:0)|(e==="full"?Ja:0):t&&t.whitespace=="pre"?Za|Ja:n&~Jo}class Ya{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=_e.none,this.match=o||(s&Jo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(D.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Za)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=D.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(D.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&&!Tm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Pm{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,s=Nm(null,n.preserveWhitespace,0)|(r?Jo:0);i?o=new Ya(i.type,i.attrs,_e.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Ya(null,null,_e.none,!0,null,s):o=new Ya(e.schema.topNodeType,null,_e.none,!0,null,s),this.nodes=[o],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,i=this.top;if(i.options&Ja||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&Za)i.options&Ja?r=r.replace(/\r\n?/g,`
342
+ `):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 o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.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 i=e.nodeName.toLowerCase(),o;Mm.hasOwnProperty(i)&&this.parser.normalizeLists&&kE(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:_E.hasOwnProperty(i))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 a,l=this.top,c=this.needsBlock;if(Tm.hasOwnProperty(i))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.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),a&&this.sync(l),this.needsBlock=c}else{let a=this.readStyles(e,n);a&&this.addElementByRule(e,s,a,s.consuming===!1?o:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
343
+ `),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 i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,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 l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=s,!a.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=_e.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):Dm(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Nm(e,o,s.options);s.options&Jo&&s.content.length==0&&(a|=Jo);let l=_e.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Dm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Ya(e,n,l,i,null,a)),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 i=r.length-1;i>=0;i--)e+=r[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}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 kE(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Mm.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function AE(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Vm(t){let e={};for(let n in t)e[n]=t[n];return e}function Dm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class Qr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ku(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Xa(ku(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Xa(ku(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Xa(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Qr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Lm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Lm(e.marks)}}function Lm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ku(t){return t.document||window.document}const Rm=new WeakMap;function TE(t){let e=Rm.get(t);return e===void 0&&Rm.set(t,e=ME(t)),e}function ME(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 i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Xa(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 i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=TE(r))&&o.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=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),c[f]):l.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let d=e[f];if(d===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=Xa(t,d,n,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const jm=65535,Hm=Math.pow(2,16);function NE(t,e){return t+e*Hm}function Im(t){return t&jm}function PE(t){return(t-(t&jm))/Hm}const Bm=1,$m=2,Qa=4,zm=8;class Au{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zm)>0}get deletedBefore(){return(this.delInfo&(Bm|Qa))>0}get deletedAfter(){return(this.delInfo&($m|Qa))>0}get deletedAcross(){return(this.delInfo&Qa)>0}}class kt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&kt.empty)return kt.empty}recover(e){let n=0,r=Im(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+PE(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 i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+o],u=this.ranges[a+s],f=l+c;if(e<=f){let d=c?e==l?-1:e==f?1:n:n,p=l+i+(d<0?0:u);if(r)return p;let h=e==(n<0?l:f)?null:NE(a/3,e-l),m=e==l?$m:e==f?Bm:Qa;return(n<0?e!=l:e!=f)&&(m|=zm),new Au(p,m,h)}i+=u-c}return r?e+i:new Au(e+i,0,null)}touches(e,n){let r=0,i=Im(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+o],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),o+=u-c}}invert(){return new kt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?kt.empty:new kt(e<0?[0,-e,0]:[0,0,e])}}kt.empty=new kt([]);class Ki{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Ki(this.maps,this.mirror,e,n)}copy(){return new Ki(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 i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i: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 i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Ki;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 i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Au(e,i,null)}}const Tu=Object.create(null);class Qe{getMap(){return kt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Tu[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 Tu)throw new RangeError("Duplicate use of step JSON ID "+e);return Tu[e]=n,n.prototype.jsonID=e,n}}class je{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new je(e,null)}static fail(e){return new je(null,e)}static fromReplace(e,n,r,i){try{return je.ok(e.replace(n,r,i))}catch(o){if(o instanceof Wa)return je.fail(o.message);throw o}}}function Mu(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Mu(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return D.fromArray(r)}class ur extends Qe{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),i=r.node(r.sharedDepth(this.to)),o=new F(Mu(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return je.fromReplace(e,this.from,this.to,o)}invert(){return new xn(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 ur(n.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(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 ur(n.from,n.to,e.markFromJSON(n.mark))}}Qe.jsonID("addMark",ur);class xn extends Qe{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 F(Mu(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return je.fromReplace(e,this.from,this.to,r)}invert(){return new ur(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 xn(n.pos,r.pos,this.mark)}merge(e){return e instanceof xn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xn(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 xn(n.from,n.to,e.markFromJSON(n.mark))}}Qe.jsonID("removeMark",xn);class fr extends Qe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return je.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return je.fromReplace(e,this.pos,this.pos+1,new F(D.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 i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new fr(this.pos,n.marks[i]);return new fr(this.pos,this.mark)}}return new Zi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fr(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 fr(n.pos,e.markFromJSON(n.mark))}}Qe.jsonID("addNodeMark",fr);class Zi extends Qe{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return je.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return je.fromReplace(e,this.pos,this.pos+1,new F(D.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zi(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 Zi(n.pos,e.markFromJSON(n.mark))}}Qe.jsonID("removeNodeMark",Zi);class et extends Qe{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Nu(e,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new kt([this.from,this.to-this.from,this.slice.size])}invert(e){return new et(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 et(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof et)||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?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new et(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?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new et(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 et(n.from,n.to,F.fromJSON(e,n.slice),!!n.structure)}}Qe.jsonID("replace",et);class Ke extends Qe{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Nu(e,this.from,this.gapFrom)||Nu(e,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return je.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?je.fromReplace(e,this.from,this.to,r):je.fail("Content does not fit in gap")}getMap(){return new kt([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 Ke(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),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Ke(n.pos,r.pos,i,o,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 Ke(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}Qe.jsonID("replaceAround",Ke);function Nu(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function VE(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),p=Math.min(c+l.nodeSize,n),h=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(h)||(s&&s.to==d&&s.mark.eq(f[m])?s.to=p:i.push(s=new xn(d,p,f[m])));a&&a.to==d?a.to=p:o.push(a=new ur(d,p,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function DE(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof Ka){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],d;for(let p=0;p<i.length;p++){let h=i[p];h.step==o-1&&f.eq(i[p].style)&&(d=h)}d?(d.to=c,d.step=o):i.push({style:f,from:Math.max(a,e),to:c,step:o})}}}),i.forEach(s=>t.step(new xn(s.from,s.to,s.style)))}function Pu(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)s.push(new et(a,u,F.empty));else{r=f;for(let d=0;d<c.marks.length;d++)n.allowsMarkType(c.marks[d].type)||t.step(new xn(a,u,c.marks[d]));if(i&&c.isText&&n.whitespace!="pre"){let d,p=/\r?\n|\r/g,h;for(;d=p.exec(c.text);)h||(h=new F(D.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new et(a+d.index,a+d.index+d[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(D.empty,!0);t.replace(a,a,new F(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function LE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function el(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),s=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(o,s,n))return r;if(r==0||i.type.spec.isolating||!LE(i,o,s))break}return null}function RE(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,c=a,u=D.empty,f=0;for(let h=o,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=D.from(r.node(h).copy(u)),f++):l--;let d=D.empty,p=0;for(let h=o,m=!1;h>n;h--)m||i.after(h+1)<i.end(h)?(m=!0,d=D.from(i.node(h).copy(d)),p++):c++;t.step(new Ke(l,c,s,a,new F(u.append(d),f,p),u.size-f,!0))}function Fm(t,e,n=null,r=t){let i=jE(t,e),o=i&&HE(r,e);return o?i.map(Wm).concat({type:e,attrs:n}).concat(o.map(Wm)):null}function Wm(t){return{type:t,attrs:null}}function jE(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function HE(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function IE(t,e,n){let r=D.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=D.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Ke(i,o,i,o,new F(r,0,0),n.length,!0))}function BE(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&$E(t.doc,t.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&qm(t,s,a,o),Pu(t,t.mapping.slice(o).map(a,1),r,void 0,c===null);let u=t.mapping.slice(o),f=u.map(a,1),d=u.map(a+s.nodeSize,1);return t.step(new Ke(f,d,f+1,d-1,new F(D.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Um(t,s,a,o),!1}})}function Um(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function qm(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
344
+ `))}})}function $E(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function zE(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ke(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new F(D.from(s),0,0),1,!0))}function Ji(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let f=i.node(c),d=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function FE(t,e,n=1,r){let i=t.doc.resolve(e),o=D.empty,s=D.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){o=D.from(i.node(a).copy(o));let u=r&&r[c];s=D.from(u?u.type.create(u.attrs,s):i.node(a).copy(s))}t.step(new et(e,e,new F(o.append(s),n,n),!0))}function tl(t,e){let n=t.resolve(e),r=n.index();return UE(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function WE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function UE(t,e){return!!(t&&e&&!t.isLeaf&&WE(t,e))}function qE(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);qm(t,u.node(),u.before(),a)}s.inlineContent&&Pu(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new et(c,l.map(e+n,-1),F.empty,!0)),r===!0){let u=t.doc.resolve(c);Um(t,u.node(),u.before(),t.steps.length)}return t}function GE(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 i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function KE(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(l,l,i);else{let f=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Vu(t,e,n=e,r=F.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Gm(i,o,r)?new et(e,n,r):new ZE(i,o,r).fit()}function Gm(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ZE{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=D.from(e.node(i).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,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new F(o,s,a);return e>-1?new Ke(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new et(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Du(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(s?c.matchType(s.type)||(f=c.fillBefore(D.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:f};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Du(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Du(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new F(Yo(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new F(Yo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));f=f.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),g=f.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(f=g,u.push(Km(m.mark(d.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=Xo(this.placed,n,D.from(u)),this.frontier[n].match=f,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=h?e==0?F.empty:new F(Yo(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new F(Yo(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||!Lu(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,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Lu(e,n,i,r,o);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Lu(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?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=Xo(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Xo(this.placed,this.depth,D.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(D.empty,!0);n.childCount&&(this.placed=Xo(this.placed,this.frontier.length,n))}}function Yo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Yo(t.firstChild.content,e-1,n)))}function Xo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Xo(t.lastChild.content,e-1,n)))}function Du(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Km(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Km(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(D.empty,!0)))),t.copy(r)}function Lu(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!JE(n,o.content,s)?a:null}function JE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function YE(t){return t.spec.defining||t.spec.definingForContent}function XE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Gm(i,o,r))return t.step(new et(e,n,r));let s=Jm(i,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let d=i.depth,p=i.pos-1;d>0;d--,p--){let h=i.node(d).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(d)>-1?a=d:i.before(d)==p&&s.splice(1,0,-d)}let l=s.indexOf(a),c=[],u=r.openStart;for(let d=r.content,p=0;;p++){let h=d.firstChild;if(c.push(h),p==r.openStart)break;d=h.content}for(let d=u-1;d>=0;d--){let p=c[d],h=YE(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))u=d;else if(h||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let g=s[(m+l)%s.length],y=!0;g<0&&(y=!1,g=-g);let w=i.node(g-1),x=i.index(g-1);if(w.canReplaceWith(x,x,h.type,h.marks))return t.replace(i.before(g),y?o.after(g):n,new F(Zm(r.content,0,r.openStart,p),p,r.openEnd))}}let f=t.steps.length;for(let d=s.length-1;d>=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let p=s[d];p<0||(e=i.before(p),n=o.after(p))}}function Zm(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Zm(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(D.empty,!0))}return t}function QE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=GE(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new F(D.from(r),0,0))}function e_(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=Jm(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Jm(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class Yi extends Qe{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 je.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return je.fromReplace(e,this.pos,this.pos+1,new F(D.from(i),0,n.isLeaf?0:1))}getMap(){return kt.empty}invert(e){return new Yi(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 Yi(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 Yi(n.pos,n.attr,n.value)}}Qe.jsonID("attr",Yi);class Qo extends Qe{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return je.ok(r)}getMap(){return kt.empty}invert(e){return new Qo(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 Qo(n.attr,n.value)}}Qe.jsonID("docAttr",Qo);let Xi=class extends Error{};Xi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Xi.prototype=Object.create(Error.prototype),Xi.prototype.constructor=Xi,Xi.prototype.name="TransformError";class Ym{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ki}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xi(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=F.empty){let i=Vu(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new F(D.from(r),0,0))}delete(e,n){return this.replace(e,n,F.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return XE(this,e,n,r),this}replaceRangeWith(e,n,r){return QE(this,e,n,r),this}deleteRange(e,n){return e_(this,e,n),this}lift(e,n){return RE(this,e,n),this}join(e,n=1){return qE(this,e,n),this}wrap(e,n){return IE(this,e,n),this}setBlockType(e,n=e,r,i=null){return BE(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return zE(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Yi(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qo(e,n)),this}addNodeMark(e,n){return this.step(new fr(e,n)),this}removeNodeMark(e,n){if(!(n instanceof _e)){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 Zi(e,n)),this}split(e,n=1,r){return FE(this,e,n,r),this}addMark(e,n,r){return VE(this,e,n,r),this}removeMark(e,n,r){return DE(this,e,n,r),this}clearIncompatible(e,n,r){return Pu(this,e,n,r),this}}const Ru=Object.create(null);class ge{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Xm(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=F.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(o);e.replaceRange(u.map(l.pos),u.map(c.pos),a?F.empty:n),a==0&&tg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),tg(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new be(e):Qi(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Qi(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Qi(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new At(e.node(0))}static atStart(e){return Qi(e,e,0,0,1)||new At(e)}static atEnd(e){return Qi(e,e,e.content.size,e.childCount,-1)||new At(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ru[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 Ru)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ru[e]=n,n.prototype.jsonID=e,n}getBookmark(){return be.between(this.$anchor,this.$head).getBookmark()}}ge.prototype.visible=!0;class Xm{constructor(e,n){this.$from=e,this.$to=n}}let Qm=!1;function eg(t){!Qm&&!t.parent.inlineContent&&(Qm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class be extends ge{constructor(e,n=e){eg(e),eg(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 ge.near(r);let i=e.resolve(n.map(this.anchor));return new be(i.parent.inlineContent?i:r,r)}replace(e,n=F.empty){if(super.replace(e,n),n==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof be&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new nl(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 be(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=ge.findFrom(n,r,!0)||ge.findFrom(n,-r,!0);if(o)n=o.$head;else return ge.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ge.findFrom(e,-r,!0)||ge.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new be(e,n)}}ge.jsonID("text",be);class nl{constructor(e,n){this.anchor=e,this.head=n}map(e){return new nl(e.map(this.anchor),e.map(this.head))}resolve(e){return be.between(e.resolve(this.anchor),e.resolve(this.head))}}class de extends ge{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:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?ge.near(o):new de(o)}content(){return new F(D.from(this.node),0,0)}eq(e){return e instanceof de&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ju(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new de(e.resolve(n.anchor))}static create(e,n){return new de(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}de.prototype.visible=!1,ge.jsonID("node",de);class ju{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new nl(r,r):new ju(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&de.isSelectable(r)?new de(n):ge.near(n)}}class At extends ge{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=F.empty){if(n==F.empty){e.delete(0,e.doc.content.size);let r=ge.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new At(e)}map(e){return new At(e)}eq(e){return e instanceof At}getBookmark(){return t_}}ge.jsonID("all",At);const t_={map(){return this},resolve(t){return new At(t)}};function Qi(t,e,n,r,i,o=!1){if(e.inlineContent)return be.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&de.isSelectable(a))return de.create(t,n-(i<0?a.nodeSize:0))}else{let l=Qi(t,a,n+i,i<0?a.childCount:0,i,o);if(l)return l}n+=a.nodeSize*i}return null}function tg(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof et||i instanceof Ke))return;let o=t.mapping.maps[r],s;o.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(ge.near(t.doc.resolve(s),n))}const ng=1,rl=2,rg=4;class n_ extends Ym{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|ng)&~rl,this.storedMarks=null,this}get selectionSet(){return(this.updated&ng)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=rl,this}ensureMarks(e){return _e.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&rl)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~rl,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)||_e.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),this.selection.empty||this.setSelection(ge.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|=rg,this}get scrolledIntoView(){return(this.updated&rg)>0}}function ig(t,e){return!e||!t?t:t.bind(e)}class es{constructor(e,n,r){this.name=e,this.init=ig(n.init,r),this.apply=ig(n.apply,r)}}const r_=[new es("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new es("selection",{init(t,e){return t.selection||ge.atStart(e.doc)},apply(t){return t.selection}}),new es("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new es("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Hu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=r_.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 es(r.key,r.spec.state,r))})}}class eo{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 i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new eo(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new n_(this)}static create(e){let n=new Hu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new eo(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Hu(this.schema,e.plugins),r=n.fields,i=new eo(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}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 i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.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 i=new Hu(e.schema,e.plugins),o=new eo(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Yr.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ge.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[s.name]=c.fromJSON.call(l,e,n[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function og(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=og(i,e,{})),n[r]=i}return n}class ts{constructor(e){this.spec=e,this.props={},e.props&&og(e.props,this,this.props),this.key=e.key?e.key.key:sg("plugin")}getState(e){return e[this.key]}}const Iu=Object.create(null);function sg(t){return t in Iu?t+"$"+ ++Iu[t]:(Iu[t]=0,t+"$")}class ns{constructor(e="key"){this.key=sg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ag=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function i_(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const o_=(t,e,n)=>{let r=i_(t,n);if(!r)return!1;let i=lg(r);if(!i){let s=r.blockRange(),a=s&&el(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(hg(t,i,e,-1))return!0;if(r.parent.content.size==0&&(to(o,"end")||de.isSelectable(o)))for(let s=r.depth;;s--){let a=Vu(t.doc,r.before(s),r.after(s),F.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(to(o,"end")?ge.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):de.create(l.doc,i.pos-o.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function to(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 s_=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=lg(r)}let s=o&&o.nodeBefore;return!s||!de.isSelectable(s)?!1:(e&&e(t.tr.setSelection(de.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function lg(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 a_(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const l_=(t,e,n)=>{let r=a_(t,n);if(!r)return!1;let i=cg(r);if(!i)return!1;let o=i.nodeAfter;if(hg(t,i,e,1))return!0;if(r.parent.content.size==0&&(to(o,"start")||de.isSelectable(o))){let s=Vu(t.doc,r.before(),r.after(),F.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(to(o,"start")?ge.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):de.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},c_=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=cg(r)}let s=o&&o.nodeAfter;return!s||!de.isSelectable(s)?!1:(e&&e(t.tr.setSelection(de.create(t.doc,o.pos)).scrollIntoView()),!0)};function cg(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 u_=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
345
+ `).scrollIntoView()),!0)};function Bu(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 ug=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Bu(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(ge.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},f_=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof At||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Bu(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(be.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},fg=(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 o=n.before();if(Ji(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&el(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function dg(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof de&&e.selection.node.isBlock)return!r.parentOffset||!Ji(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Bu(r.node(p-1).contentMatchAt(r.indexAfter(p-1)));let m=t&&t(i.parent,l,r);o.unshift(m||(l&&a?{type:a}:null)),s=p;break}else{if(p==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof be||e.selection instanceof At)&&u.deleteSelection();let f=u.mapping.map(r.pos),d=Ji(u.doc,f,o.length,o);if(d||(o[0]=a?{type:a}:null,d=Ji(u.doc,f,o.length,o)),u.split(f,o.length,o),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),h=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const d_=dg(),pg=(t,e)=>(e&&e(t.tr.setSelection(new At(t.doc))),!0);function p_(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||tl(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function hg(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&p_(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(n){let p=e.pos+o.nodeSize,h=D.empty;for(let y=s.length-1;y>=0;y--)h=D.from(s[y].create(null,h));h=D.from(i.copy(h));let m=t.tr.step(new Ke(e.pos-1,p,e.pos,p,new F(h,1,0),s.length,!0)),g=m.doc.resolve(p+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&tl(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&l?null:ge.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),d=f&&el(f);if(d!=null&&d>=e.depth)return n&&n(t.tr.lift(f,d).scrollIntoView()),!0;if(c&&to(o,"start",!0)&&to(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let y=D.empty;for(let x=h.length-1;x>=0;x--)y=D.from(h[x].copy(y));let w=t.tr.step(new Ke(e.pos-h.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new F(y,h.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function mg(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(be.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const h_=mg(-1),m_=mg(1);function g_(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[o];n.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];o.setBlockType(a,l,t,e)}r(o.scrollIntoView())}return!0}}function b_(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:o,$to:s}=e[i],a=o.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(o.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function ei(t,e=null,n){let r=n!==!1;return function(i,o){let{empty:s,$cursor:a,ranges:l}=i.selection;if(s&&!a||!b_(i.doc,l,t,r))return!1;if(o)if(a)t.isInSet(i.storedMarks||a.marks())?o(i.tr.removeStoredMark(t)):o(i.tr.addStoredMark(t.create(e)));else{let c,u=i.tr;c=!l.some(f=>i.doc.rangeHasMark(f.$from.pos,f.$to.pos,t));for(let f=0;f<l.length;f++){let{$from:d,$to:p}=l[f];if(!c)u.removeMark(d.pos,p.pos,t);else{let h=d.pos,m=p.pos,g=d.nodeAfter,y=p.nodeBefore,w=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,x=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;h+w<m&&(h+=w,m-=x),u.addMark(h,m,t.create(e))}}o(u.scrollIntoView())}return!0}}function rs(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let $u=rs(ag,o_,s_),gg=rs(ag,l_,c_);const $n={Enter:rs(u_,f_,fg,d_),"Mod-Enter":ug,Backspace:$u,"Mod-Backspace":$u,"Shift-Backspace":$u,Delete:gg,"Mod-Delete":gg,"Mod-a":pg},bg={"Ctrl-h":$n.Backspace,"Alt-Backspace":$n["Mod-Backspace"],"Ctrl-d":$n.Delete,"Ctrl-Alt-Backspace":$n["Mod-Delete"],"Alt-Delete":$n["Mod-Delete"],"Alt-d":$n["Mod-Delete"],"Ctrl-a":h_,"Ctrl-e":m_};for(let t in $n)bg[t]=$n[t];const v_=(typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1)?bg:$n;var il=200,ze=function(){};ze.prototype.append=function(e){return e.length?(e=ze.from(e),!this.length&&e||e.length<il&&this.leafAppend(e)||this.length<il&&e.leafPrepend(this)||this.appendInner(e)):this},ze.prototype.prepend=function(e){return e.length?ze.from(e).append(this):this},ze.prototype.appendInner=function(e){return new y_(this,e)},ze.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ze.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},ze.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},ze.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)},ze.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i},ze.from=function(e){return e instanceof ze?e:e&&e.length?new vg(e):ze.empty};var vg=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(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=il)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=il)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ze);ze.empty=new vg([]);var y_=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,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,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}(ze);const w_=500;class rn{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 i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new Sn(f.map));let p=f.step.map(i.slice(o)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Sn(h,void 0,void 0,c.length+u.length))),o--,h&&i.appendMap(h,o)}else s.maybeStep(f.step);if(f.selection)return a=i?f.selection.map(i.slice(o)):f.selection,l=new rn(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),d=new Sn(e.mapping.maps[u],f,n),p;(p=l&&l.merge(d))&&(d=p,u?o.pop():a=a.slice(0,a.length-1)),o.push(d),n&&(s++,n=void 0),i||(l=d)}let c=s-r.depth;return c>S_&&(a=x_(a,c),s-=c),new rn(a.append(o),s)}remapping(e,n){let r=new Ki;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new rn(this.items.append(e.map(n=>new Sn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(d=>{d.selection&&a--},i);let l=n;this.items.forEach(d=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=o.maps[p];if(d.step){let m=e.steps[p].invert(e.docs[p]),g=d.selection&&d.selection.map(o.slice(l+1,p));g&&a++,r.push(new Sn(h,m,g))}else r.push(new Sn(h))},i);let c=[];for(let d=n;d<s;d++)c.push(new Sn(o.maps[d]));let u=this.items.slice(0,i).append(c).append(r),f=new rn(u,a);return f.emptyItemCount()>w_&&(f=f.compress(this.items.length-r.length)),f}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,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let f=new Sn(c.invert(),l,u),d,p=i.length-1;(d=i.length&&i[p].merge(f))?i[p]=d:i.push(f)}}else s.map&&r--},this.items.length,0),new rn(ze.from(i.reverse()),o)}}rn.empty=new rn(ze.empty,0);function x_(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Sn{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Sn(n.getMap().invert(),n,this.selection)}}}class dr{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const S_=20;function C_(t,e,n,r){let i=n.getMeta(ti),o;if(i)return i.historyState;n.getMeta(__)&&(t=new dr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ti))return s.getMeta(ti).redo?new dr(t.done.addTransform(n,void 0,r,ol(e)),t.undone,yg(n.mapping.maps),t.prevTime,t.prevComposition):new dr(t.done,t.undone.addTransform(n,void 0,r,ol(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!O_(n,t.prevRanges)),c=s?zu(t.prevRanges,n.mapping):yg(n.mapping.maps);return new dr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,ol(e)),rn.empty,c,n.time,a??t.prevComposition)}else return(o=n.getMeta("rebased"))?new dr(t.done.rebased(n,o),t.undone.rebased(n,o),zu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new dr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),zu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function O_(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function yg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function zu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function E_(t,e,n){let r=ol(e),i=ti.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),l=new dr(n?a:o.remaining,n?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(ti,{redo:n,historyState:l})}let Fu=!1,wg=null;function ol(t){let e=t.plugins;if(wg!=e){Fu=!1,wg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Fu=!0;break}}return Fu}const ti=new ns("history"),__=new ns("closeHistory");function k_(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ts({key:ti,state:{init(){return new dr(rn.empty,rn.empty,null,0,-1)},apply(e,n,r){return C_(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Sg:r=="historyRedo"?Wu:null;return i?(n.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function xg(t,e){return(n,r)=>{let i=ti.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=E_(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const Sg=xg(!1,!0),Wu=xg(!0,!0);for(var pr={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:"'"},sl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},A_=typeof navigator<"u"&&/Mac/.test(navigator.platform),T_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ze=0;Ze<10;Ze++)pr[48+Ze]=pr[96+Ze]=String(Ze);for(var Ze=1;Ze<=24;Ze++)pr[Ze+111]="F"+Ze;for(var Ze=65;Ze<=90;Ze++)pr[Ze]=String.fromCharCode(Ze+32),sl[Ze]=String.fromCharCode(Ze);for(var Uu in pr)sl.hasOwnProperty(Uu)||(sl[Uu]=pr[Uu]);function M_(t){var e=A_&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||T_&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?sl:pr)[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 P_(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))N_?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function V_(t){let e=Object.create(null);for(let n in t)e[P_(n)]=t[n];return e}function qu(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 Gu(t){return new ts({props:{handleKeyDown:Cg(t)}})}function Cg(t){let e=V_(t);return function(n,r){let i=M_(r),o,s=e[qu(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[qu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=pr[r.keyCode])&&o!=i){let a=e[qu(o,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function Og(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let u=n.doc.resolve(s.start-2);l=new qa(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new qa(i,n.doc.resolve(o.end(s.depth)),s.depth)),a=!0}let c=Fm(l,t,e,s);return c?(r&&r(D_(n.tr,s,c,a,t).scrollIntoView()),!0):!1}}function D_(t,e,n,r,i){let o=D.empty;for(let u=n.length-1;u>=0;u--)o=D.from(n[u].type.create(n[u].attrs,o));t.step(new Ke(e.start-(r?2:0),e.end,e.start,e.end,new F(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,d=!0;u<f;u++,d=!1)!d&&Ji(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function L_(t,e){return function(n,r){let{$from:i,$to:o,node:s}=n.selection;if(s&&s.isBlock||i.depth<2||!i.sameParent(o))return!1;let a=i.node(-1);if(a.type!=t)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let f=D.empty,d=i.index(-1)?1:i.index(-2)?2:3;for(let y=i.depth-d;y>=i.depth-3;y--)f=D.from(i.node(y).copy(f));let p=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;f=f.append(D.from(t.createAndFill()));let h=i.before(i.depth-(d-1)),m=n.tr.replace(h,i.after(-p),new F(f,4-d,0)),g=-1;m.doc.nodesBetween(h,m.doc.content.size,(y,w)=>{if(g>-1)return!1;y.isTextblock&&y.content.size==0&&(g=w+1)}),g>-1&&m.setSelection(ge.near(m.doc.resolve(g))),r(m.scrollIntoView())}return!0}let l=o.pos==i.end()?a.contentMatchAt(0).defaultType:null,c=n.tr.delete(i.pos,o.pos),u=l?[null,{type:l}]:void 0;return Ji(c.doc,i.pos,2,u)?(r&&r(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function Ku(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?R_(e,n,t,o):j_(e,n,o):!0:!1}}function R_(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Ke(o-1,s,o,s,new F(D.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new qa(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const a=el(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(o,-1)-1;return tl(i.doc,l)&&i.join(l),e(i.scrollIntoView()),!0}function j_(t,e,n){let r=t.tr,i=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?D.empty:D.from(i))))return!1;let f=o.pos,d=f+s.nodeSize;return r.step(new Ke(f-(a?1:0),d+(l?1:0),f+1,d-1,new F((a?D.empty:D.from(i.copy(D.empty))).append(l?D.empty:D.from(i.copy(D.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function H_(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=D.from(c?t.create():null),f=new F(D.from(t.create(null,D.from(a.type.create(null,u)))),c?3:1,0),d=o.start,p=o.end;n(e.tr.step(new Ke(d-(c?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}const Je=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},is=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zu=null;const zn=function(t,e,n){let r=Zu||(Zu=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},I_=function(){Zu=null},ni=function(t,e,n,r){return n&&(Eg(t,e,n,r,-1)||Eg(t,e,n,r,1))},B_=/^(img|br|input|textarea|hr)$/i;function Eg(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Ft(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ss(t)||B_.test(t.nodeName)||t.contentEditable=="false")return!1;e=Je(t)+(i<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?Ft(t):0}else return!1}}function Ft(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $_(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=Ft(t)}else if(t.parentNode&&!ss(t))e=Je(t),t=t.parentNode;else return null}}function z_(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&&!ss(t))e=Je(t)+1,t=t.parentNode;else return null}}function F_(t,e,n){for(let r=e==0,i=e==Ft(t);r||i;){if(t==n)return!0;let o=Je(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==Ft(t)}}function ss(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 al=function(t){return t.focusNode&&ni(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ri(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function W_(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function U_(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ft(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ft(r.startContainer),r.startOffset)}}}const Cn=typeof navigator<"u"?navigator:null,_g=typeof document<"u"?document:null,hr=Cn&&Cn.userAgent||"",Ju=/Edge\/(\d+)/.exec(hr),kg=/MSIE \d/.exec(hr),Yu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),ht=!!(kg||Yu||Ju),mr=kg?document.documentMode:Yu?+Yu[1]:Ju?+Ju[1]:0,on=!ht&&/gecko\/(\d+)/i.test(hr);on&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const Xu=!ht&&/Chrome\/(\d+)/.exec(hr),tt=!!Xu,Ag=Xu?+Xu[1]:0,st=!ht&&!!Cn&&/Apple Computer/.test(Cn.vendor),no=st&&(/Mobile\/\w+/.test(hr)||!!Cn&&Cn.maxTouchPoints>2),Wt=no||(Cn?/Mac/.test(Cn.platform):!1),q_=Cn?/Win/.test(Cn.platform):!1,sn=/Android \d/.test(hr),as=!!_g&&"webkitFontSmoothing"in _g.documentElement.style,G_=as?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function K_(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 Fn(t,e){return typeof t=="number"?t:t[e]}function Z_(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 Tg(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=is(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,c=l?K_(o):Z_(a),u=0,f=0;if(e.top<c.top+Fn(r,"top")?f=-(c.top-e.top+Fn(i,"top")):e.bottom>c.bottom-Fn(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+Fn(i,"top")-c.top:e.bottom-c.bottom+Fn(i,"bottom")),e.left<c.left+Fn(r,"left")?u=-(c.left-e.left+Fn(i,"left")):e.right>c.right-Fn(r,"right")&&(u=e.right-c.right+Fn(i,"right")),u||f)if(l)o.defaultView.scrollBy(u,f);else{let d=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let h=a.scrollLeft-d,m=a.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function J_(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(o,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Mg(t.dom)}}function Mg(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=is(r));return e}function Y_({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Ng(n,r==0?0:r-e)}function Ng(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let ro=null;function X_(t){if(t.setActive)return t.setActive();if(ro)return t.focus(ro);let e=Mg(t);t.focus(ro==null?{get preventScroll(){return ro={preventScroll:!0},!0}}:void 0),ro||(ro=!1,Ng(e,0))}function Pg(t,e){let n,r=2e8,i,o=0,s=e.top,a=e.top,l,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let d;if(u.nodeType==1)d=u.getClientRects();else if(u.nodeType==3)d=zn(u).getClientRects();else continue;for(let p=0;p<d.length;p++){let h=d[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=u,r=m,i=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(o=f+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(o=f+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?Q_(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Pg(n,i)}function Q_(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=gr(r,1);if(o.top!=o.bottom&&Qu(e,o))return{node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:t,offset:0}}function Qu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function e3(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function t3(t,e,n){let{node:r,offset:i}=Pg(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function n3(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let a=t.docView.nearestDesc(o,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?i=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),s=!0),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}o=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Vg(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Qu(e,c))return Vg(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function r3(t,e){let n=t.dom.ownerDocument,r,i=0,o=U_(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Qu(e,c)||(s=Vg(t.dom,e,c),!s))return null}if(st)for(let c=s;r&&c;c=is(c))c.draggable&&(r=void 0);if(s=e3(s,e),r){if(on&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;as&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=n3(t,r,i,e))}a==null&&(a=t3(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Dg(t){return t.top<t.bottom||t.left<t.right}function gr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Dg(r))return r}return Array.prototype.find.call(n,Dg)||t.getBoundingClientRect()}const i3=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Lg(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=as||on;if(r.nodeType==3)if(s&&(i3.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=gr(zn(r,i,i),n);if(on&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=gr(zn(r,i-1,i-1),-1);if(c.top==l.top){let u=gr(zn(r,i,i+1),-1);if(u.top!=l.top)return ls(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,ls(gr(zn(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ft(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return ef(l.getBoundingClientRect(),!1)}if(o==null&&i<Ft(r)){let l=r.childNodes[i];if(l.nodeType==1)return ef(l.getBoundingClientRect(),!0)}return ef(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==Ft(r))){let l=r.childNodes[i-1],c=l.nodeType==3?zn(l,Ft(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ls(gr(c,1),!1)}if(o==null&&i<Ft(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?zn(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return ls(gr(c,-1),!0)}return ls(gr(r.nodeType==3?zn(r):r,-n),n>=0)}function ls(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 ef(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 Rg(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function o3(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Rg(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=Lg(t,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=zn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[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 s3=/[\u0590-\u08ac]/;function a3(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=t.domSelection();return a?!s3.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:s:Rg(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return d!=null&&(a.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let jg=null,Hg=null,Ig=!1;function l3(t,e,n){return jg==e&&Hg==n?Ig:(jg=e,Hg=n,Ig=n=="up"||n=="down"?o3(t,e,n):a3(t,e,n))}const Ut=0,Bg=1,ii=2,On=3;class cs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Ut,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 i=this.children[n];if(i==e)return r;r+=i.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 o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Je(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}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 i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof Fg){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof $g&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Je(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Je(o.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 i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&e<=c){let u=s+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let f=a;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=Je(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=Je(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}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,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],g=h+m.size;if(o>h&&s<g)return m.setSelection(e-h-m.border,n-h-m.border,r,i);h=g}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((on||st)&&e==n){let{node:p,offset:h}=a;if(p.nodeType==3){if(f=!!(h&&p.nodeValue[h-1]==`
346
+ `),f&&h==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Je(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=p.childNodes[h-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(on&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&st)&&ni(a.node,a.offset,u.anchorNode,u.anchorOffset)&&ni(l.node,l.offset,u.focusNode,u.focusOffset))return;let d=!1;if((c.extend||e==n)&&!f){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),d=!0}catch{}}if(!d){if(e>n){let h=a;a=l,l=h}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.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,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+o.border,l=s-o.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?ii:Bg,e==a&&n==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=On:o.markDirty(e-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?ii:On}r=s}this.dirty=ii}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ii:Bg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class $g extends cs{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==Ut&&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 c3 extends cs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}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 oi extends cs{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Qr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new oi(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&On||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=On&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ut){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ut}}slice(e,n,r){let i=oi.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=nf(o,n,s,r)),e>0&&(o=nf(o,0,e,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class br extends cs{constructor(e,n,r,i,o,s,a,l,c){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,o,s){let a=o.nodeViews[n.type.name],l,c=a&&a(n,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,f=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:f}=Qr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let d=u;return u=qg(u,r,n),c?l=new u3(e,n,r,i,u,f||null,d,c,o,s+1):n.isText?new ll(e,n,r,i,u,d,o):new br(e,n,r,i,u,f||null,d,o,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=()=>D.empty)}return e}matchesNode(e,n,r){return this.dirty==Ut&&e.eq(this.node)&&cl(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,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new d3(this,s&&s.node,e);m3(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?_e.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,f,d)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,f,d)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,u,f,p,e)||l.updateNextNode(c,u,f,e,d,i)||l.addNode(c,u,f,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ii)&&(s&&this.protectLocalComposition(e,s),Wg(this.contentDOM,this.children,e),no&&g3(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof be)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=b3(this.node.content,s,r-n,i-n);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new c3(this,o,n,i);e.input.compositionNodes.push(s),this.children=nf(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==On||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Ut}updateOuterDeco(e){if(cl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ug(this.dom,this.nodeDOM,tf(this.outerDeco,this.node,n),tf(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 zg(t,e,n,r,i){qg(r,e,t);let o=new br(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class ll extends br{constructor(e,n,r,i,o,s,a){super(e,n,r,i,o,null,s,a,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,i){return this.dirty==On||this.dirty!=Ut&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ut||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Ut,!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 i=this.node.cut(e,n),o=document.createTextNode(i.text);return new ll(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=On)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Fg extends cs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ut&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class u3 extends br{constructor(e,n,r,i,o,s,a,l,c,u){super(e,n,r,i,o,s,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==On)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 Wg(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=Gg(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(s instanceof oi){let l=r?r.previousSibling:t.lastChild;Wg(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=Gg(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const us=function(t){t&&(this.nodeName=t)};us.prototype=Object.create(null);const si=[new us];function tf(t,e,n){if(t.length==0)return si;let r=n?si[0]:new us,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new us(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&i.length==1&&i.push(r=new us(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Ug(t,e,n,r){if(n==si&&r==si)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],a=n[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=si[0]),i=l}f3(i,a||si[0],s)}return i}function f3(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):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function qg(t,e,n){return Ug(t,t,si,tf(e,n,t.nodeType!=1))}function cl(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 Gg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class d3{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=p3(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 i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Ut,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=oi.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==On&&s.dom==s.contentDOM&&(s.dirty=ii),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),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 i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof br){let c=this.preMatch.matched.get(l);if(c!=null&&c!=o)return!1;let u=l.dom,f,d=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=On&&cl(n,l.outerDeco));if(!d&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(l,e,n,r,i,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ii,f.updateChildren(i,s+1),f.dirty=Ut),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!cl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=br.create(this.top,n,r,i,o,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,o){let s=br.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new $g(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof oi;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof ll)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((st||tt)&&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 i=new Fg(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function p3(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof oi)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function h3(t,e){return t.type.side-e.type.side}function m3(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort(h3);for(let g=0;g<f.length;g++)n(f[g],c,!!l)}else n(u,c,!!l);let d,p;if(l)p=-1,d=l,l=null;else if(c<t.childCount)p=c,d=t.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=o&&a.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let h=o+d.nodeSize;if(d.isText){let g=h;s<i.length&&i[s].from<g&&(g=i[s].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<h&&(l=d.cut(g-o),d=d.cut(0,g-o),h=g,p=-1)}else for(;s<i.length&&i[s].to<h;)s++;let m=d.isInline&&!d.isLeaf?a.filter(g=>!g.inline):a.slice();r(d,m,e.forChild(o,d),p),o=h}}function g3(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 b3(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=n){if(o>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function nf(t,e,n,r,i){let o=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,u=a+=l.size;c>=n||u<=e?o.push(l):(c<e&&o.push(l.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>n&&o.push(l.slice(n-c,l.size,r)))}return o}function rf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(al(n)){for(l=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&de.isSelectable(f)&&i.parent&&!(f.isInline&&F_(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;c=new de(s==d?a:r.resolve(d))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,d=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);f=Math.min(f,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),d=Math.max(d,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(f<0)return null;[l,s]=d==t.state.selection.anchor?[d,f]:[f,d],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let f=e=="pointer"||t.state.selection.head<a.pos&&!o?1:-1;c=sf(t,u,a,f)}return c}function Kg(t){return t.editable?t.hasFocus():t0(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Wn(t,e=!1){let n=t.state.selection;if(Xg(t,n),!!Kg(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&tt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ni(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)y3(t);else{let{anchor:r,head:i}=n,o,s;Zg&&!(n instanceof be)&&(n.$from.parent.inlineContent||(o=Jg(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Jg(t,n.to))),t.docView.setSelection(r,i,t,e),Zg&&(o&&Yg(o),s&&Yg(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&v3(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Zg=st||tt&&Ag<63;function Jg(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(st&&i&&i.contentEditable=="false")return of(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return of(i);if(o)return of(o)}}function of(t){return t.contentEditable="true",st&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Yg(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function v3(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Kg(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function y3(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,Je(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&ht&&mr<=11&&(r.disabled=!0,r.disabled=!1)}function Xg(t,e){if(e instanceof de){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Qg(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Qg(t)}function Qg(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function sf(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||be.between(e,n,r)}function e0(t){return t.editable&&!t.hasFocus()?!1:t0(t)}function t0(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 w3(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ni(e.node,e.offset,n.anchorNode,n.anchorOffset)}function af(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ge.findFrom(o,e)}function vr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function n0(t,e,n){let r=t.state.selection;if(r instanceof be)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return vr(t,new be(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=af(t.state,e);return i&&i instanceof de?vr(t,i):!1}else if(!(Wt&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?de.isSelectable(o)?vr(t,new de(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):as?vr(t,new be(t.state.doc.resolve(e<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof de&&r.node.isInline)return vr(t,new be(e>0?r.$to:r.$from));{let i=af(t.state,e);return i?vr(t,i):!1}}}function ul(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fs(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function io(t,e){return e<0?x3(t):S3(t)}function x3(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(on&&n.nodeType==1&&r<ul(n)&&fs(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(fs(a,-1))i=n,o=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(r0(n))break;{let a=n.previousSibling;for(;a&&fs(a,-1);)i=n.parentNode,o=Je(a),a=a.previousSibling;if(a)n=a,r=ul(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?lf(t,n,r):i&&lf(t,i,o)}function S3(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=ul(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(fs(a,1))o=n,s=++r;else break}else{if(r0(n))break;{let a=n.nextSibling;for(;a&&fs(a,1);)o=a.parentNode,s=Je(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=ul(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&lf(t,o,s)}function r0(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function C3(t,e){for(;t&&e==t.childNodes.length&&!ss(t);)e=Je(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 O3(t,e){for(;t&&!e&&!ss(t);)e=Je(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 lf(t,e,n){if(e.nodeType!=3){let o,s;(s=C3(e,n))?(e=s,n=0):(o=O3(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(al(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Wn(t)},50)}function i0(t,e){let n=t.state.doc.resolve(e);if(!(tt||q_)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function o0(t,e,n){let r=t.state.selection;if(r instanceof be&&!r.empty||n.indexOf("s")>-1||Wt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=af(t.state,e);if(s&&s instanceof de)return vr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,a=r instanceof At?ge.near(s,e):ge.findFrom(s,e);return a?vr(t,a):!1}return!1}function s0(t,e){if(!(t.state.selection instanceof be))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function a0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function E3(t){if(!st||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;a0(t,r,"true"),setTimeout(()=>a0(t,r,"false"),20)}return!1}function _3(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function k3(t,e){let n=e.keyCode,r=_3(e);if(n==8||Wt&&n==72&&r=="c")return s0(t,-1)||io(t,-1);if(n==46&&!e.shiftKey||Wt&&n==68&&r=="c")return s0(t,1)||io(t,1);if(n==13||n==27)return!0;if(n==37||Wt&&n==66&&r=="c"){let i=n==37?i0(t,t.state.selection.from)=="ltr"?-1:1:-1;return n0(t,i,r)||io(t,i)}else if(n==39||Wt&&n==70&&r=="c"){let i=n==39?i0(t,t.state.selection.from)=="ltr"?1:-1:1;return n0(t,i,r)||io(t,i)}else{if(n==38||Wt&&n==80&&r=="c")return o0(t,-1,r)||io(t,-1);if(n==40||Wt&&n==78&&r=="c")return E3(t)||o0(t,1,r)||io(t,1);if(r==(Wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function l0(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;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")||Qr.fromSchema(t.state.schema),a=g0(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=h0[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
125
347
 
126
- `);return{dom:a,text:f,slice:e}}function El(n,e,t,i,r){let s=r.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(i||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||i,n)}),s)return e?new v(w.from(n.state.schema.text(e.replace(/\r\n?/g,`
127
- `))),0,0):v.empty;let h=n.someProp("clipboardTextParser",f=>f(e,r,i,n));if(h)l=h;else{let f=r.marks(),{schema:u}=n.state,p=lt.fromSchema(u);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(u.text(m,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=Tf(t),hn&&Af(o);let c=o&&o.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 f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Rt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Cf.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Of(Il(l,+d[1],+d[2]),d[4]);else if(l=v.maxOpen(kf(l.content,r),!0),l.openStart||l.openEnd){let h=0,f=0;for(let u=l.content.firstChild;h<l.openStart&&!u.type.spec.isolating;h++,u=u.firstChild);for(let u=l.content.lastChild;f<l.openEnd&&!u.type.spec.isolating;f++,u=u.lastChild);l=Il(l,h,f)}return n.someProp("transformPasted",h=>{l=h(l,n)}),l}const Cf=/^(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 kf(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=r.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Pl(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Rl(o[o.length-1],s.length));let d=Dl(l,a);o.push(d),r=r.matchType(d.type),s=a}}),o)return w.from(o)}return n}function Dl(n,e,t=0){for(let i=e.length-1;i>=t;i--)n=e[i].create(null,w.from(n));return n}function Pl(n,e,t,i,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let s=Pl(n,e,t,i.lastChild,r+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(r==n.length-1?t.type:n[r+1]))return i.copy(i.content.append(w.from(Dl(t,n,r+1))))}}function Rl(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Rl(n.lastChild,e-1)),i=n.contentMatchAt(n.childCount).fillBefore(w.empty,!0);return n.copy(t.append(i))}function gr(n,e,t,i,r,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),r<i-1&&(l=gr(l,e,t,i,r+1,s)),r>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=r).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(w.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Il(n,e,t){return e<n.openStart&&(n=new v(gr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new v(gr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Vl={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 zl=null;function Bl(){return zl||(zl=document.implementation.createHTMLDocument("title"))}let yr=null;function Mf(n){let e=window.trustedTypes;return e?(yr||(yr=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),yr.createHTML(n)):n}function Tf(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Bl().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(n),r;if((r=i&&Vl[i[1].toLowerCase()])&&(n=r.map(s=>"<"+s+">").join("")+n+r.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Mf(n),r)for(let s=0;s<r.length;s++)t=t.querySelector(r[s])||t;return t}function Af(n){let e=n.querySelectorAll(G?"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 Of(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:r,openStart:s,openEnd:o}=n;for(let l=i.length-2;l>=0;l-=2){let a=t.nodes[i[l]];if(!a||a.hasRequiredAttrs())break;r=w.from(a.create(i[l+1],r)),s++,o++}return new v(r,s,o)}const Q={},ee={},Nf={touchstart:!0,touchmove:!0};class Ef{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 Df(n){for(let e in Q){let t=Q[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=i=>{Rf(n,i)&&!wr(n,i)&&(n.editable||!(i.type in ee))&&t(n,i)},Nf[e]?{passive:!0}:void 0)}Y&&n.dom.addEventListener("input",()=>null),br(n)}function _e(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Pf(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 br(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=i=>wr(n,i))})}function wr(n,e){return n.someProp("handleDOMEvents",t=>{let i=t[e.type];return i?i(n,e)||e.defaultPrevented:!1})}function Rf(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 If(n,e){!wr(n,e)&&Q[e.type]&&(n.editable||!(e.type in ee))&&Q[e.type](n,e)}ee.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Hl(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ye&&G&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wt&&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",r=>r(n,ht(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",i=>i(n,t))||vf(n,t)?t.preventDefault():_e(n,"key")},ee.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},ee.keypress=(n,e)=>{let t=e;if(Hl(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||de&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let i=n.state.selection;if(!(i instanceof E)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(t.charCode);!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,i.$from.pos,i.$to.pos,r))&&n.dispatch(n.state.tr.insertText(r).scrollIntoView()),t.preventDefault()}};function si(n){return{left:n.clientX,top:n.clientY}}function Vf(n,e){let t=e.x-n.clientX,i=e.y-n.clientY;return t*t+i*i<100}function Sr(n,e,t,i,r){if(i==-1)return!1;let s=n.state.doc.resolve(i);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),r,!0):l(n,t,s.node(o),s.before(o),r,!1)))return!0;return!1}function Kt(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 zf(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),i=t.nodeAfter;return i&&i.isAtom&&A.isSelectable(i)?(Kt(n,new A(t)),!0):!1}function Bf(n,e){if(e==-1)return!1;let t=n.state.selection,i,r;t instanceof A&&(i=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(A.isSelectable(l)){i&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?r=s.before(t.$from.depth):r=s.before(o);break}}return r!=null?(Kt(n,A.create(n.state.doc,r)),!0):!1}function Lf(n,e,t,i,r){return Sr(n,"handleClickOn",e,t,i)||n.someProp("handleClick",s=>s(n,e,i))||(r?Bf(n,t):zf(n,t))}function Hf(n,e,t,i){return Sr(n,"handleDoubleClickOn",e,t,i)||n.someProp("handleDoubleClick",r=>r(n,e,i))}function Ff(n,e,t,i){return Sr(n,"handleTripleClickOn",e,t,i)||n.someProp("handleTripleClick",r=>r(n,e,i))||$f(n,t,i)}function $f(n,e,t){if(t.button!=0)return!1;let i=n.state.doc;if(e==-1)return i.inlineContent?(Kt(n,E.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let s=r.depth+1;s>0;s--){let o=s>r.depth?r.nodeAfter:r.node(s),l=r.before(s);if(o.inlineContent)Kt(n,E.create(i,l+1,l+1+o.content.size));else if(A.isSelectable(o))Kt(n,A.create(i,l));else continue;return!0}}function xr(n){return oi(n)}const Ll=de?"metaKey":"ctrlKey";Q.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let i=xr(n),r=Date.now(),s="singleClick";r-n.input.lastClick.time<500&&Vf(t,n.input.lastClick)&&!t[Ll]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(si(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Wf(n,o,t,!!i)):(s=="doubleClick"?Hf:Ff)(n,o.pos,o.inside,t)?t.preventDefault():_e(n,"pointer"))};class Wf{constructor(e,t,i,r){this.view=e,this.pos=t,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[Ll],this.allowDefault=i.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const l=r?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&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof A&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ge&&!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)),_e(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(()=>Oe(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(si(e))),this.updateAllowDefault(e),this.allowDefault||!t?_e(this.view,"pointer"):Lf(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Y&&this.mightDrag&&!this.mightDrag.node.isAtom||G&&!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)?(Kt(this.view,O.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):_e(this.view,"pointer")}move(e){this.updateAllowDefault(e),_e(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)}}Q.touchstart=n=>{n.input.lastTouch=Date.now(),xr(n),_e(n,"pointer")},Q.touchmove=n=>{n.input.lastTouch=Date.now(),_e(n,"pointer")},Q.contextmenu=n=>xr(n);function Hl(n,e){return n.composing?!0:Y&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const _f=ye?5e3:-1;ee.compositionstart=ee.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof E&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),oi(n,!0),n.markCursor=null;else if(oi(n,!e.selection.empty),ge&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let i=n.domSelectionRange();for(let r=i.focusNode,s=i.focusOffset;r&&r.nodeType==1&&s!=0;){let o=s<0?r.lastChild:r.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else r=o,s=-1}}n.input.composing=!0}Fl(n,_f)},ee.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++,Fl(n,20))};function Fl(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>oi(n),e))}function $l(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Kf());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function qf(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Vh(e.focusNode,e.focusOffset),i=zh(e.focusNode,e.focusOffset);if(t&&i&&t!=i){let r=i.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||i==s)return s;if(!r||!r.isText(i.nodeValue))return i;if(n.input.compositionNode==i){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return i}}return t||i}function Kf(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function oi(n,e=!1){if(!(ye&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),$l(n),e||n.docView&&n.docView.dirty){let t=hr(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 Jf(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(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const gn=ne&&He<15||Wt&&$h<604;Q.copy=ee.cut=(n,e)=>{let t=e,i=n.state.selection,r=t.type=="cut";if(i.empty)return;let s=gn?null:t.clipboardData,o=i.content(),{dom:l,text:a}=Nl(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Jf(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jf(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Gf(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 r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),i.parentNode&&i.parentNode.removeChild(i),t?yn(n,i.value,null,r,e):yn(n,i.textContent,i.innerHTML,r,e)},50)}function yn(n,e,t,i,r){let s=El(n,e,t,i,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,s||v.empty)))return!0;if(!s)return!1;let o=jf(s),l=o?n.state.tr.replaceSelectionWith(o,i):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Wl(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," "):""}ee.paste=(n,e)=>{let t=e;if(n.composing&&!ye)return;let i=gn?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;i&&yn(n,Wl(i),i.getData("text/html"),r,t)?t.preventDefault():Gf(n,t)};class _l{constructor(e,t,i){this.slice=e,this.move=t,this.node=i}}const ql=de?"altKey":"ctrlKey";Q.dragstart=(n,e)=>{let t=e,i=n.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let r=n.state.selection,s=r.empty?null:n.posAtCoords(si(t)),o;if(!(s&&s.pos>=r.from&&s.pos<=(r instanceof A?r.to-1:r.to))){if(i&&i.mightDrag)o=A.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&&(o=A.create(n.state.doc,h.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:d}=Nl(n,l);(!t.dataTransfer.files.length||!G||Uo>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(gn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",gn||t.dataTransfer.setData("text/plain",c),n.dragging=new _l(d,!t[ql],o)},Q.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},ee.dragover=ee.dragenter=(n,e)=>e.preventDefault(),ee.drop=(n,e)=>{let t=e,i=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let r=n.posAtCoords(si(t));if(!r)return;let s=n.state.doc.resolve(r.pos),o=i&&i.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=El(n,Wl(t.dataTransfer),gn?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(i&&!t[ql]);if(n.someProp("handleDrop",p=>p(n,t,o||v.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?Wd(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.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=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(h?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(f))return;let u=c.doc.resolve(d);if(h&&A.isSelectable(o.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new A(u));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,C)=>p=C),c.setSelection(ur(n,u,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},Q.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())&&Oe(n)},20))},Q.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)},Q.beforeinput=(n,e)=>{if(G&&ye&&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",s=>s(n,ht(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in ee)Q[n]=ee[n];function bn(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 li{constructor(e,t){this.toDOM=e,this.spec=t||mt,this.side=this.spec.side||0}map(e,t,i,r){let{pos:s,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new ie(s-i,s-i,this)}valid(){return!0}eq(e){return this==e||e instanceof li&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&bn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class qe{constructor(e,t){this.attrs=e,this.spec=t||mt}map(e,t,i,r){let s=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-i,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-i;return s>=o?null:new ie(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof qe&&bn(this.attrs,e.attrs)&&bn(this.spec,e.spec)}static is(e){return e.type instanceof qe}destroy(){}}class vr{constructor(e,t){this.attrs=e,this.spec=t||mt}map(e,t,i,r){let s=e.mapResult(t.from+r,1);if(s.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=s.pos?null:new ie(s.pos-i,o.pos-i,this)}valid(e,t){let{index:i,offset:r}=e.content.findIndex(t.from),s;return r==t.from&&!(s=e.child(i)).isText&&r+s.nodeSize==t.to}eq(e){return this==e||e instanceof vr&&bn(this.attrs,e.attrs)&&bn(this.spec,e.spec)}destroy(){}}class ie{constructor(e,t,i){this.from=e,this.to=t,this.type=i}copy(e,t){return new ie(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 ie(e,e,new li(t,i))}static inline(e,t,i,r){return new ie(e,t,new qe(i,r))}static node(e,t,i,r){return new ie(e,t,new vr(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof qe}get widget(){return this.type instanceof li}}const Jt=[],mt={};class B{constructor(e,t){this.local=e.length?e:Jt,this.children=t.length?t:Jt}static create(e,t){return t.length?ai(t,e,0,mt):U}find(e,t,i){let r=[];return this.findInner(e??0,t??1e9,r,0,i),r}findInner(e,t,i,r,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&i.push(l.copy(l.from+r,l.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,i,r+l,s)}}map(e,t,i){return this==U||e.maps.length==0?this:this.mapInner(e,t,0,0,i||mt)}mapInner(e,t,i,r,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,i,r);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Uf(this.children,o||[],e,t,i,r,s):o?new B(o.sort(gt),Jt):U}add(e,t){return t.length?this==U?B.create(e,t):this.addInner(e,t,0):this}addInner(e,t,i){let r,s=0;e.forEach((l,a)=>{let c=a+i,d;if(d=Jl(t,l,c)){for(r||(r=this.children.slice());s<r.length&&r[s]<a;)s+=3;r[s]==a?r[s+2]=r[s+2].addInner(l,d,c+1):r.splice(s,0,a,a+l.nodeSize,ai(d,l,c+1,mt)),s+=3}});let o=Kl(s?jl(t):t,-i);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new B(o.length?this.local.concat(o).sort(gt):this.local,r||this.children)}remove(e){return e.length==0||this==U?this:this.removeInner(e,0)}removeInner(e,t){let i=this.children,r=this.local;for(let s=0;s<i.length;s+=3){let o,l=i[s]+t,a=i[s+1]+t;for(let d=0,h;d<e.length;d++)(h=e[d])&&h.from>l&&h.to<a&&(e[d]=null,(o||(o=[])).push(h));if(!o)continue;i==this.children&&(i=this.children.slice());let c=i[s+2].removeInner(o,l+1);c!=U?i[s+2]=c:(i.splice(s,3),s-=3)}if(r.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<r.length;l++)r[l].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new B(r,i):U}forChild(e,t){if(this==U)return this;if(t.isLeaf)return B.empty;let i,r;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 s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof qe){let c=Math.max(s,a.from)-s,d=Math.min(o,a.to)-s;c<d&&(r||(r=[])).push(a.copy(c,d))}}if(r){let l=new B(r.sort(gt),Jt);return i?new Ke([l,i]):l}return i||U}eq(e){if(this==e)return!0;if(!(e instanceof B)||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 Cr(this.localsInner(e))}localsInner(e){if(this==U)return Jt;if(e.inlineContent||!this.local.some(qe.is))return this.local;let t=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof qe||t.push(this.local[i]);return t}forEachSet(e){e(this)}}B.empty=new B([],[]),B.removeOverlap=Cr;const U=B.empty;class Ke{constructor(e){this.members=e}map(e,t){const i=this.members.map(r=>r.map(e,t,mt));return Ke.from(i)}forChild(e,t){if(t.isLeaf)return B.empty;let i=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,t);s!=U&&(s instanceof Ke?i=i.concat(s.members):i.push(s))}return Ke.from(i)}eq(e){if(!(e instanceof Ke)||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 r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(!t)t=s;else{i&&(t=t.slice(),i=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Cr(i?t:t.sort(gt)):Jt}static from(e){switch(e.length){case 0:return U;case 1:return e[0];default:return new Ke(e.every(t=>t instanceof B)?e:e.reduce((t,i)=>t.concat(i instanceof B?i:i.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Uf(n,e,t,i,r,s,o){let l=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,u,p,m)=>{let g=m-p-(u-f);for(let b=0;b<l.length;b+=3){let C=l[b+1];if(C<0||f>C+d-h)continue;let y=l[b]+d-h;u>=y?l[b+1]=f<=y?-2:-1:f>=d&&g&&(l[b]+=g,l[b+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]+s),h=d-r;if(h<0||h>=i.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),u=f-r,{index:p,offset:m}=i.content.findIndex(h),g=i.maybeChild(p);if(g&&m==h&&m+g.nodeSize==u){let b=l[c+2].mapInner(t,g,d+1,n[c]+s+1,o);b!=U?(l[c]=h,l[c+1]=u,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Zf(l,n,e,t,r,s,o),d=ai(c,i,0,o);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,f=0;h<d.children.length;h+=3){let u=d.children[h];for(;f<l.length&&l[f]<u;)f+=3;l.splice(f,0,d.children[h],d.children[h+1],d.children[h+2])}}return new B(e.sort(gt),l)}function Kl(n,e){if(!e||!n.length)return n;let t=[];for(let i=0;i<n.length;i++){let r=n[i];t.push(new ie(r.from+e,r.to+e,r.type))}return t}function Zf(n,e,t,i,r,s,o){function l(a,c){for(let d=0;d<a.local.length;d++){let h=a.local[d].map(i,r,c);h?t.push(h):o.onRemove&&o.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]+s+1);return t}function Jl(n,e,t){if(e.isLeaf)return null;let i=t+e.nodeSize,r=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<i&&((r||(r=[])).push(o),n[s]=null);return r}function jl(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ai(n,e,t,i){let r=[],s=!1;e.forEach((l,a)=>{let c=Jl(n,l,a+t);if(c){s=!0;let d=ai(c,l,t+a+1,i);d!=U&&r.push(a,a+l.nodeSize,d)}});let o=Kl(s?jl(n):n,-t).sort(gt);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(i.onRemove&&i.onRemove(o[l].spec),o.splice(l--,1));return o.length||r.length?new B(o,r):U}function gt(n,e){return n.from-e.from||n.to-e.to}function Cr(n){let e=n;for(let t=0;t<e.length-1;t++){let i=e[t];if(i.from!=i.to)for(let r=t+1;r<e.length;r++){let s=e[r];if(s.from==i.from){s.to!=i.to&&(e==n&&(e=n.slice()),e[r]=s.copy(s.from,i.to),Gl(e,r+1,s.copy(i.to,s.to)));continue}else{s.from<i.to&&(e==n&&(e=n.slice()),e[t]=i.copy(i.from,s.from),Gl(e,r,i.copy(s.from,i.to)));break}}}return e}function Gl(n,e,t){for(;e<n.length&&gt(t,n[e])>0;)e++;n.splice(e,0,t)}function kr(n){let e=[];return n.someProp("decorations",t=>{let i=t(n.state);i&&i!=U&&e.push(i)}),n.cursorWrapper&&e.push(B.create(n.state.doc,[n.cursorWrapper.deco])),Ke.from(e)}const Xf={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Yf=ne&&He<=11;class Qf{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 eu{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qf,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let r=0;r<i.length;r++)this.queue.push(i[r]);ne&&He<=11&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Yf&&(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,Xf)),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(xl(this.view)){if(this.suppressingSelectionUpdates)return Oe(this.view);if(ne&&He<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&dt(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 s=e.focusNode;s;s=cn(s))t.add(s);for(let s=e.anchorNode;s;s=cn(s))if(t.has(s)){i=s;break}let r=i&&this.view.docView.nearestDesc(i);if(r&&r.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(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&xl(e)&&!this.ignoreSelectionChange(i),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let h=this.registerMutation(t[d],a);h&&(s=s<0?h.from:Math.min(h.from,s),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(l=!0))}if(ge&&a.length){let d=a.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,f]=d;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of d){let u=f.parentNode;u&&u.nodeName=="LI"&&(!h||iu(e,h)!=u)&&f.remove()}}}let c=null;s<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ti(i)&&(c=hr(e))&&c.eq(O.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Oe(e),this.currentSelection.set(i),e.scrollToSelection()):(s>-1||r)&&(s>-1&&(e.docView.markDirty(s,o),tu(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||Oe(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 r=e.previousSibling,s=e.nextSibling;if(ne&&He<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:h,nextSibling:f}=e.addedNodes[d];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(r=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=r&&r.parentNode==e.target?K(r)+1:0,l=i.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?K(s):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 Ul=new WeakMap,Zl=!1;function tu(n){if(!Ul.has(n)&&(Ul.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=ge,Zl)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."),Zl=!0}}function Xl(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return dt(o.node,o.offset,r,s)&&([t,i,r,s]=[r,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}}function nu(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return Xl(n,r)}let t;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",i,!0),t?Xl(n,t):null}function iu(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 ru(n,e,t){let{node:i,fromOffset:r,toOffset:s,from:o,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}],ti(a)||c.push({node:a.focusNode,offset:a.focusOffset})),G&&n.input.lastKeyCode===8)for(let g=s;g>r;g--){let b=i.childNodes[g-1],C=b.pmViewDesc;if(b.nodeName=="BR"&&!C){s=g;break}if(!C||C.size)break}let h=n.state.doc,f=n.someProp("domParser")||Rt.fromSchema(n.state.schema),u=h.resolve(o),p=null,m=f.parse(i,{topNode:u.parent,topMatch:u.parent.contentMatchAt(u.index()),topOpen:!0,from:r,to:s,preserveWhitespace:u.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:su,context:u});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:l}}function su(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Y&&/^(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||Y&&/^(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 ou=/^(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 lu(n,e,t,i,r){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,V=hr(n,T);if(V&&!n.state.selection.eq(V)){if(G&&ye&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Z=>Z(n,ht(13,"Enter"))))return;let I=n.state.tr.setSelection(V);T=="pointer"?I.setMeta("pointer",!0):T=="key"&&I.scrollIntoView(),s&&I.setMeta("composition",s),n.dispatch(I)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=ru(n,e,t),d=n.state.doc,h=d.slice(c.from,c.to),f,u;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,u="end"):(f=n.state.selection.from,u="start"),n.input.lastKeyCode=null;let p=du(h.content,c.doc.content,c.from,f,u);if(p&&n.input.domChangeCount++,(Wt&&n.input.lastIOSEnter>Date.now()-225||ye)&&r.some(T=>T.nodeType==1&&!ou.test(T.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",T=>T(n,ht(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(i&&a instanceof E&&!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 T=Yl(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let V=n.state.tr.setSelection(T);s&&V.setMeta("composition",s),n.dispatch(V)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof E&&(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)),ne&&He<=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),b=d.resolve(p.start),C=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,y;if((Wt&&n.input.lastIOSEnter>Date.now()-225&&(!C||r.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(y=O.findFrom(c.doc.resolve(m.pos+1),1,!0))&&y.head==g.pos)&&n.someProp("handleKeyDown",T=>T(n,ht(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&cu(d,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,ht(8,"Backspace")))){ye&&G&&n.domObserver.suppressSelectionUpdates();return}G&&ye&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),ye&&!C&&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(T){return T(n,ht(13,"Enter"))})},20));let S=p.start,x=p.endA,k,N,R;if(C){if(m.pos==g.pos)ne&&He<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Oe(n),20)),k=n.state.tr.delete(S,x),N=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(R=au(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))k=n.state.tr,R.type=="add"?k.addMark(S,x,R.mark):k.removeMark(S,x,R.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",V=>V(n,S,x,T)))return;k=n.state.tr.insertText(T,S,x)}}if(k||(k=n.state.tr.replace(S,x,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let T=Yl(n,k.doc,c.sel);T&&!(G&&ye&&n.composing&&T.empty&&(p.start!=p.endB||n.input.lastAndroidDelete<Date.now()-100)&&(T.head==S||T.head==k.mapping.map(x)-1)||ne&&T.empty&&T.head==S)&&k.setSelection(T)}N&&k.ensureMarks(N),s&&k.setMeta("composition",s),n.dispatch(k.scrollIntoView())}function Yl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ur(n,e.resolve(t.anchor),e.resolve(t.head))}function au(n,e){let t=n.firstChild.marks,i=e.firstChild.marks,r=t,s=i,o,l,a;for(let d=0;d<i.length;d++)r=i[d].removeFromSet(r);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(r.length==1&&s.length==0)l=r[0],o="add",a=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&s.length==1)l=s[0],o="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:o}}function cu(n,e,t,i,r){if(t-e<=r.pos-i.pos||Mr(i,!0,!1)<r.pos)return!1;let s=n.resolve(e);if(!i.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(Mr(s,!0,!0));return!o.parent.isTextblock||o.pos>t||Mr(o,!0,!1)<t?!1:i.parent.content.cut(i.parentOffset).eq(o.parent.content)}function Mr(n,e,t){let i=n.depth,r=e?n.end():n.pos;for(;i>0&&(e||n.indexAfter(i)==n.node(i).childCount);)i--,r++,e=!1;if(t){let s=n.node(i).maybeChild(n.indexAfter(i));for(;s&&!s.isLeaf;)s=s.firstChild,r++}return r}function du(n,e,t,i,r){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&n.size<e.size){let a=i<=s&&i>=o?s-i:0;s-=a,s&&s<e.size&&Ql(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,s&&s<n.size&&Ql(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function Ql(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 hu{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 Ef,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ra),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=na(this),ta(this),this.nodeViews=ia(this),this.docView=cl(this.state.doc,ea(this),kr(this),this.dom,this),this.domObserver=new eu(this,(i,r,s,o)=>lu(this,i,r,s,o)),this.domObserver.start(),Df(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&&br(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ra),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 r=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&($l(this),o=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let u=ia(this);uu(u,this.nodeViews)&&(this.nodeViews=u,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&br(this),this.editable=na(this),ta(this);let a=kr(this),c=ea(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,c,a);(h||!e.selection.eq(r.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&qh(this);if(o){this.domObserver.stop();let u=h&&(ne||G)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&fu(r.selection,e.selection);if(h){let p=G?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=qf(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=cl(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(u=!0)}u||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&mf(this))?Oe(this,u):(wl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((i=this.dragging)===null||i===void 0)&&i.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&Kh(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof A){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Zo(this,t.getBoundingClientRect(),e)}else Zo(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,r=-1;if(this.state.doc.nodeAt(i.from)==i.node)r=i.from;else{let s=i.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==i.node&&(r=s)}this.dragging=new _l(e.slice,e.move,r<0?void 0:A.create(this.state.doc,r))}someProp(e,t){let i=this._props&&this._props[e],r;if(i!=null&&(r=t?t(i):i))return r;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(r=t?t(l):l))return r}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(ne){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&&Jh(this.dom),Oe(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 Xh(this,e)}coordsAtPos(e,t=1){return nl(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 r=this.docView.posFromDOM(e,t,i);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return nf(this,t||this.state,e)}pasteHTML(e,t){return yn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return yn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Pf(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kr(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Rh())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return If(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?Y&&this.root.nodeType===11&&Lh(this.dom.ownerDocument)==this.dom&&nu(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function ea(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"),[ie.node(0,n.state.doc.content.size,e)]}function ta(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:ie.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function na(n){return!n.someProp("editable",e=>e(n.state)===!1)}function fu(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 ia(n){let e=Object.create(null);function t(i){for(let r in i)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=i[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function uu(n,e){let t=0,i=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)i++;return t!=i}function ra(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 Tr,Ar;if(typeof WeakMap<"u"){let n=new WeakMap;Tr=e=>n.get(e),Ar=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Tr=i=>{for(let r=0;r<n.length;r+=2)if(n[r]==i)return n[r+1]},Ar=(i,r)=>(t==10&&(t=0),n[t++]=i,n[t++]=r)}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,r=e/this.width|0;let s=i+1,o=r+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:i,top:r,right:s,bottom:o}}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:r,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?i==0:r==this.width)?null:this.map[s*this.width+(t<0?i-1:r)]:(t<0?s==0:o==this.height)?null:this.map[i+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:i,top:r,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(r,a),right:Math.max(i,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let i=n.top;i<n.bottom;i++)for(let r=n.left;r<n.right;r++){const s=i*this.width+r,o=this.map[s];t[o]||(t[o]=!0,!(r==n.left&&r&&this.map[s-1]==o||i==n.top&&i&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let i=0,r=0;;i++){const s=r+t.child(i).nodeSize;if(i==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<r;)o++;return o==l?s-1:this.map[o]}r=s}}static get(n){return Tr(n)||Ar(n,pu(n))}};function pu(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=mu(n),t=n.childCount,i=[];let r=0,s=null;const o=[];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(;r<i.length&&i[r]!=0;)r++;if(p==h.childCount)break;const m=h.child(p),{colspan:g,rowspan:b,colwidth:C}=m.attrs;for(let y=0;y<b;y++){if(y+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:b-y});break}const S=r+y*e;for(let x=0;x<g;x++){i[S+x]==0?i[S+x]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:g-x});const k=C&&C[x];if(k){const N=(S+x)%e*2,R=o[N];R==null||R!=k&&o[N+1]==1?(o[N]=k,o[N+1]=1):R==k&&o[N+1]++}}}r+=g,d+=m.nodeSize}const f=(c+1)*e;let u=0;for(;r<f;)i[r++]==0&&u++;u&&(s||(s=[])).push({type:"missing",row:c,n:u}),d++}const l=new H(e,t,i,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&gu(l,o,n),l}function mu(n){let e=-1,t=!1;for(let i=0;i<n.childCount;i++){const r=n.child(i);let s=0;if(t)for(let o=0;o<i;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>i&&(s+=c.attrs.colspan)}}for(let o=0;o<r.childCount;o++){const l=r.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function gu(n,e,t){n.problems||(n.problems=[]);const i={};for(let r=0;r<n.map.length;r++){const s=n.map[r];if(i[s])continue;i[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const d=(r+c)%n.width,h=e[d*2];h!=null&&(!a.colwidth||a.colwidth[c]!=h)&&((l||(l=yu(a)))[c]=h)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function yu(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function sa(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),i=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,r=Number(n.getAttribute("colspan")||1),s={colspan:r,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:i&&i.length==r?i:null};for(const o in e){const l=e[o].getFromDOM,a=l&&l(n);a!=null&&(s[o]=a)}return s}function oa(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 r=e[i].setDOMAttr;r&&r(n.attrs[i],t)}return t}function bu(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=>sa(i,e)}],toDOM(i){return["td",oa(i,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:i=>sa(i,e)}],toDOM(i){return["th",oa(i,e),0]}}}}function ke(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const i=n.nodes[t],r=i.spec.tableRole;r&&(e[r]=i)}}return e}var Je=new ln("selectingCells");function wn(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 ci(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 Or(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=wn(e.$head)||wu(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function wu(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 Nr(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Su(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Er(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function la(n,e,t){const i=n.node(-1),r=H.get(i),s=n.start(-1),o=r.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function jt(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(r=>r>0)||(i.colwidth=null)),i}var $=class Pe extends O{constructor(e,t=e){const i=e.node(-1),r=H.get(i),s=e.start(-1),o=r.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=r.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const c=a.map(d=>{const h=i.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const f=s+d+1;return new wo(l.resolve(f),l.resolve(f+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)),r=e.resolve(t.map(this.$headCell.pos));if(Nr(i)&&Nr(r)&&Er(i,r)){const s=this.$anchorCell.node(-1)!=i.node(-1);return s&&this.isRowSelection()?Pe.rowSelection(i,r):s&&this.isColSelection()?Pe.colSelection(i,r):new Pe(i,r)}return E.between(i,r)}content(){const e=this.$anchorCell.node(-1),t=H.get(e),i=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i),s={},o=[];for(let a=r.top;a<r.bottom;a++){const c=[];for(let d=a*t.width+r.left,h=r.left;h<r.right;h++,d++){const f=t.map[d];if(s[f])continue;s[f]=!0;const u=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=r.left-u.left,g=u.right-r.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=jt(b,0,m)),g>0&&(b=jt(b,b.colspan-g,g)),u.left<r.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(u.top<r.top||u.bottom>r.bottom){const b={...p.attrs,rowspan:Math.min(u.bottom,r.bottom)-Math.max(u.top,r.top)};u.top<r.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}o.push(e.child(a).copy(w.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new v(w.from(l),1,1)}replace(e,t=v.empty){const i=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:l,$to:a}=r[o],c=e.mapping.slice(i);e.replace(c.map(l.pos),c.map(a.pos),o?v.empty:t)}const s=O.findFrom(e.doc.resolve(e.mapping.slice(i).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new v(w.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),i=H.get(t),r=this.$anchorCell.start(-1),s=i.cellsInRect(i.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),r+s[o])}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,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(i,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const i=e.node(-1),r=H.get(i),s=e.start(-1),o=r.findCell(e.pos-s),l=r.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+r.map[o.left])),l.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+r.map[l.left])),o.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))),new Pe(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=H.get(e),i=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-i),s=t.colCount(this.$headCell.pos-i);if(Math.min(r,s)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof Pe&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const i=e.node(-1),r=H.get(i),s=e.start(-1),o=r.findCell(e.pos-s),l=r.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+r.map[o.top*r.width])),l.right<r.width&&(t=a.resolve(s+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+r.map[l.top*r.width])),o.right<r.width&&(e=a.resolve(s+r.map[r.width*(o.top+1)-1]))),new Pe(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Pe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,i=t){return new Pe(e.resolve(t),e.resolve(i))}getBookmark(){return new xu(this.$anchorCell.pos,this.$headCell.pos)}};$.prototype.visible=!1,O.jsonID("cell",$);var xu=class Ba{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ba(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&&Er(t,i)?new $(t,i):O.near(i,1)}};function vu(n){if(!(n.selection instanceof $))return null;const e=[];return n.selection.forEachCell((t,i)=>{e.push(ie.node(i,i+t.nodeSize,{class:"selectedCell"}))}),B.create(n.doc,e)}function Cu({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,i=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,i--);return t==i&&/row|table/.test(n.node(r).type.spec.tableRole)}function ku({$from:n,$to:e}){let t,i;for(let r=n.depth;r>0;r--){const s=n.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let r=e.depth;r>0;r--){const s=e.node(r);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){i=s;break}}return t!==i&&e.parentOffset===0}function Mu(n,e,t){const i=(e||n).selection,r=(e||n).doc;let s,o;if(i instanceof A&&(o=i.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=$.create(r,i.from);else if(o=="row"){const l=r.resolve(i.from+1);s=$.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];s=$.create(r,a+1,c)}}else i instanceof E&&Cu(i)?s=E.create(r,i.from):i instanceof E&&ku(i)&&(s=E.create(r,i.$from.start(),i.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var Tu=new ln("fix-tables");function aa(n,e,t,i){const r=n.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let c=l,d=Math.min(r,o+3);c<d;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}i(a,t),l<r&&n.child(l).sameMarkup(a)?aa(n.child(l),a,t+1,i):a.nodesBetween(0,a.content.size,i,t+1),t+=a.nodeSize}}function Au(n,e){let t;const i=(r,s)=>{r.type.spec.tableRole=="table"&&(t=Ou(n,r,s,t))};return e?e.doc!=n.doc&&aa(e.doc,n.doc,0,i):n.doc.descendants(i),t}function Ou(n,e,t,i){const r=H.get(e);if(!r.problems)return i;i||(i=n.tr);const s=[];for(let a=0;a<r.height;a++)s.push(0);for(let a=0;a<r.problems.length;a++){const c=r.problems[a];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const h=d.attrs;for(let f=0;f<h.rowspan;f++)s[c.row+f]+=c.n;i.setNodeMarkup(i.mapping.map(t+1+c.pos),null,jt(h,h.colspan-c.n,c.n))}else if(c.type=="missing")s[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 o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,c=t+1;a<r.height;a++){const d=e.child(a),h=c+d.nodeSize,f=s[a];if(f>0){let u="cell";d.firstChild&&(u=d.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const b=ke(n.schema)[u].createAndFill();b&&p.push(b)}const m=(a==0||o==a-1)&&l==a?c+1:h-1;i.insert(i.mapping.map(m),p)}c=h}return i.setMeta(Tu,{fixTables:!0})}function ca(n){const e=n.selection,t=Or(n),i=t.node(-1),r=t.start(-1),s=H.get(i);return{...e instanceof $?s.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):s.findCell(t.pos-r),tableStart:r,map:s,table:i}}function Nu(n){return function(e,t){if(!ci(e))return!1;if(t){const i=ke(e.schema),r=ca(e),s=e.tr,o=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=o.map(a=>r.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==i.header_cell&&s.setNodeMarkup(r.tableStart+o[a],i.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(r.tableStart+o[a],i.header_cell,l[a].attrs);t(s)}return!0}}function da(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 r=0;r<i.length;r++){const s=e.table.nodeAt(i[r]);if(s&&s.type!==t.header_cell)return!1}return!0}function Dr(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Nu(n):function(t,i){if(!ci(t))return!1;if(i){const r=ke(t.schema),s=ca(t),o=t.tr,l=da("row",s,r),a=da("column",s,r),d=(n==="column"?l:n==="row"?a:!1)?1:0,h=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;s.map.cellsInRect(h).forEach(u=>{const p=u+s.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,f,m.attrs)}),i(o)}return!0}}Dr("row",{useDeprecatedLogic:!0}),Dr("column",{useDeprecatedLogic:!0}),Dr("cell",{useDeprecatedLogic:!0});function Eu(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let i=n.index(-1)-1,r=n.before();i>=0;i--){const s=n.node(-1).child(i),o=s.lastChild;if(o)return r-1-o.nodeSize;r-=s.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),r=n.after();i<t.childCount;i++){const s=t.child(i);if(s.childCount)return r+1;r+=s.nodeSize}}return null}function ha(n){return function(e,t){if(!ci(e))return!1;const i=Eu(Or(e),n);if(i==null)return!1;if(t){const r=e.doc.resolve(i);t(e.tr.setSelection(E.between(r,Su(r))).scrollIntoView())}return!0}}function di(n,e){const t=n.selection;if(!(t instanceof $))return!1;if(e){const i=n.tr,r=ke(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(r)||i.replace(i.mapping.map(o+1),i.mapping.map(o+s.nodeSize-1),new v(r,0,0))}),i.docChanged&&e(i)}return!0}function Du(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 r=e.child(0),s=r.type.spec.tableRole,o=r.type.schema,l=[];if(s=="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=Pr(ke(o).row,new v(c,d,h)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(t||i?Pr(ke(o).row,new v(e,t,i)).content:e);else return null;return Pu(o,l)}function Pu(n,e){const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let c=r;c<r+l;c++)t[c]=(t[c]||0)+a}}let i=0;for(let r=0;r<t.length;r++)i=Math.max(i,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(w.empty),t[r]<i){const s=ke(n).cell.createAndFill(),o=[];for(let l=t[r];l<i;l++)o.push(s);e[r]=e[r].append(w.from(o))}return{height:e.length,width:i,rows:e}}function Pr(n,e){const t=n.createAndFill();return new bo(t).replace(0,t.content.size,e).doc}function Ru({width:n,height:e,rows:t},i,r){if(n!=i){const s=[],o=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let d=s[l]||0,h=0;d<i;h++){let f=a.child(h%a.childCount);d+f.attrs.colspan>i&&(f=f.type.createChecked(jt(f.attrs,f.attrs.colspan,d+f.attrs.colspan-i),f.content)),c.push(f),d+=f.attrs.colspan;for(let u=1;u<f.attrs.rowspan;u++)s[l+u]=(s[l+u]||0)+f.attrs.colspan}o.push(w.from(c))}t=o,n=i}if(e!=r){const s=[];for(let o=0,l=0;o<r;o++,l++){const a=[],c=t[l%e];for(let d=0;d<c.childCount;d++){let h=c.child(d);o+h.attrs.rowspan>r&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,r-h.attrs.rowspan)},h.content)),a.push(h)}s.push(w.from(a))}t=s,e=r}return{width:n,height:e,rows:t}}function Iu(n,e,t,i,r,s,o){const l=n.doc.type.schema,a=ke(l);let c,d;if(r>e.width)for(let h=0,f=0;h<e.height;h++){const u=t.child(h);f+=u.nodeSize;const p=[];let m;u.lastChild==null||u.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=d||(d=a.header_cell.createAndFill());for(let g=e.width;g<r;g++)p.push(m);n.insert(n.mapping.slice(o).map(f-1+i),p)}if(s>e.height){const h=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,r);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 f=a.row.create(null,w.from(h)),u=[];for(let p=e.height;p<s;p++)u.push(f);n.insert(n.mapping.slice(o).map(i+t.nodeSize-2),u)}return!!(c||d)}function fa(n,e,t,i,r,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=r;c<s;c++){const d=o*e.width+c,h=e.map[d];if(e.map[d-e.width]==h){a=!0;const f=t.nodeAt(h),{top:u,left:p}=e.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+i),null,{...f.attrs,rowspan:o-u}),n.insert(n.mapping.slice(l).map(e.positionAt(o,p,t)),f.type.createAndFill({...f.attrs,rowspan:u+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function ua(n,e,t,i,r,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=r;c<s;c++){const d=c*e.width+o,h=e.map[d];if(e.map[d-1]==h){a=!0;const f=t.nodeAt(h),u=e.colCount(h),p=n.mapping.slice(l).map(h+i);n.setNodeMarkup(p,null,jt(f.attrs,o-u,f.attrs.colspan-(o-u))),n.insert(p+f.nodeSize,f.type.createAndFill(jt(f.attrs,0,o-u))),c+=f.attrs.rowspan-1}}return a}function pa(n,e,t,i,r){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let o=H.get(s);const{top:l,left:a}=i,c=a+r.width,d=l+r.height,h=n.tr;let f=0;function u(){if(s=t?h.doc.nodeAt(t-1):h.doc,!s)throw new Error("No table found");o=H.get(s),f=h.mapping.maps.length}Iu(h,o,s,t,c,d,f)&&u(),fa(h,o,s,t,a,c,l,f)&&u(),fa(h,o,s,t,a,c,d,f)&&u(),ua(h,o,s,t,l,d,a,f)&&u(),ua(h,o,s,t,l,d,c,f)&&u();for(let p=l;p<d;p++){const m=o.positionAt(p,a,s),g=o.positionAt(p,c,s);h.replace(h.mapping.slice(f).map(m+t),h.mapping.slice(f).map(g+t),new v(r.rows[p-l],0,0))}u(),h.setSelection(new $(h.doc.resolve(t+o.positionAt(l,a,s)),h.doc.resolve(t+o.positionAt(d-1,c-1,s)))),e(h)}var Vu=qo({ArrowLeft:fi("horiz",-1),ArrowRight:fi("horiz",1),ArrowUp:fi("vert",-1),ArrowDown:fi("vert",1),"Shift-ArrowLeft":ui("horiz",-1),"Shift-ArrowRight":ui("horiz",1),"Shift-ArrowUp":ui("vert",-1),"Shift-ArrowDown":ui("vert",1),Backspace:di,"Mod-Backspace":di,Delete:di,"Mod-Delete":di});function hi(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function fi(n,e){return(t,i,r)=>{if(!r)return!1;const s=t.selection;if(s instanceof $)return hi(t,i,O.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=ma(r,n,e);if(o==null)return!1;if(n=="horiz")return hi(t,i,O.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=la(l,n,e);let c;return a?c=O.near(a,1):e<0?c=O.near(t.doc.resolve(l.before(-1)),-1):c=O.near(t.doc.resolve(l.after(-1)),1),hi(t,i,c)}}}function ui(n,e){return(t,i,r)=>{if(!r)return!1;const s=t.selection;let o;if(s instanceof $)o=s;else{const a=ma(r,n,e);if(a==null)return!1;o=new $(t.doc.resolve(a))}const l=la(o.$headCell,n,e);return l?hi(t,i,new $(o.$anchorCell,l)):!1}}function zu(n,e){const t=n.state.doc,i=wn(t.resolve(e));return i?(n.dispatch(n.state.tr.setSelection(new $(i))),!0):!1}function Bu(n,e,t){if(!ci(n.state))return!1;let i=Du(t);const r=n.state.selection;if(r instanceof $){i||(i={width:1,height:1,rows:[w.from(Pr(ke(n.state.schema).cell,t))]});const s=r.$anchorCell.node(-1),o=r.$anchorCell.start(-1),l=H.get(s).rectBetween(r.$anchorCell.pos-o,r.$headCell.pos-o);return i=Ru(i,l.right-l.left,l.bottom-l.top),pa(n.state,n.dispatch,o,l,i),!0}else if(i){const s=Or(n.state),o=s.start(-1);return pa(n.state,n.dispatch,o,H.get(s.node(-1)).findCell(s.pos-o),i),!0}else return!1}function Lu(n,e){var t;if(e.ctrlKey||e.metaKey)return;const i=ga(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof $)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&i&&(r=wn(n.state.selection.$anchor))!=null&&((t=Rr(n,e))==null?void 0:t.pos)!=r.pos)s(r,e),e.preventDefault();else if(!i)return;function s(a,c){let d=Rr(n,c);const h=Je.getState(n.state)==null;if(!d||!Er(a,d))if(h)d=a;else return;const f=new $(a,d);if(h||!n.state.selection.eq(f)){const u=n.state.tr.setSelection(f);h&&u.setMeta(Je,a.pos),n.dispatch(u)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",l),Je.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Je,-1))}function l(a){const c=a,d=Je.getState(n.state);let h;if(d!=null)h=n.state.doc.resolve(d);else if(ga(n,c.target)!=i&&(h=Rr(n,e),!h))return o();h&&s(h,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",l)}function ma(n,e,t){if(!(n.state.selection instanceof E))return null;const{$head:i}=n.state.selection;for(let r=i.depth-1;r>=0;r--){const s=i.node(r);if((t<0?i.index(r):i.indexAfter(r))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=i.before(r),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function ga(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Rr(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?wn(n.state.doc.resolve(t.pos)):null}var Hu=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")),Ir(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,Ir(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Ir(n,e,t,i,r,s){var o;let l=0,a=!0,c=e.firstChild;const d=n.firstChild;if(d){for(let h=0,f=0;h<d.childCount;h++){const{colspan:u,colwidth:p}=d.child(h).attrs;for(let m=0;m<u;m++,f++){const g=r==f?s:p&&p[m],b=g?g+"px":"";if(l+=g||i,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=b,e.appendChild(C)}}}for(;c;){const h=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=h}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var oe=new ln("tableColumnResizing");function Fu({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:i=Hu,lastColumnResizable:r=!0}={}){const s=new on({key:oe,state:{init(o,l){var a,c;const d=(c=(a=s.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,h=ke(l.schema).table.name;return i&&d&&(d[h]=(f,u)=>new i(f,t,u)),new $u(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=oe.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Wu(o,l,n,r)},mouseleave:o=>{_u(o)},mousedown:(o,l)=>{qu(o,l,e,t)}},decorations:o=>{const l=oe.getState(o);if(l&&l.activeHandle>-1)return Uu(o,l.activeHandle)},nodeViews:{}}});return s}var $u=class bi{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,i=e.getMeta(oe);if(i&&i.setHandle!=null)return new bi(i.setHandle,!1);if(i&&i.setDragging!==void 0)return new bi(t.activeHandle,i.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return Nr(e.doc.resolve(r))||(r=-1),new bi(r,t.dragging)}return t}};function Wu(n,e,t,i){const r=oe.getState(n.state);if(r&&!r.dragging){const s=Ju(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=t?o=ya(n,e,"left",t):a-e.clientX<=t&&(o=ya(n,e,"right",t))}if(o!=r.activeHandle){if(!i&&o!==-1){const l=n.state.doc.resolve(o),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}wa(n,o)}}}function _u(n){const e=oe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&wa(n,-1)}function qu(n,e,t,i){var r;const s=(r=n.dom.ownerDocument.defaultView)!=null?r:window,o=oe.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=n.state.doc.nodeAt(o.activeHandle),a=Ku(n,o.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(oe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(h){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",d);const f=oe.getState(n.state);f!=null&&f.dragging&&(ju(n,f.activeHandle,ba(f.dragging,h,t)),n.dispatch(n.state.tr.setMeta(oe,{setDragging:null})))}function d(h){if(!h.which)return c(h);const f=oe.getState(n.state);if(f&&f.dragging){const u=ba(f.dragging,h,t);Sa(n,f.activeHandle,u,i)}}return Sa(n,o.activeHandle,a,i),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),e.preventDefault(),!0}function Ku(n,e,{colspan:t,colwidth:i}){const r=i&&i[i.length-1];if(r)return r;const s=n.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,a=t;if(i)for(let c=0;c<t;c++)i[c]&&(l-=i[c],a--);return l/a}function Ju(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ya(n,e,t,i){const r=t=="right"?-i:i,s=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=wn(n.state.doc.resolve(o));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 ba(n,e,t){const i=e.clientX-n.startX;return Math.max(t,n.startWidth+i)}function wa(n,e){n.dispatch(n.state.tr.setMeta(oe,{setHandle:e}))}function ju(n,e,t){const i=n.state.doc.resolve(e),r=i.node(-1),s=H.get(r),o=i.start(-1),l=s.colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<s.height;c++){const d=c*s.width+l;if(c&&s.map[d]==s.map[d-s.width])continue;const h=s.map[d],f=r.nodeAt(h).attrs,u=f.colspan==1?0:l-s.colCount(h);if(f.colwidth&&f.colwidth[u]==t)continue;const p=f.colwidth?f.colwidth.slice():Gu(f.colspan);p[u]=t,a.setNodeMarkup(o+h,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function Sa(n,e,t,i){const r=n.state.doc.resolve(e),s=r.node(-1),o=r.start(-1),l=H.get(s).colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Ir(s,a.firstChild,a,i,l,t)}function Gu(n){return Array(n).fill(0)}function Uu(n,e){var t;const i=[],r=n.doc.resolve(e),s=r.node(-1);if(!s)return B.empty;const o=H.get(s),l=r.start(-1),a=o.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const d=a+c*o.width;if((a==o.width-1||o.map[d]!=o.map[d+1])&&(c==0||o.map[d]!=o.map[d-o.width])){const h=o.map[d],f=l+h+s.nodeAt(h).nodeSize-1,u=document.createElement("div");u.className="column-resize-handle",(t=oe.getState(n))!=null&&t.dragging&&i.push(ie.node(l+h,l+h+s.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),i.push(ie.widget(f,u))}}return B.create(n.doc,i)}function Zu({allowTableNodeSelection:n=!1}={}){return new on({key:Je,state:{init(){return null},apply(e,t){const i=e.getMeta(Je);if(i!=null)return i==-1?null:i;if(t==null||!e.docChanged)return t;const{deleted:r,pos:s}=e.mapping.mapResult(t);return r?null:s}},props:{decorations:vu,handleDOMEvents:{mousedown:Lu},createSelectionBetween(e){return Je.getState(e.state)!=null?e.state.selection:null},handleTripleClick:zu,handleKeyDown:Vu,handlePaste:Bu},appendTransaction(e,t,i){return Mu(i,Au(i,t),n)}})}const Sn=n=>{const e=Object.fromEntries(Array.from(n.attributes).map(t=>[t.name,t.value]));return delete e.draggable,e},xa="data-gs-mrk-fs",va="data-gs-ib",pi="data-gs-ifrg",Ne="attrs",Ca={[Ne]:{default:"{}"}},Ee={[Ne]:{default:{}}},ka=n=>({[Ne]:JSON.stringify(Sn(n))}),De=n=>({attrs:Sn(n)}),xn=n=>e=>[n,e.attrs.attrs,0],je=n=>n.attrs[Ne]?JSON.parse(n.attrs[Ne]):{},Xu={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${pi}]`,getAttrs:De}],toDOM:()=>["span",{[pi]:""},0]},div:{group:"block",content:"inline*",attrs:Ee,parseDOM:[{tag:"div",getAttrs:De}],toDOM:xn("div")},paragraph:{group:"block",content:"inline*",attrs:Ee,parseDOM:[{tag:"p",getAttrs:De}],toDOM:xn("p")},orderedList:{group:"block",content:"listItem+",attrs:Ee,parseDOM:[{tag:"ol",getAttrs:De}],toDOM:xn("ol")},bulletList:{group:"block",content:"listItem+",attrs:Ee,parseDOM:[{tag:"ul",getAttrs:De}],toDOM:xn("ul")},listItem:{content:"block*",group:"block",attrs:Ee,parseDOM:[{tag:"li",getAttrs:De}],toDOM:xn("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:Ee,parseDOM:[{tag:"pre",getAttrs:De}],toDOM:n=>["pre",n.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:Ee,parseDOM:[{tag:"img[src]",getAttrs:De}],toDOM:n=>["img",n.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${va}]`}],toDOM(){return["br",{[va]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:Ee,parseDOM:[{tag:"br",getAttrs:De}],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:Sn(t)})})),toDOM({attrs:n}){const{level:e}=n;return[e?`h${e}`:"div",n.attrs,0]}},...bu({tableGroup:"block",cellContent:"block+",cellAttributes:{[Ne]:{default:Ee[Ne].default,getFromDOM:Sn,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:Sn(n)}),priority:0}],toDOM(n){const{tagName:e,attrs:t}=n.attrs;return[e,t,0]}}},vn=(n,e)=>({attrs:Ca,parseDOM:n.map(t=>({tag:t,getAttrs:ka})),toDOM:e}),Yu={strong:vn(["strong","b"],n=>["b",je(n)]),link:vn(["a"],n=>["a",je(n),0]),em:vn(["em","i"],n=>["em",je(n)]),underline:vn(["u"],n=>["u",je(n),0]),strikethrough:vn(["s"],n=>["s",je(n),0]),font_size:{attrs:{...Ca,size:{default:null}},parseDOM:[{tag:`span[${xa}]`,getAttrs:n=>({...ka(n),size:n.style.fontSize})}],toDOM(n){const{size:e}=n.attrs,t={...je(n),[xa]:!0};return e&&(t.style=`font-size: ${e}`),["span",t,0]}}},Ma=new yd({nodes:Xu,marks:Yu}),mi=new WeakMap,Vr=new WeakMap,Qu=(n,e)=>{mi.set(n,e),Vr.set(e,n)},ep=(n,e)=>{mi.delete(n),Vr.delete(e)},zr=n=>mi.get(n),tp=n=>Vr.get(n),Ta=n=>{var t;const e=tp(n);return(t=e==null?void 0:e.__gjsv)==null?void 0:t.model},np=n=>n.dispatchEvent(new CustomEvent("input"));function ip(n){const e=t=>{if(t.tagName==="SPAN"&&t.hasAttribute(pi)){if(t.getAttribute("style")){t.removeAttribute(pi);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 rp(n,e={}){if(!e.enableOnClick)return()=>{};const t=n.Components.events,i=d=>n.getSelectedAll().includes(d),r=d=>d.isInstanceOf("text")&&!d.isChildOf("text"),s=d=>d.isChildOf("text"),o=d=>n.getEditing()===d,l=(d,h={})=>{d.trigger("focus",h.event)},a=(d,h)=>{i(d)&&r(d)&&!o(d)&&l(d,h)},c=(d,h)=>{if(i(d)&&!r(d)&&s(d)){const f=d.parents().find(u=>u.isInstanceOf("text"));f&&(l(f,h),setTimeout(()=>n.select(f),0))}};return n.on(t.select,a),n.on(t.selectBefore,c),()=>{n.off(t.select,a),n.off(t.selectBefore,c)}}const sp=(n,e)=>{const t=op(n);return t&&mp(t)?lp(n,e):t?Ro(()=>({type:n.schema.nodes.div}))(n,e):!1};function op(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 lp(n,e){const{selection:t,schema:i,tr:r}=n;r.split(t.from,1);const s=t.from+1,o=r.doc.nodeAt(s),l={...o.attrs.attrs,id:void 0},a=o.textContent.length>0,c=o.textContent.length||0,d=o.textContent||" ",h=i.text(d),f=i.nodes.div.create(l,a?h:[],[]);return r.replaceRangeWith(s,s+c+2,f),r.setSelection(E.create(r.doc,s+1)),e==null||e(r.scrollIntoView()),!0}function ap(n,e,t){const{state:i,dispatch:r}=n,{selection:s,tr:o}=i,l=(a,c,d)=>{const h={};return a.split(";").forEach(f=>{const[u,p]=f.split(":").map(m=>m.trim());u&&(h[u]=p)}),h[c]=d,Object.entries(h).map(([f,u])=>`${f}: ${u}`).join("; ")};if(!s.empty||t)o.doc.nodesBetween(s.from,s.to,(a,c)=>{var d,h;if(a.type===i.schema.nodes.image){const f=l(((d=a.attrs.attrs)==null?void 0:d.style)||"","float",e);o.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:f}})}else if(a.type.isBlock){const f=l(((h=a.attrs.attrs)==null?void 0:h.style)||"","text-align",e);Aa(a)?o.setBlockType(s.from,void 0,i.schema.nodes.div,{attrs:{style:f}}):o.setNodeMarkup(c,void 0,{...a.attrs,attrs:{...a.attrs.attrs,style:f}})}});else{const a=i.doc.resolve(s.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);o.setNodeMarkup(c,void 0,{...d.attrs,style:h})}}o.docChanged&&r(o.scrollIntoView())}const Cn=(n,e)=>{const{from:t,to:i}=n.selection;let r=!1;return n.doc.nodesBetween(t,i,s=>{if(r)return!1;s.marks.some(o=>o.type===e)&&(r=!0)}),r};function cp(n,e,t="_blank"){const{state:i,dispatch:r}=n,{schema:s,selection:o,tr:l}=i,a=s.marks.link;try{const c=a.create({[Ne]:JSON.stringify({href:e,target:t})});l.addMark(o.from,o.to,c),r(l.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function dp(n,e){const{state:t,dispatch:i}=n,{selection:r,tr:s}=t;if(r.empty)return;const o=t.schema.marks.font_size;if(!o){console.error("Font size mark is not defined in the schema.");return}s.addMark(r.from,r.to,o.create({size:e})),i(s.scrollIntoView())}const yt=(n,e)=>{const{doc:t,selection:i}=n.state,r=t.resolve(i.from);for(let s=r.depth;s>0;s--){const o=r.node(s);if(e(o))return{pos:s>0?r.before(s):0,start:r.start(s),depth:s,node:o}}},hp=n=>(n||"").split(";").map(e=>e.split(":")).reduce((e,[t,i])=>(t=t.replace(/-./g,r=>r.toUpperCase()[1]).trim(),e[t]=`${i}`.trim(),e),{});function fp(...n){return(e,t)=>{const i=o=>{e=e.apply(o),t==null||t(o)},r=n.pop();return n.reduce((o,l)=>o||l(e,i),!1)&&r!==void 0&&r(e,t)}}const up=(n,e)=>{const{state:t,dispatch:i}=n;if(e!=null&&e.event){const{event:r}=e,s=n.posAtCoords({left:r.clientX,top:r.clientY});s!=null&&s.pos&&i(t.tr.setSelection(E.create(t.doc,s.pos)))}else Io(t,i);setTimeout(()=>setTimeout(()=>n.focus()))},Br=n=>n.isBlock,Aa=n=>n.type.name==="inlineFragment",pp=n=>Br(n)&&!Aa(n),Oa=n=>n.type.name==="bulletList",Na=n=>n.type.name==="orderedList",mp=n=>n.type.name==="heading",gp=n=>Oa(n)||Na(n),Ea=(n,e)=>{var s,o;const t=(s=yt(n,l=>l.type===e))==null?void 0:s.node,i=n.state.schema.nodes.listItem;let r;return t?r=nr(i):(o=yt(n,gp))!=null&&o.node?r=fp(nr(i),Ko(e)):r=Ko(e),r(n.state,n.dispatch)},Da=(n,e)=>{const{selection:t}=n.state;return[...t.$from.marks(),...t.$to.marks()].find(i=>i.type.name===e)},yp=n=>{var o;const{view:e,prop:t,editor:i,propCSS:r}=n,s=(o=yt(e,pp))==null?void 0:o.node;if(s){const l=s.attrs.attrs||{},a=hp(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())||{})[r]||""}}return""},bp=n=>{const{view:e,prop:t,markName:i,editor:r,propCSS:s}=n,o=Da(e,i);if(o){const l=o.attrs;if(l[t])return l[t];if(l[Ne]){const a=je(o).id;if(a){const c=r.Components.getById(a);return((c==null?void 0:c.getStyle())||{})[s]||""}}}return""},Pa=(n,e)=>{const{dispatch:t}=n,{nodes:i,marks:r}=n.state.schema;return{text:{selected:()=>{const{selection:s,doc:o}=n.state;return o.textBetween(s.from,s.to," ")},replace:(s,o={})=>{const{state:l}=n,{from:a}=l.selection;let c=l.tr.replaceSelectionWith(l.schema.text(s));o.select&&(c=c.setSelection(E.create(c.doc,a,a+s.length))),t==null||t(c)}},bold:{toggle:()=>at(r.strong)(n.state,t),isActive:()=>Cn(n.state,r.strong)},italic:{toggle:()=>at(r.em)(n.state,t),isActive:()=>Cn(n.state,r.em)},underline:{toggle:()=>at(r.underline)(n.state,t),isActive:()=>Cn(n.state,r.underline)},strikethrough:{toggle:()=>at(r.strikethrough)(n.state,t),isActive:()=>Cn(n.state,r.strikethrough)},link:{get:()=>{const s=Ta(n);if(s!=null&&s.is("link"))return s.getAttributes();{const o=Da(n,"link");return o?je(o):{}}},toggle:()=>at(r.link)(n.state,t),isActive:()=>Cn(n.state,r.link),create:s=>{const o=Ta(n);o!=null&&o.is("link")?(o.addAttributes({href:s.url,target:s.target}),n.focus()):cp(n,s.url,s.target)}},alignText:{get:()=>yp({view:n,editor:e,prop:"textAlign",propCSS:"text-align"}),set:s=>ap(n,s.value,!0)},fontSize:{get:()=>bp({view:n,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:s=>dp(n,s.value)},image:{open(){const s="assetLayout",{state:o,dispatch:l}=n,{selection:a,doc:c}=o,d=c.textBetween(a.from,a.to," "),h={id:s,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:f=>{const u={alt:d,src:f.asset.getSrc()};l(o.tr.replaceSelectionWith(i.image.createAndFill({attrs:u})))}}};e.runCommand(Gt.layoutToggle,h)}},heading:{get:()=>{var o;const s=(o=yt(n,Br))==null?void 0:o.node;return`${(s==null?void 0:s.attrs.level)||""}`},set:({value:s})=>{var a;const{state:o}=n,l=(a=yt(n,Br))==null?void 0:a.node;dh(o.schema.nodes.heading,{attrs:l==null?void 0:l.attrs.attrs,level:s?parseInt(s,10):0})(o,t)}},listBullet:{isActive:()=>{var s;return!!((s=yt(n,Oa))!=null&&s.node)},toggle:()=>Ea(n,i.bulletList)},listOrdered:{isActive:()=>{var s;return!!((s=yt(n,Na))!=null&&s.node)},toggle:()=>Ea(n,i.orderedList)}}},be="rte:selectionchange",fe={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>'},wp=(n,e)=>{var a;const{editor:t,el:i}=n,r=mi.get(i),s=Pa(r,t),o={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:fe.bold,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.bold.isActive()})}},onClick:({setState:c})=>{s.bold.toggle(),c({active:s.bold.isActive()})}},italic:{id:"italic",icon:fe.italic,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.italic.isActive()})}},onClick:({setState:c})=>{s.italic.toggle(),c({active:s.italic.isActive()})}},underline:{id:"underline",icon:fe.underline,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.underline.isActive()})}},onClick:({setState:c})=>{s.underline.toggle(),c({active:s.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:fe.strikethrough,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.strikethrough.isActive()})}},onClick:({setState:c})=>{s.strikethrough.toggle(),c({active:s.strikethrough.isActive()})}},image:{id:"image",icon:fe.image,size:"s",type:"button",onClick:()=>s.image.open()},link:{id:"link",icon:fe.link,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.link.isActive(),disabled:r.state.selection.empty})}},onClick:({event:c})=>{const d=c.currentTarget||c.target,{x:h,y:f,width:u,height:p}=d.getBoundingClientRect(),m="linkLayout",g=()=>t.runCommand(Gt.layoutRemove,{id:m}),b=s.link.get(),C={id:m,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:h,y:f,w:u,h:p},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:y=>{y.preventDefault();const S=new FormData(y.currentTarget);s.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:(b==null?void 0:b.href)||"",onChange:({value:y,setState:S})=>S({value:y})},{type:"selectField",name:"target",label:"Open link in",emptyState:"Current window",value:(b==null?void 0:b.target)||"",options:[{id:"",label:"Current window"},{id:"_blank",label:"New window"}],onChange:({value:y,setState:S})=>S({value:y})},{type:"row",style:{gap:10,justifyContent:"end"},children:[s.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{s.link.toggle(),g()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};t.runCommand(Gt.layoutToggle,C)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:fe.alignTextLeft},{id:"center",icon:fe.alignTextCenter},{id:"right",icon:fe.alignTextRight},{id:"justify",icon:fe.alignTextJustify}],editorEvents:{[be]:({setState:c})=>{c({value:s.alignText.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),s.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:fe.listBullet,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.listBullet.isActive()})}},onClick:({setState:c})=>{s.listBullet.toggle(),c({active:s.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:fe.listOrdered,size:"s",type:"button",editorEvents:{[be]:({setState:c})=>{c({active:s.listOrdered.isActive()})}},onClick:({setState:c})=>{s.listOrdered.toggle(),c({active:s.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:{[be]:({setState:c})=>{c({value:s.heading.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),s.heading.set({value:c}),r.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:{[be]:({setState:c})=>{c({value:s.fontSize.get()})}},onChange:({value:c,setState:d})=>{d({value:c}),s.fontSize.set({value:c}),r.focus()}}},l=[o.bold,o.italic,o.underline,o.strikethrough,o.image,o.link,o.listBullet,o.listOrdered,o.alignText,o.heading,o.fontSize];return((a=e.toolbar)==null?void 0:a.call(e,{...n,commands:s,layouts:o,proseMirror:{view:r},items:l}))||l};class Sp{constructor(e,t,i){this.editor=i,this.node=e,this.dom=document.createElement("img"),this.view=t,Object.keys(e.attrs.attrs).forEach(r=>{this.dom.setAttribute(r,e.attrs.attrs[r])}),this.dom.addEventListener("dblclick",r=>this.handleDoubleClick(r))}handleDoubleClick(e){const{editor:t,view:i}=this;Pa(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 Ge{constructor(e,t,i={}){this.match=e,this.match=e,this.handler=typeof t=="string"?xp(t):t,this.undoable=i.undoable!==!1,this.inCode=i.inCode||!1}}function xp(n){return function(e,t,i,r){let s=n;if(t[1]){let o=t[0].lastIndexOf(t[1]);s+=t[0].slice(o+t[1].length),i+=o;let l=i-r;l>0&&(s=t[0].slice(o-l,o)+s,i=r)}return e.tr.insertText(s,i,r)}}const vp=500;function Cp({rules:n}){let e=new on({state:{init(){return null},apply(t,i){let r=t.getMeta(this);return r||(t.selectionSet||t.docChanged?null:i)}},props:{handleTextInput(t,i,r,s){return Ra(t,i,r,s,n,e)},handleDOMEvents:{compositionend:t=>{setTimeout(()=>{let{$cursor:i}=t.state.selection;i&&Ra(t,i.pos,i.pos,"",n,e)})}}},isInputRules:!0});return e}function Ra(n,e,t,i,r,s){if(n.composing)return!1;let o=n.state,l=o.doc.resolve(e),a=l.parent.textBetween(Math.max(0,l.parentOffset-vp),l.parentOffset,null,"")+i;for(let c=0;c<r.length;c++){let d=r[c];if(l.parent.type.spec.code){if(!d.inCode)continue}else if(d.inCode==="only")continue;let h=d.match.exec(a),f=h&&d.handler(o,h,e-(h[0].length-i.length),t);if(f)return d.undoable&&f.setMeta(s,{transform:f,from:e,to:t,text:i}),n.dispatch(f),!0}return!1}const kp=new Ge(/--$/,"—"),Mp=new Ge(/\.\.\.$/,"…"),Tp=new Ge(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Ap=new Ge(/"$/,"”"),Op=new Ge(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Np=new Ge(/'$/,"’"),Ep=[Tp,Ap,Op,Np];function Lr(n,e,t=null,i){return new Ge(n,(r,s,o,l)=>{let a=t instanceof Function?t(s):t,c=r.tr.delete(o,l),d=c.doc.resolve(o),h=d.blockRange(),f=h&&co(h,e,a);if(!f)return null;c.wrap(h,f);let u=c.doc.resolve(o-1).nodeBefore;return u&&u.type==e&&Un(c.doc,o-1)&&(!i||i(s,u))&&c.join(o-1),c})}function Ia(n,e,t=null){return new Ge(n,(i,r,s,o)=>{let l=i.doc.resolve(s),a=t instanceof Function?t(r):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?i.tr.delete(s,o).setBlockType(s,s,e,a):null})}function Dp(n){return Lr(/^\s*>\s$/,n)}function Pp(n){return Lr(/^(\d+)\.\s$/,n,e=>({order:+e[1]}),(e,t)=>t.childCount+t.attrs.order==+e[1])}function Rp(n){return Lr(/^\s*([-+*])\s$/,n)}function Ip(n){return Ia(/^```$/,n)}function Vp(n,e){return Ia(new RegExp("^(#{1,"+e+"})\\s$"),n,t=>({level:t[1].length}))}function zp(n){const e=Ep.concat(Mp,kp);let t;return(t=n.nodes.blockquote)&&e.push(Dp(t)),(t=n.nodes.orderedList)&&e.push(Pp(t)),(t=n.nodes.bulletList)&&e.push(Rp(t)),(t=n.nodes.codeBlock)&&e.push(Ip(t)),(t=n.nodes.heading)&&e.push(Vp(t,6)),Cp({rules:e})}const Bp="rteProseMirror",Lp=Ze(function(n,e={}){const t={plugins:o=>o.plugins,...e},i=(o,l)=>{var p,m;const a=((p=t.schema)==null?void 0:p.call(t,{editor:n,schema:Ma}))||Ma,{nodes:c,marks:d}=a,h=Rt.fromSchema(a).parse(o),f=Ft.create({doc:h,schema:a,plugins:(m=t.plugins)==null?void 0:m.call(t,{editor:n,plugins:[Fu(),Zu(),zp(a),xh(),tr({Tab:ha(1),"Shift-Tab":ha(-1)}),tr({Enter:an(Po,Nh(c.listItem),sp),"Shift-Enter":an(Do,(g,b)=>(b&&b(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":_o,"Mod-y":Yi,"Mod-Shift-z":Yi,"Mod-b":at(d.strong),"Mod-i":at(d.em),"Shift-Tab":nr(c.listItem),Tab:Ph(c.listItem)}),tr(fh)]})}),u=new hu({mount:o},{state:f,dispatchTransaction(g){var x;const{state:b}=u,C=b.apply(g),y=!b.doc.eq(C.doc);u.updateState(C);const S=!b.selection.eq(C.selection);y&&(np(((x=l==null?void 0:l.view)==null?void 0:x.el)||o),u.focus()),(S||y)&&n.trigger(be)}});return o.__rteView=u,u.setProps({nodeViews:{image(g){return new Sp(g,u,n)}}}),u},r=o=>wp(o,t);n.setCustomRte({toolbar:r,parseContent:!0,async enable(o,l,a){const c=zr(o);if(c)return c;const d=i(o,a);return Qu(o,d),up(d,a),d},disable(o){const l=zr(o);if(l)return ep(o,l),l.destroy(),{forceSync:!0}},getContent(o){const l=zr(o);if(l){const{schema:a,doc:c}=l.state,d=document.createElement("div"),h=lt.fromSchema(a).serializeFragment(c.content);return h.childNodes.forEach(f=>{f.nodeType===Node.ELEMENT_NODE&&f.innerHTML===""&&(f.innerHTML="<br/>")}),d.appendChild(h),ip(d),o.classList.remove("ProseMirror-focused"),d.innerHTML}return o.innerHTML}});const s=rp(n,t);Xe({editor:n,licenseKey:t.licenseKey,plan:ae.free,pluginName:Bp,cleanup:()=>{n.RichTextEditor.customRte=void 0,s()}})});le.dialogComponent=Ya,le.fsLightboxComponent=Dc,le.lightGalleryComponent=Fc,le.listPagesComponent=Oc,le.rteProseMirror=Lp,le.swiperComponent=ed,le.tableComponent=vc,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
348
+ `);return{dom:l,text:d,slice:e}}function c0(t,e,n,r,i){let o=i.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||o||!n);if(l){if(t.someProp("transformPastedText",d=>{e=d(e,o||r,t)}),o)return e?new F(D.from(t.state.schema.text(e.replace(/\r\n?/g,`
349
+ `))),0,0):F.empty;let f=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(f)a=f;else{let d=i.marks(),{schema:p}=t.state,h=Qr.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=N3(n),as&&P3(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 f=+u[3];f>0;f--){let d=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||_u.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!A3.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=V3(p0(a,+u[1],+u[2]),u[4]);else if(a=F.maxOpen(T3(a.content,i),!0),a.openStart||a.openEnd){let f=0,d=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;d<a.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);a=p0(a,f,d)}return t.someProp("transformPasted",f=>{a=f(a,t)}),a}const A3=/^(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 T3(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&f0(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=d0(s[s.length-1],o.length));let u=u0(a,l);s.push(u),i=i.matchType(u.type),o=l}}),s)return D.from(s)}return t}function u0(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,D.from(t));return t}function f0(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=f0(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(D.from(u0(n,t,i+1))))}}function d0(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,d0(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(D.empty,!0);return t.copy(n.append(r))}function cf(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=cf(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(D.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function p0(t,e,n){return e<t.openStart&&(t=new F(cf(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new F(cf(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const h0={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 m0=null;function g0(){return m0||(m0=document.implementation.createHTMLDocument("title"))}let uf=null;function M3(t){let e=window.trustedTypes;return e?(uf||(uf=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),uf.createHTML(t)):t}function N3(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=g0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&h0[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=M3(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function P3(t){let e=t.querySelectorAll(tt?"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 V3(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:i,openStart:o,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=D.from(l.create(r[a+1],i)),o++,s++}return new F(i,o,s)}const at={},lt={},D3={touchstart:!0,touchmove:!0};class L3{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 R3(t){for(let e in at){let n=at[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{H3(t,r)&&!df(t,r)&&(t.editable||!(r.type in lt))&&n(t,r)},D3[e]?{passive:!0}:void 0)}st&&t.dom.addEventListener("input",()=>null),ff(t)}function yr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function j3(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 ff(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>df(t,r))})}function df(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function H3(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 I3(t,e){!df(t,e)&&at[e.type]&&(t.editable||!(e.type in lt))&&at[e.type](t,e)}lt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!v0(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(sn&&tt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),no&&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",i=>i(t,ri(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||k3(t,n)?n.preventDefault():yr(t,"key")},lt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},lt.keypress=(t,e)=>{let n=e;if(v0(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof be)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function fl(t){return{left:t.clientX,top:t.clientY}}function B3(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function pf(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function oo(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 $3(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&de.isSelectable(r)?(oo(t,new de(n)),!0):!1}function z3(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof de&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(de.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(oo(t,de.create(t.state.doc,i)),!0):!1}function F3(t,e,n,r,i){return pf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?z3(t,n):$3(t,n))}function W3(t,e,n,r){return pf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function U3(t,e,n,r){return pf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||q3(t,n,r)}function q3(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(oo(t,be.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)oo(t,be.create(r,a+1,a+1+s.content.size));else if(de.isSelectable(s))oo(t,de.create(r,a));else continue;return!0}}function hf(t){return dl(t)}const b0=Wt?"metaKey":"ctrlKey";at.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=hf(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&B3(n,t.input.lastClick)&&!n[b0]&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords(fl(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new G3(t,s,n,!!r)):(o=="doubleClick"?W3:U3)(t,s.pos,s.inside,n)?n.preventDefault():yr(t,"pointer"))};class G3{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[b0],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof de&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&on&&!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)),yr(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(()=>Wn(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(fl(e))),this.updateAllowDefault(e),this.allowDefault||!n?yr(this.view,"pointer"):F3(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||st&&this.mightDrag&&!this.mightDrag.node.isAtom||tt&&!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)?(oo(this.view,ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),yr(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)}}at.touchstart=t=>{t.input.lastTouch=Date.now(),hf(t),yr(t,"pointer")},at.touchmove=t=>{t.input.lastTouch=Date.now(),yr(t,"pointer")},at.contextmenu=t=>hf(t);function v0(t,e){return t.composing?!0:st&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const K3=sn?5e3:-1;lt.compositionstart=lt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof be&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),dl(t,!0),t.markCursor=null;else if(dl(t,!e.selection.empty),on&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}y0(t,K3)},lt.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++,y0(t,20))};function y0(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>dl(t),e))}function w0(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=J3());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Z3(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=$_(e.focusNode,e.focusOffset),r=z_(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.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 J3(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function dl(t,e=!1){if(!(sn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),w0(t),e||t.docView&&t.docView.dirty){let n=rf(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 Y3(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(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ds=ht&&mr<15||no&&G_<604;at.copy=lt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ds?null:n.clipboardData,s=r.content(),{dom:a,text:l}=l0(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Y3(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function X3(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Q3(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 i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ps(t,r.value,null,i,e):ps(t,r.textContent,r.innerHTML,i,e)},50)}function ps(t,e,n,r,i){let o=c0(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||F.empty)))return!0;if(!o)return!1;let s=X3(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function x0(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," "):""}lt.paste=(t,e)=>{let n=e;if(t.composing&&!sn)return;let r=ds?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ps(t,x0(r),r.getData("text/html"),i,n)?n.preventDefault():Q3(t,n)};class S0{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const C0=Wt?"altKey":"ctrlKey";at.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(fl(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof de?i.to-1:i.to))){if(r&&r.mightDrag)s=de.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=de.create(t.state.doc,f.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=l0(t,a);(!n.dataTransfer.files.length||!tt||Ag>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ds?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ds||n.dataTransfer.setData("text/plain",c),t.dragging=new S0(u,!n[C0],s)},at.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},lt.dragover=lt.dragenter=(t,e)=>e.preventDefault(),lt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(fl(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=c0(t,x0(n.dataTransfer),ds?null:n.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!n[C0]);if(t.someProp("handleDrop",h=>h(t,n,s||F.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?KE(t.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let c=t.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=c.doc;if(f?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(d))return;let p=c.doc.resolve(u);if(f&&de.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new de(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,w)=>h=w),c.setSelection(sf(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},at.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())&&Wn(t)},20))},at.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)},at.beforeinput=(t,e)=>{if(tt&&sn&&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",o=>o(t,ri(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in lt)at[t]=lt[t];function hs(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 pl{constructor(e,n){this.toDOM=e,this.spec=n||ai,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new mt(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof pl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&hs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wr{constructor(e,n){this.attrs=e,this.spec=n||ai}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new mt(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof wr&&hs(this.attrs,e.attrs)&&hs(this.spec,e.spec)}static is(e){return e.type instanceof wr}destroy(){}}class mf{constructor(e,n){this.attrs=e,this.spec=n||ai}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new mt(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof mf&&hs(this.attrs,e.attrs)&&hs(this.spec,e.spec)}destroy(){}}class mt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new mt(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 mt(e,e,new pl(n,r))}static inline(e,n,r,i){return new mt(e,n,new wr(r,i))}static node(e,n,r,i){return new mt(e,n,new mf(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof wr}get widget(){return this.type instanceof pl}}const so=[],ai={};class De{constructor(e,n){this.local=e.length?e:so,this.children=n.length?n:so}static create(e,n){return n.length?hl(n,e,0,ai):nt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ai)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?ek(this.children,s||[],e,n,r,i,o):s?new De(s.sort(li),so):nt}add(e,n){return n.length?this==nt?De.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let c=l+r,u;if(u=E0(n,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,hl(u,a,c+1,ai)),o+=3}});let s=O0(o?_0(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new De(s.length?this.local.concat(s).sort(li):this.local,i||this.children)}remove(e){return e.length==0||this==nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<l&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=nt?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let a=0;a<i.length;a++)i[a].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new De(i,r):nt}forChild(e,n){if(this==nt)return this;if(n.isLeaf)return De.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof wr){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new De(i.sort(li),so);return r?new xr([a,r]):a}return r||nt}eq(e){if(this==e)return!0;if(!(e instanceof De)||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 gf(this.localsInner(e))}localsInner(e){if(this==nt)return so;if(e.inlineContent||!this.local.some(wr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}De.empty=new De([],[]),De.removeOverlap=gf;const nt=De.empty;class xr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,ai));return xr.from(r)}forChild(e,n){if(n.isLeaf)return De.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=nt&&(o instanceof xr?r=r.concat(o.members):r.push(o))}return xr.from(r)}eq(e){if(!(e instanceof xr)||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 i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?gf(r?n:n.sort(li)):so}static from(e){switch(e.length){case 0:return nt;case 1:return e[0];default:return new xr(e.every(n=>n instanceof De)?e:e.reduce((n,r)=>n.concat(r instanceof De?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function ek(t,e,n,r,i,o,s){let a=t.slice();for(let c=0,u=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((d,p,h,m)=>{let g=m-h-(p-d);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||d>w+u-f)continue;let x=a[y]+u-f;p>=x?a[y+1]=d<=x?-2:-1:d>=u&&g&&(a[y]+=g,a[y+1]+=g)}f+=g}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+o),f=u-i;if(f<0||f>=r.content.size){l=!0;continue}let d=n.map(t[c+1]+o,-1),p=d-i,{index:h,offset:m}=r.content.findIndex(f),g=r.maybeChild(h);if(g&&m==f&&m+g.nodeSize==p){let y=a[c+2].mapInner(n,g,u+1,t[c]+o+1,s);y!=nt?(a[c]=f,a[c+1]=p,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=tk(a,t,e,n,i,o,s),u=hl(c,r,0,s);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,d=0;f<u.children.length;f+=3){let p=u.children[f];for(;d<a.length&&a[d]<p;)d+=3;a.splice(d,0,u.children[f],u.children[f+1],u.children[f+2])}}return new De(e.sort(li),a)}function O0(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new mt(i.from+e,i.to+e,i.type))}return n}function tk(t,e,n,r,i,o,s){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,i,c);f?n.push(f):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+o+1);return n}function E0(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function _0(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function hl(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let c=E0(t,a,l+n);if(c){o=!0;let u=hl(c,a,n+l+1,r);u!=nt&&i.push(l,l+a.nodeSize,u)}});let s=O0(o?_0(t):t,-n).sort(li);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new De(s,i):nt}function li(t,e){return t.from-e.from||t.to-e.to}function gf(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),k0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),k0(e,i,r.copy(o.from,r.to)));break}}}return e}function k0(t,e,n){for(;e<t.length&&li(n,t[e])>0;)e++;t.splice(e,0,n)}function bf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=nt&&e.push(r)}),t.cursorWrapper&&e.push(De.create(t.state.doc,[t.cursorWrapper.deco])),xr.from(e)}const nk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},rk=ht&&mr<=11;class ik{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 ok{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ik,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ht&&mr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),rk&&(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,nk)),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(e0(this.view)){if(this.suppressingSelectionUpdates)return Wn(this.view);if(ht&&mr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ni(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 o=e.focusNode;o;o=is(o))n.add(o);for(let o=e.anchorNode;o;o=is(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&e0(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(a=!0))}if(on&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,d]=u;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of u){let p=d.parentNode;p&&p.nodeName=="LI"&&(!f||lk(e,f)!=p)&&d.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&al(r)&&(c=rf(e))&&c.eq(ge.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Wn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),sk(e)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Wn(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 f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(ht&&mr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:d}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==e.target?Je(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?Je(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,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 A0=new WeakMap,T0=!1;function sk(t){if(!A0.has(t)&&(A0.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=on,T0)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."),T0=!0}}function M0(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ni(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function ak(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return M0(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?M0(t,n):null}function lk(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 ck(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],al(l)||c.push({node:l.focusNode,offset:l.focusOffset})),tt&&t.input.lastKeyCode===8)for(let g=o;g>i;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){o=g;break}if(!w||w.size)break}let f=t.state.doc,d=t.someProp("domParser")||_u.fromSchema(t.state.schema),p=f.resolve(s),h=null,m=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:uk,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),h={anchor:g+s,head:y+s}}return{doc:m,sel:h,from:s,to:a}}function uk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(st&&/^(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||st&&/^(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 fk=/^(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 dk(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,V=rf(t,T);if(V&&!t.state.selection.eq(V)){if(tt&&sn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",z=>z(t,ri(13,"Enter"))))return;let I=t.state.tr.setSelection(V);T=="pointer"?I.setMeta("pointer",!0):T=="key"&&I.scrollIntoView(),o&&I.setMeta("composition",o),t.dispatch(I)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=ck(t,e,n),u=t.state.doc,f=u.slice(c.from,c.to),d,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(d=t.state.selection.to,p="end"):(d=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=mk(f.content,c.doc.content,c.from,d,p);if(h&&t.input.domChangeCount++,(no&&t.input.lastIOSEnter>Date.now()-225||sn)&&i.some(T=>T.nodeType==1&&!fk.test(T.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",T=>T(t,ri(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof be&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let T=N0(t,t.state.doc,c.sel);if(T&&!T.eq(t.state.selection)){let V=t.state.tr.setSelection(T);o&&V.setMeta("composition",o),t.dispatch(V)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof be&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),ht&&mr<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),y=u.resolve(h.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA,x;if((no&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(x=ge.findFrom(c.doc.resolve(m.pos+1),1,!0))&&x.head==g.pos)&&t.someProp("handleKeyDown",T=>T(t,ri(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&hk(u,h.start,h.endA,m,g)&&t.someProp("handleKeyDown",T=>T(t,ri(8,"Backspace")))){sn&&tt&&t.domObserver.suppressSelectionUpdates();return}tt&&sn&&h.endB==h.start&&(t.input.lastAndroidDelete=Date.now()),sn&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,ri(13,"Enter"))})},20));let O=h.start,v=h.endA,E,A,B;if(w){if(m.pos==g.pos)ht&&mr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Wn(t),20)),E=t.state.tr.delete(O,v),A=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(B=pk(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start()))))E=t.state.tr,B.type=="add"?E.addMark(O,v,B.mark):E.removeMark(O,v,B.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset);if(t.someProp("handleTextInput",V=>V(t,O,v,T)))return;E=t.state.tr.insertText(T,O,v)}}if(E||(E=t.state.tr.replace(O,v,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let T=N0(t,E.doc,c.sel);T&&!(tt&&sn&&t.composing&&T.empty&&(h.start!=h.endB||t.input.lastAndroidDelete<Date.now()-100)&&(T.head==O||T.head==E.mapping.map(v)-1)||ht&&T.empty&&T.head==O)&&E.setSelection(T)}A&&E.ensureMarks(A),o&&E.setMeta("composition",o),t.dispatch(E.scrollIntoView())}function N0(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:sf(t,e.resolve(n.anchor),e.resolve(n.head))}function pk(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(D.from(c).eq(t))return{mark:a,type:s}}function hk(t,e,n,r,i){if(n-e<=i.pos-r.pos||vf(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let a=o.nodeAfter;return a!=null&&n==e+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(vf(o,!0,!0));return!s.parent.isTextblock||s.pos>n||vf(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function vf(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function mk(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&t.size<e.size){let l=r<=o&&r>=s?o-r:0;o-=l,o&&o<e.size&&P0(e.textBetween(o-1,o+1))&&(o+=l?1:-1),a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,o&&o<t.size&&P0(t.textBetween(o-1,o+1))&&(o+=l?1:-1),s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}function P0(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 gk{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 L3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(j0),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=L0(this),D0(this),this.nodeViews=R0(this),this.docView=zg(this.state.doc,V0(this),bf(this),this.dom,this),this.domObserver=new ok(this,(r,i,o,s)=>dk(this,r,i,o,s)),this.domObserver.start(),R3(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&&ff(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(j0),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 i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(w0(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=R0(this);vk(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ff(this),this.editable=L0(this),D0(this);let l=bf(this),c=V0(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(i.selection))&&(s=!0);let d=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&J_(this);if(s){this.domObserver.stop();let p=f&&(ht||tt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&bk(i.selection,e.selection);if(f){let h=tt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Z3(this)),(o||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=zg(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&w3(this))?Wn(this,p):(Xg(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():d&&Y_(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof de){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Tg(this,n.getBoundingClientRect(),e)}else Tg(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,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new S0(e.slice,e.move,i<0?void 0:de.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(i=n?n(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(ht){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&&X_(this.dom),Wn(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 r3(this,e)}coordsAtPos(e,n=1){return Lg(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 i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return l3(this,n||this.state,e)}pasteHTML(e,n){return ps(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ps(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(j3(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,I_())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return I3(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?st&&this.root.nodeType===11&&W_(this.dom.ownerDocument)==this.dom&&ak(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function V0(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"),[mt.node(0,t.state.doc.content.size,e)]}function D0(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:mt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function L0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function bk(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 R0(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function vk(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function j0(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 yf,wf;if(typeof WeakMap<"u"){let t=new WeakMap;yf=e=>t.get(e),wf=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;yf=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},wf=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var He=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,i=e/this.width|0;let o=r+1,s=i+1;for(let a=1;o<this.width&&this.map[e+a]==n;a++)o++;for(let a=1;s<this.height&&this.map[e+this.width*a]==n;a++)s++;return{left:r,top:i,right:o,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:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(o,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width;const a=(t+1)*this.width;for(;s<a&&this.map[s]<i;)s++;return s==a?o-1:this.map[s]}i=o}}static get(t){return yf(t)||wf(t,yk(t))}};function yk(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=wk(t),n=t.childCount,r=[];let i=0,o=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 f=t.child(c);u++;for(let h=0;;h++){for(;i<r.length&&r[i]!=0;)i++;if(h==f.childCount)break;const m=f.child(h),{colspan:g,rowspan:y,colwidth:w}=m.attrs;for(let x=0;x<y;x++){if(x+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:y-x});break}const O=i+x*e;for(let v=0;v<g;v++){r[O+v]==0?r[O+v]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:g-v});const E=w&&w[v];if(E){const A=(O+v)%e*2,B=s[A];B==null||B!=E&&s[A+1]==1?(s[A]=E,s[A+1]=1):B==E&&s[A+1]++}}}i+=g,u+=m.nodeSize}const d=(c+1)*e;let p=0;for(;i<d;)r[i++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),u++}const a=new He(e,n,r,o);let l=!1;for(let c=0;!l&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(l=!0);return l&&xk(a,s,t),a}function wk(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let o=0;if(n)for(let s=0;s<r;s++){const a=t.child(s);for(let l=0;l<a.childCount;l++){const c=a.child(l);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const a=i.child(s);o+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function xk(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const o=t.map[i];if(r[o])continue;r[o]=!0;const s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let a=null;const l=s.attrs;for(let c=0;c<l.colspan;c++){const u=(i+c)%t.width,f=e[u*2];f!=null&&(!l.colwidth||l.colwidth[c]!=f)&&((a||(a=Sk(l)))[c]=f)}a&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:a})}}function Sk(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function H0(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,i=Number(t.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const s in e){const a=e[s].getFromDOM,l=a&&a(t);l!=null&&(o[s]=l)}return o}function I0(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 i=e[r].setDOMAttr;i&&i(t.attrs[r],n)}return n}function Ck(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=>H0(r,e)}],toDOM(r){return["td",I0(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>H0(r,e)}],toDOM(r){return["th",I0(r,e),0]}}}}function En(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Sr=new ns("selectingCells");function ms(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 ml(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 xf(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=ms(e.$head)||Ok(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Ok(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 Sf(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Ek(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Cf(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function B0(t,e,n){const r=t.node(-1),i=He.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function ao(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(i=>i>0)||(r.colwidth=null)),r}var Fe=class Zn extends ge{constructor(e,n=e){const r=e.node(-1),i=He.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),a=e.node(0),l=i.cellsInRect(s).filter(u=>u!=n.pos-o);l.unshift(n.pos-o);const c=l.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const d=o+u+1;return new Xm(a.resolve(d),a.resolve(d+f.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)),i=e.resolve(n.map(this.$headCell.pos));if(Sf(r)&&Sf(i)&&Cf(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Zn.rowSelection(r,i):o&&this.isColSelection()?Zn.colSelection(r,i):new Zn(r,i)}return be.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=He.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*n.width+i.left,f=i.left;f<i.right;f++,u++){const d=n.map[u];if(o[d])continue;o[d]=!0;const p=n.findCell(d);let h=e.nodeAt(d);if(!h)throw RangeError(`No cell with offset ${d} found`);const m=i.left-p.left,g=p.right-i.right;if(m>0||g>0){let y=h.attrs;if(m>0&&(y=ao(y,0,m)),g>0&&(y=ao(y,y.colspan-g,g)),p.left<i.left){if(h=h.type.createAndFill(y),!h)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else h=h.type.create(y,h.content)}if(p.top<i.top||p.bottom>i.bottom){const y={...h.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?h=h.type.createAndFill(y):h=h.type.create(y,h.content)}c.push(h)}s.push(e.child(l).copy(D.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:s;return new F(D.from(a),1,1)}replace(e,n=F.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:a,$to:l}=i[s],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),s?F.empty:n)}const o=ge.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new F(D.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=He.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[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,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=He.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(o+i.map[s.left])),a.bottom<i.height&&(n=l.resolve(o+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(o+i.map[a.left])),s.bottom<i.height&&(e=l.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new Zn(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=He.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==n.width}eq(e){return e instanceof Zn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=He.get(r),o=e.start(-1),s=i.findCell(e.pos-o),a=i.findCell(n.pos-o),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(o+i.map[s.top*i.width])),a.right<i.width&&(n=l.resolve(o+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(o+i.map[a.top*i.width])),s.right<i.width&&(e=l.resolve(o+i.map[i.width*(s.top+1)-1]))),new Zn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Zn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Zn(e.resolve(n),e.resolve(r))}getBookmark(){return new _k(this.$anchorCell.pos,this.$headCell.pos)}};Fe.prototype.visible=!1,ge.jsonID("cell",Fe);var _k=class mb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new mb(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&&Cf(n,r)?new Fe(n,r):ge.near(r,1)}};function kk(t){if(!(t.selection instanceof Fe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(mt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),De.create(t.doc,e)}function Ak({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function Tk({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function Mk(t,e,n){const r=(e||t).selection,i=(e||t).doc;let o,s;if(r instanceof de&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=Fe.create(i,r.from);else if(s=="row"){const a=i.resolve(r.from+1);o=Fe.rowSelection(a,a)}else if(!n){const a=He.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];o=Fe.create(i,l+1,c)}}else r instanceof be&&Ak(r)?o=be.create(i,r.from):r instanceof be&&Tk(r)&&(o=be.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var Nk=new ns("fix-tables");function $0(t,e,n,r){const i=t.childCount,o=e.childCount;e:for(let s=0,a=0;s<o;s++){const l=e.child(s);for(let c=a,u=Math.min(i,s+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?$0(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function Pk(t,e){let n;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=Vk(t,i,o,n))};return e?e.doc!=t.doc&&$0(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Vk(t,e,n,r){const i=He.get(e);if(!i.problems)return r;r||(r=t.tr);const o=[];for(let l=0;l<i.height;l++)o.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const f=u.attrs;for(let d=0;d<f.rowspan;d++)o[c.row+d]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,ao(f,f.colspan-c.n,c.n))}else if(c.type=="missing")o[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,a;for(let l=0;l<o.length;l++)o[l]&&(s==null&&(s=l),a=l);for(let l=0,c=n+1;l<i.height;l++){const u=e.child(l),f=c+u.nodeSize,d=o[l];if(d>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const h=[];for(let g=0;g<d;g++){const y=En(t.schema)[p].createAndFill();y&&h.push(y)}const m=(l==0||s==l-1)&&a==l?c+1:f-1;r.insert(r.mapping.map(m),h)}c=f}return r.setMeta(Nk,{fixTables:!0})}function z0(t){const e=t.selection,n=xf(t),r=n.node(-1),i=n.start(-1),o=He.get(r);return{...e instanceof Fe?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function Dk(t){return function(e,n){if(!ml(e))return!1;if(n){const r=En(e.schema),i=z0(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(l=>i.table.nodeAt(l));for(let l=0;l<s.length;l++)a[l].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[l],r.cell,a[l].attrs);if(o.steps.length==0)for(let l=0;l<s.length;l++)o.setNodeMarkup(i.tableStart+s[l],r.header_cell,a[l].attrs);n(o)}return!0}}function F0(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 i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Of(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Dk(t):function(n,r){if(!ml(n))return!1;if(r){const i=En(n.schema),o=z0(n),s=n.tr,a=F0("row",o,i),l=F0("column",o,i),u=(t==="column"?a:t==="row"?l:!1)?1:0,f=t=="column"?{left:0,top:u,right:1,bottom:o.map.height}:t=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;o.map.cellsInRect(f).forEach(p=>{const h=p+o.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,d,m.attrs)}),r(s)}return!0}}Of("row",{useDeprecatedLogic:!0}),Of("column",{useDeprecatedLogic:!0}),Of("cell",{useDeprecatedLogic:!0});function Lk(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.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),i=t.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function W0(t){return function(e,n){if(!ml(e))return!1;const r=Lk(xf(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(be.between(i,Ek(i))).scrollIntoView())}return!0}}function gl(t,e){const n=t.selection;if(!(n instanceof Fe))return!1;if(e){const r=t.tr,i=En(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new F(i,0,0))}),r.docChanged&&e(r)}return!0}function Rk(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 i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),f=l<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Ef(En(s).row,new F(c,u,f)).content),a.push(c)}else if(o=="cell"||o=="header_cell")a.push(n||r?Ef(En(s).row,new F(e,n,r)).content:e);else return null;return jk(s,a)}function jk(t,e){const n=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:a,colspan:l}=o.child(s).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(D.empty),n[i]<r){const o=En(t).cell.createAndFill(),s=[];for(let a=n[i];a<r;a++)s.push(o);e[i]=e[i].append(D.from(s))}return{height:e.length,width:r,rows:e}}function Ef(t,e){const n=t.createAndFill();return new Ym(n).replace(0,n.content.size,e).doc}function Hk({width:t,height:e,rows:n},r,i){if(t!=r){const o=[],s=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=o[a]||0,f=0;u<r;f++){let d=l.child(f%l.childCount);u+d.attrs.colspan>r&&(d=d.type.createChecked(ao(d.attrs,d.attrs.colspan,u+d.attrs.colspan-r),d.content)),c.push(d),u+=d.attrs.colspan;for(let p=1;p<d.attrs.rowspan;p++)o[a+p]=(o[a+p]||0)+d.attrs.colspan}s.push(D.from(c))}n=s,t=r}if(e!=i){const o=[];for(let s=0,a=0;s<i;s++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);s+f.attrs.rowspan>i&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,i-f.attrs.rowspan)},f.content)),l.push(f)}o.push(D.from(l))}n=o,e=i}return{width:t,height:e,rows:n}}function Ik(t,e,n,r,i,o,s){const a=t.doc.type.schema,l=En(a);let c,u;if(i>e.width)for(let f=0,d=0;f<e.height;f++){const p=n.child(f);d+=p.nodeSize;const h=[];let m;p.lastChild==null||p.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=u||(u=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)h.push(m);t.insert(t.mapping.slice(s).map(d-1+r),h)}if(o>e.height){const f=[];for(let h=0,m=(e.height-1)*e.width;h<Math.max(e.width,i);h++){const g=h>=e.width?!1:n.nodeAt(e.map[m+h]).type==l.header_cell;f.push(g?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const d=l.row.create(null,D.from(f)),p=[];for(let h=e.height;h<o;h++)p.push(d);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),p)}return!!(c||u)}function U0(t,e,n,r,i,o,s,a){if(s==0||s==e.height)return!1;let l=!1;for(let c=i;c<o;c++){const u=s*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){l=!0;const d=n.nodeAt(f),{top:p,left:h}=e.findCell(f);t.setNodeMarkup(t.mapping.slice(a).map(f+r),null,{...d.attrs,rowspan:s-p}),t.insert(t.mapping.slice(a).map(e.positionAt(s,h,n)),d.type.createAndFill({...d.attrs,rowspan:p+d.attrs.rowspan-s})),c+=d.attrs.colspan-1}}return l}function q0(t,e,n,r,i,o,s,a){if(s==0||s==e.width)return!1;let l=!1;for(let c=i;c<o;c++){const u=c*e.width+s,f=e.map[u];if(e.map[u-1]==f){l=!0;const d=n.nodeAt(f),p=e.colCount(f),h=t.mapping.slice(a).map(f+r);t.setNodeMarkup(h,null,ao(d.attrs,s-p,d.attrs.colspan-(s-p))),t.insert(h+d.nodeSize,d.type.createAndFill(ao(d.attrs,0,s-p))),c+=d.attrs.rowspan-1}}return l}function G0(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=He.get(o);const{top:a,left:l}=r,c=l+i.width,u=a+i.height,f=t.tr;let d=0;function p(){if(o=n?f.doc.nodeAt(n-1):f.doc,!o)throw new Error("No table found");s=He.get(o),d=f.mapping.maps.length}Ik(f,s,o,n,c,u,d)&&p(),U0(f,s,o,n,l,c,a,d)&&p(),U0(f,s,o,n,l,c,u,d)&&p(),q0(f,s,o,n,a,u,l,d)&&p(),q0(f,s,o,n,a,u,c,d)&&p();for(let h=a;h<u;h++){const m=s.positionAt(h,l,o),g=s.positionAt(h,c,o);f.replace(f.mapping.slice(d).map(m+n),f.mapping.slice(d).map(g+n),new F(i.rows[h-a],0,0))}p(),f.setSelection(new Fe(f.doc.resolve(n+s.positionAt(a,l,o)),f.doc.resolve(n+s.positionAt(u-1,c-1,o)))),e(f)}var Bk=Cg({ArrowLeft:vl("horiz",-1),ArrowRight:vl("horiz",1),ArrowUp:vl("vert",-1),ArrowDown:vl("vert",1),"Shift-ArrowLeft":yl("horiz",-1),"Shift-ArrowRight":yl("horiz",1),"Shift-ArrowUp":yl("vert",-1),"Shift-ArrowDown":yl("vert",1),Backspace:gl,"Mod-Backspace":gl,Delete:gl,"Mod-Delete":gl});function bl(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function vl(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;if(o instanceof Fe)return bl(n,r,ge.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;const s=K0(i,t,e);if(s==null)return!1;if(t=="horiz")return bl(n,r,ge.near(n.doc.resolve(o.head+e),e));{const a=n.doc.resolve(s),l=B0(a,t,e);let c;return l?c=ge.near(l,1):e<0?c=ge.near(n.doc.resolve(a.before(-1)),-1):c=ge.near(n.doc.resolve(a.after(-1)),1),bl(n,r,c)}}}function yl(t,e){return(n,r,i)=>{if(!i)return!1;const o=n.selection;let s;if(o instanceof Fe)s=o;else{const l=K0(i,t,e);if(l==null)return!1;s=new Fe(n.doc.resolve(l))}const a=B0(s.$headCell,t,e);return a?bl(n,r,new Fe(s.$anchorCell,a)):!1}}function $k(t,e){const n=t.state.doc,r=ms(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Fe(r))),!0):!1}function zk(t,e,n){if(!ml(t.state))return!1;let r=Rk(n);const i=t.state.selection;if(i instanceof Fe){r||(r={width:1,height:1,rows:[D.from(Ef(En(t.state.schema).cell,n))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=He.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=Hk(r,a.right-a.left,a.bottom-a.top),G0(t.state,t.dispatch,s,a,r),!0}else if(r){const o=xf(t.state),s=o.start(-1);return G0(t.state,t.dispatch,s,He.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function Fk(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Z0(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Fe)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ms(t.state.selection.$anchor))!=null&&((n=_f(t,e))==null?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(l,c){let u=_f(t,c);const f=Sr.getState(t.state)==null;if(!u||!Cf(l,u))if(f)u=l;else return;const d=new Fe(l,u);if(f||!t.state.selection.eq(d)){const p=t.state.tr.setSelection(d);f&&p.setMeta(Sr,l.pos),t.dispatch(p)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),Sr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Sr,-1))}function a(l){const c=l,u=Sr.getState(t.state);let f;if(u!=null)f=t.state.doc.resolve(u);else if(Z0(t,c.target)!=r&&(f=_f(t,e),!f))return s();f&&o(f,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function K0(t,e,n){if(!(t.state.selection instanceof be))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const a=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function Z0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function _f(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ms(t.state.doc.resolve(n.pos)):null}var Wk=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")),kf(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,kf(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function kf(t,e,n,r,i,o){var s;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let f=0,d=0;f<u.childCount;f++){const{colspan:p,colwidth:h}=u.child(f).attrs;for(let m=0;m<p;m++,d++){const g=i==d?o:h&&h[m],y=g?g+"px":"";if(a+=g||r,g||(l=!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 f=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=f}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var Tt=new ns("tableColumnResizing");function Uk({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Wk,lastColumnResizable:i=!0}={}){const o=new ts({key:Tt,state:{init(s,a){var l,c;const u=(c=(l=o.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,f=En(a.schema).table.name;return r&&u&&(u[f]=(d,p)=>new r(d,n,p)),new qk(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{const a=Tt.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{Gk(s,a,t,i)},mouseleave:s=>{Kk(s)},mousedown:(s,a)=>{Zk(s,a,e,n)}},decorations:s=>{const a=Tt.getState(s);if(a&&a.activeHandle>-1)return e4(s,a.activeHandle)},nodeViews:{}}});return o}var qk=class Nl{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Tt);if(r&&r.setHandle!=null)return new Nl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Nl(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Sf(e.doc.resolve(i))||(i=-1),new Nl(i,n.dragging)}return n}};function Gk(t,e,n,r){const i=Tt.getState(t.state);if(i&&!i.dragging){const o=Yk(e.target);let s=-1;if(o){const{left:a,right:l}=o.getBoundingClientRect();e.clientX-a<=n?s=J0(t,e,"left",n):l-e.clientX<=n&&(s=J0(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){const a=t.state.doc.resolve(s),l=a.node(-1),c=He.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}X0(t,s)}}}function Kk(t){const e=Tt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&X0(t,-1)}function Zk(t,e,n,r){var i;const o=(i=t.dom.ownerDocument.defaultView)!=null?i:window,s=Tt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const a=t.state.doc.nodeAt(s.activeHandle),l=Jk(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(Tt,{setDragging:{startX:e.clientX,startWidth:l}}));function c(f){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const d=Tt.getState(t.state);d!=null&&d.dragging&&(Xk(t,d.activeHandle,Y0(d.dragging,f,n)),t.dispatch(t.state.tr.setMeta(Tt,{setDragging:null})))}function u(f){if(!f.which)return c(f);const d=Tt.getState(t.state);if(d&&d.dragging){const p=Y0(d.dragging,f,n);Q0(t,d.activeHandle,p,r)}}return Q0(t,s.activeHandle,l,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function Jk(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=t.domAtPos(e);let a=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function Yk(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function J0(t,e,n,r){const i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,a=ms(t.state.doc.resolve(s));if(!a)return-1;if(n=="right")return a.pos;const l=He.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Y0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function X0(t,e){t.dispatch(t.state.tr.setMeta(Tt,{setHandle:e}))}function Xk(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),o=He.get(i),s=r.start(-1),a=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+a;if(c&&o.map[u]==o.map[u-o.width])continue;const f=o.map[u],d=i.nodeAt(f).attrs,p=d.colspan==1?0:a-o.colCount(f);if(d.colwidth&&d.colwidth[p]==n)continue;const h=d.colwidth?d.colwidth.slice():Qk(d.colspan);h[p]=n,l.setNodeMarkup(s+f,null,{...d,colwidth:h})}l.docChanged&&t.dispatch(l)}function Q0(t,e,n,r){const i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),a=He.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&kf(o,l.firstChild,l,r,a,n)}function Qk(t){return Array(t).fill(0)}function e4(t,e){var n;const r=[],i=t.doc.resolve(e),o=i.node(-1);if(!o)return De.empty;const s=He.get(o),a=i.start(-1),l=s.colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=l+c*s.width;if((l==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const f=s.map[u],d=a+f+o.nodeAt(f).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Tt.getState(t))!=null&&n.dragging&&r.push(mt.node(a+f,a+f+o.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(mt.widget(d,p))}}return De.create(t.doc,r)}function t4({allowTableNodeSelection:t=!1}={}){return new ts({key:Sr,state:{init(){return null},apply(e,n){const r=e.getMeta(Sr);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:kk,handleDOMEvents:{mousedown:Fk},createSelectionBetween(e){return Sr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:$k,handleKeyDown:Bk,handlePaste:zk},appendTransaction(e,n,r){return Mk(r,Pk(r,n),t)}})}const gs=t=>{const e=Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value]));return delete e.draggable,e},eb="data-gs-mrk-fs",tb="data-gs-ib",wl="data-gs-ifrg",Un="attrs",nb={[Un]:{default:"{}"}},qn={[Un]:{default:{}}},rb=t=>({[Un]:JSON.stringify(gs(t))}),Gn=t=>({attrs:gs(t)}),bs=t=>e=>[t,e.attrs.attrs,0],Cr=t=>t.attrs[Un]?JSON.parse(t.attrs[Un]):{},n4={doc:{content:"block+"},text:{group:"inline",inline:!0},inlineFragment:{group:"block",content:"inline*",isTextBlock:!0,parseDOM:[{tag:`span[${wl}]`,getAttrs:Gn}],toDOM:()=>["span",{[wl]:""},0]},div:{group:"block",content:"inline*",attrs:qn,parseDOM:[{tag:"div",getAttrs:Gn}],toDOM:bs("div")},paragraph:{group:"block",content:"inline*",attrs:qn,parseDOM:[{tag:"p",getAttrs:Gn}],toDOM:bs("p")},orderedList:{group:"block",content:"listItem+",attrs:qn,parseDOM:[{tag:"ol",getAttrs:Gn}],toDOM:bs("ol")},bulletList:{group:"block",content:"listItem+",attrs:qn,parseDOM:[{tag:"ul",getAttrs:Gn}],toDOM:bs("ul")},listItem:{content:"block*",group:"block",attrs:qn,parseDOM:[{tag:"li",getAttrs:Gn}],toDOM:bs("li"),defining:!0},codeBlock:{group:"block",content:"text*",marks:"",attrs:qn,parseDOM:[{tag:"pre",getAttrs:Gn}],toDOM:t=>["pre",t.attrs.attrs,["code",0]]},image:{inline:!0,group:"inline",selectable:!0,attrs:qn,parseDOM:[{tag:"img[src]",getAttrs:Gn}],toDOM:t=>["img",t.attrs.attrs]},inlineBreak:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:`br[${tb}]`}],toDOM(){return["br",{[tb]:""}]}},hardBreak:{inline:!1,group:"block",selectable:!1,attrs:qn,parseDOM:[{tag:"br",getAttrs:Gn}],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:gs(n)})})),toDOM({attrs:t}){const{level:e}=t;return[e?`h${e}`:"div",t.attrs,0]}},...Ck({tableGroup:"block",cellContent:"block+",cellAttributes:{[Un]:{default:qn[Un].default,getFromDOM:gs,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:gs(t)}),priority:0}],toDOM(t){const{tagName:e,attrs:n}=t.attrs;return[e,n,0]}}},vs=(t,e)=>({attrs:nb,parseDOM:t.map(n=>({tag:n,getAttrs:rb})),toDOM:e}),r4={strong:vs(["strong","b"],t=>["b",Cr(t)]),link:vs(["a"],t=>["a",Cr(t),0]),em:vs(["em","i"],t=>["em",Cr(t)]),underline:vs(["u"],t=>["u",Cr(t),0]),strikethrough:vs(["s"],t=>["s",Cr(t),0]),font_size:{attrs:{...nb,size:{default:null}},parseDOM:[{tag:`span[${eb}]`,getAttrs:t=>({...rb(t),size:t.style.fontSize})}],toDOM(t){const{size:e}=t.attrs,n={...Cr(t),[eb]:!0};return e&&(n.style=`font-size: ${e}`),["span",n,0]}}},ib=new CE({nodes:n4,marks:r4}),xl=new WeakMap,Af=new WeakMap,i4=(t,e)=>{xl.set(t,e),Af.set(e,t)},o4=(t,e)=>{xl.delete(t),Af.delete(e)},Tf=t=>xl.get(t),s4=t=>Af.get(t),ob=t=>{var n;const e=s4(t);return(n=e==null?void 0:e.__gjsv)==null?void 0:n.model},a4=t=>t.dispatchEvent(new CustomEvent("input"));function l4(t){const e=n=>{if(n.tagName==="SPAN"&&n.hasAttribute(wl)){if(n.getAttribute("style")){n.removeAttribute(wl);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 c4(t,e={}){if(!e.enableOnClick)return()=>{};const n=t.Components.events,r=u=>t.getSelectedAll().includes(u),i=u=>u.isInstanceOf("text")&&!u.isChildOf("text"),o=u=>u.isChildOf("text"),s=u=>t.getEditing()===u,a=(u,f={})=>{u.trigger("focus",f.event)},l=(u,f)=>{r(u)&&i(u)&&!s(u)&&a(u,f)},c=(u,f)=>{if(r(u)&&!i(u)&&o(u)){const d=u.parents().find(p=>p.isInstanceOf("text"));d&&(a(d,f),setTimeout(()=>t.select(d),0))}};return t.on(n.select,l),t.on(n.selectBefore,c),()=>{t.off(n.select,l),t.off(n.selectBefore,c)}}const u4=(t,e)=>{const n=f4(t);return n&&w4(n)?d4(t,e):n?dg(()=>({type:t.schema.nodes.div}))(t,e):!1};function f4(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 d4(t,e){const{selection:n,schema:r,tr:i}=t;i.split(n.from,1);const o=n.from+1,s=i.doc.nodeAt(o),a={...s.attrs.attrs,id:void 0},l=s.textContent.length>0,c=s.textContent.length||0,u=s.textContent||" ",f=r.text(u),d=r.nodes.div.create(a,l?f:[],[]);return i.replaceRangeWith(o,o+c+2,d),i.setSelection(be.create(i.doc,o+1)),e==null||e(i.scrollIntoView()),!0}function p4(t,e,n){const{state:r,dispatch:i}=t,{selection:o,tr:s}=r,a=(l,c,u)=>{const f={};return l.split(";").forEach(d=>{const[p,h]=d.split(":").map(m=>m.trim());p&&(f[p]=h)}),f[c]=u,Object.entries(f).map(([d,p])=>`${d}: ${p}`).join("; ")};if(!o.empty||n)s.doc.nodesBetween(o.from,o.to,(l,c)=>{var u,f;if(l.type===r.schema.nodes.image){const d=a(((u=l.attrs.attrs)==null?void 0:u.style)||"","float",e);s.setNodeMarkup(c,void 0,{...l.attrs,attrs:{...l.attrs.attrs,style:d}})}else if(l.type.isBlock){const d=a(((f=l.attrs.attrs)==null?void 0:f.style)||"","text-align",e);sb(l)?s.setBlockType(o.from,void 0,r.schema.nodes.div,{attrs:{style:d}}):s.setNodeMarkup(c,void 0,{...l.attrs,attrs:{...l.attrs.attrs,style:d}})}});else{const l=r.doc.resolve(o.from),c=l.start(l.depth),u=r.doc.nodeAt(c);if(u!=null&&u.type.isBlock){const f=a(u.attrs.style||"","text-align",e);s.setNodeMarkup(c,void 0,{...u.attrs,style:f})}}s.docChanged&&i(s.scrollIntoView())}const ys=(t,e)=>{const{from:n,to:r}=t.selection;let i=!1;return t.doc.nodesBetween(n,r,o=>{if(i)return!1;o.marks.some(s=>s.type===e)&&(i=!0)}),i};function h4(t,e,n="_blank"){const{state:r,dispatch:i}=t,{schema:o,selection:s,tr:a}=r,l=o.marks.link;try{const c=l.create({[Un]:JSON.stringify({href:e,target:n})});a.addMark(s.from,s.to,c),i(a.scrollIntoView())}catch(c){console.error("Error applying link mark:",c)}}function m4(t,e){const{state:n,dispatch:r}=t,{selection:i,tr:o}=n;if(i.empty)return;const s=n.schema.marks.font_size;if(!s){console.error("Font size mark is not defined in the schema.");return}o.addMark(i.from,i.to,s.create({size:e})),r(o.scrollIntoView())}const ci=(t,e)=>{const{doc:n,selection:r}=t.state,i=n.resolve(r.from);for(let o=i.depth;o>0;o--){const s=i.node(o);if(e(s))return{pos:o>0?i.before(o):0,start:i.start(o),depth:o,node:s}}},g4=t=>(t||"").split(";").map(e=>e.split(":")).reduce((e,[n,r])=>(n=n.replace(/-./g,i=>i.toUpperCase()[1]).trim(),e[n]=`${r}`.trim(),e),{});function b4(...t){return(e,n)=>{const r=s=>{e=e.apply(s),n==null||n(s)},i=t.pop();return t.reduce((s,a)=>s||a(e,r),!1)&&i!==void 0&&i(e,n)}}const v4=(t,e)=>{const{state:n,dispatch:r}=t;if(e!=null&&e.event){const{event:i}=e,o=t.posAtCoords({left:i.clientX,top:i.clientY});o!=null&&o.pos&&r(n.tr.setSelection(be.create(n.doc,o.pos)))}else pg(n,r);setTimeout(()=>setTimeout(()=>t.focus()))},Mf=t=>t.isBlock,sb=t=>t.type.name==="inlineFragment",y4=t=>Mf(t)&&!sb(t),ab=t=>t.type.name==="bulletList",lb=t=>t.type.name==="orderedList",w4=t=>t.type.name==="heading",x4=t=>ab(t)||lb(t),cb=(t,e)=>{var o,s;const n=(o=ci(t,a=>a.type===e))==null?void 0:o.node,r=t.state.schema.nodes.listItem;let i;return n?i=Ku(r):(s=ci(t,x4))!=null&&s.node?i=b4(Ku(r),Og(e)):i=Og(e),i(t.state,t.dispatch)},ub=(t,e)=>{const{selection:n}=t.state;return[...n.$from.marks(),...n.$to.marks()].find(r=>r.type.name===e)},S4=t=>{var s;const{view:e,prop:n,editor:r,propCSS:i}=t,o=(s=ci(e,y4))==null?void 0:s.node;if(o){const a=o.attrs.attrs||{},l=g4(a.style);if(n in l)return l[n]||"";if(a.id){const c=r.Components.getById(a.id);return((c==null?void 0:c.getStyle())||{})[i]||""}}return""},C4=t=>{const{view:e,prop:n,markName:r,editor:i,propCSS:o}=t,s=ub(e,r);if(s){const a=s.attrs;if(a[n])return a[n];if(a[Un]){const l=Cr(s).id;if(l){const c=i.Components.getById(l);return((c==null?void 0:c.getStyle())||{})[o]||""}}}return""},fb=(t,e)=>{const{dispatch:n}=t,{nodes:r,marks:i}=t.state.schema;return{text:{selected:()=>{const{selection:o,doc:s}=t.state;return s.textBetween(o.from,o.to," ")},replace:(o,s={})=>{const{state:a}=t,{from:l}=a.selection;let c=a.tr.replaceSelectionWith(a.schema.text(o));s.select&&(c=c.setSelection(be.create(c.doc,l,l+o.length))),n==null||n(c)}},bold:{toggle:()=>ei(i.strong)(t.state,n),isActive:()=>ys(t.state,i.strong)},italic:{toggle:()=>ei(i.em)(t.state,n),isActive:()=>ys(t.state,i.em)},underline:{toggle:()=>ei(i.underline)(t.state,n),isActive:()=>ys(t.state,i.underline)},strikethrough:{toggle:()=>ei(i.strikethrough)(t.state,n),isActive:()=>ys(t.state,i.strikethrough)},link:{get:()=>{const o=ob(t);if(o!=null&&o.is("link"))return o.getAttributes();{const s=ub(t,"link");return s?Cr(s):{}}},toggle:()=>ei(i.link)(t.state,n),isActive:()=>ys(t.state,i.link),create:o=>{const s=ob(t);s!=null&&s.is("link")?(s.addAttributes({href:o.url,target:o.target}),t.focus()):h4(t,o.url,o.target)}},alignText:{get:()=>S4({view:t,editor:e,prop:"textAlign",propCSS:"text-align"}),set:o=>p4(t,o.value,!0)},fontSize:{get:()=>C4({view:t,editor:e,markName:"font_size",prop:"size",propCSS:"font-size"}),set:o=>m4(t,o.value)},image:{open(){const o="assetLayout",{state:s,dispatch:a}=t,{selection:l,doc:c}=s,u=c.textBetween(l.from,l.to," "),f={id:o,disablePropagation:!0,placer:{type:"dialog",title:"Select image",size:"l"},header:!1,layout:{type:"panelAssets",onSelect:d=>{const p={alt:u,src:d.asset.getSrc()};a(s.tr.replaceSelectionWith(r.image.createAndFill({attrs:p})))}}};e.runCommand(Kt.layoutToggle,f)}},heading:{get:()=>{var s;const o=(s=ci(t,Mf))==null?void 0:s.node;return`${(o==null?void 0:o.attrs.level)||""}`},set:({value:o})=>{var l;const{state:s}=t,a=(l=ci(t,Mf))==null?void 0:l.node;g_(s.schema.nodes.heading,{attrs:a==null?void 0:a.attrs.attrs,level:o?parseInt(o,10):0})(s,n)}},listBullet:{isActive:()=>{var o;return!!((o=ci(t,ab))!=null&&o.node)},toggle:()=>cb(t,r.bulletList)},listOrdered:{isActive:()=>{var o;return!!((o=ci(t,lb))!=null&&o.node)},toggle:()=>cb(t,r.orderedList)}}},an="rte:selectionchange",qt={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>'},O4=(t,e)=>{var l;const{editor:n,el:r}=t,i=xl.get(r),o=fb(i,n),s={separator:{type:"column",style:{borderRightWidth:"1px",borderRightStyle:"solid",alignSelf:"stretch",margin:3}},bold:{id:"bold",icon:qt.bold,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.bold.isActive()})}},onClick:({setState:c})=>{o.bold.toggle(),c({active:o.bold.isActive()})}},italic:{id:"italic",icon:qt.italic,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.italic.isActive()})}},onClick:({setState:c})=>{o.italic.toggle(),c({active:o.italic.isActive()})}},underline:{id:"underline",icon:qt.underline,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.underline.isActive()})}},onClick:({setState:c})=>{o.underline.toggle(),c({active:o.underline.isActive()})}},strikethrough:{id:"strikethrough",icon:qt.strikethrough,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.strikethrough.isActive()})}},onClick:({setState:c})=>{o.strikethrough.toggle(),c({active:o.strikethrough.isActive()})}},image:{id:"image",icon:qt.image,size:"s",type:"button",onClick:()=>o.image.open()},link:{id:"link",icon:qt.link,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.link.isActive(),disabled:i.state.selection.empty})}},onClick:({event:c})=>{const u=c.currentTarget||c.target,{x:f,y:d,width:p,height:h}=u.getBoundingClientRect(),m="linkLayout",g=()=>n.runCommand(Kt.layoutRemove,{id:m}),y=o.link.get(),w={id:m,style:{width:240},disablePropagation:!0,placer:{type:"popover",closeOnClickAway:!0,x:f,y:d,w:p,h},header:{label:"Link"},layout:{type:"column",as:"form",style:{padding:"0 10px 15px",gap:10},onSubmit:x=>{x.preventDefault();const O=new FormData(x.currentTarget);o.link.create({url:O.get("url"),target:O.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:x,setState:O})=>O({value:x})},{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:x,setState:O})=>O({value:x})},{type:"row",style:{gap:10,justifyContent:"end"},children:[o.link.isActive()&&{type:"button",label:"Clear",buttonType:"button",onClick:()=>{o.link.toggle(),g()}},{type:"button",variant:"primary",label:"Submit",buttonType:"submit"}]}]}};n.runCommand(Kt.layoutToggle,w)}},alignText:{id:"alignText",type:"buttonGroupField",size:"s",value:"",options:[{id:"left",icon:qt.alignTextLeft},{id:"center",icon:qt.alignTextCenter},{id:"right",icon:qt.alignTextRight},{id:"justify",icon:qt.alignTextJustify}],editorEvents:{[an]:({setState:c})=>{c({value:o.alignText.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),o.alignText.set({value:c})}},listBullet:{id:"listBullet",icon:qt.listBullet,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.listBullet.isActive()})}},onClick:({setState:c})=>{o.listBullet.toggle(),c({active:o.listBullet.isActive()})}},listOrdered:{id:"listOrdered",icon:qt.listOrdered,size:"s",type:"button",editorEvents:{[an]:({setState:c})=>{c({active:o.listOrdered.isActive()})}},onClick:({setState:c})=>{o.listOrdered.toggle(),c({active:o.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:{[an]:({setState:c})=>{c({value:o.heading.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),o.heading.set({value:c}),i.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:{[an]:({setState:c})=>{c({value:o.fontSize.get()})}},onChange:({value:c,setState:u})=>{u({value:c}),o.fontSize.set({value:c}),i.focus()}}},a=[s.bold,s.italic,s.underline,s.strikethrough,s.image,s.link,s.listBullet,s.listOrdered,s.alignText,s.heading,s.fontSize];return((l=e.toolbar)==null?void 0:l.call(e,{...t,commands:o,layouts:s,proseMirror:{view:i},items:a}))||a};class E4{constructor(e,n,r){this.editor=r,this.node=e,this.dom=document.createElement("img"),this.view=n,Object.keys(e.attrs.attrs).forEach(i=>{this.dom.setAttribute(i,e.attrs.attrs[i])}),this.dom.addEventListener("dblclick",i=>this.handleDoubleClick(i))}handleDoubleClick(e){const{editor:n,view:r}=this;fb(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 Or{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?_4(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function _4(t){return function(e,n,r,i){let o=t;if(n[1]){let s=n[0].lastIndexOf(n[1]);o+=n[0].slice(s+n[1].length),r+=s;let a=r-i;a>0&&(o=n[0].slice(s-a,s)+o,r=i)}return e.tr.insertText(o,r,i)}}const k4=500;function A4({rules:t}){let e=new ts({state:{init(){return null},apply(n,r){let i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,o){return db(n,r,i,o,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&db(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function db(t,e,n,r,i,o){if(t.composing)return!1;let s=t.state,a=s.doc.resolve(e),l=a.parent.textBetween(Math.max(0,a.parentOffset-k4),a.parentOffset,null,"")+r;for(let c=0;c<i.length;c++){let u=i[c];if(a.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let f=u.match.exec(l),d=f&&u.handler(s,f,e-(f[0].length-r.length),n);if(d)return u.undoable&&d.setMeta(o,{transform:d,from:e,to:n,text:r}),t.dispatch(d),!0}return!1}const T4=new Or(/--$/,"—"),M4=new Or(/\.\.\.$/,"…"),N4=new Or(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),P4=new Or(/"$/,"”"),V4=new Or(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),D4=new Or(/'$/,"’"),L4=[N4,P4,V4,D4];function Nf(t,e,n=null,r){return new Or(t,(i,o,s,a)=>{let l=n instanceof Function?n(o):n,c=i.tr.delete(s,a),u=c.doc.resolve(s),f=u.blockRange(),d=f&&Fm(f,e,l);if(!d)return null;c.wrap(f,d);let p=c.doc.resolve(s-1).nodeBefore;return p&&p.type==e&&tl(c.doc,s-1)&&(!r||r(o,p))&&c.join(s-1),c})}function pb(t,e,n=null){return new Or(t,(r,i,o,s)=>{let a=r.doc.resolve(o),l=n instanceof Function?n(i):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?r.tr.delete(o,s).setBlockType(o,o,e,l):null})}function R4(t){return Nf(/^\s*>\s$/,t)}function j4(t){return Nf(/^(\d+)\.\s$/,t,e=>({order:+e[1]}),(e,n)=>n.childCount+n.attrs.order==+e[1])}function H4(t){return Nf(/^\s*([-+*])\s$/,t)}function I4(t){return pb(/^```$/,t)}function B4(t,e){return pb(new RegExp("^(#{1,"+e+"})\\s$"),t,n=>({level:n[1].length}))}function $4(t){const e=L4.concat(M4,T4);let n;return(n=t.nodes.blockquote)&&e.push(R4(n)),(n=t.nodes.orderedList)&&e.push(j4(n)),(n=t.nodes.bulletList)&&e.push(H4(n)),(n=t.nodes.codeBlock)&&e.push(I4(n)),(n=t.nodes.heading)&&e.push(B4(n,6)),A4({rules:e})}const z4="rteProseMirror",F4=Jn(function(t,e={}){const n={plugins:s=>s.plugins,...e},r=(s,a)=>{var h,m;const l=((h=n.schema)==null?void 0:h.call(n,{editor:t,schema:ib}))||ib,{nodes:c,marks:u}=l,f=_u.fromSchema(l).parse(s),d=eo.create({doc:f,schema:l,plugins:(m=n.plugins)==null?void 0:m.call(n,{editor:t,plugins:[Uk(),t4(),$4(l),k_(),Gu({Tab:W0(1),"Shift-Tab":W0(-1)}),Gu({Enter:rs(fg,L_(c.listItem),u4),"Shift-Enter":rs(ug,(g,y)=>(y&&y(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()),!0)),"Mod-z":Sg,"Mod-y":Wu,"Mod-Shift-z":Wu,"Mod-b":ei(u.strong),"Mod-i":ei(u.em),"Shift-Tab":Ku(c.listItem),Tab:H_(c.listItem)}),Gu(v_)]})}),p=new gk({mount:s},{state:d,dispatchTransaction(g){var v;const{state:y}=p,w=y.apply(g),x=!y.doc.eq(w.doc);p.updateState(w);const O=!y.selection.eq(w.selection);x&&(a4(((v=a==null?void 0:a.view)==null?void 0:v.el)||s),p.focus()),(O||x)&&t.trigger(an)}});return s.__rteView=p,p.setProps({nodeViews:{image(g){return new E4(g,p,t)}}}),p},i=s=>O4(s,n);t.setCustomRte({toolbar:i,parseContent:!0,async enable(s,a,l){const c=Tf(s);if(c)return c;const u=r(s,l);return i4(s,u),v4(u,l),u},disable(s){const a=Tf(s);if(a)return o4(s,a),a.destroy(),{forceSync:!0}},getContent(s){const a=Tf(s);if(a){const{schema:l,doc:c}=a.state,u=document.createElement("div"),f=Qr.fromSchema(l).serializeFragment(c.content);return f.childNodes.forEach(d=>{d.nodeType===Node.ELEMENT_NODE&&d.innerHTML===""&&(d.innerHTML="<br/>")}),u.appendChild(f),l4(u),s.classList.remove("ProseMirror-focused"),u.innerHTML}return s.innerHTML}});const o=c4(t,n);Yn({editor:t,licenseKey:n.licenseKey,plan:vt.free,pluginName:z4,cleanup:()=>{t.RichTextEditor.customRte=void 0,o()}})});Xe.dialogComponent=Vb,Xe.fsLightboxComponent=dv,Xe.lightGalleryComponent=xv,Xe.listPagesComponent=cv,Xe.rteProseMirror=F4,Xe.rteTinyMce=sE,Xe.swiperComponent=Lv,Xe.tableComponent=rv,Object.defineProperty(Xe,Symbol.toStringTag,{value:"Module"})});