@strands.gg/accui 2.15.11 → 2.16.0
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/StrandsUIPlugin-C9rrMU2i.cjs.js +1 -0
- package/dist/{StrandsUIPlugin-JP858JzQ.es.js → StrandsUIPlugin-tl7L52hZ.es.js} +15 -63
- package/dist/accui.css +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +149 -177
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/webcomponents/define-element.d.ts +24 -0
- package/dist/webcomponents/entries/strands-alert.d.ts +12 -0
- package/dist/webcomponents/entries/strands-button.d.ts +12 -0
- package/dist/webcomponents/entries/strands-card.d.ts +12 -0
- package/dist/webcomponents/entries/strands-checkbox-group.d.ts +11 -0
- package/dist/webcomponents/entries/strands-divider.d.ts +12 -0
- package/dist/webcomponents/entries/strands-input.d.ts +14 -0
- package/dist/webcomponents/entries/strands-link.d.ts +12 -0
- package/dist/webcomponents/entries/strands-loader-spinner.d.ts +10 -0
- package/dist/webcomponents/entries/strands-modal.d.ts +16 -0
- package/dist/webcomponents/entries/strands-pill.d.ts +11 -0
- package/dist/webcomponents/entries/strands-radio-group.d.ts +11 -0
- package/dist/webcomponents/entries/strands-slider.d.ts +10 -0
- package/dist/webcomponents/entries/strands-table.d.ts +13 -0
- package/dist/webcomponents/entries/strands-tabs.d.ts +12 -0
- package/dist/webcomponents/entries/strands-theme-toggle.d.ts +10 -0
- package/dist/webcomponents/entries/strands-toggle.d.ts +10 -0
- package/dist/webcomponents/entries/strands-tooltip.d.ts +12 -0
- package/dist/webcomponents/index.d.ts +8 -0
- package/dist/webcomponents/loader.d.ts +73 -0
- package/dist/webcomponents/registry.d.ts +41 -0
- package/package.json +3 -1
- package/dist/StrandsUIPlugin-DSCUXdBp.cjs.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),e=(t,e)=>{const i=t.l||t;for(const[n,r]of e)i[n]=r;return i},i={class:"accui-component-scope"},n={class:"alert-content"},r={class:"alert-icon-container"},s={class:"alert-main-icon",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true"},o=["d"],l={class:"alert-text-container"},a={key:0,class:"alert-dismiss-container"},u=e(t.defineComponent({u:"UiAlert",props:{variant:{default:"info"},title:{},message:{},dismissible:{type:Boolean,default:0}},emits:["dismiss"],setup(e){const u=e,h=t.computed(()=>({success:"alert alert-success",error:"alert alert-error",warning:"alert alert-warning",info:"alert alert-info"}[u.variant])),c=t.computed(()=>"alert-title"),d=t.computed(()=>"alert-message"),f=t.computed(()=>({success:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",error:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",warning:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",info:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"}[u.variant]));return(e,u)=>(t.openBlock(),t.createElementBlock("div",i,[t.createElementVNode("div",{class:t.normalizeClass(h.value),role:"alert"},[t.createElementVNode("div",n,[t.createElementVNode("div",r,[(t.openBlock(),t.createElementBlock("svg",s,[t.createElementVNode("path",{"fill-rule":"evenodd",d:f.value,"clip-rule":"evenodd"},null,8,o)]))]),t.createElementVNode("div",l,[e.title?(t.openBlock(),t.createElementBlock("h3",{key:0,class:t.normalizeClass(c.value)},t.toDisplayString(e.title),3)):t.createCommentVNode("",1),t.createElementVNode("div",{class:t.normalizeClass(d.value)},[t.renderSlot(e.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.message),1)],1)],2)]),e.dismissible?(t.openBlock(),t.createElementBlock("div",a,[t.createElementVNode("button",{type:"button",class:"alert-dismiss-button",onClick:u[0]||(u[0]=t=>e.$emit("dismiss"))},[...u[1]||(u[1]=[t.createElementVNode("span",{class:"sr-only"},"Dismiss",-1),t.createElementVNode("svg",{class:"alert-dismiss-icon",fill:"currentColor",viewBox:"0 0 20 20"},[t.createElementVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])])])):t.createCommentVNode("",1)])],2)]))}}),[["__scopeId","data-v-68f69cce"]]),h={key:0,class:"loader-icon"},c=["width","height"],d=["d"],f=["stroke-width"],p=["stroke-width"],m=["width","height"],g={key:3,class:"loader-text"},y=e(t.defineComponent({u:"UiLoader",props:{size:{default:"md"},color:{default:"primary"},variant:{default:"circle"},text:{},centered:{type:Boolean,default:1},weight:{default:30},fullWidth:{type:Boolean,default:0}},setup(e){const i='<svg width="302" height="438" viewBox="0 0 302 438" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M71.5001 96C71.5001 96 132 106 137 61.5C142 17 117.5 3.50005 94.5001 1.50003C71.5001 -0.499996 16.0001 8.5 2.00014 72.5C-6.5 130.5 71.5003 227.5 165 218C258.5 208.5 280.758 148.5 283.5 121C286.242 93.5 277.5 61.5 238.5 61.5C153 61.5 150.501 185 170.5 235C190.5 285 199 279 213 314C227.001 349 217.296 411.458 183 427C129.456 450.65 92 426 78.5 407.5C65 389 68.0003 357 94.5001 344.5C121 332 212.41 393.5 301.5 361" stroke="black"/>\n</svg>\n'.replace(/<svg[^>]*>/,"").replace(/<\/svg>/,"").trim(),n=i.match(/d="([^"]*)"/)?.[1]||"",r=e,s={sm:32,md:48,lg:64,xl:80},o=t.computed(()=>"number"==typeof r.size?r.size:s[r.size]||s.md);return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["loader-container",[{"loader-centered":e.centered},`loader-color-${e.color}`]])},["spinner"===e.variant?(t.openBlock(),t.createElementBlock("div",h,[(t.openBlock(),t.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 500 500"},[t.createElementVNode("defs",null,[t.createElementVNode("path",{id:"logo-path",d:t.unref(n),transform:"translate(81, 13) scale(1.0)"},null,8,d)]),t.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-semi-color)","stroke-width":e.weight,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,f),t.createElementVNode("use",{href:"#logo-path",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":e.weight,"stroke-linecap":"round","stroke-linejoin":"round",class:"loader-animated-path"},null,8,p)],8,c))])):"circle"===e.variant?(t.openBlock(),t.createElementBlock("div",{key:1,class:"loader-circle",style:t.normalizeStyle({width:`${o.value}px`,height:`${o.value}px`})},[(t.openBlock(),t.createElementBlock("svg",{width:o.value,height:o.value,viewBox:"0 0 50 50"},[...i[0]||(i[0]=[t.createElementVNode("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"var(--loader-solid-color)","stroke-width":"4","stroke-linecap":"round",class:"loader-circle-path"},null,-1)])],8,m))],4)):"bar"===e.variant?(t.openBlock(),t.createElementBlock("div",{key:2,class:"loader-bar",style:t.normalizeStyle({width:e.fullWidth?"100%":1.5*o.value+"px",height:`${Math.max(.1*o.value,4)}px`})},[...i[1]||(i[1]=[t.createElementVNode("div",{class:"loader-bar-track"},[t.createElementVNode("div",{class:"loader-bar-fill"})],-1)])],4)):t.createCommentVNode("",1),e.text?(t.openBlock(),t.createElementBlock("p",g,t.toDisplayString(e.text),1)):t.createCommentVNode("",1)],2))}}),[["__scopeId","data-v-4b565c5d"]]),b={key:0,class:"button-loading-content"},w={key:0},v={key:0,class:"leading-icon"},k={key:1,class:"trailing-icon"},x=e(t.defineComponent({u:"UiButton.Content",props:{loading:{type:Boolean,default:0},loadingText:{},icon:{type:Boolean,default:0},size:{},align:{default:"center"}},setup(e){const i=t.useSlots(),n=t.computed(()=>!!i["leading-icon"]),r=t.computed(()=>!!i["trailing-icon"]),s=e,o=t.computed(()=>{switch(s.size){case"xs":return 16;case"sm":return 18;case"md":default:return 20;case"lg":return 24;case"xl":return 28}}),l=t.computed(()=>s.size?`button-content-${s.size}`:"button-content-md");return(e,i)=>e.loading?(t.openBlock(),t.createElementBlock("span",b,[t.createVNode(y,{variant:"circle",size:o.value,centered:0,color:"white"},null,8,["size"]),e.icon?t.createCommentVNode("",1):(t.openBlock(),t.createElementBlock("span",w,t.toDisplayString(e.loadingText||"Loading..."),1))])):(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass(["button-content",l.value])},[e.icon?t.renderSlot(e.$slots,"icon",{key:0},void 0,1):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[n.value?(t.openBlock(),t.createElementBlock("span",v,[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)])):t.createCommentVNode("",1),t.renderSlot(e.$slots,"icon",{},void 0,1),t.createElementVNode("span",{class:t.normalizeClass(["button-text-content",`button-text-align-${e.align}`])},[t.renderSlot(e.$slots,"default",{},void 0,1)],2),r.value?(t.openBlock(),t.createElementBlock("span",k,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1)],64))],2))}}),[["__scopeId","data-v-fb8bbb18"]]),M=["href","target","rel"],S=t.defineComponent({u:"UiButton.Anchor",props:{to:{},href:{},external:{type:Boolean,default:0},disabled:{type:Boolean,default:0},loading:{type:Boolean,default:0},loadingText:{},icon:{type:Boolean,default:0},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(e,{emit:i}){const n=e,r=i,s=t.computed(()=>{if(n.href)return n.href;if(n.to){if("string"==typeof n.to)return n.to;if("object"==typeof n.to&&n.to)return"#route-object-not-supported"}return"#"}),o=t=>{n.disabled||n.loading?t.preventDefault():r("click",t)};return(e,i)=>(t.openBlock(),t.createElementBlock("a",{href:s.value,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,class:t.normalizeClass(e.buttonClasses),style:t.normalizeStyle(e.buttonStyles),onClick:o},[t.createVNode(x,{loading:e.loading,"loading-text":e.loadingText,icon:e.icon},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon")]),icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon")]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon")]),m:3},8,["loading","loading-text","icon"])],14,M))}}),T=t.defineComponent({u:"UiButton.Nuxt",props:{to:{},disabled:{type:Boolean,default:0},loading:{type:Boolean,default:0},loadingText:{},icon:{type:Boolean,default:0},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(e,{emit:i}){const n=t.getCurrentInstance(),r=t.computed(()=>{const t=n?.appContext.app.component("NuxtLink");if(t)return"NuxtLink";const e=n?.appContext.app.component("RouterLink");return e?"RouterLink":"a"}),s=e,o=i,l=t=>{s.disabled||s.loading?t.preventDefault():o("click",t)};return(e,i)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{to:"a"!==r.value?e.to:void 0,href:"a"===r.value?"string"==typeof e.to?e.to:"/":void 0,class:t.normalizeClass(e.buttonClasses),style:t.normalizeStyle(e.buttonStyles),onClick:l},{default:t.withCtx(()=>[t.createVNode(x,{loading:e.loading,"loading-text":e.loadingText,icon:e.icon},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon")]),icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon")]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon")]),m:3},8,["loading","loading-text","icon"])]),m:3},8,["to","href","class","style"]))}}),E=t.defineComponent({u:"UiButton.Vue",props:{to:{},disabled:{type:Boolean,default:0},loading:{type:Boolean,default:0},loadingText:{},icon:{type:Boolean,default:0},buttonClasses:{},buttonStyles:{}},emits:["click"],setup(e,{emit:i}){const n=e,r=i,s=t=>{n.disabled||n.loading?t.preventDefault():r("click",t)};return(e,i)=>{const n=t.resolveComponent("router-link");return t.openBlock(),t.createBlock(n,{to:e.to,class:t.normalizeClass(e.buttonClasses),style:t.normalizeStyle(e.buttonStyles),onClick:s},{default:t.withCtx(()=>[t.createVNode(x,{loading:e.loading,"loading-text":e.loadingText,icon:e.icon},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon")]),icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon")]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon")]),m:3},8,["loading","loading-text","icon"])]),m:3},8,["to","class","style"])}}}),C={class:"ui-tooltip-content"},O=e(t.defineComponent({inheritAttrs:0,u:"UiTooltip",props:{content:{default:""},position:{default:"top"},delay:{default:500},disabled:{type:Boolean,default:0},offset:{default:8},maxWidth:{default:250}},setup(e){const i=e,n=t.ref(),r=t.ref(),s=t.ref(0),o=t.ref(0);let l=null,a=null;const u=t.ref({}),h=()=>{i.disabled||(a&&(clearTimeout(a),a=null),o.value=1,t.nextTick(()=>{(async()=>{if(!n.value||!r.value||!o.value)return;await t.nextTick();const e=n.value.getBoundingClientRect();r.value.style.visibility="hidden",r.value.style.opacity="1";const s=r.value.getBoundingClientRect(),l=s.width,a=s.height;r.value.style.visibility="",r.value.style.opacity="";const h=window.innerWidth,c=window.innerHeight;let d=0,f=0;switch(i.position){case"top":d=e.top-a-i.offset,f=e.left+e.width/2-l/2;break;case"bottom":d=e.bottom+i.offset,f=e.left+e.width/2-l/2;break;case"left":d=e.top+e.height/2-a/2,f=e.left-l-i.offset;break;case"right":d=e.top+e.height/2-a/2,f=e.right+i.offset}f<8?f=8:f+l>h-8&&(f=h-l-8),d<8?d=8:d+a>c-8&&(d=c-a-8),u.value={position:"fixed",top:`${d}px`,left:`${f}px`,zIndex:"9999"}})()}),l=setTimeout(()=>{s.value=1},i.delay))},c=()=>{l&&(clearTimeout(l),l=null),a=setTimeout(()=>{s.value=0,setTimeout(()=>{o.value=0},200)},100)};return t.onUnmounted(()=>{l&&clearTimeout(l),a&&clearTimeout(a)}),(e,i)=>(t.openBlock(),t.createElementBlock("div",t.mergeProps({ref_key:"tooltipContainer",ref:n,class:"ui-tooltip-container"},e.$attrs,{onMouseenter:h,onMouseleave:c}),[t.renderSlot(e.$slots,"default",{},void 0,1),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[o.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"tooltipRef",ref:r,class:t.normalizeClass(["ui-tooltip",[`ui-tooltip--${e.position}`,{"ui-tooltip--visible":s.value}]]),style:t.normalizeStyle(u.value),role:"tooltip"},[t.createElementVNode("div",C,[t.renderSlot(e.$slots,"tooltip",{},()=>[t.createTextVNode(t.toDisplayString(e.content),1)],1)]),t.createElementVNode("div",{class:t.normalizeClass(["ui-tooltip-arrow",`ui-tooltip-arrow--${e.position}`])},null,2)],6)):t.createCommentVNode("",1)]))],16))}}),[["__scopeId","data-v-ba66edda"]]),A=["type","disabled","tabindex"],$=["type","disabled","tabindex"],R=e(t.defineComponent({inheritAttrs:0,u:"UiButton",props:{variant:{default:"primary"},size:{default:"md"},type:{default:"button"},disabled:{type:Boolean,default:0},loading:{type:Boolean,default:0},loadingText:{},fullWidth:{type:Boolean,default:0},color:{default:"primary"},fontWeight:{default:600},icon:{type:Boolean,default:0},squircle:{type:Boolean,default:0},to:{},href:{},external:{type:Boolean,default:0},tabindex:{},title:{},align:{default:"center"}},emits:["click"],setup(e,{emit:i}){const n=e,r=t.computed(()=>n.title?"string"==typeof n.title?{content:n.title,position:"top",disabled:n.disabled||n.loading}:{...n.title,disabled:n.title.disabled??(n.disabled||n.loading)}:null),s=t.computed(()=>"undefined"!=typeof process&&void 0!==process.client||"undefined"!=typeof window&&(window.__NUXT__||window.$nuxt)?1:0),o=t.computed(()=>{try{if("undefined"!=typeof window&&window.Vue?.Router)return 1}catch(t){}return 0}),l=t.computed(()=>["ui-button",`ui-button-${n.variant}`,`ui-button-${n.size}`,`ui-button-color-${n.color}`,n.loading?"ui-button-loading":"",n.disabled?"ui-button-disabled":"",n.fullWidth?"ui-button-full-width":"",n.icon?"ui-button-icon":"",n.squircle?"ui-button-squircle":""].filter(Boolean)),a=t.computed(()=>l.value.join(" ")),u=t.computed(()=>({fontWeight:n.fontWeight})),h=t.computed(()=>n.disabled||n.loading?-1:n.tabindex??void 0);return(e,i)=>e.title?(t.openBlock(),t.createBlock(O,t.normalizeProps(t.mergeProps({key:0},r.value)),{default:t.withCtx(()=>[e.to?s.value&&e.to?(t.openBlock(),t.createBlock(T,{key:1,to:e.to,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[1]||(i[1]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):o.value&&e.to?(t.openBlock(),t.createBlock(E,{key:2,to:e.to,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[2]||(i[2]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(t.openBlock(),t.createBlock(S,{key:3,to:e.to,href:e.href,external:e.external,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[3]||(i[3]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(t.openBlock(),t.createElementBlock("button",t.mergeProps({key:0},e.$attrs,{type:e.type,disabled:e.disabled||e.loading,class:a.value,style:u.value,tabindex:h.value,onClick:i[0]||(i[0]=t=>e.$emit("click",t))}),[t.createVNode(x,{loading:e.loading,"loading-text":e.loadingText,icon:e.icon,size:e.size,align:e.align},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","align"])],16,A))]),m:3},16)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.to?s.value&&e.to?(t.openBlock(),t.createBlock(T,{key:1,to:e.to,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[5]||(i[5]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):o.value&&e.to?(t.openBlock(),t.createBlock(E,{key:2,to:e.to,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[6]||(i[6]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(t.openBlock(),t.createBlock(S,{key:3,to:e.to,href:e.href,external:e.external,disabled:e.disabled,loading:e.loading,"loading-text":e.loadingText,icon:e.icon,"button-classes":l.value,"button-styles":u.value,tabindex:h.value,onClick:i[7]||(i[7]=t=>e.$emit("click",t))},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["to","href","external","disabled","loading","loading-text","icon","button-classes","button-styles","tabindex"])):(t.openBlock(),t.createElementBlock("button",t.mergeProps({key:0},e.$attrs,{type:e.type,disabled:e.disabled||e.loading,class:a.value,style:u.value,tabindex:h.value,onClick:i[4]||(i[4]=t=>e.$emit("click",t))}),[t.createVNode(x,{loading:e.loading,"loading-text":e.loadingText,icon:e.icon,size:e.size,align:e.align},t.createSlots({icon:t.withCtx(()=>[t.renderSlot(e.$slots,"icon",{},void 0,1)]),default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,1)]),m:2},[e.$slots["leading-icon"]?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,e.$slots["trailing-icon"]?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["loading","loading-text","icon","size","align"])],16,$))],64))}}),[["__scopeId","data-v-62daebaa"]]),L={key:0,class:"ui-card-header"},B={key:0,class:"ui-card-title-wrapper"},I={key:0,class:"ui-card-title"},N={key:0,class:"ui-card-subtitle"},D={key:1,class:"ui-card-content"},_={key:2,class:"ui-card-footer"},z=e(t.defineComponent({inheritAttrs:0,u:"UiCard",props:{variant:{default:"default"},padding:{default:"md"},shadow:{default:"sm"},color:{default:"default"},title:{},subtitle:{}},setup(e){const i=t.useAttrs();return(e,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ui-card",[`ui-card-${e.variant}`,`ui-card-padding-${e.padding}`,`ui-card-shadow-${e.shadow}`,`ui-card-color-${e.color}`,t.unref(i).class]])},[e.$slots.header||e.title||e.subtitle||e.$slots["leading-icon"]||e.$slots["trailing-icon"]?(t.openBlock(),t.createElementBlock("div",L,[t.renderSlot(e.$slots,"header",{},()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1),e.title||e.$slots.title||e.subtitle||e.$slots.subtitle?(t.openBlock(),t.createElementBlock("div",B,[e.title||e.$slots.title?t.renderSlot(e.$slots,"title",{key:0},()=>[e.title?(t.openBlock(),t.createElementBlock("h2",I,t.toDisplayString(e.title),1)):t.createCommentVNode("",1)],1):t.createCommentVNode("",1),e.subtitle||e.$slots.subtitle?t.renderSlot(e.$slots,"subtitle",{key:1},()=>[e.subtitle?(t.openBlock(),t.createElementBlock("p",N,t.toDisplayString(e.subtitle),1)):t.createCommentVNode("",1)],1):t.createCommentVNode("",1)])):t.createCommentVNode("",1),t.renderSlot(e.$slots,"trailing-icon",{},void 0,1),t.renderSlot(e.$slots,"actions",{},void 0,1)],1)])):t.createCommentVNode("",1),e.$slots.default?(t.openBlock(),t.createElementBlock("div",D,[t.renderSlot(e.$slots,"default",{},void 0,1)])):t.createCommentVNode("",1),e.$slots.footer?(t.openBlock(),t.createElementBlock("div",_,[t.renderSlot(e.$slots,"footer",{},void 0,1)])):t.createCommentVNode("",1)],2))}}),[["__scopeId","data-v-40cbf608"]]),P=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=t=>{const e=(t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,i)=>i?i.toUpperCase():e.toLowerCase()))(t);return e.charAt(0).toUpperCase()+e.slice(1)},j=(...t)=>t.filter((t,e,i)=>Boolean(t)&&""!==t.trim()&&i.indexOf(t)===e).join(" ").trim(),U=t=>""===t;var q={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const V=({name:e,iconNode:i,absoluteStrokeWidth:n,"absolute-stroke-width":r,strokeWidth:s,"stroke-width":o,size:l=q.width,color:a=q.stroke,...u},{slots:h})=>t.h("svg",{...q,...u,width:l,height:l,stroke:a,"stroke-width":U(n)||U(r)||1==n||1==r?24*Number(s||o||q["stroke-width"])/Number(l):s||o||q["stroke-width"],class:j("lucide",u.class,...e?[`lucide-${P(H(e))}-icon`,`lucide-${P(e)}`]:["lucide-icon"])},[...i.map(e=>t.h(...e)),...h.default?[h.default()]:[]]),F=(e,i)=>(n,{slots:r,attrs:s})=>t.h(V,{...s,...n,iconNode:i,name:e},r),K=F("align-center",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),J=F("align-left",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),W=F("align-right",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]),G=F("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),Q=F("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]),Y=F("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),Z=F("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),X=F("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),tt=F("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),et=F("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),it=F("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),nt=F("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),rt=F("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),st=F("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ot=F("file-input",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]),lt=F("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),at=F("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]),ut=F("heading-3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]),ht=F("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),ct=F("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),dt=F("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]),ft=F("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),pt=F("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]),mt=F("redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]),gt=F("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),yt=F("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),bt=F("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),wt=F("undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),vt=F("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),kt={key:0,class:"input-leading-icon"},xt=["id","type","value","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","tabindex"],Mt={key:1,class:"input-trailing-icon"},St={key:2,class:"input-trailing-icon"},Tt={key:3,class:"input-trailing-icon"},Et=e(t.defineComponent({u:"UiInput.Text",props:{type:{default:"text"},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean,default:1},hasLeadingIcon:{type:Boolean,default:0},hasTrailingIcon:{type:Boolean,default:0},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(e,{emit:i}){const n=e,r=i,s=t.ref(0),o=t.computed(()=>"password"===n.type?s.value?"text":"password":n.type),l=t.computed(()=>n.hasTrailingIcon||"password"===n.type||"search"===n.type&&n.modelValue),a=t.computed(()=>{if(void 0!==n.tabindex)return n.tabindex+1}),u=t.computed(()=>{const t=[];return n.error&&t.push("input-error"),n.disabled&&t.push("input-disabled"),n.readonly&&t.push("input-readonly"),t.push(`input-size-${n.size}`),t}),h=t.computed(()=>{const t=[];return n.hasLeadingIcon?t.push("input-padding-left-icon"):t.push("input-padding-left"),l.value?t.push("input-padding-right-icon"):t.push("input-padding-right"),t}),c=t=>{let e=t.target.value;"number"===n.type&&""!==e&&(e=parseFloat(e)||0),r("update:modelValue",e)},d=t=>{r("blur",t)},f=t=>{r("focus",t)},p=t=>{r("keydown",t)},m=()=>{s.value=!s.value},g=()=>{r("update:modelValue","")};return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-field-wrapper",u.value])},[n.hasLeadingIcon?(t.openBlock(),t.createElementBlock("div",kt,[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)])):t.createCommentVNode("",1),t.createElementVNode("input",{id:e.inputId,type:o.value,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,min:e.min,max:e.max,step:e.step,autocomplete:e.autocomplete,spellcheck:e.spellcheck,tabindex:e.tabindex,class:t.normalizeClass(["input-base",h.value]),onInput:c,onBlur:d,onFocus:f,onKeydown:p},null,42,xt),"password"===e.type?(t.openBlock(),t.createElementBlock("div",Mt,[t.createVNode(R,{color:s.value?"primary":"secondary",variant:s.value?"primary":"ghost",size:"sm",icon:"",squircle:"",tabindex:a.value,"aria-label":s.value?"Hide password":"Show password",onClick:m},{icon:t.withCtx(()=>[s.value?(t.openBlock(),t.createBlock(t.unref(rt),{key:0})):(t.openBlock(),t.createBlock(t.unref(st),{key:1}))]),m:1},8,["color","variant","tabindex","aria-label"])])):"search"!==e.type||!e.modelValue||e.disabled||e.readonly?n.hasTrailingIcon?(t.openBlock(),t.createElementBlock("div",Tt,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1):(t.openBlock(),t.createElementBlock("div",St,[t.createVNode(R,{color:"danger",variant:"ghost",size:"sm",icon:"",squircle:"",tabindex:a.value,"aria-label":"Clear search",onClick:g},{icon:t.withCtx(()=>[t.createVNode(t.unref(vt))]),m:1},8,["tabindex"])]))],2))}}),[["__scopeId","data-v-b3152b5d"]]),Ct={key:0,class:"input-leading-icon"},Ot=["id","value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck"],At={key:1,class:"input-trailing-icon"},$t=e(t.defineComponent({u:"UiInput.Textarea",props:{rows:{default:3},cols:{},maxlength:{},autocomplete:{},spellcheck:{type:Boolean,default:1},resizable:{type:Boolean,default:1},hasLeadingIcon:{type:Boolean,default:0},hasTrailingIcon:{type:Boolean,default:0},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","keydown"],setup(e,{emit:i}){const n=e,r=i,s=t.computed(()=>{const t=[];return n.error&&t.push("input-error"),n.disabled&&t.push("input-disabled"),n.readonly&&t.push("input-readonly"),t.push(`input-size-${n.size}`),t}),o=t.computed(()=>{const t=[];return n.hasLeadingIcon?t.push("input-padding-left-icon"):t.push("input-padding-left"),n.hasTrailingIcon?t.push("input-padding-right-icon"):t.push("input-padding-right"),t}),l=t=>{const e=t.target;r("update:modelValue",e.value)},a=t=>{r("blur",t)},u=t=>{r("focus",t)},h=t=>{r("keydown",t)};return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-field-wrapper input-textarea",s.value])},[n.hasLeadingIcon?(t.openBlock(),t.createElementBlock("div",Ct,[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)])):t.createCommentVNode("",1),t.createElementVNode("div",{class:t.normalizeClass(["textarea-wrapper",{"textarea-resizable":e.resizable}])},[t.createElementVNode("textarea",{id:e.inputId,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,rows:e.rows,cols:e.cols,maxlength:e.maxlength,autocomplete:e.autocomplete,spellcheck:e.spellcheck,class:t.normalizeClass(["input-base",[{"input-textarea-resize":e.resizable},o.value]]),onInput:l,onBlur:a,onFocus:u,onKeydown:h},null,42,Ot)],2),n.hasTrailingIcon?(t.openBlock(),t.createElementBlock("div",At,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1)],2))}}),[["__scopeId","data-v-4f57fd4b"]]);function Rt(e){const{trigger:i,floating:n,placement:r="bottom-start",offset:s=8,flip:o=1,shift:l=1,sameWidth:a=0,autoUpdate:u=0,clickOutside:h}=e,c=t.ref({position:"fixed",top:"0px",left:"0px",zIndex:"9999"}),d=()=>{(async()=>{if(await t.nextTick(),!i.value||!n.value)return;if("function"!=typeof i.value.getBoundingClientRect||"function"!=typeof n.value.getBoundingClientRect)return;const e=i.value.getBoundingClientRect(),u=n.value.getBoundingClientRect(),[h,d="start"]=r.split("-");let f=0,p=0;switch(h){case"bottom":f=e.left,p=e.bottom+s;break;case"top":f=e.left,p=e.top-u.height-s;break;case"right":f=e.right+s,p=e.top;break;case"left":f=e.left-u.width-s,p=e.top}if("top"===h||"bottom"===h)switch(d){case"center":f=e.left+(e.width-u.width)/2;break;case"end":f=e.right-u.width}else if("left"===h||"right"===h)switch(d){case"center":p=e.top+(e.height-u.height)/2;break;case"end":p=e.bottom-u.height}let m=a?e.width:void 0;const g=window.innerWidth,y=window.innerHeight;let b=0,w=0;if(o){if("bottom"===h&&p+u.height>y-8){const t=e.top-u.height-s;t>=8&&(p=t,b=1)}else if("top"===h&&p<8){const t=e.bottom+s;t+u.height<=y-8&&(p=t,b=0)}if("right"===h&&f+u.width>g-8){const t=e.left-u.width-s;t>=8&&(f=t,w=1)}else if("left"===h&&f<8){const t=e.right+s;t+u.width<=g-8&&(f=t,w=0)}}l&&(f<8?f=8:f+u.width>g-8&&(f=g-u.width-8),p<8?p=8:p+u.height>y-8&&(p=y-u.height-8));const v={position:"fixed",zIndex:"9999",...m?{width:`${m}px`}:{}};b?v.bottom=y-p-u.height+"px":v.top=`${p}px`,w?v.right=g-f-u.width+"px":v.left=`${f}px`,c.value=v})()};let f=null;const p=()=>{d()},m=()=>{if(d(),h?.enabled&&h.handler&&i.value){if("function"!=typeof i.value.getBoundingClientRect)return;const t=i.value.getBoundingClientRect(),e=window.innerHeight,n=window.innerWidth;(t.bottom<0||t.top>e||t.right<0||t.left>n)&&h.handler()}},g=t=>{if(!h?.enabled||!h.handler)return;const e=t.target;if(!e||!i.value||!n.value)return;if("function"!=typeof i.value.contains||"function"!=typeof n.value.contains)return;const r=i.value.contains(e),s=n.value.contains(e);r||s||h.handler()},y=()=>{u&&(window.removeEventListener("resize",p),window.removeEventListener("scroll",m,1)),h?.enabled&&document.removeEventListener("click",g,1),f&&(f.disconnect(),f=null)};return t.onMounted(()=>{u&&(window.addEventListener("resize",p),window.addEventListener("scroll",m,1),"undefined"!=typeof ResizeObserver&&(f=new ResizeObserver(()=>{d()}),t.nextTick(()=>{i.value&&f&&"function"==typeof i.value.getBoundingClientRect&&f.observe(i.value),n.value&&f&&"function"==typeof n.value.getBoundingClientRect&&f.observe(n.value)}))),h?.enabled&&document.addEventListener("click",g,1)}),t.onUnmounted(()=>{y()}),{floatingStyle:c,updatePosition:d,cleanup:y}}const Lt={key:0,class:"input-leading-icon"},Bt=["tabindex","aria-expanded","aria-controls","aria-disabled"],It={class:"input-select-value"},Nt={key:0,class:"input-select-text"},Dt={key:1,class:"input-select-placeholder"},_t={key:1,class:"input-trailing-icon"},zt=["id","aria-multiselectable"],Pt={key:0,class:"input-dropdown-search"},Ht={key:0,class:"input-dropdown-no-options"},jt=["onClick","onMouseenter","aria-selected"],Ut={class:"input-dropdown-option-content"},qt={class:"input-dropdown-option-text"},Vt={key:0,class:"input-dropdown-option-description"},Ft={key:0,class:"input-dropdown-option-check"},Kt=e(t.defineComponent({u:"UiInput.Select",props:{options:{default:()=>[]},multiple:{type:Boolean,default:0},searchable:{type:Boolean,default:0},allowInsert:{type:Boolean,default:0},maxDropdownHeight:{default:400},noOptionsText:{default:"No options available"},searchPlaceholder:{default:""},hasLeadingIcon:{type:Boolean,default:0},hasTrailingIcon:{type:Boolean,default:0},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(e,{emit:i}){const n=e,r=i,s=t.ref(),o=t.ref(),l=t.ref(),a=t.computed(()=>`dropdown-${n.inputId||Math.random().toString(36).substr(2,9)}`),u=t.computed(()=>{if(s.value){const t=s.value.closest('[role="dialog"][aria-modal="true"]');if(t)return t}return"body"}),h=t.ref({isOpen:0,searchQuery:"",highlightedIndex:-1}),{floatingStyle:c,updatePosition:d,cleanup:f}=Rt({trigger:s,floating:o,placement:"bottom-start",offset:10,shift:1,flip:1,sameWidth:1,autoUpdate:1,clickOutside:{enabled:1,handler:()=>{M()}}}),p=t.computed(()=>n.multiple?Array.isArray(n.modelValue)?n.modelValue:[]:void 0!==n.modelValue?[n.modelValue]:[]),m=t.computed(()=>{if(n.multiple){const t=n.options.filter(t=>p.value.includes(t.value));return t.length>0?`${t.length} selected`:null}{const t=n.options.find(t=>t.value===n.modelValue);return t?.label||null}}),g=t.computed(()=>{let t=n.options;if(n.searchable&&h.value.searchQuery){const e=h.value.searchQuery.toLowerCase();t=n.options.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)),n.allowInsert&&n.multiple&&h.value.searchQuery.trim()&&(n.options.some(t=>t.label.toLowerCase()===h.value.searchQuery.toLowerCase())||(t=[{value:`__insert__${h.value.searchQuery}`,label:`Add "${h.value.searchQuery}"`,description:"Add as new item",disabled:0},...t]))}return t}),y=t.computed(()=>n.searchPlaceholder&&""!==n.searchPlaceholder.trim()?n.searchPlaceholder:n.allowInsert&&n.multiple?"Search or create...":"Search..."),b=t.computed(()=>n.disabled?-1:n.tabindex??0),w=t.computed(()=>{if(void 0!==n.tabindex)return n.tabindex+1}),v=t.computed(()=>{const t=[];return n.error&&t.push("input-error"),n.disabled&&t.push("input-disabled"),t.push(`input-size-${n.size}`),t}),k=t.computed(()=>{const t=[];return n.hasLeadingIcon?t.push("input-padding-left-icon"):t.push("input-padding-left"),n.hasTrailingIcon?t.push("input-padding-right-icon"):t.push("input-padding-right"),t}),x=async()=>{if(!n.disabled){if(h.value.isOpen=1,h.value.searchQuery="",await t.nextTick(),d(),-1===h.value.highlightedIndex){const t=g.value.findIndex(t=>!t.disabled);h.value.highlightedIndex=t>=0?t:0}if(n.searchable&&l.value){const t=l.value.$el?.querySelector("input");t&&t.focus()}document.addEventListener("keydown",A),r("focus",new FocusEvent("focus"))}},M=()=>{h.value.isOpen&&(h.value.isOpen=0,h.value.highlightedIndex=-1,h.value.searchQuery="",document.removeEventListener("keydown",A),r("blur",new FocusEvent("blur")))},S=()=>{h.value.isOpen?M():x()},T=t=>t.value&&"string"==typeof t.value&&t.value.startsWith("__insert__")?0:p.value.includes(t.value),E=t=>{if(!t.disabled)if(n.multiple){const e=[...p.value];if(t.value&&"string"==typeof t.value&&t.value.startsWith("__insert__")){const i=t.value.replace("__insert__","");e.includes(i)||e.push(i),h.value.searchQuery=""}else{const i=e.indexOf(t.value);i>-1?e.splice(i,1):e.push(t.value)}r("update:modelValue",e)}else r("update:modelValue",t.value),M()},C=t=>{if(["Enter"," ","ArrowDown","ArrowUp","Escape"].includes(t.key)&&(t.preventDefault(),!h.value.isOpen||"ArrowDown"!==t.key&&"ArrowUp"!==t.key))switch(t.key){case"Enter":case" ":S();break;case"ArrowDown":case"ArrowUp":x();break;case"Escape":M()}},O=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),$(1);break;case"ArrowUp":t.preventDefault(),$(-1);break;case"Enter":if(t.preventDefault(),h.value.highlightedIndex>=0){const t=g.value[h.value.highlightedIndex];t&&!t.disabled&&E(t)}break;case"Escape":M()}},A=t=>{if(h.value.isOpen)switch(t.key){case"Escape":M();break;case"ArrowDown":t.preventDefault(),$(1);break;case"ArrowUp":t.preventDefault(),$(-1);break;case"Enter":if(t.preventDefault(),h.value.highlightedIndex>=0){const t=g.value[h.value.highlightedIndex];t&&!t.disabled&&E(t)}}},$=t=>{const e=g.value;if(0===e.length)return;let i=h.value.highlightedIndex+t;i<0?i=e.length-1:i>=e.length&&(i=0);let n=0;for(;e[i]?.disabled&&n<e.length;)i+=t,i<0&&(i=e.length-1),i>=e.length&&(i=0),n++;h.value.highlightedIndex=i};return t.onUnmounted(()=>{h.value.isOpen&&M(),document.removeEventListener("keydown",A),f()}),(e,i)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{class:t.normalizeClass(["input-field-wrapper",[v.value,k.value]])},[n.hasLeadingIcon?(t.openBlock(),t.createElementBlock("div",Lt,[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)])):t.createCommentVNode("",1),t.createElementVNode("div",{ref_key:"selectTriggerRef",ref:s,class:t.normalizeClass(["input-select-trigger",{"input-select-open":h.value.isOpen}]),onClick:S,onKeydown:C,tabindex:b.value,role:"combobox","aria-expanded":h.value.isOpen,"aria-haspopup":1,"aria-controls":a.value,"aria-disabled":e.disabled},[t.createElementVNode("div",It,[m.value?(t.openBlock(),t.createElementBlock("span",Nt,t.toDisplayString(m.value),1)):(t.openBlock(),t.createElementBlock("span",Dt,t.toDisplayString(e.placeholder||"Select an option..."),1))]),t.createElementVNode("div",{class:t.normalizeClass(["input-select-arrow",{"input-select-arrow-open":h.value.isOpen}])},[t.createVNode(t.unref(X))],2)],42,Bt),n.hasTrailingIcon?(t.openBlock(),t.createElementBlock("div",_t,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1)],2),(t.openBlock(),t.createBlock(t.Teleport,{to:u.value},[h.value.isOpen?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:o,id:a.value,class:t.normalizeClass(["input-dropdown",{"input-dropdown--multiple":e.multiple}]),style:t.normalizeStyle(t.unref(c)),role:"listbox","aria-multiselectable":e.multiple,onMousedown:i[1]||(i[1]=t.withModifiers(()=>{},["prevent"]))},[e.searchable?(t.openBlock(),t.createElementBlock("div",Pt,[t.createVNode(Dp,{ref_key:"searchInputRef",ref:l,modelValue:h.value.searchQuery,"onUpdate:modelValue":i[0]||(i[0]=t=>h.value.searchQuery=t),type:"search",placeholder:y.value,size:"sm",tabindex:w.value,onKeydown:O},{"leading-icon":t.withCtx(()=>[t.createVNode(t.unref(gt))]),m:1},8,["modelValue","placeholder","tabindex"])])):t.createCommentVNode("",1),t.createElementVNode("div",{class:"input-dropdown-options",style:t.normalizeStyle({maxHeight:`${e.maxDropdownHeight}px`})},[0===g.value.length?(t.openBlock(),t.createElementBlock("div",Ht,[t.renderSlot(e.$slots,"zero-state",{},()=>[t.createTextVNode(t.toDisplayString(e.noOptionsText),1)],1)])):t.createCommentVNode("",1),(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(g.value,(i,n)=>(t.openBlock(),t.createElementBlock("div",{key:i.value,class:t.normalizeClass(["input-dropdown-option",{"input-dropdown-option--selected":T(i),"input-dropdown-option--highlighted":n===h.value.highlightedIndex,"input-dropdown-option--disabled":i.disabled,"input-dropdown-option--insert":i.value&&"string"==typeof i.value&&i.value.startsWith("__insert__")}]),onClick:t=>E(i),onMouseenter:t=>h.value.highlightedIndex=n,role:"option","aria-selected":T(i)},[t.createElementVNode("div",Ut,[t.createElementVNode("div",qt,t.toDisplayString(i.label),1),i.description?(t.openBlock(),t.createElementBlock("div",Vt,t.toDisplayString(i.description),1)):t.createCommentVNode("",1)]),e.multiple&&T(i)?(t.openBlock(),t.createElementBlock("div",Ft,[t.createVNode(t.unref(Z))])):t.createCommentVNode("",1)],42,jt))),128))],4)],46,zt)):t.createCommentVNode("",1)],8,["to"]))],64))}}),[["__scopeId","data-v-302debb0"]]),Jt={class:"input-leading-icon"},Wt=["src"],Gt=["id","accept","multiple","disabled","required"],Qt={class:"input-file-content"},Yt={key:0,class:"input-file-selected"},Zt={class:"input-file-list"},Xt={class:"input-file-item"},te={class:"input-file-name"},ee={key:1,class:"input-file-prompt"},ie={class:"input-file-prompt-text"},ne={key:0,class:"input-file-accept-text"},re={key:2,class:"input-file-selected"},se={class:"input-file-selected-text"},oe={class:"input-file-list"},le={class:"input-file-name"},ae={class:"input-file-size"},ue={key:0,class:"input-trailing-icon"},he={key:1,class:"input-trailing-icon"},ce=t.defineComponent({u:"UiInput.File",props:{accept:{},multiple:{type:Boolean,default:0},maxFileSize:{default:10485760},dragDropText:{},selectedText:{},preview:{},hasLeadingIcon:{type:Boolean,default:0},hasTrailingIcon:{type:Boolean,default:0},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","file-error","clear-preview","blur","focus"],setup(e,{emit:i}){const n=e,r=i,s=t.ref(),o=t.ref(0),l=t.ref(null),a=t.ref([]),u=t.computed(()=>n.preview?n.preview:l.value);t.computed(()=>Boolean(n.preview));const h=t.computed(()=>n.preview?n.preview:null),c=t.computed(()=>{const t=[];return n.error&&t.push("input-error"),n.disabled&&t.push("input-disabled"),t.push(`input-size-${n.size}`),t}),d=t.computed(()=>{const t=[];return t.push("input-padding-left-icon"),a.value.length>0||h.value||n.disabled?t.push("input-padding-right-icon"):t.push("input-padding-right"),t}),f=t=>{if(n.maxFileSize&&t.size>n.maxFileSize)return`File "${t.name}" is too large. Maximum size is ${y(n.maxFileSize)}.`;if(n.accept){const e=n.accept.split(",").map(t=>t.trim().toLowerCase()),i=t.type.toLowerCase(),r="."+t.name.split(".").pop()?.toLowerCase();if(!e.some(t=>{if(t.startsWith("."))return r===t;if(t.includes("*")){const e=t.split("/")[0];return i.startsWith(e)}return i===t}))return`File "${t.name}" is not an accepted file type.`}return null},p=t=>{for(const e of t){const t=f(e);if(t)return void r("file-error",t)}n.multiple?a.value=[...a.value,...t]:a.value=t.slice(0,1),n.multiple?r("update:modelValue",a.value):r("update:modelValue",a.value[0]||null),!n.multiple&&a.value.length>0&&a.value[0].type.startsWith("image/")&&m(a.value[0])},m=t=>{l.value&&URL.revokeObjectURL(l.value);const e=new FileReader;e.onload=t=>{l.value=t.target?.result},e.readAsDataURL(t)},g=()=>{a.value=[],r("update:modelValue",n.multiple?[]:null),l.value&&(URL.revokeObjectURL(l.value),l.value=null),s.value&&(s.value.value=""),n.preview&&r("clear-preview")},y=t=>{if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,e)).toFixed(2))+" "+["Bytes","KB","MB","GB"][e]},b=()=>{!n.disabled&&s.value&&s.value.click()},w=t=>{const e=t.target,i=Array.from(e.files||[]);i.length>0&&p(i)},v=t=>{n.disabled||(o.value=1)},k=t=>{o.value=0},x=t=>{if(n.disabled)return;o.value=0;const e=Array.from(t.dataTransfer?.files||[]);e.length>0&&p(e)},M=t=>{r("blur",t)},S=t=>{r("focus",t)};return t.watch(()=>n.modelValue,t=>{t?Array.isArray(t)?a.value=t:(a.value=[t],t.type.startsWith("image/")&&m(t)):(a.value=[],l.value&&(URL.revokeObjectURL(l.value),l.value=null))},{immediate:1}),t.onUnmounted(()=>{l.value&&URL.revokeObjectURL(l.value)}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-field-wrapper",[c.value,d.value]])},[t.createElementVNode("div",Jt,[u.value?(t.openBlock(),t.createElementBlock("img",{key:0,src:u.value,alt:"Preview",class:"input-file-preview"},null,8,Wt)):n.hasLeadingIcon?t.renderSlot(e.$slots,"leading-icon",{key:1},void 0,1):(t.openBlock(),t.createBlock(t.unref(ot),{key:2}))]),t.createElementVNode("div",{class:t.normalizeClass(["input-file-area",{"input-file-dragover":o.value,"input-file-disabled":e.disabled}]),onClick:b,onDragover:t.withModifiers(v,["prevent"]),onDragleave:t.withModifiers(k,["prevent"]),onDrop:t.withModifiers(x,["prevent"])},[t.createElementVNode("input",{ref_key:"fileInputRef",ref:s,id:e.inputId,type:"file",accept:e.accept,multiple:e.multiple,disabled:e.disabled,required:e.required,class:"input-file-hidden",onChange:w,onBlur:M,onFocus:S},null,40,Gt),t.createElementVNode("div",Qt,[h.value&&0===a.value.length?(t.openBlock(),t.createElementBlock("div",Yt,[i[0]||(i[0]=t.createElementVNode("div",{class:"input-file-selected-text"}," File loaded ",-1)),t.createElementVNode("div",Zt,[t.createElementVNode("div",Xt,[t.createElementVNode("span",te,t.toDisplayString(h.value),1)])])])):0===a.value.length?(t.openBlock(),t.createElementBlock("div",ee,[t.createElementVNode("div",ie,t.toDisplayString(e.dragDropText||"Click to select or drag and drop"),1),e.accept?(t.openBlock(),t.createElementBlock("div",ne,t.toDisplayString(e.accept),1)):t.createCommentVNode("",1)])):(t.openBlock(),t.createElementBlock("div",re,[t.createElementVNode("div",se,t.toDisplayString(e.selectedText||`${a.value.length} file(s) selected`),1),t.createElementVNode("div",oe,[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(e,i)=>(t.openBlock(),t.createElementBlock("div",{key:i,class:"input-file-item"},[t.createElementVNode("span",le,t.toDisplayString(e.name),1),t.createElementVNode("span",ae,"("+t.toDisplayString(y(e.size))+")",1)]))),128))])]))])],34),(a.value.length>0||h.value)&&!e.disabled?(t.openBlock(),t.createElementBlock("div",ue,[t.createElementVNode("button",{type:"button",class:"input-file-clear",onClick:t.withModifiers(g,["stop"]),"aria-label":"Clear selected files"},[t.createVNode(t.unref(vt))])])):n.hasTrailingIcon?(t.openBlock(),t.createElementBlock("div",he,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1)],2))}}),de=e(ce,[["__scopeId","data-v-e1fd712d"]]),fe={class:"tabs-wrapper"},pe={key:0,class:"tabs-before"},me=["aria-selected","id","onClick"],ge={key:1,class:"tabs-after"},ye=["aria-labelledby"],be=e(t.defineComponent({u:"UiTabs",props:{modelValue:{},tabs:{},underlineWidth:{default:"5rem"},orientation:{default:"horizontal"},size:{default:"md"},variant:{default:"default"},tabWidth:{default:"fill"},sticky:{default:null}},emits:["update:modelValue"],setup(e,{emit:i}){const n=e,r=i,s=t.useSlots(),o=t.computed(()=>!!s.content),l=t.computed(()=>n.tabs.find(t=>t.value===n.modelValue)),a=t.ref([]),u=t.ref(0),h=t.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"}),c=t.ref({width:"0px",height:"0px",left:"0px",top:"0px",opacity:"0"});let d=-1,f=0;const p=(t,e)=>{const i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=getComputedStyle(e),o=parseFloat(s.getPropertyValue("--underline-thickness")||"5");let l=5;"sm"===n.size?l=4:"lg"===n.size&&(l=6);const a=r.height;if("vertical"===n.orientation){const t=i.top-r.top;return{height:i.height-4*l,top:t+2*l,width:o,left:l-o/2}}{const t=i.left-r.left,e=i.width;if("full"===n.underlineWidth)return{width:e-30,left:t+15,height:o,top:a-l-o/2};let s;return s=n.underlineWidth.endsWith("%")?e*(parseFloat(n.underlineWidth)/100):n.underlineWidth.endsWith("px")?parseFloat(n.underlineWidth):n.underlineWidth.endsWith("rem")?parseFloat(n.underlineWidth)*parseFloat(getComputedStyle(document.documentElement).fontSize):parseFloat(n.underlineWidth)||e,{width:s,left:t+(e-s)/2,height:o,top:a-l-o/2}}},m=async t=>{if(!a.value[t]||t===d)return;f=1;const e=a.value[t],i=e.parentElement;if(!i)return;const r=p(e,i),s=e.getBoundingClientRect(),o=i.getBoundingClientRect();let l,u;if("vertical"===n.orientation?(l=s.top-o.top,u=s.height):(l=s.left-o.left,u=s.width),-1===d)return"vertical"===n.orientation?(h.value={height:`${r.height}px`,top:`${r.top}px`,width:`${r.width}px`,left:`${r.left}px`,opacity:"1"},c.value={height:`${u}px`,top:`${l}px`,width:`${s.width}px`,left:"0",opacity:"1"}):(h.value={width:`${r.width}px`,left:`${r.left}px`,height:`${r.height}px`,top:`${r.top}px`,opacity:"1"},c.value={width:`${u}px`,left:`${l}px`,height:"100%",top:"0",opacity:"1"}),d=t,void(f=0);const m=a.value[d];if(p(m,i),m.getBoundingClientRect(),window.matchMedia("(prefers-reduced-motion: reduce)").matches)return h.value={width:`${r.width||0}px`,left:`${r.left||0}px`,height:`${r.height||7}px`,top:`${r.top}px`,opacity:"1"},"vertical"===n.orientation?c.value={height:`${u}px`,top:`${l}px`,width:"100%",left:"0",opacity:"1"}:c.value={width:`${u}px`,left:`${l}px`,height:"100%",top:"0",opacity:"1"},d=t,void(f=0);requestAnimationFrame(()=>{"vertical"===n.orientation?(h.value={height:`${r.height}px`,top:`${r.top}px`,width:`${r.width||7}px`,left:`${r.left}px`,opacity:"1"},c.value={height:`${u}px`,top:`${l}px`,width:"100%",left:"0",opacity:"1"}):(h.value={width:`${r.width}px`,left:`${r.left}px`,height:`${r.height||7}px`,top:`${r.top}px`,opacity:"1"},c.value={width:`${u}px`,left:`${l}px`,height:"100%",top:"0",opacity:"1"}),d=t,setTimeout(()=>{f=0},200)})};let g=null;const y=()=>{const t=n.tabs.findIndex(t=>t.value===n.modelValue);if(-1!==t&&a.value&&a.value[t]){const e=u.value;u.value=0;const i=a.value[t],r=i.parentElement;if(r){const t=p(i,r),e=i.getBoundingClientRect(),s=r.getBoundingClientRect();let o,l;"vertical"===n.orientation?(o=e.top-s.top,l=e.height,h.value={height:`${t.height}px`,top:`${t.top}px`,width:`${t.width}px`,left:`${t.left}px`,opacity:"1"},c.value={height:`${l}px`,top:`${o}px`,width:`${e.width}px`,left:"0",opacity:"1"}):(o=e.left-s.left,l=e.width,h.value={width:`${t.width}px`,left:`${t.left}px`,height:`${t.height}px`,top:`${t.top}px`,opacity:"1"},c.value={width:`${l}px`,left:`${o}px`,height:"100%",top:"0",opacity:"1"})}d=t,f=0,setTimeout(()=>{u.value=e},10)}g&&clearTimeout(g),g=setTimeout(()=>{g=null},50)};t.onMounted(async()=>{await t.nextTick();const e=n.tabs.findIndex(t=>t.value===n.modelValue);-1!==e&&(m(e),setTimeout(()=>{u.value=1},50)),window.addEventListener("resize",y)}),t.onUnmounted(()=>{window.removeEventListener("resize",y),g&&(clearTimeout(g),g=null)});const{modelValue:b}=t.toRefs(n);return t.watch(b,async()=>{await t.nextTick();const e=n.tabs.findIndex(t=>t.value===n.modelValue);-1!==e&&m(e)}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["tabs-container",[`tabs-container--${e.orientation}`,`tabs-container--${e.size}`,`tabs-container--${e.variant}`,{"tabs-container--with-content":o.value}]])},[t.createElementVNode("div",fe,[t.createElementVNode("div",{class:t.normalizeClass(["tabs-list",[`tabs-list--${e.orientation}`,`tabs-list--${e.size}`,`tabs-list--${e.variant}`]]),style:t.normalizeStyle(e.sticky?{position:"sticky",[e.sticky.side]:`${e.sticky.offset}px`,zIndex:10}:{})},[e.$slots.before?(t.openBlock(),t.createElementBlock("div",pe,[t.renderSlot(e.$slots,"before",{},void 0,1)])):t.createCommentVNode("",1),t.createElementVNode("div",{class:t.normalizeClass(["tabs-buttons-wrapper",`tabs-buttons-wrapper--${e.tabWidth}`]),role:"tablist"},[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(e.tabs,(i,n)=>(t.openBlock(),t.createElementBlock("button",{key:i.value,ref_for:1,ref_key:"tabButtons",ref:a,class:t.normalizeClass(["tab-button",[`tab-button--${e.size}`,`tab-button--${e.variant}`,`tab-button--${e.tabWidth}`,{"tab-button-active":t.unref(b)===i.value}]]),"aria-selected":t.unref(b)===i.value,"aria-controls":"tabpanel",id:`tab-${i.value}`,role:"tab",onClick:e=>(async(e,i)=>{f||(r("update:modelValue",e),await t.nextTick(),m(i))})(i.value,n)},t.toDisplayString(i.label),11,me))),128)),t.createElementVNode("div",{class:t.normalizeClass(["tab-background",{"no-transition":!u.value}]),style:t.normalizeStyle(c.value)},null,6),t.createElementVNode("div",{class:t.normalizeClass(["tab-underline",{"no-transition":!u.value}]),style:t.normalizeStyle(h.value)},null,6)],2),e.$slots.after?(t.openBlock(),t.createElementBlock("div",ge,[t.renderSlot(e.$slots,"after",{},void 0,1)])):t.createCommentVNode("",1)],6)]),o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["tabs-content",`tabs-content--${e.orientation}`]),role:"tabpanel","aria-labelledby":`tab-${t.unref(b)}`,id:"tabpanel"},[t.renderSlot(e.$slots,"content",{activeTab:l.value},void 0,1)],10,ye)):t.createCommentVNode("",1)],2))}}),[["__scopeId","data-v-901716e3"]]),we={key:0,class:"ui-divider-text"},ve=e(t.defineComponent({u:"UiDivider",props:{orientation:{default:"horizontal"},variant:{default:"solid"},text:{},textPosition:{default:"center"},color:{default:"var(--accui-divider-color)"},thickness:{default:"1px"},margin:{default:"1rem"},spacing:{default:"auto"}},setup(e){const i=e,n=t.useSlots(),r=t.computed(()=>!(!i.text&&!n.default)),s=t.computed(()=>{const t={};return"horizontal"===i.orientation?(t.width="auto"===i.spacing?"100%":"number"==typeof i.spacing?`${i.spacing}px`:i.spacing,t.marginTop="number"==typeof i.margin?`${i.margin}px`:i.margin,t.marginBottom="number"==typeof i.margin?`${i.margin}px`:i.margin,r.value||(t.height="number"==typeof i.thickness?`${i.thickness}px`:i.thickness),t["--divider-color"]="#e5e7eb"===i.color?"var(--accui-divider-color)":i.color,t["--divider-thickness"]="number"==typeof i.thickness?`${i.thickness}px`:i.thickness):(t.height="auto"===i.spacing?"100%":"number"==typeof i.spacing?`${i.spacing}px`:i.spacing,t.marginLeft="number"==typeof i.margin?`${i.margin}px`:i.margin,t.marginRight="number"==typeof i.margin?`${i.margin}px`:i.margin,r.value||(t.width="number"==typeof i.thickness?`${i.thickness}px`:i.thickness),t["--divider-color"]="#e5e7eb"===i.color?"var(--accui-divider-color)":i.color,t["--divider-thickness"]="number"==typeof i.thickness?`${i.thickness}px`:i.thickness),t});return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["ui-divider",`ui-divider--${e.orientation}`,`ui-divider--${e.variant}`,{"ui-divider--with-text":r.value,[`ui-divider--text-${e.textPosition}`]:r.value}]),style:t.normalizeStyle(s.value)},[r.value?(t.openBlock(),t.createElementBlock("span",we,[t.renderSlot(e.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.text),1)],1)])):t.createCommentVNode("",1)],6))}}),[["__scopeId","data-v-1c798024"]]),ke={class:"datetime-picker-wrapper"},xe={class:"datetime-picker-leading-icon"},Me={class:"datetime-picker-display"},Se={key:0,class:"datetime-picker-value"},Te={key:1,class:"datetime-picker-placeholder"},Ee={key:1,class:"datetime-picker-trailing-icon"},Ce={key:1,class:"datetime-picker-panel"},Oe={class:"datetime-picker-header"},Ae={class:"datetime-picker-month-year"},$e=["value"],Re=["value"],Le={class:"datetime-picker-weekdays"},Be={class:"datetime-picker-grid"},Ie={key:2,class:"datetime-picker-panel datetime-picker-time-panel"},Ne={class:"time-selector"},De={class:"time-column"},_e={class:"time-scroll"},ze={class:"time-column"},Pe={class:"time-scroll"},He={key:0,class:"time-column"},je={class:"time-scroll"},Ue={class:"datetime-picker-footer"},qe=t.defineComponent({u:"UiDateTimePicker",props:{modelValue:{},type:{default:"date"},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},min:{},max:{},error:{type:Boolean,default:0},size:{default:"md"},format:{default:"iso"},is24Hour:{type:Boolean,default:1},minuteStep:{default:1}},emits:["update:modelValue","change"],setup(e,{emit:i}){const n=e,r=i,s=t.ref(),o=t.ref(),l=t.ref(0),{floatingStyle:a,updatePosition:u,cleanup:h}=Rt({trigger:s,floating:o,placement:"bottom-start",offset:8,shift:1,flip:1,autoUpdate:1,clickOutside:{enabled:1,handler:()=>{c()}}}),c=()=>{l.value=0},d=()=>{l.value?c():(async()=>{n.disabled||n.readonly||(l.value=1,await t.nextTick(),u())})()},f=t.ref("time"===n.type?"time":"date"),p=t.ref((new Date).getMonth()),m=t.ref((new Date).getFullYear()),g=t.ref((new Date).getHours()),y=t.ref((new Date).getMinutes()),b=t.ref("AM"),w=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Su","Mo","Tu","We","Th","Fr","Sa"],k=t.computed(()=>n.min?n.min instanceof Date?n.min:new Date(n.min):null),x=t.computed(()=>n.max?n.max instanceof Date?n.max:new Date(n.max):null),M=t.computed(()=>{if(!n.modelValue)return null;if(n.modelValue instanceof Date)return n.modelValue;if("time"===n.type&&"string"==typeof n.modelValue){const t=n.modelValue.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(t){const e=new Date;return e.setHours(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]||"0"),0),e}}return new Date(n.modelValue)}),S=t.computed(()=>{if(!M.value||isNaN(M.value.getTime()))return"";const t=M.value;if("time"===n.type){if(n.is24Hour)return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`;{const e=t.getHours()%12||12,i=t.getHours()>=12?"PM":"AM";return`${e}:${String(t.getMinutes()).padStart(2,"0")} ${i}`}}const e=t.getDate(),i=t.getMonth()+1,r=t.getFullYear();let s="";switch(n.format){case"us":s=`${i}/${e}/${r}`;break;case"eu":s=`${e}/${i}/${r}`;break;default:s=`${r}-${String(i).padStart(2,"0")}-${String(e).padStart(2,"0")}`}if("date"===n.type)return s;let o="";if(n.is24Hour)o=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`;else{const e=t.getHours()%12||12,i=t.getHours()>=12?"PM":"AM";o=`${e}:${String(t.getMinutes()).padStart(2,"0")} ${i}`}return`${s} ${o}`}),T=t.computed(()=>{const t=[];return n.error&&t.push("datetime-picker-error"),n.disabled&&t.push("datetime-picker-disabled"),n.readonly&&t.push("datetime-picker-readonly"),t.push(`datetime-picker-size-${n.size}`),t}),E=t.computed(()=>"date"===n.type||"datetime"===n.type&&"date"===f.value),C=t.computed(()=>"time"===n.type||"datetime"===n.type&&"time"===f.value),O=t.computed(()=>[{label:"Date",value:"date"},{label:"Time",value:"time"}]),A=t.computed(()=>{const t=[],e=n.is24Hour?23:12;for(let i=n.is24Hour?0:1;i<=e;i++)t.push(i);return t}),$=t.computed(()=>{const t=[];for(let e=0;e<60;e+=n.minuteStep)t.push(e);return t}),L=t.computed(()=>{const t=(new Date).getFullYear(),e=k.value?.getFullYear()||t-100,i=x.value?.getFullYear()||t+100,n=[];for(let r=e;r<=i;r++)n.push(r);return n}),B=t.computed(()=>k.value?new Date(m.value,p.value,1)<=k.value:0),I=t.computed(()=>x.value?new Date(m.value,p.value+1,0)>=x.value:0),N=t.computed(()=>{const t=[],e=m.value,i=p.value,n=new Date(e,i,1),r=new Date(n);r.setDate(r.getDate()-n.getDay());const s=new Date;s.setHours(0,0,0,0);for(let o=0;o<42;o++){const e=new Date(r);e.setDate(r.getDate()+o);const n=e.getMonth()!==i,l=e.getTime()===s.getTime(),a=M.value&&e.getFullYear()===M.value.getFullYear()&&e.getMonth()===M.value.getMonth()&&e.getDate()===M.value.getDate(),u=!!(k.value&&e<k.value||x.value&&e>x.value);t.push({key:`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`,date:e.getDate(),month:e.getMonth(),year:e.getFullYear(),otherMonth:n,isToday:l,isSelected:a||0,isDisabled:u})}return t}),D=()=>{switch(n.type){case"time":return"Select time";case"datetime":return"Select date and time";default:return"Select date"}},_=()=>{0===p.value?(p.value=11,m.value--):p.value--},z=()=>{11===p.value?(p.value=0,m.value++):p.value++},P=(t,e)=>{let i=M.value?new Date(M.value):new Date;if(!M.value){const t=new Date;i.setFullYear(t.getFullYear(),t.getMonth(),t.getDate())}if("hour"===t){let t=e;n.is24Hour||("PM"===b.value&&12!==t&&(t+=12),"AM"===b.value&&12===t&&(t=0)),g.value=e,i.setHours(t)}else if("minute"===t)y.value=e,i.setMinutes(e);else if("period"===t){b.value=e;let t=g.value;"PM"===e&&12!==t&&(t+=12),"AM"===e&&12===t&&(t=0),i.setHours(t)}r("update:modelValue",i),r("change",i)},H=()=>{const t=new Date;k.value&&t<k.value||x.value&&t>x.value||(r("update:modelValue",t),r("change",t),c())},j=()=>{r("update:modelValue",null),r("change",null)};return t.watch(()=>n.modelValue,t=>{if(t){const e=t instanceof Date?t:new Date(t);if(!isNaN(e.getTime())){if(p.value=e.getMonth(),m.value=e.getFullYear(),n.is24Hour)g.value=e.getHours();else{const t=e.getHours();g.value=t%12||12,b.value=t>=12?"PM":"AM"}y.value=e.getMinutes()}}},{immediate:1}),t.onUnmounted(()=>{h()}),(e,i)=>(t.openBlock(),t.createElementBlock("div",ke,[t.createElementVNode("div",{ref_key:"triggerElement",ref:s,class:t.normalizeClass(["datetime-picker-trigger",[T.value,{"datetime-picker-open":l.value}]]),onClick:d},[t.createElementVNode("div",xe,["date"===e.type?(t.openBlock(),t.createBlock(t.unref(Y),{key:0})):"time"===e.type?(t.openBlock(),t.createBlock(t.unref(it),{key:1})):(t.openBlock(),t.createBlock(t.unref(Q),{key:2}))]),t.createElementVNode("div",Me,[S.value?(t.openBlock(),t.createElementBlock("span",Se,t.toDisplayString(S.value),1)):(t.openBlock(),t.createElementBlock("span",Te,t.toDisplayString(e.placeholder||D()),1))]),!e.modelValue||e.disabled||e.readonly?(t.openBlock(),t.createElementBlock("div",Ee,[t.createVNode(t.unref(X))])):(t.openBlock(),t.createElementBlock("div",{key:0,class:"datetime-picker-trailing-icon",onClick:t.withModifiers(j,["stop"])},[t.createVNode(t.unref(vt))]))],2),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[l.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"floatingElement",ref:o,class:"datetime-picker-dropdown",style:t.normalizeStyle(t.unref(a))},["datetime"===e.type?(t.openBlock(),t.createBlock(be,{key:0,modelValue:f.value,"onUpdate:modelValue":i[0]||(i[0]=t=>f.value=t),tabs:O.value,variant:"default",size:"sm",style:{"margin-bottom":"1rem"}},null,8,["modelValue","tabs"])):t.createCommentVNode("",1),E.value?(t.openBlock(),t.createElementBlock("div",Ce,[t.createElementVNode("div",Oe,[t.createVNode(R,{onClick:_,disabled:B.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:t.withCtx(()=>[t.createVNode(t.unref(tt))]),m:1},8,["disabled"]),t.createElementVNode("div",Ae,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":i[1]||(i[1]=t=>p.value=t),class:"datetime-picker-select"},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(w,(e,i)=>t.createElementVNode("option",{key:i,value:i},t.toDisplayString(e),9,$e)),64))],512),[[t.vModelSelect,p.value]]),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":i[2]||(i[2]=t=>m.value=t),class:"datetime-picker-select"},[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(L.value,e=>(t.openBlock(),t.createElementBlock("option",{key:e,value:e},t.toDisplayString(e),9,Re))),128))],512),[[t.vModelSelect,m.value]])]),t.createVNode(R,{onClick:z,disabled:I.value,color:"secondary",variant:"primary",icon:"",squircle:""},{icon:t.withCtx(()=>[t.createVNode(t.unref(et))]),m:1},8,["disabled"])]),t.createElementVNode("div",Le,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(v,e=>t.createElementVNode("div",{key:e,class:"datetime-picker-weekday"},t.toDisplayString(e),1)),64))]),t.createElementVNode("div",Be,[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(N.value,e=>(t.openBlock(),t.createBlock(R,{key:e.key,color:e.isSelected||e.isToday?"primary":"secondary",variant:e.isSelected?"primary":e.isToday?"outline":"primary",disabled:e.isDisabled||e.otherMonth,class:t.normalizeClass(["datetime-picker-day",{"datetime-picker-day-other":e.otherMonth,"datetime-picker-day-disabled":e.isDisabled}]),icon:"",squircle:"",onClick:t=>(t=>{if(t.isDisabled||t.otherMonth)return;const e=M.value||new Date,i=new Date(t.year,t.month,t.date,e.getHours(),e.getMinutes());r("update:modelValue",i),r("change",i),"datetime"===n.type?f.value="time":"date"===n.type&&c()})(e)},{icon:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.date),1)]),m:2},1032,["color","variant","disabled","class","onClick"]))),128))])])):t.createCommentVNode("",1),C.value?(t.openBlock(),t.createElementBlock("div",Ie,[t.createElementVNode("div",Ne,[t.createElementVNode("div",De,[i[6]||(i[6]=t.createElementVNode("label",{class:"time-label"},"Hour",-1)),t.createElementVNode("div",_e,[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(A.value,e=>(t.openBlock(),t.createBlock(R,{key:e,color:g.value===e?"primary":"secondary",variant:g.value===e?"primary":"ghost",size:"sm",squircle:"",onClick:t=>P("hour",e)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(String(e).padStart(2,"0")),1)]),m:2},1032,["color","variant","onClick"]))),128))])]),t.createElementVNode("div",ze,[i[7]||(i[7]=t.createElementVNode("label",{class:"time-label"},"Minute",-1)),t.createElementVNode("div",Pe,[(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList($.value,e=>(t.openBlock(),t.createBlock(R,{key:e,color:y.value===e?"primary":"secondary",variant:y.value===e?"primary":"ghost",size:"sm",squircle:"",onClick:t=>P("minute",e)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(String(e).padStart(2,"0")),1)]),m:2},1032,["color","variant","onClick"]))),128))])]),e.is24Hour?t.createCommentVNode("",1):(t.openBlock(),t.createElementBlock("div",He,[i[10]||(i[10]=t.createElementVNode("label",{class:"time-label"},"Period",-1)),t.createElementVNode("div",je,[t.createVNode(R,{color:"AM"===b.value?"primary":"secondary",variant:"AM"===b.value?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:i[3]||(i[3]=t=>P("period","AM"))},{default:t.withCtx(()=>[...i[8]||(i[8]=[t.createTextVNode(" AM ",-1)])]),m:1},8,["color","variant"]),t.createVNode(R,{color:"PM"===b.value?"primary":"secondary",variant:"PM"===b.value?"primary":"ghost",size:"sm",squircle:"",class:"time-option",onClick:i[4]||(i[4]=t=>P("period","PM"))},{default:t.withCtx(()=>[...i[9]||(i[9]=[t.createTextVNode(" PM ",-1)])]),m:1},8,["color","variant"])])]))])])):t.createCommentVNode("",1),t.createVNode(ve),t.createElementVNode("div",Ue,[t.createVNode(R,{onClick:H,color:"primary",variant:"primary",squircle:"",style:{flex:"1"}},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString("time"===e.type?"Now":"Today"),1)]),m:1}),t.createVNode(R,{onClick:i[5]||(i[5]=t=>{j(),c()}),color:"danger",variant:"primary",squircle:"",style:{flex:"1"}},{default:t.withCtx(()=>[...i[11]||(i[11]=[t.createTextVNode(" Clear ",-1)])]),m:1}),t.createVNode(R,{onClick:c,color:"secondary",variant:"primary",squircle:"",style:{flex:"1"}},{default:t.withCtx(()=>[...i[12]||(i[12]=[t.createTextVNode(" Close ",-1)])]),m:1})])],4)):t.createCommentVNode("",1)]))]))}}),Ve=e(qe,[["__scopeId","data-v-f688c330"]]),Fe=t.defineComponent({u:"UiInput.Date",props:{min:{},max:{},format:{default:"iso"},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(e,{emit:i}){const n=i,r=t=>{n("update:modelValue",t)},s=t=>{n("change",t)};return(e,i)=>(t.openBlock(),t.createBlock(Ve,{"model-value":e.modelValue,type:"date",placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,min:e.min,max:e.max,error:Boolean(e.error),size:e.size,format:e.format,"onUpdate:modelValue":r,onChange:s},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format"]))}}),Ke=t.defineComponent({u:"UiInput.Time",props:{is24Hour:{type:Boolean,default:1},minuteStep:{default:1},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(e,{emit:i}){const n=i,r=t=>{n("update:modelValue",t)},s=t=>{n("change",t)};return(e,i)=>(t.openBlock(),t.createBlock(Ve,{"model-value":e.modelValue,type:"time",placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,error:Boolean(e.error),size:e.size,is24Hour:e.is24Hour,minuteStep:e.minuteStep,"onUpdate:modelValue":r,onChange:s},null,8,["model-value","placeholder","disabled","readonly","required","error","size","is24Hour","minuteStep"]))}}),Je=t.defineComponent({u:"UiInput.DateTime",props:{min:{},max:{},format:{default:"iso"},is24Hour:{type:Boolean,default:1},minuteStep:{default:1},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean,default:0},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{default:"md"},tabindex:{}},emits:["update:modelValue","change","blur","focus","keydown"],setup(e,{emit:i}){const n=i,r=t=>{n("update:modelValue",t)},s=t=>{n("change",t)};return(e,i)=>(t.openBlock(),t.createBlock(Ve,{"model-value":e.modelValue,type:"datetime",placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,min:e.min,max:e.max,error:Boolean(e.error),size:e.size,format:e.format,is24Hour:e.is24Hour,minuteStep:e.minuteStep,"onUpdate:modelValue":r,onChange:s},null,8,["model-value","placeholder","disabled","readonly","required","min","max","error","size","format","is24Hour","minuteStep"]))}});function We(t){this.content=t}function Ge(t,e,i){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:i;let r=t.child(n),s=e.child(n);if(r!=s){if(!r.sameMarkup(s))return i;if(r.isText&&r.text!=s.text){for(let t=0;r.text[t]==s.text[t];t++)i++;return i}if(r.content.size||s.content.size){let t=Ge(r.content,s.content,i+1);if(null!=t)return t}i+=r.nodeSize}else i+=r.nodeSize}}function Qe(t,e,i,n){for(let r=t.childCount,s=e.childCount;;){if(0==r||0==s)return r==s?null:{a:i,b:n};let o=t.child(--r),l=e.child(--s),a=o.nodeSize;if(o!=l){if(!o.sameMarkup(l))return{a:i,b:n};if(o.isText&&o.text!=l.text){let t=0,e=Math.min(o.text.length,l.text.length);for(;t<e&&o.text[o.text.length-t-1]==l.text[l.text.length-t-1];)t++,i--,n--;return{a:i,b:n}}if(o.content.size||l.content.size){let t=Qe(o.content,l.content,i-1,n-1);if(t)return t}i-=a,n-=a}else i-=a,n-=a}}We.prototype={constructor:We,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-1==e?void 0:this.content[e+1]},update:function(t,e,i){var n=i&&i!=t?this.remove(i):this,r=n.find(t),s=n.content.slice();return-1==r?s.push(i||t,e):(s[r+1]=e,i&&(s[r]=i)),new We(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var i=this.content.slice();return i.splice(e,2),new We(i)},addToStart:function(t,e){return new We([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var i=this.remove(t).content.slice();return i.push(t,e),new We(i)},addBefore:function(t,e,i){var n=this.remove(e),r=n.content.slice(),s=n.find(t);return r.splice(-1==s?r.length:s,0,e,i),new We(r)},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=We.from(t)).size?new We(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=We.from(t)).size?new We(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=We.from(t);for(var i=0;i<t.content.length;i+=2)e=e.remove(t.content[i]);return e},toObject:function(){var t={};return this.forEach(function(e,i){t[e]=i}),t},get size(){return this.content.length>>1}},We.from=function(t){if(t instanceof We)return t;var e=[];if(t)for(var i in t)e.push(i,t[i]);return new We(e)};class Ye{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let i=0;i<t.length;i++)this.size+=t[i].nodeSize}nodesBetween(t,e,i,n=0,r){for(let s=0,o=0;o<e;s++){let l=this.content[s],a=o+l.nodeSize;if(a>t&&0!=i(l,n+o,r||null,s)&&l.content.size){let r=o+1;l.nodesBetween(Math.max(0,t-r),Math.min(l.content.size,e-r),i,n+r)}o=a}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,i,n){let r="",s=1;return this.nodesBetween(t,e,(o,l)=>{let a=o.isText?o.text.slice(Math.max(t,l)-l,e-l):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&a||o.isTextblock)&&i&&(s?s=0:r+=i),r+=a},0),r}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,i=t.firstChild,n=this.content.slice(),r=0;for(e.isText&&e.sameMarkup(i)&&(n[n.length-1]=e.withText(e.text+i.text),r=1);r<t.content.length;r++)n.push(t.content[r]);return new Ye(n,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let i=[],n=0;if(e>t)for(let r=0,s=0;s<e;r++){let o=this.content[r],l=s+o.nodeSize;l>t&&((s<t||l>e)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))),i.push(o),n+=o.nodeSize),s=l}return new Ye(i,n)}cutByIndex(t,e){return t==e?Ye.empty:0==t&&e==this.content.length?this:new Ye(this.content.slice(t,e))}replaceChild(t,e){let i=this.content[t];if(i==e)return this;let n=this.content.slice(),r=this.size+e.nodeSize-i.nodeSize;return n[t]=e,new Ye(n,r)}addToStart(t){return new Ye([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ye(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return 0;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return 0;return 1}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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,i=0;e<this.content.length;e++){let n=this.content[e];t(n,i,e),i+=n.nodeSize}}findDiffStart(t,e=0){return Ge(this,t,e)}findDiffEnd(t,e=this.size,i=t.size){return Qe(this,t,e,i)}findIndex(t){if(0==t)return Xe(0,t);if(t==this.size)return Xe(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,i=0;;e++){let n=i+this.child(e).nodeSize;if(n>=t)return n==t?Xe(e+1,n):Xe(e,i);i=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return Ye.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ye(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ye.empty;let e,i=0;for(let n=0;n<t.length;n++){let r=t[n];i+=r.nodeSize,n&&r.isText&&t[n-1].sameMarkup(r)?(e||(e=t.slice(0,n)),e[e.length-1]=r.withText(e[e.length-1].text+r.text)):e&&e.push(r)}return new Ye(e||t,i)}static from(t){if(!t)return Ye.empty;if(t instanceof Ye)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ye([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ye.empty=new Ye([],0);const Ze={index:0,offset:0};function Xe(t,e){return Ze.index=t,Ze.offset=e,Ze}function ti(t,e){if(t===e)return 1;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return 0;let i=Array.isArray(t);if(Array.isArray(e)!=i)return 0;if(i){if(t.length!=e.length)return 0;for(let i=0;i<t.length;i++)if(!ti(t[i],e[i]))return 0}else{for(let i in t)if(!(i in e)||!ti(t[i],e[i]))return 0;for(let i in e)if(!(i in t))return 0}return 1}let ei=class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,i=0;for(let n=0;n<t.length;n++){let r=t[n];if(this.eq(r))return t;if(this.type.excludes(r.type))e||(e=t.slice(0,n));else{if(r.type.excludes(this.type))return t;!i&&r.type.rank>this.type.rank&&(e||(e=t.slice(0,n)),e.push(this),i=1),e&&e.push(r)}}return e||(e=t.slice()),i||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return 1;return 0}eq(t){return this==t||this.type==t.type&&ti(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let i=t.marks[e.type];if(!i)throw new RangeError(`There is no mark type ${e.type} in this schema`);let n=i.create(e.attrs);return i.checkAttrs(n.attrs),n}static sameSet(t,e){if(t==e)return 1;if(t.length!=e.length)return 0;for(let i=0;i<t.length;i++)if(!t[i].eq(e[i]))return 0;return 1}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return t.none;if(e instanceof t)return[e];let i=e.slice();return i.sort((t,e)=>t.type.rank-e.type.rank),i}};ei.none=[];class ii extends Error{}class ni{constructor(t,e,i){this.content=t,this.openStart=e,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let i=si(this.content,t+this.openStart,e);return i&&new ni(i,this.openStart,this.openEnd)}removeBetween(t,e){return new ni(ri(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return ni.empty;let i=e.openStart||0,n=e.openEnd||0;if("number"!=typeof i||"number"!=typeof n)throw new RangeError("Invalid input for Slice.fromJSON");return new ni(Ye.fromJSON(t,e.content),i,n)}static maxOpen(t,e=1){let i=0,n=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)i++;for(let r=t.lastChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.lastChild)n++;return new ni(t,i,n)}}function ri(t,e,i){let{index:n,offset:r}=t.findIndex(e),s=t.maybeChild(n),{index:o,offset:l}=t.findIndex(i);if(r==e||s.isText){if(l!=i&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(i))}if(n!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(n,s.copy(ri(s.content,e-r-1,i-r-1)))}function si(t,e,i,n){let{index:r,offset:s}=t.findIndex(e),o=t.maybeChild(r);if(s==e||o.isText)return n&&!n.canReplace(r,r,i)?null:t.cut(0,e).append(i).append(t.cut(e));let l=si(o.content,e-s-1,i,o);return l&&t.replaceChild(r,o.copy(l))}function oi(t,e,i){if(i.openStart>t.depth)throw new ii("Inserted content deeper than insertion position");if(t.depth-i.openStart!=e.depth-i.openEnd)throw new ii("Inconsistent open depths");return li(t,e,i,0)}function li(t,e,i,n){let r=t.index(n),s=t.node(n);if(r==e.index(n)&&n<t.depth-i.openStart){let o=li(t,e,i,n+1);return s.copy(s.content.replaceChild(r,o))}if(i.content.size){if(i.openStart||i.openEnd||t.depth!=n||e.depth!=n){let{start:r,end:o}=function(t,e){let i=e.depth-t.openStart,n=e.node(i).copy(t.content);for(let r=i-1;r>=0;r--)n=e.node(r).copy(Ye.from(n));return{start:n.resolveNoCache(t.openStart+i),end:n.resolveNoCache(n.content.size-t.openEnd-i)}}(i,t);return di(s,fi(t,r,o,e,n))}{let n=t.parent,r=n.content;return di(n,r.cut(0,t.parentOffset).append(i.content).append(r.cut(e.parentOffset)))}}return di(s,pi(t,e,n))}function ai(t,e){if(!e.type.compatibleContent(t.type))throw new ii("Cannot join "+e.type.name+" onto "+t.type.name)}function ui(t,e,i){let n=t.node(i);return ai(n,e.node(i)),n}function hi(t,e){let i=e.length-1;i>=0&&t.isText&&t.sameMarkup(e[i])?e[i]=t.withText(e[i].text+t.text):e.push(t)}function ci(t,e,i,n){let r=(e||t).node(i),s=0,o=e?e.index(i):r.childCount;t&&(s=t.index(i),t.depth>i?s++:t.textOffset&&(hi(t.nodeAfter,n),s++));for(let l=s;l<o;l++)hi(r.child(l),n);e&&e.depth==i&&e.textOffset&&hi(e.nodeBefore,n)}function di(t,e){return t.type.checkContent(e),t.copy(e)}function fi(t,e,i,n,r){let s=t.depth>r&&ui(t,e,r+1),o=n.depth>r&&ui(i,n,r+1),l=[];return ci(null,t,r,l),s&&o&&e.index(r)==i.index(r)?(ai(s,o),hi(di(s,fi(t,e,i,n,r+1)),l)):(s&&hi(di(s,pi(t,e,r+1)),l),ci(e,i,r,l),o&&hi(di(o,pi(i,n,r+1)),l)),ci(n,null,r,l),new Ye(l)}function pi(t,e,i){let n=[];return ci(null,t,i,n),t.depth>i&&hi(di(ui(t,e,i+1),pi(t,e,i+1)),n),ci(e,null,i,n),new Ye(n)}ni.empty=new ni(Ye.empty,0,0);class mi{constructor(t,e,i){this.pos=t,this.path=e,this.parentOffset=i,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let i=this.pos-this.path[this.path.length-1],n=t.child(e);return i?t.child(e).cut(i):n}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let i=this.path[3*e],n=0==e?0:this.path[3*e-1]+1;for(let r=0;r<t;r++)n+=i.child(r).nodeSize;return n}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return ei.none;if(this.textOffset)return t.child(e).marks;let i=t.maybeChild(e-1),n=t.maybeChild(e);if(!i){let t=i;i=n,n=t}let r=i.marks;for(var s=0;s<r.length;s++)0!=r[s].type.spec.inclusive||n&&r[s].isInSet(n.marks)||(r=r[s--].removeFromSet(r));return r}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let i=e.marks,n=t.parent.maybeChild(t.index());for(var r=0;r<i.length;r++)0!=i[r].type.spec.inclusive||n&&i[r].isInSet(n.marks)||(i=i[r--].removeFromSet(i));return i}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);i>=0;i--)if(t.pos<=this.end(i)&&(!e||e(this.node(i))))return new wi(this,t,i);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let i=[],n=0,r=e;for(let s=t;;){let{index:t,offset:e}=s.content.findIndex(r),o=r-e;if(i.push(s,t,n+e),!o)break;if(s=s.child(t),s.isText)break;r=o-1,n+=e+1}return new mi(e,i,r)}static resolveCached(t,e){let i=bi.get(t);if(i)for(let r=0;r<i.elts.length;r++){let t=i.elts[r];if(t.pos==e)return t}else bi.set(t,i=new gi);let n=i.elts[i.i]=mi.resolve(t,e);return i.i=(i.i+1)%yi,n}}class gi{constructor(){this.elts=[],this.i=0}}const yi=12,bi=new WeakMap;class wi{constructor(t,e,i){this.$from=t,this.$to=e,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 vi=Object.create(null);class ki{constructor(t,e,i,n=ei.none){this.type=t,this.attrs=e,this.marks=n,this.content=i||Ye.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,i,n=0){this.content.nodesBetween(t,e,i,n,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,i,n){return this.content.textBetween(t,e,i,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,i){return this.type==t&&ti(this.attrs,e||t.defaultAttrs||vi)&&ei.sameSet(this.marks,i||ei.none)}copy(t=null){return t==this.content?this:new ki(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new ki(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,i=0){if(t==e)return ni.empty;let n=this.resolve(t),r=this.resolve(e),s=i?0:n.sharedDepth(e),o=n.start(s),l=n.node(s).content.cut(n.pos-o,r.pos-o);return new ni(l,n.depth-s,r.depth-s)}replace(t,e,i){return oi(this.resolve(t),this.resolve(e),i)}nodeAt(t){for(let e=this;;){let{index:i,offset:n}=e.content.findIndex(t);if(e=e.maybeChild(i),!e)return null;if(n==t||e.isText)return e;t-=n+1}}childAfter(t){let{index:e,offset:i}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:i}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:i}=this.content.findIndex(t);if(i<t)return{node:this.content.child(e),index:e,offset:i};let n=this.content.child(e-1);return{node:n,index:e-1,offset:i-n.nodeSize}}resolve(t){return mi.resolveCached(this,t)}resolveNoCache(t){return mi.resolve(this,t)}rangeHasMark(t,e,i){let n=0;return e>t&&this.nodesBetween(t,e,t=>(i.isInSet(t.marks)&&(n=1),!n)),n}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Mi(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,i=Ye.empty,n=0,r=i.childCount){let s=this.contentMatchAt(t).matchFragment(i,n,r),o=s&&s.matchFragment(this.content,e);if(!o||!o.validEnd)return 0;for(let l=n;l<r;l++)if(!this.type.allowsMarks(i.child(l).marks))return 0;return 1}canReplaceWith(t,e,i,n){if(n&&!this.type.allowsMarks(n))return 0;let r=this.contentMatchAt(t).matchType(i),s=r&&r.matchFragment(this.content,e);return s?s.validEnd:0}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=ei.none;for(let e=0;e<this.marks.length;e++){let i=this.marks[e];i.type.checkAttrs(i.attrs),t=i.addToSet(t)}if(!ei.sameSet(t,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 t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(t=>t.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let i;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,i)}let n=Ye.fromJSON(t,e.content),r=t.nodeType(e.type).create(e.attrs,n,i);return r.type.checkAttrs(r.attrs),r}}ki.prototype.text=void 0;class xi extends ki{constructor(t,e,i,n){if(super(t,e,null,n),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Mi(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new xi(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new xi(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Mi(t,e){for(let i=t.length-1;i>=0;i--)e=t[i].type.name+"("+e+")";return e}class Si{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let i=new Ti(t,e);if(null==i.next)return Si.empty;let n=Ei(i);i.next&&i.err("Unexpected trailing text");let r=function(t){let e=Object.create(null);return function i(n){let r=[];n.forEach(e=>{t[e].forEach(({term:e,to:i})=>{if(!e)return;let n;for(let t=0;t<r.length;t++)r[t][0]==e&&(n=r[t][1]);Li(t,i).forEach(t=>{n||r.push([e,n=[]]),-1==n.indexOf(t)&&n.push(t)})})});let s=e[n.join(",")]=new Si(n.indexOf(t.length-1)>-1);for(let t=0;t<r.length;t++){let n=r[t][1].sort(Ri);s.next.push({type:r[t][0],next:e[n.join(",")]||i(n)})}return s}(Li(t,0))}(function(t){let e=[[]];return r(function t(e,s){if("choice"==e.type)return e.exprs.reduce((e,i)=>e.concat(t(i,s)),[]);if("seq"!=e.type){if("star"==e.type){let o=i();return n(s,o),r(t(e.expr,o),o),[n(o)]}if("plus"==e.type){let o=i();return r(t(e.expr,s),o),r(t(e.expr,o),o),[n(o)]}if("opt"==e.type)return[n(s)].concat(t(e.expr,s));if("range"==e.type){let o=s;for(let n=0;n<e.min;n++){let n=i();r(t(e.expr,o),n),o=n}if(-1==e.max)r(t(e.expr,o),o);else for(let s=e.min;s<e.max;s++){let s=i();n(o,s),r(t(e.expr,o),s),o=s}return[n(o)]}if("name"==e.type)return[n(s,void 0,e.value)];throw new Error("Unknown expr type")}for(let n=0;;n++){let o=t(e.exprs[n],s);if(n==e.exprs.length-1)return o;r(o,s=i())}}(t,0),i()),e;function i(){return e.push([])-1}function n(t,i,n){let r={term:n,to:i};return e[t].push(r),r}function r(t,e){t.forEach(t=>t.to=e)}}(n));return function(t,e){for(let i=0,n=[t];i<n.length;i++){let t=n[i],r=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:i,next:o}=t.next[e];s.push(i.name),!r||i.isText||i.hasRequiredAttrs()||(r=0),-1==n.indexOf(o)&&n.push(o)}r&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(r,i),r}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,i=t.childCount){let n=this;for(let r=e;n&&r<i;r++)n=n.matchType(t.child(r).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let i=0;i<t.next.length;i++)if(this.next[e].type==t.next[i].type)return 1;return 0}fillBefore(t,e=0,i=0){let n=[this];return function r(s,o){let l=s.matchFragment(t,i);if(l&&(!e||l.validEnd))return Ye.from(o.map(t=>t.createAndFill()));for(let t=0;t<s.next.length;t++){let{type:e,next:i}=s.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==n.indexOf(i)){n.push(i);let t=r(i,o.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==t)return this.wrapCache[i+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let n=i.shift(),r=n.match;if(r.matchType(t)){let t=[];for(let e=n;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<r.next.length;t++){let{type:s,next:o}=r.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||n.type&&!o.validEnd||(i.push({match:s.contentMatch,type:s,via:n}),e[s.name]=1)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(i){t.push(i);for(let n=0;n<i.next.length;n++)-1==t.indexOf(i.next[n].next)&&e(i.next[n].next)}(this),t.map((e,i)=>{let n=i+(e.validEnd?"*":" ")+" ";for(let r=0;r<e.next.length;r++)n+=(r?", ":"")+e.next[r].type.name+"->"+t.indexOf(e.next[r].next);return n}).join("\n")}}Si.empty=new Si(1);class Ti{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||1)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function Ei(t){let e=[];do{e.push(Ci(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function Ci(t){let e=[];do{e.push(Oi(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function Oi(t){let e=function(t){if(t.eat("(")){let e=Ei(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let i=t.nodeTypes,n=i[e];if(n)return[n];let r=[];for(let s in i){let t=i[s];t.isInGroup(e)&&r.push(t)}return 0==r.length&&t.err("No node type or group '"+e+"' found"),r}(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(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("{"))break;e=$i(t,e)}return e}function Ai(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function $i(t,e){let i=Ai(t),n=i;return t.eat(",")&&(n="}"!=t.next?Ai(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:i,max:n,expr:e}}function Ri(t,e){return e-t}function Li(t,e){let i=[];return function e(n){let r=t[n];if(1==r.length&&!r[0].term)return e(r[0].to);i.push(n);for(let t=0;t<r.length;t++){let{term:n,to:s}=r[t];n||-1!=i.indexOf(s)||e(s)}}(e),i.sort(Ri)}function Bi(t){let e=Object.create(null);for(let i in t){let n=t[i];if(!n.hasDefault)return null;e[i]=n.default}return e}function Ii(t,e){let i=Object.create(null);for(let n in t){let r=e&&e[n];if(void 0===r){let e=t[n];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+n);r=e.default}i[n]=r}return i}function Ni(t,e,i,n){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${i} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Di(t,e){let i=Object.create(null);if(e)for(let n in e)i[n]=new zi(t,n,e[n]);return i}let _i=class t{constructor(t,e,i){this.name=t,this.schema=e,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=Di(t,i.attrs),this.defaultAttrs=Bi(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Si.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return 1;return 0}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:Ii(this.attrs,t)}create(t=null,e,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ki(this,this.computeAttrs(t),Ye.from(e),ei.setFrom(i))}createChecked(t=null,e,i){return e=Ye.from(e),this.checkContent(e),new ki(this,this.computeAttrs(t),e,ei.setFrom(i))}createAndFill(t=null,e,i){if(t=this.computeAttrs(t),(e=Ye.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let n=this.contentMatch.matchFragment(e),r=n&&n.fillBefore(Ye.empty,1);return r?new ki(this,t,e.append(r),ei.setFrom(i)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return 0;for(let i=0;i<t.childCount;i++)if(!this.allowsMarks(t.child(i).marks))return 0;return 1}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){Ni(this.attrs,t,"node")}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return 1;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return 0;return 1}allowedMarks(t){if(null==this.markSet)return t;let e;for(let i=0;i<t.length;i++)this.allowsMarkType(t[i].type)?e&&e.push(t[i]):e||(e=t.slice(0,i));return e?e.length?e:ei.none:t}static compile(e,i){let n=Object.create(null);e.forEach((e,r)=>n[e]=new t(e,i,r));let r=i.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};class zi{constructor(t,e,i){this.hasDefault={}.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate="string"==typeof i.validate?function(t,e,i){let n=i.split("|");return i=>{let r=null===i?"null":typeof i;if(n.indexOf(r)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${r}`)}}(t,e,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Pi{constructor(t,e,i,n){this.name=t,this.rank=e,this.schema=i,this.spec=n,this.attrs=Di(t,n.attrs),this.excluded=null;let r=Bi(this.attrs);this.instance=r?new ei(this,r):null}create(t=null){return!t&&this.instance?this.instance:new ei(this,Ii(this.attrs,t))}static compile(t,e){let i=Object.create(null),n=0;return t.forEach((t,r)=>i[t]=new Pi(t,n++,e,r)),i}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){Ni(this.attrs,t,"mark")}excludes(t){return this.excluded.indexOf(t)>-1}}class Hi{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=We.from(t.nodes),e.marks=We.from(t.marks||{}),this.nodes=_i.compile(this.spec.nodes,this),this.marks=Pi.compile(this.spec.marks,this);let i=Object.create(null);for(let n in this.nodes){if(n in this.marks)throw new RangeError(n+" can not be both a node and a mark");let t=this.nodes[n],e=t.spec.content||"",r=t.spec.marks;if(t.contentMatch=i[e]||(i[e]=Si.parse(e,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==r?null:r?ji(this,r.split(" ")):""!=r&&t.inlineContent?null:[]}for(let n in this.marks){let t=this.marks[n],e=t.spec.excludes;t.excluded=null==e?[t]:""==e?[]:ji(this,e.split(" "))}this.nodeFromJSON=t=>ki.fromJSON(this,t),this.markFromJSON=t=>ei.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,i,n){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof _i))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,i,n)}text(t,e){let i=this.nodes.text;return new xi(i,i.defaultAttrs,t,ei.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function ji(t,e){let i=[];for(let n=0;n<e.length;n++){let r=e[n],s=t.marks[r],o=s;if(s)i.push(s);else for(let e in t.marks){let n=t.marks[e];("_"==r||n.spec.group&&n.spec.group.split(" ").indexOf(r)>-1)&&i.push(o=n)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return i}class Ui{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let i=this.matchedStyles=[];e.forEach(t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];i.indexOf(e)<0&&i.push(e),this.styles.push(t)}}),this.normalizeLists=!this.tags.some(e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return 0;let i=t.nodes[e.node];return i.contentMatch.matchType(i)})}parse(t,e={}){let i=new Wi(this,e,0);return i.addAll(t,ei.none,e.from,e.to),i.finish()}parseSlice(t,e={}){let i=new Wi(this,e,1);return i.addAll(t,ei.none,e.from,e.to),ni.maxOpen(i.finish())}matchTag(t,e,i){for(let n=i?this.tags.indexOf(i)+1:0;n<this.tags.length;n++){let i=this.tags[n];if(Gi(t,i.tag)&&(void 0===i.namespace||t.namespaceURI==i.namespace)&&(!i.context||e.matchesContext(i.context))){if(i.getAttrs){let e=i.getAttrs(t);if(0==e)continue;i.attrs=e||void 0}return i}}}matchStyle(t,e,i,n){for(let r=n?this.styles.indexOf(n)+1:0;r<this.styles.length;r++){let n=this.styles[r],s=n.style;if(!(0!=s.indexOf(t)||n.context&&!i.matchesContext(n.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(n.getAttrs){let t=n.getAttrs(e);if(0==t)continue;n.attrs=t||void 0}return n}}}static schemaRules(t){let e=[];function i(t){let i=null==t.priority?50:t.priority,n=0;for(;n<e.length;n++){let t=e[n];if((null==t.priority?50:t.priority)<i)break}e.splice(n,0,t)}for(let n in t.marks){let e=t.marks[n].spec.parseDOM;e&&e.forEach(t=>{i(t=Qi(t)),t.mark||t.ignore||t.clearMark||(t.mark=n)})}for(let n in t.nodes){let e=t.nodes[n].spec.parseDOM;e&&e.forEach(t=>{i(t=Qi(t)),t.node||t.ignore||t.mark||(t.node=n)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ui(t,Ui.schemaRules(t)))}}const qi={address:1,article:1,aside:1,blockquote:1,canvas:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,li:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,table:1,tfoot:1,ul:1},Vi={head:1,noscript:1,object:1,script:1,style:1,title:1},Fi={ol:1,ul:1};function Ki(t,e,i){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&i}class Ji{constructor(t,e,i,n,r,s){this.type=t,this.attrs=e,this.marks=i,this.solid=n,this.options=s,this.content=[],this.activeMarks=ei.none,this.match=r||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(Ye.from(t));if(!e){let e,i=this.type.contentMatch;return(e=i.findWrapping(t.type))?(this.match=i,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let i=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-t[0].length))}}let e=Ye.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(Ye.empty,1))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!qi.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Wi{constructor(t,e,i){this.parser=t,this.options=e,this.isOpen=i,this.open=0,this.localPreserveWS=0;let n,r=e.topNode,s=Ki(null,e.preserveWhitespace,0)|(i?4:0);n=r?new Ji(r.type,r.attrs,ei.none,1,e.topMatch||r.type.contentMatch,s):new Ji(i?null:t.schema.topNodeType,null,ei.none,1,null,s),this.nodes=[n],this.find=e.findPositions,this.needsBlock=0}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let i=t.nodeValue,n=this.top,r=2&n.options?"full":this.localPreserveWS||(1&n.options)>0;if("full"===r||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(i)){if(r)i="full"!==r?i.replace(/\r?\n|\r/g," "):i.replace(/\r\n?/g,"\n");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let e=n.content[n.content.length-1],r=t.previousSibling;(!e||r&&"BR"==r.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(i=i.slice(1))}i&&this.insertNode(this.parser.schema.text(i),e,!/\S/.test(i)),this.findInText(t)}else this.findInside(t)}addElement(t,e,i){let n=this.localPreserveWS,r=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=1);let s,o=t.nodeName.toLowerCase();Fi.hasOwnProperty(o)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,i=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&Fi.hasOwnProperty(t)&&i?(i.appendChild(e),e=i):"li"==t?i=e:t&&(i=null)}}(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,i));t:if(l?l.ignore:Vi.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,e);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let i,n=this.needsBlock;if(qi.hasOwnProperty(o))r.content.length&&r.content[0].isInline&&this.open&&(this.open--,r=this.top),i=1,r.type||(this.needsBlock=1);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=l&&l.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),i&&this.sync(r),this.needsBlock=n}else{let i=this.readStyles(t,e);i&&this.addElementByRule(t,l,i,0==l.consuming?s:void 0)}this.localPreserveWS=n}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,1)}readStyles(t,e){let i=t.style;if(i&&i.length)for(let n=0;n<this.parser.matchedStyles.length;n++){let t=this.parser.matchedStyles[n],r=i.getPropertyValue(t);if(r)for(let i;;){let n=this.parser.matchStyle(t,r,this,i);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter(t=>!n.clearMark(t)):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),0!=n.consuming)break;i=n}}return e}addElementByRule(t,e,i,n){let r,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),i,"BR"==t.nodeName)||this.leafFallback(t,i);else{let t=this.enter(s,e.attrs||null,i,e.preserveWhitespace);t&&(r=1,i=t)}else{let t=this.parser.schema.marks[e.mark];i=i.concat(t.create(e.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(n)this.addElement(t,i,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(t=>this.insertNode(t,i,0));else{let n=t;"string"==typeof e.contentElement?n=t.querySelector(e.contentElement):"function"==typeof e.contentElement?n=e.contentElement(t):e.contentElement&&(n=e.contentElement),this.findAround(t,n,1),this.addAll(n,i),this.findAround(t,n,0)}r&&this.sync(o)&&this.open--}addAll(t,e,i,n){let r=i||0;for(let s=i?t.childNodes[i]:t.firstChild,o=null==n?null:t.childNodes[n];s!=o;s=s.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(s,e);this.findAtPoint(t,r)}findPlace(t,e,i){let n,r;for(let s=this.open,o=0;s>=0;s--){let e=this.nodes[s],l=e.findWrapping(t);if(l&&(!n||n.length>l.length+o)&&(n=l,r=e,!l.length))break;if(e.solid){if(i)break;o+=2}}if(!n)return null;this.sync(r);for(let s=0;s<n.length;s++)e=this.enterInner(n[s],null,e,0);return e}insertNode(t,e,i){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let n=this.findPlace(t,e,i);if(n){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let i=ei.none;for(let r of n.concat(t.marks))(e.type?e.type.allowsMarkType(r.type):Yi(r.type,t.type))&&(i=r.addToSet(i));return e.content.push(t.mark(i)),1}return 0}enter(t,e,i,n){let r=this.findPlace(t.create(e),i,0);return r&&(r=this.enterInner(t,e,i,1,n)),r}enterInner(t,e,i,n=0,r){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=Ki(t,r,s.options);4&s.options&&0==s.content.length&&(o|=4);let l=ei.none;return i=i.filter(e=>(s.type?s.type.allowsMarkType(e.type):Yi(e.type,t))?(l=e.addToSet(l),0):1),this.nodes.push(new Ji(t,e,l,n,null,o)),this.open++,i}closeExtra(t=0){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));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(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,1;this.localPreserveWS&&(this.nodes[e].options|=1)}return 0}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let i=this.nodes[e].content;for(let e=i.length-1;e>=0;e--)t+=i[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==t&&this.find[i].offset==e&&(this.find[i].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,i){if(t!=e&&this.find)for(let n=0;n<this.find.length;n++)null==this.find[n].pos&&1==t.nodeType&&t.contains(this.find[n].node)&&e.compareDocumentPosition(this.find[n].node)&(i?2:4)&&(this.find[n].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),i=this.options.context,n=!(this.isOpen||i&&i.parent.type!=this.nodes[0].type),r=-(i?i.depth+1:0)+(n?0:1),s=(t,o)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;o>=r;o--)if(s(t-1,o))return 1;return 0}{let t=o>0||0==o&&n?this.nodes[o].type:i&&o>=r?i.node(o-r).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return 0;o--}}return 1};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let i=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Gi(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Qi(t){let e={};for(let i in t)e[i]=t[i];return e}function Yi(t,e){let i=e.schema.nodes;for(let n in i){let r=i[n];if(!r.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let i=0;i<t.edgeCount;i++){let{type:n,next:r}=t.edge(i);if(n==e)return 1;if(s.indexOf(r)<0&&o(r))return 1}};if(o(r.contentMatch))return 1}}class Zi{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},i){i||(i=tn(e).createDocumentFragment());let n=i,r=[];return t.forEach(t=>{if(r.length||t.marks.length){let i=0,s=0;for(;i<r.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(r[i][0])||0==e.type.spec.spanning)break;i++,s++}else s++}for(;i<r.length;)n=r.pop()[1];for(;s<t.marks.length;){let i=t.marks[s++],o=this.serializeMark(i,t.isInline,e);o&&(r.push([i,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(t,e))}),i}serializeNodeInner(t,e){let{dom:i,contentDOM:n}=nn(tn(e),this.nodes[t.type.name](t),null,t.attrs);if(n){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,n)}return i}serializeNode(t,e={}){let i=this.serializeNodeInner(t,e);for(let n=t.marks.length-1;n>=0;n--){let r=this.serializeMark(t.marks[n],t.isInline,e);r&&((r.contentDOM||r.dom).appendChild(i),i=r.dom)}return i}serializeMark(t,e,i={}){let n=this.marks[t.type.name];return n&&nn(tn(i),n(t,e),null,t.attrs)}static renderSpec(t,e,i=null,n){return nn(t,e,i,n)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Zi(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=Xi(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return Xi(t.marks)}}function Xi(t){let e={};for(let i in t){let n=t[i].spec.toDOM;n&&(e[i]=n)}return e}function tn(t){return t.document||window.document}const en=new WeakMap;function nn(t,e,i,n){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let r,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(n&&(r=function(t){let e=en.get(t);return void 0===e&&en.set(t,e=function(t){let e=null;return function t(i){if(i&&"object"==typeof i)if(Array.isArray(i))if("string"==typeof i[0])e||(e=[]),e.push(i);else for(let e=0;e<i.length;e++)t(i[e]);else for(let e in i)t(i[e])}(t),e}(t)),e}(n))&&r.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,l=s.indexOf(" ");l>0&&(i=s.slice(0,l),s=s.slice(l+1));let a=i?t.createElementNS(i,s):t.createElement(s),u=e[1],h=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){h=2;for(let t in u)if(null!=u[t]){let e=t.indexOf(" ");e>0?a.setAttributeNS(t.slice(0,e),t.slice(e+1),u[t]):"style"==t&&a.style?a.style.cssText=u[t]:a.setAttribute(t,u[t])}}for(let c=h;c<e.length;c++){let r=e[c];if(0===r){if(c<e.length-1||c>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}{let{dom:e,contentDOM:s}=nn(t,r,i,n);if(a.appendChild(e),s){if(o)throw new RangeError("Multiple content holes");o=s}}}return{dom:a,contentDOM:o}}const rn=Math.pow(2,16);function sn(t,e){return t+e*rn}function on(t){return 65535&t}class ln{constructor(t,e,i){this.pos=t,this.delInfo=e,this.recover=i}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class an{constructor(t,e=0){if(this.ranges=t,this.inverted=e,!t.length&&an.empty)return an.empty}recover(t){let e=0,i=on(t);if(!this.inverted)for(let n=0;n<i;n++)e+=this.ranges[3*n+2]-this.ranges[3*n+1];return this.ranges[3*i]+e+function(t){return(t-(65535&t))/rn}(t)}mapResult(t,e=1){return this.k(t,e,0)}map(t,e=1){return this.k(t,e,1)}k(t,e,i){let n=0,r=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?n:0);if(l>t)break;let a=this.ranges[o+r],u=this.ranges[o+s],h=l+a;if(t<=h){let r=l+n+((a?t==l?-1:t==h?1:e:e)<0?0:u);if(i)return r;let s=t==(e<0?l:h)?null:sn(o/3,t-l),c=t==l?2:t==h?1:4;return(e<0?t!=l:t!=h)&&(c|=8),new ln(r,c,s)}n+=u-a}return i?t+n:new ln(t+n,0,null)}touches(t,e){let i=0,n=on(e),r=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let e=this.ranges[o]-(this.inverted?i:0);if(e>t)break;let l=this.ranges[o+r];if(t<=e+l&&o==3*n)return 1;i+=this.ranges[o+s]-l}return 0}forEach(t){let e=this.inverted?2:1,i=this.inverted?1:2;for(let n=0,r=0;n<this.ranges.length;n+=3){let s=this.ranges[n],o=s-(this.inverted?r:0),l=s+(this.inverted?0:r),a=this.ranges[n+e],u=this.ranges[n+i];t(o,o+a,l,l+u),r+=u-a}}invert(){return new an(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?an.empty:new an(t<0?[0,-t,0]:[0,0,t])}}an.empty=new an([]);class un{constructor(t,e,i=0,n=(t?t.length:0)){this.mirror=e,this.from=i,this.to=n,this.M=t||[],this.ownData=!(t||e)}get maps(){return this.M}slice(t=0,e=this.maps.length){return new un(this.M,this.mirror,t,e)}appendMap(t,e){this.ownData||(this.M=this.M.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=1),this.to=this.M.push(t),null!=e&&this.setMirror(this.M.length-1,e)}appendMapping(t){for(let e=0,i=this.M.length;e<t.M.length;e++){let n=t.getMirror(e);this.appendMap(t.M[e],null!=n&&n<e?i+n:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,i=this.M.length+t.M.length;e>=0;e--){let n=t.getMirror(e);this.appendMap(t.M[e].invert(),null!=n&&n>e?i-n-1:void 0)}}invert(){let t=new un;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this.k(t,e,1);for(let i=this.from;i<this.to;i++)t=this.M[i].map(t,e);return t}mapResult(t,e=1){return this.k(t,e,0)}k(t,e,i){let n=0;for(let r=this.from;r<this.to;r++){let i=this.M[r].mapResult(t,e);if(null!=i.recover){let e=this.getMirror(r);if(null!=e&&e>r&&e<this.to){r=e,t=this.M[e].recover(i.recover);continue}}n|=i.delInfo,t=i.pos}return i?t:new ln(t,n,null)}}const hn=Object.create(null);class cn{getMap(){return an.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=hn[e.stepType];if(!i)throw new RangeError(`No step type ${e.stepType} defined`);return i.fromJSON(t,e)}static jsonID(t,e){if(t in hn)throw new RangeError("Duplicate use of step JSON ID "+t);return hn[t]=e,e.prototype.jsonID=t,e}}class dn{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new dn(t,null)}static fail(t){return new dn(null,t)}static fromReplace(t,e,i,n){try{return dn.ok(t.replace(e,i,n))}catch(r){if(r instanceof ii)return dn.fail(r.message);throw r}}}function fn(t,e,i){let n=[];for(let r=0;r<t.childCount;r++){let s=t.child(r);s.content.size&&(s=s.copy(fn(s.content,e,s))),s.isInline&&(s=e(s,i,r)),n.push(s)}return Ye.fromArray(n)}class pn extends cn{constructor(t,e,i){super(),this.from=t,this.to=e,this.mark=i}apply(t){let e=t.slice(this.from,this.to),i=t.resolve(this.from),n=i.node(i.sharedDepth(this.to)),r=new ni(fn(e.content,(t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,n),e.openStart,e.openEnd);return dn.fromReplace(t,this.from,this.to,r)}invert(){return new mn(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),i=t.mapResult(this.to,-1);return e.deleted&&i.deleted||e.pos>=i.pos?null:new pn(e.pos,i.pos,this.mark)}merge(t){return t instanceof pn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new pn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new pn(e.from,e.to,t.markFromJSON(e.mark))}}cn.jsonID("addMark",pn);class mn extends cn{constructor(t,e,i){super(),this.from=t,this.to=e,this.mark=i}apply(t){let e=t.slice(this.from,this.to),i=new ni(fn(e.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),e.openStart,e.openEnd);return dn.fromReplace(t,this.from,this.to,i)}invert(){return new pn(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),i=t.mapResult(this.to,-1);return e.deleted&&i.deleted||e.pos>=i.pos?null:new mn(e.pos,i.pos,this.mark)}merge(t){return t instanceof mn&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new mn(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new mn(e.from,e.to,t.markFromJSON(e.mark))}}cn.jsonID("removeMark",mn);class gn extends cn{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return dn.fail("No node at mark step's position");let i=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return dn.fromReplace(t,this.pos,this.pos+1,new ni(Ye.from(i),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(t))return new gn(this.pos,e.marks[i]);return new gn(this.pos,this.mark)}}return new yn(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new gn(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new gn(e.pos,t.markFromJSON(e.mark))}}cn.jsonID("addNodeMark",gn);class yn extends cn{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return dn.fail("No node at mark step's position");let i=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return dn.fromReplace(t,this.pos,this.pos+1,new ni(Ye.from(i),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new gn(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new yn(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yn(e.pos,t.markFromJSON(e.mark))}}cn.jsonID("removeNodeMark",yn);class bn extends cn{constructor(t,e,i,n=0){super(),this.from=t,this.to=e,this.slice=i,this.structure=n}apply(t){return this.structure&&vn(t,this.from,this.to)?dn.fail("Structure replace would overwrite content"):dn.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new an([this.from,this.to-this.from,this.slice.size])}invert(t){return new bn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),i=t.mapResult(this.to,-1);return e.deletedAcross&&i.deletedAcross?null:new bn(e.pos,Math.max(e.pos,i.pos),this.slice,this.structure)}merge(t){if(!(t instanceof bn)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?ni.empty:new ni(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new bn(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?ni.empty:new ni(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new bn(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=1),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new bn(e.from,e.to,ni.fromJSON(t,e.slice),!!e.structure)}}cn.jsonID("replace",bn);class wn extends cn{constructor(t,e,i,n,r,s,o=0){super(),this.from=t,this.to=e,this.gapFrom=i,this.gapTo=n,this.slice=r,this.insert=s,this.structure=o}apply(t){if(this.structure&&(vn(t,this.from,this.gapFrom)||vn(t,this.gapTo,this.to)))return dn.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return dn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,e.content);return i?dn.fromReplace(t,this.from,this.to,i):dn.fail("Content does not fit in gap")}getMap(){return new an([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new wn(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),i=t.mapResult(this.to,-1),n=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),r=this.to==this.gapTo?i.pos:t.map(this.gapTo,1);return e.deletedAcross&&i.deletedAcross||n<e.pos||r>i.pos?null:new wn(e.pos,i.pos,n,r,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=1),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new wn(e.from,e.to,e.gapFrom,e.gapTo,ni.fromJSON(t,e.slice),e.insert,!!e.structure)}}function vn(t,e,i){let n=t.resolve(e),r=i-e,s=n.depth;for(;r>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,r--;if(r>0){let t=n.node(s).maybeChild(n.indexAfter(s));for(;r>0;){if(!t||t.isLeaf)return 1;t=t.firstChild,r--}}return 0}function kn(t,e,i,n=i.contentMatch,r=1){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let e=s.child(a),u=l+e.nodeSize,h=n.matchType(e.type);if(h){n=h;for(let n=0;n<e.marks.length;n++)i.allowsMarkType(e.marks[n].type)||t.step(new mn(l,u,e.marks[n]));if(r&&e.isText&&"pre"!=i.whitespace){let t,n,r=/\r?\n|\r/g;for(;t=r.exec(e.text);)n||(n=new ni(Ye.from(i.schema.text(" ",i.allowedMarks(e.marks))),0,0)),o.push(new bn(l+t.index,l+t.index+t[0].length,n))}}else o.push(new bn(l,u,ni.empty));l=u}if(!n.validEnd){let e=n.fillBefore(Ye.empty,1);t.replace(l,l,new ni(e,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function xn(t,e,i){return(0==e||t.canReplace(e,t.childCount))&&(i==t.childCount||t.canReplace(0,i))}function Mn(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth;;--i){let n=t.$from.node(i),r=t.$from.index(i),s=t.$to.indexAfter(i);if(i<t.depth&&n.canReplace(r,s,e))return i;if(0==i||n.type.spec.isolating||!xn(n,r,s))break}return null}function Sn(t,e,i=null,n=t){let r=function(t,e){let{parent:i,startIndex:n,endIndex:r}=t,s=i.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return i.canReplaceWith(n,r,o)?s:null}(t,e),s=r&&function(t,e){let{parent:i,startIndex:n,endIndex:r}=t,s=i.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let a=n;l&&a<r;a++)l=l.matchType(i.child(a).type);return l&&l.validEnd?o:null}(n,e);return s?r.map(Tn).concat({type:e,attrs:i}).concat(s.map(Tn)):null}function Tn(t){return{type:t,attrs:null}}function En(t,e,i,n){e.forEach((r,s)=>{if(r.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(r.text);){let r=t.mapping.slice(n).map(i+1+s+o.index);t.replaceWith(r,r+1,e.type.schema.linebreakReplacement.create())}}})}function Cn(t,e,i,n){e.forEach((r,s)=>{if(r.type==r.type.schema.linebreakReplacement){let r=t.mapping.slice(n).map(i+1+s);t.replaceWith(r,r+1,e.type.schema.text("\n"))}})}function On(t,e,i=1,n){let r=t.resolve(e),s=r.depth-i,o=n&&n[n.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 0;for(let u=r.depth-1,h=i-2;u>s;u--,h--){let t=r.node(u),e=r.index(u);if(t.type.spec.isolating)return 0;let i=t.content.cutByIndex(e,t.childCount),s=n&&n[h+1];s&&(i=i.replaceChild(0,s.type.create(s.attrs)));let o=n&&n[h]||t;if(!t.canReplace(e+1,t.childCount)||!o.type.validContent(i))return 0}let l=r.indexAfter(s),a=n&&n[0];return r.node(s).canReplaceWith(l,l,a?a.type:r.node(s+1).type)}function An(t,e){let i=t.resolve(e),n=i.index();return $n(i.nodeBefore,i.nodeAfter)&&i.parent.canReplace(n,n+1)}function $n(t,e){return!(!t||!e||t.isLeaf||!function(t,e){e.content.size||t.type.compatibleContent(e.type);let i=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let r=0;r<e.childCount;r++){let s=e.child(r),o=s.type==n?t.type.schema.nodes.text:s.type;if(i=i.matchType(o),!i)return 0;if(!t.type.allowsMarks(s.marks))return 0}return i.validEnd}(t,e))}function Rn(t,e,i=-1){let n=t.resolve(e);for(let r=n.depth;;r--){let t,s,o=n.index(r);if(r==n.depth?(t=n.nodeBefore,s=n.nodeAfter):i>0?(t=n.node(r+1),o++,s=n.node(r).maybeChild(o)):(t=n.node(r).maybeChild(o-1),s=n.node(r+1)),t&&!t.isTextblock&&$n(t,s)&&n.node(r).canReplace(o,o+1))return e;if(0==r)break;e=i<0?n.before(r):n.after(r)}}function Ln(t,e,i){let n=t.resolve(e);if(!i.content.size)return e;let r=i.content;for(let s=0;s<i.openStart;s++)r=r.firstChild.content;for(let s=1;s<=(0==i.openStart&&i.size?2:1);s++)for(let t=n.depth;t>=0;t--){let e=t==n.depth?0:n.pos<=(n.start(t+1)+n.end(t+1))/2?-1:1,i=n.index(t)+(e>0?1:0),o=n.node(t),l=0;if(1==s)l=o.canReplace(i,i,r);else{let t=o.contentMatchAt(i).findWrapping(r.firstChild.type);l=t&&o.canReplaceWith(i,i,t[0])}if(l)return 0==e?n.pos:e<0?n.before(t+1):n.after(t+1)}return null}function Bn(t,e,i=e,n=ni.empty){if(e==i&&!n.size)return null;let r=t.resolve(e),s=t.resolve(i);return In(r,s,n)?new bn(e,i,n):new Nn(r,s,n).fit()}function In(t,e,i){return!i.openStart&&!i.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),i.content)}cn.jsonID("replaceAround",wn);class Nn{constructor(t,e,i){this.$from=t,this.$to=e,this.unplaced=i,this.frontier=[],this.placed=Ye.empty;for(let n=0;n<=t.depth;n++){let e=t.node(n);this.frontier.push({type:e.type,match:e.contentMatchAt(t.indexAfter(n))})}for(let n=t.depth;n>0;n--)this.placed=Ye.from(t.node(n).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,i=this.$from,n=this.close(t<0?this.$to:i.doc.resolve(t));if(!n)return null;let r=this.placed,s=i.depth,o=n.depth;for(;s&&o&&1==r.childCount;)r=r.firstChild.content,s--,o--;let l=new ni(r,s,o);return t>-1?new wn(i.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||i.pos!=this.$to.pos?new bn(i.pos,n.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,i=0,n=this.unplaced.openEnd;i<t;i++){let r=e.firstChild;if(e.childCount>1&&(n=0),r.type.spec.isolating&&n<=i){t=i;break}e=r.content}for(let e=1;e<=2;e++)for(let i=1==e?t:this.unplaced.openStart;i>=0;i--){let t,n=null;i?(n=zn(this.unplaced.content,i-1).firstChild,t=n.content):t=this.unplaced.content;let r=t.firstChild;for(let s=this.depth;s>=0;s--){let t,{type:o,match:l}=this.frontier[s],a=null;if(1==e&&(r?l.matchType(r.type)||(a=l.fillBefore(Ye.from(r),0)):n&&o.compatibleContent(n.type)))return{sliceDepth:i,frontierDepth:s,parent:n,inject:a};if(2==e&&r&&(t=l.findWrapping(r.type)))return{sliceDepth:i,frontierDepth:s,parent:n,wrap:t};if(n&&l.matchType(n.type))break}}}openMore(){let{content:t,openStart:e,openEnd:i}=this.unplaced,n=zn(t,e);return!n.childCount||n.firstChild.isLeaf?0:(this.unplaced=new ni(t,e+1,Math.max(i,n.size+e>=t.size-i?e+1:0)),1)}dropNode(){let{content:t,openStart:e,openEnd:i}=this.unplaced,n=zn(t,e);if(n.childCount<=1&&e>0){let r=t.size-e<=e+n.size;this.unplaced=new ni(Dn(t,e-1,1),e-1,r?e-1:i)}else this.unplaced=new ni(Dn(t,e,1),e,i)}placeNodes({sliceDepth:t,frontierDepth:e,parent:i,inject:n,wrap:r}){for(;this.depth>e;)this.closeFrontierNode();if(r)for(let p=0;p<r.length;p++)this.openFrontierNode(r[p]);let s=this.unplaced,o=i?i.content:s.content,l=s.openStart-t,a=0,u=[],{match:h,type:c}=this.frontier[e];if(n){for(let t=0;t<n.childCount;t++)u.push(n.child(t));h=h.matchFragment(n)}let d=o.size+t-(s.content.size-s.openEnd);for(;a<o.childCount;){let t=o.child(a),e=h.matchType(t.type);if(!e)break;a++,(a>1||0==l||t.content.size)&&(h=e,u.push(Pn(t.mark(c.allowedMarks(t.marks)),1==a?l:0,a==o.childCount?d:-1)))}let f=a==o.childCount;f||(d=-1),this.placed=_n(this.placed,e,Ye.from(u)),this.frontier[e].match=h,f&&d<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let p=0,m=o;p<d;p++){let t=m.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),m=t.content}this.unplaced=f?0==t?ni.empty:new ni(Dn(s.content,t-1,1),t-1,d<0?s.openEnd:t-1):new ni(Dn(s.content,t,a),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Hn(this.$to,this.$to.depth,e.type,e.match,0)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:i}=this.$to,n=this.$to.after(i);for(;i>1&&n==this.$to.end(--i);)++n;return n}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:i,type:n}=this.frontier[e],r=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Hn(t,e,n,i,r);if(s){for(let i=e-1;i>=0;i--){let{match:e,type:n}=this.frontier[i],r=Hn(t,i,n,e,1);if(!r||r.childCount)continue t}return{depth:e,fit:s,move:r?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=_n(this.placed,e.depth,e.fit)),t=e.move;for(let i=e.depth+1;i<=t.depth;i++){let e=t.node(i),n=e.type.contentMatch.fillBefore(e.content,1,t.index(i));this.openFrontierNode(e.type,e.attrs,n)}return t}openFrontierNode(t,e=null,i){let n=this.frontier[this.depth];n.match=n.match.matchType(t),this.placed=_n(this.placed,this.depth,Ye.from(t.create(e,i))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Ye.empty,1);t.childCount&&(this.placed=_n(this.placed,this.frontier.length,t))}}function Dn(t,e,i){return 0==e?t.cutByIndex(i,t.childCount):t.replaceChild(0,t.firstChild.copy(Dn(t.firstChild.content,e-1,i)))}function _n(t,e,i){return 0==e?t.append(i):t.replaceChild(t.childCount-1,t.lastChild.copy(_n(t.lastChild.content,e-1,i)))}function zn(t,e){for(let i=0;i<e;i++)t=t.firstChild.content;return t}function Pn(t,e,i){if(e<=0)return t;let n=t.content;return e>1&&(n=n.replaceChild(0,Pn(n.firstChild,e-1,1==n.childCount?i-1:0))),e>0&&(n=t.type.contentMatch.fillBefore(n).append(n),i<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(Ye.empty,1)))),t.copy(n)}function Hn(t,e,i,n,r){let s=t.node(e),o=r?t.indexAfter(e):t.index(e);if(o==s.childCount&&!i.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,1,o);return l&&!function(t,e,i){for(let n=i;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return 1;return 0}(i,s.content,o)?l:null}function jn(t){return t.spec.defining||t.spec.definingForContent}function Un(t,e,i,n,r){if(e<i){let r=t.firstChild;t=t.replaceChild(0,r.copy(Un(r.content,e+1,i,n,r)))}if(e>n){let e=r.contentMatchAt(0),i=e.fillBefore(t).append(t);t=i.append(e.matchFragment(i).fillBefore(Ye.empty,1))}return t}function qn(t,e){let i=[];for(let n=Math.min(t.depth,e.depth);n>=0;n--){let r=t.start(n);if(r<t.pos-(t.depth-n)||e.end(n)>e.pos+(e.depth-n)||t.node(n).type.spec.isolating||e.node(n).type.spec.isolating)break;(r==e.start(n)||n==t.depth&&n==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&n&&e.start(n-1)==r-1)&&i.push(n)}return i}class Vn extends cn{constructor(t,e,i){super(),this.pos=t,this.attr=e,this.value=i}apply(t){let e=t.nodeAt(this.pos);if(!e)return dn.fail("No node at attribute step's position");let i=Object.create(null);for(let r in e.attrs)i[r]=e.attrs[r];i[this.attr]=this.value;let n=e.type.create(i,null,e.marks);return dn.fromReplace(t,this.pos,this.pos+1,new ni(Ye.from(n),0,e.isLeaf?0:1))}getMap(){return an.empty}invert(t){return new Vn(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Vn(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vn(e.pos,e.attr,e.value)}}cn.jsonID("attr",Vn);class Fn extends cn{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let i=t.type.create(e,t.content,t.marks);return dn.ok(i)}getMap(){return an.empty}invert(t){return new Fn(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Fn(e.attr,e.value)}}cn.jsonID("docAttr",Fn);let Kn=class extends Error{};Kn=function t(e){let i=Error.call(this,e);return i.__proto__=t.prototype,i},(Kn.prototype=Object.create(Error.prototype)).constructor=Kn,Kn.prototype.name="TransformError";class Jn{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new un}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Kn(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,i=ni.empty){let n=Bn(this.doc,t,e,i);return n&&this.step(n),this}replaceWith(t,e,i){return this.replace(t,e,new ni(Ye.from(i),0,0))}delete(t,e){return this.replace(t,e,ni.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,i){return function(t,e,i,n){if(!n.size)return t.deleteRange(e,i);let r=t.doc.resolve(e),s=t.doc.resolve(i);if(In(r,s,n))return t.step(new bn(e,i,n));let o=qn(r,t.doc.resolve(i));0==o[o.length-1]&&o.pop();let l=-(r.depth+1);o.unshift(l);for(let d=r.depth,f=r.pos-1;d>0;d--,f--){let t=r.node(d).type.spec;if(t.defining||t.definingAsContext||t.isolating)break;o.indexOf(d)>-1?l=d:r.before(d)==f&&o.splice(1,0,-d)}let a=o.indexOf(l),u=[],h=n.openStart;for(let d=n.content,f=0;;f++){let t=d.firstChild;if(u.push(t),f==n.openStart)break;d=t.content}for(let d=h-1;d>=0;d--){let t=u[d],e=jn(t.type);if(e&&!t.sameMarkup(r.node(Math.abs(l)-1)))h=d;else if(e||!t.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let e=(d+h+1)%(n.openStart+1),l=u[e];if(l)for(let u=0;u<o.length;u++){let h=o[(u+a)%o.length],c=1;h<0&&(c=0,h=-h);let d=r.node(h-1),f=r.index(h-1);if(d.canReplaceWith(f,f,l.type,l.marks))return t.replace(r.before(h),c?s.after(h):i,new ni(Un(n.content,0,n.openStart,e),e,n.openEnd))}}let c=t.steps.length;for(let d=o.length-1;d>=0&&(t.replace(e,i,n),!(t.steps.length>c));d--){let t=o[d];t<0||(e=r.before(t),i=s.after(t))}}(this,t,e,i),this}replaceRangeWith(t,e,i){return function(t,e,i,n){if(!n.isInline&&e==i&&t.doc.resolve(e).parent.content.size){let r=function(t,e,i){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),i))return e;if(0==n.parentOffset)for(let r=n.depth-1;r>=0;r--){let t=n.index(r);if(n.node(r).canReplaceWith(t,t,i))return n.before(r+1);if(t>0)return null}if(n.parentOffset==n.parent.content.size)for(let r=n.depth-1;r>=0;r--){let t=n.indexAfter(r);if(n.node(r).canReplaceWith(t,t,i))return n.after(r+1);if(t<n.node(r).childCount)return null}return null}(t.doc,e,n.type);null!=r&&(e=i=r)}t.replaceRange(e,i,new ni(Ye.from(n),0,0))}(this,t,e,i),this}deleteRange(t,e){return function(t,e,i){let n=t.doc.resolve(e),r=t.doc.resolve(i),s=qn(n,r);for(let o=0;o<s.length;o++){let e=s[o],i=o==s.length-1;if(i&&0==e||n.node(e).type.contentMatch.validEnd)return t.delete(n.start(e),r.end(e));if(e>0&&(i||n.node(e-1).canReplace(n.index(e-1),r.indexAfter(e-1))))return t.delete(n.before(e),r.after(e))}for(let o=1;o<=n.depth&&o<=r.depth;o++)if(e-n.start(o)==n.depth-o&&i>n.end(o)&&r.end(o)-i!=r.depth-o&&n.start(o-1)==r.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),r.index(o-1)))return t.delete(n.before(o),i);t.delete(e,i)}(this,t,e),this}lift(t,e){return function(t,e,i){let{$from:n,$to:r,depth:s}=e,o=n.before(s+1),l=r.after(s+1),a=o,u=l,h=Ye.empty,c=0;for(let p=s,m=0;p>i;p--)m||n.index(p)>0?(m=1,h=Ye.from(n.node(p).copy(h)),c++):a--;let d=Ye.empty,f=0;for(let p=s,m=0;p>i;p--)m||r.after(p+1)<r.end(p)?(m=1,d=Ye.from(r.node(p).copy(d)),f++):u++;t.step(new wn(a,u,o,l,new ni(h.append(d),c,f),h.size-c,1))}(this,t,e),this}join(t,e=1){return function(t,e,i){let n=null,{linebreakReplacement:r}=t.doc.type.schema,s=t.doc.resolve(e-i),o=s.node().type;if(r&&o.inlineContent){let t="pre"==o.whitespace,e=!!o.contentMatch.matchType(r);t&&!e?n=0:!t&&e&&(n=1)}let l=t.steps.length;if(0==n){let n=t.doc.resolve(e+i);Cn(t,n.node(),n.before(),l)}o.inlineContent&&kn(t,e+i-1,o,s.node().contentMatchAt(s.index()),null==n);let a=t.mapping.slice(l),u=a.map(e-i);if(t.step(new bn(u,a.map(e+i,-1),ni.empty,1)),1==n){let e=t.doc.resolve(u);En(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return function(t,e,i){let n=Ye.empty;for(let o=i.length-1;o>=0;o--){if(n.size){let t=i[o].type.contentMatch.matchFragment(n);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Ye.from(i[o].type.create(i[o].attrs,n))}let r=e.start,s=e.end;t.step(new wn(r,s,r,s,new ni(n,0,0),i.length,1))}(this,t,e),this}setBlockType(t,e=t,i,n=null){return function(t,e,i,n,r){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,i,(e,i)=>{let o="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,o)&&function(t,e,i){let n=t.resolve(e),r=n.index();return n.parent.canReplaceWith(r,r+1,i)}(t.doc,t.mapping.slice(s).map(i),n)){let r=null;if(n.schema.linebreakReplacement){let t="pre"==n.whitespace,e=!!n.contentMatch.matchType(n.schema.linebreakReplacement);t&&!e?r=0:!t&&e&&(r=1)}0==r&&Cn(t,e,i,s),kn(t,t.mapping.slice(s).map(i,1),n,void 0,null===r);let l=t.mapping.slice(s),a=l.map(i,1),u=l.map(i+e.nodeSize,1);return t.step(new wn(a,u,a+1,u-1,new ni(Ye.from(n.create(o,null,e.marks)),0,0),1,1)),1==r&&En(t,e,i,s),0}})}(this,t,e,i,n),this}setNodeMarkup(t,e,i=null,n){return function(t,e,i,n,r){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");i||(i=s.type);let o=i.create(n,null,r||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!i.validContent(s.content))throw new RangeError("Invalid content for node type "+i.name);t.step(new wn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ni(Ye.from(o),0,0),1,1))}(this,t,e,i,n),this}setNodeAttribute(t,e,i){return this.step(new Vn(t,e,i)),this}setDocAttribute(t,e){return this.step(new Fn(t,e)),this}addNodeMark(t,e){return this.step(new gn(t,e)),this}removeNodeMark(t,e){let i=this.doc.nodeAt(t);if(!i)throw new RangeError("No node at position "+t);if(e instanceof ei)e.isInSet(i.marks)&&this.step(new yn(t,e));else{let n,r=i.marks,s=[];for(;n=e.isInSet(r);)s.push(new yn(t,n)),r=n.removeFromSet(r);for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t,e=1,i){return function(t,e,i=1,n){let r=t.doc.resolve(e),s=Ye.empty,o=Ye.empty;for(let l=r.depth,a=r.depth-i,u=i-1;l>a;l--,u--){s=Ye.from(r.node(l).copy(s));let t=n&&n[u];o=Ye.from(t?t.type.create(t.attrs,o):r.node(l).copy(o))}t.step(new bn(e,e,new ni(s.append(o),i,i),1))}(this,t,e,i),this}addMark(t,e,i){return function(t,e,i,n){let r,s,o=[],l=[];t.doc.nodesBetween(e,i,(t,a,u)=>{if(!t.isInline)return;let h=t.marks;if(!n.isInSet(h)&&u.type.allowsMarkType(n.type)){let u=Math.max(a,e),c=Math.min(a+t.nodeSize,i),d=n.addToSet(h);for(let t=0;t<h.length;t++)h[t].isInSet(d)||(r&&r.to==u&&r.mark.eq(h[t])?r.to=c:o.push(r=new mn(u,c,h[t])));s&&s.to==u?s.to=c:l.push(s=new pn(u,c,n))}}),o.forEach(e=>t.step(e)),l.forEach(e=>t.step(e))}(this,t,e,i),this}removeMark(t,e,i){return function(t,e,i,n){let r=[],s=0;t.doc.nodesBetween(e,i,(t,o)=>{if(!t.isInline)return;s++;let l=null;if(n instanceof Pi){let e,i=t.marks;for(;e=n.isInSet(i);)(l||(l=[])).push(e),i=e.removeFromSet(i)}else n?n.isInSet(t.marks)&&(l=[n]):l=t.marks;if(l&&l.length){let n=Math.min(o+t.nodeSize,i);for(let t=0;t<l.length;t++){let i,a=l[t];for(let t=0;t<r.length;t++){let e=r[t];e.step==s-1&&a.eq(r[t].style)&&(i=e)}i?(i.to=n,i.step=s):r.push({style:a,from:Math.max(o,e),to:n,step:s})}}}),r.forEach(e=>t.step(new mn(e.from,e.to,e.style)))}(this,t,e,i),this}clearIncompatible(t,e,i){return kn(this,t,e,i),this}}const Wn=Object.create(null);class Gn{constructor(t,e,i){this.$anchor=t,this.$head=e,this.ranges=i||[new Qn(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return 0;return 1}content(){return this.$from.doc.slice(this.from,this.to,1)}replace(t,e=ni.empty){let i=e.content.lastChild,n=null;for(let o=0;o<e.openEnd;o++)n=i,i=i.lastChild;let r=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:a}=s[o],u=t.mapping.slice(r);t.replaceRange(u.map(l.pos),u.map(a.pos),o?ni.empty:e),0==o&&or(t,r,(i?i.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(t,e){let i=t.steps.length,n=this.ranges;for(let r=0;r<n.length;r++){let{$from:s,$to:o}=n[r],l=t.mapping.slice(i),a=l.map(s.pos),u=l.map(o.pos);r?t.deleteRange(a,u):(t.replaceRangeWith(a,u,e),or(t,i,e.isInline?-1:1))}}static findFrom(t,e,i=0){let n=t.parent.inlineContent?new Xn(t):sr(t.node(0),t.parent,t.pos,t.index(),e,i);if(n)return n;for(let r=t.depth-1;r>=0;r--){let n=e<0?sr(t.node(0),t.node(r),t.before(r+1),t.index(r),e,i):sr(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,i);if(n)return n}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new nr(t.node(0))}static atStart(t){return sr(t,t,0,0,1)||new nr(t)}static atEnd(t){return sr(t,t,t.content.size,t.childCount,-1)||new nr(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=Wn[e.type];if(!i)throw new RangeError(`No selection type ${e.type} defined`);return i.fromJSON(t,e)}static jsonID(t,e){if(t in Wn)throw new RangeError("Duplicate use of selection JSON ID "+t);return Wn[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Xn.between(this.$anchor,this.$head).getBookmark()}}Gn.prototype.visible=1;class Qn{constructor(t,e){this.$from=t,this.$to=e}}let Yn=0;function Zn(t){Yn||t.parent.inlineContent||(Yn=1)}class Xn extends Gn{constructor(t,e=t){Zn(t),Zn(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let i=t.resolve(e.map(this.head));if(!i.parent.inlineContent)return Gn.near(i);let n=t.resolve(e.map(this.anchor));return new Xn(n.parent.inlineContent?n:i,i)}replace(t,e=ni.empty){if(super.replace(t,e),e==ni.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof Xn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new tr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Xn(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,i=e){let n=t.resolve(e);return new this(n,i==e?n:t.resolve(i))}static between(t,e,i){let n=t.pos-e.pos;if(i&&!n||(i=n>=0?1:-1),!e.parent.inlineContent){let t=Gn.findFrom(e,i,1)||Gn.findFrom(e,-i,1);if(!t)return Gn.near(e,i);e=t.$head}return t.parent.inlineContent||(0==n||(t=(Gn.findFrom(t,-i,1)||Gn.findFrom(t,i,1)).$anchor).pos<e.pos!=n<0)&&(t=e),new Xn(t,e)}}Gn.jsonID("text",Xn);class tr{constructor(t,e){this.anchor=t,this.head=e}map(t){return new tr(t.map(this.anchor),t.map(this.head))}resolve(t){return Xn.between(t.resolve(this.anchor),t.resolve(this.head))}}class er extends Gn{constructor(t){let e=t.nodeAfter,i=t.node(0).resolve(t.pos+e.nodeSize);super(t,i),this.node=e}map(t,e){let{deleted:i,pos:n}=e.mapResult(this.anchor),r=t.resolve(n);return i?Gn.near(r):new er(r)}content(){return new ni(Ye.from(this.node),0,0)}eq(t){return t instanceof er&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ir(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new er(t.resolve(e.anchor))}static create(t,e){return new er(t.resolve(e))}static isSelectable(t){return!t.isText&&0!=t.type.spec.selectable}}er.prototype.visible=0,Gn.jsonID("node",er);class ir{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:i}=t.mapResult(this.anchor);return e?new tr(i,i):new ir(i)}resolve(t){let e=t.resolve(this.anchor),i=e.nodeAfter;return i&&er.isSelectable(i)?new er(e):Gn.near(e)}}class nr extends Gn{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=ni.empty){if(e==ni.empty){t.delete(0,t.doc.content.size);let e=Gn.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new nr(t)}map(t){return new nr(t)}eq(t){return t instanceof nr}getBookmark(){return rr}}Gn.jsonID("all",nr);const rr={map(){return this},resolve:t=>new nr(t)};function sr(t,e,i,n,r,s=0){if(e.inlineContent)return Xn.create(t,i);for(let o=n-(r>0?0:1);r>0?o<e.childCount:o>=0;o+=r){let n=e.child(o);if(n.isAtom){if(!s&&er.isSelectable(n))return er.create(t,i-(r<0?n.nodeSize:0))}else{let e=sr(t,n,i+r,r<0?n.childCount:0,r,s);if(e)return e}i+=n.nodeSize*r}return null}function or(t,e,i){let n=t.steps.length-1;if(n<e)return;let r,s=t.steps[n];(s instanceof bn||s instanceof wn)&&(t.mapping.maps[n].forEach((t,e,i,n)=>{null==r&&(r=n)}),t.setSelection(Gn.near(t.doc.resolve(r),i)))}class lr extends Jn{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return ei.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=1){let i=this.selection;return e&&(t=t.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||ei.none))),i.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,i){let n=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(n.text(t),1):this.deleteSelection();{if(null==i&&(i=e),i=null==i?e:i,!t)return this.deleteRange(e,i);let r=this.storedMarks;if(!r){let t=this.doc.resolve(e);r=i==e?t.marks():t.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(e,i,n.text(t,r)),this.selection.empty||this.setSelection(Gn.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return 0;return 1}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ar(t,e){return e&&t?t.bind(e):t}class ur{constructor(t,e,i){this.name=t,this.init=ar(e.init,i),this.apply=ar(e.apply,i)}}const hr=[new ur("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new ur("selection",{init:(t,e)=>t.selection||Gn.atStart(e.doc),apply:t=>t.selection}),new ur("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,i,n)=>n.selection.$cursor?t.storedMarks:null}),new ur("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class cr{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hr.slice(),e&&e.forEach(t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new ur(t.key,t.spec.state,t))})}}class dr{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=e){let e=this.config.plugins[i];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return 0}return 1}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],i=this.applyInner(t),n=null;for(;;){let r=0;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=n?n[s].n:0,a=n?n[s].state:this,u=l<e.length&&o.spec.appendTransaction.call(o,l?e.slice(l):e,a,i);if(u&&i.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!n){n=[];for(let t=0;t<this.config.plugins.length;t++)n.push(t<s?{state:i,n:e.length}:{state:this,n:0})}e.push(u),i=i.applyInner(u),r=1}n&&(n[s]={state:i,n:e.length})}}if(!r)return{state:i,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new dr(this.config),i=this.config.fields;for(let n=0;n<i.length;n++){let r=i[n];e[r.name]=r.apply(t,this[r.name],this,e)}return e}get tr(){return new lr(this)}static create(t){let e=new cr(t.doc?t.doc.type.schema:t.schema,t.plugins),i=new dr(e);for(let n=0;n<e.fields.length;n++)i[e.fields[n].name]=e.fields[n].init(t,i);return i}reconfigure(t){let e=new cr(this.schema,t.plugins),i=e.fields,n=new dr(e);for(let r=0;r<i.length;r++){let e=i[r].name;n[e]=this.hasOwnProperty(e)?this[e]:i[r].init(t,n)}return n}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(t=>t.toJSON())),t&&"object"==typeof t)for(let i in t){if("doc"==i||"selection"==i)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=t[i],r=n.spec.state;r&&r.toJSON&&(e[i]=r.toJSON.call(n,this[n.key]))}return e}static fromJSON(t,e,i){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let n=new cr(t.schema,t.plugins),r=new dr(n);return n.fields.forEach(n=>{if("doc"==n.name)r.doc=ki.fromJSON(t.schema,e.doc);else if("selection"==n.name)r.selection=Gn.fromJSON(r.doc,e.selection);else if("storedMarks"==n.name)e.storedMarks&&(r.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(i)for(let s in i){let o=i[s],l=o.spec.state;if(o.key==n.name&&l&&l.fromJSON&&{}.hasOwnProperty.call(e,s))return void(r[n.name]=l.fromJSON.call(o,t,e[s],r))}r[n.name]=n.init(t,r)}}),r}}function fr(t,e,i){for(let n in t){let r=t[n];r instanceof Function?r=r.bind(e):"handleDOMEvents"==n&&(r=fr(r,e,{})),i[n]=r}return i}class pr{constructor(t){this.spec=t,this.props={},t.props&&fr(t.props,this,this.props),this.key=t.key?t.key.key:gr("plugin")}getState(t){return t[this.key]}}const mr=Object.create(null);function gr(t){return t in mr?t+"$"+ ++mr[t]:(mr[t]=0,t+"$")}class yr{constructor(t="key"){this.key=gr(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const br=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},wr=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let vr=null;const kr=function(t,e,i){let n=vr||(vr=document.createRange());return n.setEnd(t,null==i?t.nodeValue.length:i),n.setStart(t,e||0),n},xr=function(t,e,i,n){return i&&(Sr(t,e,i,n,-1)||Sr(t,e,i,n,1))},Mr=/^(img|br|input|textarea|hr)$/i;function Sr(t,e,i,n,r){for(var s;;){if(t==i&&e==n)return 1;if(e==(r<0?0:Tr(t))){let i=t.parentNode;if(!i||1!=i.nodeType||Er(t)||Mr.test(t.nodeName)||"false"==t.contentEditable)return 0;e=br(t)+(r<0?0:1),t=i}else{if(1!=t.nodeType)return 0;{let i=t.childNodes[e+(r<0?-1:0)];if(1==i.nodeType&&"false"==i.contentEditable){if(!(null===(s=i.pmViewDesc)||void 0===s?void 0:s.ignoreForSelection))return 0;e+=r}else t=i,e=r<0?Tr(t):0}}}}function Tr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Er(t){let e;for(let i=t;i&&!(e=i.pmViewDesc);i=i.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Cr=function(t){return t.focusNode&&xr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Or(t,e){let i=document.createEvent("Event");return i.initEvent("keydown",1,1),i.keyCode=t,i.key=i.code=e,i}const Ar="undefined"!=typeof navigator?navigator:null,$r="undefined"!=typeof document?document:null,Rr=Ar&&Ar.userAgent||"",Lr=/Edge\/(\d+)/.exec(Rr),Br=/MSIE \d/.exec(Rr),Ir=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rr),Nr=!!(Br||Ir||Lr),Dr=Br?document.documentMode:Ir?+Ir[1]:Lr?+Lr[1]:0,_r=!Nr&&/gecko\/(\d+)/i.test(Rr),zr=!Nr&&/Chrome\/(\d+)/.exec(Rr),Pr=!!zr,Hr=zr?+zr[1]:0,jr=!Nr&&!!Ar&&/Apple Computer/.test(Ar.vendor),Ur=jr&&(/Mobile\/\w+/.test(Rr)||!!Ar&&Ar.maxTouchPoints>2),qr=Ur||(Ar?/Mac/.test(Ar.platform):0),Vr=Ar?/Win/.test(Ar.platform):0,Fr=/Android \d/.test(Rr),Kr=!!$r&&"webkitFontSmoothing"in $r.documentElement.style,Jr=Kr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Wr(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 Gr(t,e){return"number"==typeof t?t:t[e]}function Qr(t){let e=t.getBoundingClientRect(),i=e.width/t.offsetWidth||1,n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*i,top:e.top,bottom:e.top+t.clientHeight*n}}function Yr(t,e,i){let n=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=i||t.dom;o;){if(1!=o.nodeType){o=wr(o);continue}let t=o,i=t==s.body,l=i?Wr(s):Qr(t),a=0,u=0;if(e.top<l.top+Gr(n,"top")?u=-(l.top-e.top+Gr(r,"top")):e.bottom>l.bottom-Gr(n,"bottom")&&(u=e.bottom-e.top>l.bottom-l.top?e.top+Gr(r,"top")-l.top:e.bottom-l.bottom+Gr(r,"bottom")),e.left<l.left+Gr(n,"left")?a=-(l.left-e.left+Gr(r,"left")):e.right>l.right-Gr(n,"right")&&(a=e.right-l.right+Gr(r,"right")),a||u)if(i)s.defaultView.scrollBy(a,u);else{let i=t.scrollLeft,n=t.scrollTop;u&&(t.scrollTop+=u),a&&(t.scrollLeft+=a);let r=t.scrollLeft-i,s=t.scrollTop-n;e={left:e.left-r,top:e.top-s,right:e.right-r,bottom:e.bottom-s}}let h=i?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o="absolute"==h?o.offsetParent:wr(o)}}function Zr(t){let e=[],i=t.ownerDocument;for(let n=t;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=i);n=wr(n));return e}function Xr(t,e){for(let i=0;i<t.length;i++){let{dom:n,top:r,left:s}=t[i];n.scrollTop!=r+e&&(n.scrollTop=r+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let ts=null;function es(t,e){let i,n,r,s,o=2e8,l=0,a=e.top,u=e.top;for(let h=t.firstChild,c=0;h;h=h.nextSibling,c++){let t;if(1==h.nodeType)t=h.getClientRects();else{if(3!=h.nodeType)continue;t=kr(h).getClientRects()}for(let d=0;d<t.length;d++){let f=t[d];if(f.top<=a&&f.bottom>=u){a=Math.max(f.bottom,a),u=Math.min(f.top,u);let t=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(t<o){i=h,o=t,n=t&&3==i.nodeType?{left:f.right<e.left?f.right:f.left,top:e.top}:e,1==h.nodeType&&t&&(l=c+(e.left>=(f.left+f.right)/2?1:0));continue}}else f.top>e.top&&!r&&f.left<=e.left&&f.right>=e.left&&(r=h,s={left:Math.max(f.left,Math.min(f.right,e.left)),top:f.top});!i&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(l=c+1)}}return!i&&r&&(i=r,n=s,o=0),i&&3==i.nodeType?function(t,e){let i=t.nodeValue.length,n=document.createRange();for(let r=0;r<i;r++){n.setEnd(t,r+1),n.setStart(t,r);let i=ls(n,1);if(i.top!=i.bottom&&is(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(i,n):!i||o&&1==i.nodeType?{node:t,offset:l}:es(i,n)}function is(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ns(t,e,i){let n=t.childNodes.length;if(n&&i.top<i.bottom)for(let r=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-i.top)/(i.bottom-i.top))-2)),s=r;;){let i=t.childNodes[s];if(1==i.nodeType){let t=i.getClientRects();for(let n=0;n<t.length;n++){let r=t[n];if(is(e,r))return ns(i,e,r)}}if((s=(s+1)%n)==r)break}return t}function rs(t,e){let i,n=t.dom.ownerDocument,r=0,s=function(t,e,i){if(t.caretPositionFromPoint)try{let n=t.caretPositionFromPoint(e,i);if(n)return{node:n.offsetNode,offset:Math.min(Tr(n.offsetNode),n.offset)}}catch(n){}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,i);if(n)return{node:n.startContainer,offset:Math.min(Tr(n.startContainer),n.startOffset)}}}(n,e.left,e.top);s&&({node:i,offset:r}=s);let o,l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top);if(!l||!t.dom.contains(1!=l.nodeType?l.parentNode:l)){let i=t.dom.getBoundingClientRect();if(!is(e,i))return null;if(l=ns(t.dom,e,i),!l)return null}if(jr)for(let u=l;i&&u;u=wr(u))u.draggable&&(i=void 0);if(l=function(t,e){let i=t.parentNode;return i&&/^li$/i.test(i.nodeName)&&e.left<t.getBoundingClientRect().left?i:t}(l,e),i){if(_r&&1==i.nodeType&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let t,n=i.childNodes[r];"IMG"==n.nodeName&&(t=n.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&r++}let n;Kr&&r&&1==i.nodeType&&1==(n=i.childNodes[r-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=e.top&&r--,i==t.dom&&r==i.childNodes.length-1&&1==i.lastChild.nodeType&&e.top>i.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:0!=r&&1==i.nodeType&&"BR"==i.childNodes[r-1].nodeName||(o=function(t,e,i,n){let r=-1;for(let s=e,o=0;s!=t.dom;){let e,i=t.docView.nearestDesc(s,1);if(!i)return null;if(1==i.dom.nodeType&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((e=i.dom.getBoundingClientRect()).width||e.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!o&&e.left>n.left||e.top>n.top?r=i.posBefore:(!o&&e.right<n.left||e.bottom<n.top)&&(r=i.posAfter),o=1),!i.contentDOM&&r<0&&!i.node.isText))return(i.node.isBlock?n.top<(e.top+e.bottom)/2:n.left<(e.left+e.right)/2)?i.posBefore:i.posAfter;s=i.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,i,-1)}(t,i,r,e))}null==o&&(o=function(t,e,i){let{node:n,offset:r}=es(e,i),s=-1;if(1==n.nodeType&&!n.firstChild){let t=n.getBoundingClientRect();s=t.left!=t.right&&i.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(n,r,s)}(t,l,e));let a=t.docView.nearestDesc(l,1);return{pos:o,inside:a?a.posAtStart-a.border:-1}}function ss(t){return t.top<t.bottom||t.left<t.right}function ls(t,e){let i=t.getClientRects();if(i.length){let t=i[e<0?0:i.length-1];if(ss(t))return t}return[].find.call(i,ss)||t.getBoundingClientRect()}const as=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function us(t,e,i){let{node:n,offset:r,atom:s}=t.docView.domFromPos(e,i<0?-1:1),o=Kr||_r;if(3==n.nodeType){if(!o||!as.test(n.nodeValue)&&(i<0?r:r!=n.nodeValue.length)){let t=r,e=r,s=i<0?1:-1;return i<0&&!r?(e++,s=-1):i>=0&&r==n.nodeValue.length?(t--,s=1):i<0?t--:e++,hs(ls(kr(n,t,e),s),s<0)}{let t=ls(kr(n,r,r),i);if(_r&&r&&/\s/.test(n.nodeValue[r-1])&&r<n.nodeValue.length){let e=ls(kr(n,r-1,r-1),-1);if(e.top==t.top){let i=ls(kr(n,r,r+1),-1);if(i.top!=t.top)return hs(i,i.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(null==s&&r&&(i<0||r==Tr(n))){let t=n.childNodes[r-1];if(1==t.nodeType)return cs(t.getBoundingClientRect(),0)}if(null==s&&r<Tr(n)){let t=n.childNodes[r];if(1==t.nodeType)return cs(t.getBoundingClientRect(),1)}return cs(n.getBoundingClientRect(),i>=0)}if(null==s&&r&&(i<0||r==Tr(n))){let t=n.childNodes[r-1],e=3==t.nodeType?kr(t,Tr(t)-(o?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return hs(ls(e,1),0)}if(null==s&&r<Tr(n)){let t=n.childNodes[r];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?kr(t,0,o?0:1):1==t.nodeType?t:null:null;if(e)return hs(ls(e,-1),1)}return hs(ls(3==n.nodeType?kr(n):n,-i),i>=0)}function hs(t,e){if(0==t.width)return t;let i=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:i,right:i}}function cs(t,e){if(0==t.height)return t;let i=e?t.top:t.bottom;return{top:i,bottom:i,left:t.left,right:t.right}}function ds(t,e,i){let n=t.state,r=t.root.activeElement;n!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return i()}finally{n!=e&&t.updateState(n),r!=t.dom&&r&&r.focus()}}const fs=/[\u0590-\u08ac]/;let ps=null,ms=null,gs=0;class ys{constructor(t,e,i,n){this.parent=t,this.children=e,this.dom=i,this.contentDOM=n,this.dirty=0,i.pmViewDesc=this}matchesWidget(t){return 0}matchesMark(t){return 0}matchesNode(t,e,i){return 0}matchesHack(t){return 0}parseRule(){return null}stopEvent(t){return 0}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,i=this.posAtStart;;e++){let n=this.children[e];if(n==t)return i;i+=n.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(t,e,i){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(i<0){let i,n;if(t==this.contentDOM)i=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&(!(n=i.pmViewDesc)||n.parent!=this);)i=i.previousSibling;return i?this.posBeforeChild(n)+n.size:this.posAtStart}{let i,n;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(n=i.pmViewDesc)||n.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(n):this.posAtEnd}}let n;if(t==this.dom&&this.contentDOM)n=e>br(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){n=0;break}if(e.previousSibling)break}if(null==n&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){n=1;break}if(e.nextSibling)break}}return(null==n?i>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=0){for(let i=1,n=t;n;n=n.parentNode){let r,s=this.getDesc(n);if(s&&(!e||s.node)){if(!i||!(r=s.nodeDOM)||(1==r.nodeType?r.contains(1==t.nodeType?t:t.parentNode):r==t))return s;i=0}}}getDesc(t){let e=t.pmViewDesc;for(let i=e;i;i=i.parent)if(i==this)return e}posFromDOM(t,e,i){for(let n=t;n;n=n.parentNode){let r=this.getDesc(n);if(r)return r.localPosFromDOM(t,e,i)}return-1}descAt(t){for(let e=0,i=0;e<this.children.length;e++){let n=this.children[e],r=i+n.size;if(i==t&&r!=i){for(;!n.border&&n.children.length;)for(let t=0;t<n.children.length;t++){let e=n.children[t];if(e.size){n=e;break}}return n}if(t<r)return n.descAt(t-i-n.border);i=r}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let i=0,n=0;for(let r=0;i<this.children.length;i++){let e=this.children[i],s=r+e.size;if(s>t||e instanceof Ss){n=t-r;break}r=s}if(n)return this.children[i].domFromPos(n-this.children[i].border,e);for(let r;i&&!(r=this.children[i-1]).size&&r instanceof bs&&r.side>=0;i--);if(e<=0){let t,n=1;for(;t=i?this.children[i-1]:null,t&&t.dom.parentNode!=this.contentDOM;i--,n=0);return t&&e&&n&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?br(t.dom)+1:0}}{let t,n=1;for(;t=i<this.children.length?this.children[i]:null,t&&t.dom.parentNode!=this.contentDOM;i++,n=0);return t&&n&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?br(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,i=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,r=-1;for(let s=i,o=0;;o++){let i=this.children[o],l=s+i.size;if(-1==n&&t<=l){let r=s+i.border;if(t>=r&&e<=l-i.border&&i.node&&i.contentDOM&&this.contentDOM.contains(i.contentDOM))return i.parseRange(t,e,r);t=s;for(let e=o;e>0;e--){let i=this.children[e-1];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(1)){n=br(i.dom)+1;break}t-=i.size}-1==n&&(n=0)}if(n>-1&&(l>e||o==this.children.length-1)){e=l;for(let t=o+1;t<this.children.length;t++){let i=this.children[t];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(-1)){r=br(i.dom);break}e+=i.size}-1==r&&(r=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:t,to:e,fromOffset:n,toOffset:r}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return 0;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:i}=this.domFromPos(t,0);if(1!=e.nodeType||i==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[i]}setSelection(t,e,i,n=0){let r=Math.min(t,e),s=Math.max(t,e);for(let f=0,p=0;f<this.children.length;f++){let o=this.children[f],l=p+o.size;if(r>p&&s<l)return o.setSelection(t-p-o.border,e-p-o.border,i,n);p=l}let o=this.domFromPos(t,t?-1:1),l=e==t?o:this.domFromPos(e,e?-1:1),a=i.root.getSelection(),u=i.domSelectionRange(),h=0;if((_r||jr)&&t==e){let{node:t,offset:e}=o;if(3==t.nodeType){if(h=!(!e||"\n"!=t.nodeValue[e-1]),h&&e==t.nodeValue.length)for(let i,n=t;n;n=n.parentNode){if(i=n.nextSibling){"BR"==i.nodeName&&(o=l={node:i.parentNode,offset:br(i)+1});break}let t=n.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let i=t.childNodes[e-1];h=i&&("BR"==i.nodeName||"false"==i.contentEditable)}}if(_r&&u.focusNode&&u.focusNode!=l.node&&1==u.focusNode.nodeType){let t=u.focusNode.childNodes[u.focusOffset];t&&"false"==t.contentEditable&&(n=1)}if(!(n||h&&jr)&&xr(o.node,o.offset,u.anchorNode,u.anchorOffset)&&xr(l.node,l.offset,u.focusNode,u.focusOffset))return;let c=0;if((a.extend||t==e)&&(!h||!_r)){a.collapse(o.node,o.offset);try{t!=e&&a.extend(l.node,l.offset),c=1}catch(d){}}if(!c){if(t>e){let t=o;o=l,l=t}let i=document.createRange();i.setEnd(l.node,l.offset),i.setStart(o.node,o.offset),a.removeAllRanges(),a.addRange(i)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let i=0,n=0;n<this.children.length;n++){let r=this.children[n],s=i+r.size;if(i==s?t<=s&&e>=i:t<s&&e>i){let n=i+r.border,o=s-r.border;if(t>=n&&e<=o)return this.dirty=t==i||e==s?2:1,void(t!=n||e!=o||!r.contentLost&&r.dom.parentNode==this.contentDOM?r.markDirty(t-n,e-n):r.dirty=3);r.dirty=r.dom!=r.contentDOM||r.dom.parentNode!=this.contentDOM||r.children.length?3:2}i=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let i=1==t?2:1;e.dirty<i&&(e.dirty=i)}}get domAtom(){return 0}get ignoreForCoords(){return 0}get ignoreForSelection(){return 0}isText(t){return 0}}class bs extends ys{constructor(t,e,i,n){let r,s=e.type.toDOM;if("function"==typeof s&&(s=s(i,()=>r?r.parent?r.parent.posBeforeChild(r):void 0:n)),!e.type.spec.raw){if(1!=s.nodeType){let t=document.createElement("span");t.appendChild(s),s=t}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,r=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:1}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(t):0}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return 1}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ws extends ys{constructor(t,e,i,n){super(t,[],e,null),this.textDOM=i,this.text=n}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class vs extends ys{constructor(t,e,i,n,r){super(t,[],i,n),this.mark=e,this.spec=r}static create(t,e,i,n){let r=n.nodeViews[e.type.name],s=r&&r(e,n,i);return s&&s.dom||(s=Zi.renderSpec(document,e.type.spec.toDOM(e,i),null,e.attrs)),new vs(t,e,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,i){let n=vs.create(this.parent,this.mark,1,i),r=this.children,s=this.size;e<s&&(r=_s(r,e,s,i)),t>0&&(r=_s(r,0,t,i));for(let o=0;o<r.length;o++)r[o].parent=n;return n.children=r,n}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ks extends ys{constructor(t,e,i,n,r,s,o,l,a){super(t,[],r,s),this.node=e,this.outerDeco=i,this.innerDeco=n,this.nodeDOM=o}static create(t,e,i,n,r,s){let o,l=r.nodeViews[e.type.name],a=l&&l(e,r,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:s,i,n),u=a&&a.dom,h=a&&a.contentDOM;if(e.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(e.text);else if(!u){let t=Zi.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:u,contentDOM:h}=t)}h||e.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),e.type.spec.draggable&&(u.draggable=1));let c=u;return u=Ls(u,i,e),a?o=new Ts(t,e,i,n,u,h||null,c,a,r,s+1):e.isText?new Ms(t,e,i,n,u,c,r):new ks(t,e,i,n,u,h||null,c,r,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let i=this.children[e];if(this.dom.contains(i.dom.parentNode)){t.contentElement=i.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Ye.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,i){return 0==this.dirty&&t.eq(this.node)&&Bs(e,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let i=this.node.inlineContent,n=e,r=t.composing?this.localCompositionInfo(t,e):null,s=r&&r.pos>-1?r:null,o=r&&r.pos<0,l=new Ns(this,s&&s.node,t);!function(t,e,i,n){let r=e.locals(t),s=0;if(0==r.length){for(let i=0;i<t.childCount;i++){let o=t.child(i);n(o,r,e.forChild(s,o),i),s+=o.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let h,c,d,f;for(;o<r.length&&r[o].to==s;){let t=r[o++];t.widget&&(h?(c||(c=[h])).push(t):h=t)}if(h)if(c){c.sort(Ds);for(let t=0;t<c.length;t++)i(c[t],u,!!a)}else i(h,u,!!a);if(a)f=-1,d=a,a=null;else{if(!(u<t.childCount))break;f=u,d=t.child(u++)}for(let t=0;t<l.length;t++)l[t].to<=s&&l.splice(t--,1);for(;o<r.length&&r[o].from<=s&&r[o].to>s;)l.push(r[o++]);let p=s+d.nodeSize;if(d.isText){let t=p;o<r.length&&r[o].from<t&&(t=r[o].from);for(let e=0;e<l.length;e++)l[e].to<t&&(t=l[e].to);t<p&&(a=d.cut(t-s),d=d.cut(0,t-s),p=t,f=-1)}else for(;o<r.length&&r[o].to<p;)o++;n(d,d.isInline&&!d.isLeaf?l.filter(t=>!t.inline):l.slice(),e.forChild(s,d),f),s=p}}(this.node,this.innerDeco,(e,r,s)=>{e.spec.marks?l.syncToMarks(e.spec.marks,i,t):e.type.side>=0&&!s&&l.syncToMarks(r==this.node.childCount?ei.none:this.node.child(r).marks,i,t),l.placeWidget(e,t,n)},(e,s,a,u)=>{let h;l.syncToMarks(e.marks,i,t),l.findNodeMatch(e,s,a,u)||o&&t.state.selection.from>n&&t.state.selection.to<n+e.nodeSize&&(h=l.findIndexWithChild(r.node))>-1&&l.updateNodeAt(e,s,a,h,t)||l.updateNextNode(e,s,a,t,u,n)||l.addNode(e,s,a,t,n),n+=e.nodeSize}),l.syncToMarks([],i,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),Es(this.contentDOM,this.children,t),Ur&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:i,to:n}=t.state.selection;if(!(t.state.selection instanceof Xn)||i<e||n>e+this.node.content.size)return null;let r=t.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let t=r.nodeValue,s=function(t,e,i,n){for(let r=0,s=0;r<t.childCount&&s<=n;){let o=t.child(r++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;r<t.childCount;){let e=t.child(r++);if(s+=e.nodeSize,!e.isText)break;a+=e.text}if(s>=i){if(s>=n&&a.slice(n-e.length-l,n-l)==e)return n-e.length;let t=l<n?a.lastIndexOf(e,n-l-1):-1;if(t>=0&&t+e.length+l>=i)return l+t;if(i==n&&a.length>=n+e.length-l&&a.slice(n-l,n-l+e.length)==e)return n}}return-1}(this.node.content,t,i-e,n-e);return s<0?null:{node:r,pos:s,text:t}}return{node:r,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:i,text:n}){if(this.getDesc(e))return;let r=e;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let s=new ws(this,r,e,n);t.input.compositionNodes.push(s),this.children=_s(this.children,i,i+n.length,t,s)}update(t,e,i,n){return 3!=this.dirty&&t.sameMarkup(this.node)?(this.updateInner(t,e,i,n),1):0}updateInner(t,e,i,n){this.updateOuterDeco(e),this.node=t,this.innerDeco=i,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Bs(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=$s(this.dom,this.nodeDOM,As(this.outerDeco,this.node,e),As(t,this.node,e)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=1))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function xs(t,e,i,n,r){Ls(n,e,t);let s=new ks(void 0,t,e,i,n,n,n,r,0);return s.contentDOM&&s.updateChildren(r,0),s}class Ms extends ks{constructor(t,e,i,n,r,s,o){super(t,e,i,n,r,null,s,o,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||1}}update(t,e,i,n){return 3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node)?0:(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=t,this.dirty=0,1)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return 1;return 0}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,i){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,i)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,i){let n=this.node.cut(t,e),r=document.createTextNode(n.text);return new Ms(this.parent,n,this.outerDeco,this.innerDeco,r,r,i)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return 0}isText(t){return this.node.text==t}}class Ss extends ys{parseRule(){return{ignore:1}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return 1}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Ts extends ks{constructor(t,e,i,n,r,s,o,l,a,u){super(t,e,i,n,r,s,o,a,u),this.spec=l}update(t,e,i,n){if(3==this.dirty)return 0;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let r=this.spec.update(t,e,i);return r&&this.updateInner(t,e,i,n),r}return this.contentDOM||t.isLeaf?super.update(t,e,i,n):0}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,i,n){this.spec.setSelection?this.spec.setSelection(t,e,i.root):super.setSelection(t,e,i,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):0}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Es(t,e,i){let n=t.firstChild,r=0;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=n;)n=Is(n),r=1;n=n.nextSibling}else r=1,t.insertBefore(l,n);if(o instanceof vs){let e=n?n.previousSibling:t.lastChild;Es(o.contentDOM,o.children,i),n=e?e.nextSibling:t.firstChild}}for(;n;)n=Is(n),r=1;r&&i.trackWrites==t&&(i.trackWrites=null)}const Cs=function(t){t&&(this.nodeName=t)};Cs.prototype=Object.create(null);const Os=[new Cs];function As(t,e,i){if(0==t.length)return Os;let n=i?Os[0]:new Cs,r=[n];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&r.push(n=new Cs(o.nodeName));for(let t in o){let s=o[t];null!=s&&(i&&1==r.length&&r.push(n=new Cs(e.isInline?"span":"div")),"class"==t?n.class=(n.class?n.class+" ":"")+s:"style"==t?n.style=(n.style?n.style+";":"")+s:"nodeName"!=t&&(n[t]=s))}}}return r}function $s(t,e,i,n){if(i==Os&&n==Os)return e;let r=e;for(let s=0;s<n.length;s++){let e=n[s],o=i[s];if(s){let i;o&&o.nodeName==e.nodeName&&r!=t&&(i=r.parentNode)&&i.nodeName.toLowerCase()==e.nodeName||(i=document.createElement(e.nodeName),i.pmIsDeco=1,i.appendChild(r),o=Os[0]),r=i}Rs(r,o||Os[0],e)}return r}function Rs(t,e,i){for(let n in e)"class"==n||"style"==n||"nodeName"==n||n in i||t.removeAttribute(n);for(let n in i)"class"!=n&&"style"!=n&&"nodeName"!=n&&i[n]!=e[n]&&t.setAttribute(n,i[n]);if(e.class!=i.class){let n=e.class?e.class.split(" ").filter(Boolean):[],r=i.class?i.class.split(" ").filter(Boolean):[];for(let e=0;e<n.length;e++)-1==r.indexOf(n[e])&&t.classList.remove(n[e]);for(let e=0;e<r.length;e++)-1==n.indexOf(r[e])&&t.classList.add(r[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=i.style){if(e.style){let i,n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;i=n.exec(e.style);)t.style.removeProperty(i[1])}i.style&&(t.style.cssText+=i.style)}}function Ls(t,e,i){return $s(t,t,Os,As(e,i,1!=t.nodeType))}function Bs(t,e){if(t.length!=e.length)return 0;for(let i=0;i<t.length;i++)if(!t[i].type.eq(e[i].type))return 0;return 1}function Is(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Ns{constructor(t,e,i){this.lock=e,this.view=i,this.index=0,this.stack=[],this.changed=0,this.top=t,this.preMatch=function(t,e){let i=e,n=i.children.length,r=t.childCount,s=new Map,o=[];t:for(;r>0;){let l;for(;;)if(n){let t=i.children[n-1];if(!(t instanceof vs)){l=t,n--;break}i=t,n=t.children.length}else{if(i==e)break t;n=i.parent.children.indexOf(i),i=i.parent}let a=l.node;if(a){if(a!=t.child(r-1))break;--r,s.set(l,r),o.push(l)}}return{index:r,matched:s,matches:o.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let i=t;i<e;i++)this.top.children[i].destroy();this.top.children.splice(t,e-t),this.changed=1}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,i){let n=0,r=this.stack.length>>1,s=Math.min(r,t.length);for(;n<s&&(n==r-1?this.top:this.stack[n+1<<1]).matchesMark(t[n])&&0!=t[n].type.spec.spanning;)n++;for(;n<r;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<t.length;){this.stack.push(this.top,this.index+1);let n=-1;for(let e=this.index;e<Math.min(this.index+3,this.top.children.length);e++){let i=this.top.children[e];if(i.matchesMark(t[r])&&!this.isLocked(i.dom)){n=e;break}}if(n>-1)n>this.index&&(this.changed=1,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let n=vs.create(this.top,t[r],e,i);this.top.children.splice(this.index,0,n),this.top=n,this.changed=1}this.index=0,r++}}findNodeMatch(t,e,i,n){let r,s=-1;if(n>=this.preMatch.index&&(r=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&r.matchesNode(t,e,i))s=this.top.children.indexOf(r,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let n=this.top.children[o];if(n.matchesNode(t,e,i)&&!this.preMatch.matched.has(n)){s=o;break}}return s<0?0:(this.destroyBetween(this.index,s),this.index++,1)}updateNodeAt(t,e,i,n,r){let s=this.top.children[n];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),s.update(t,e,i,r)?(this.destroyBetween(this.index,n),this.index++,1):0}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,i,n,r,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof ks){let a=this.preMatch.matched.get(l);if(null!=a&&a!=r)return 0;let u,h=l.dom,c=this.isLocked(h)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&3!=l.dirty&&Bs(e,l.outerDeco));if(!c&&l.update(t,e,i,n))return this.destroyBetween(this.index,o),l.dom!=h&&(this.changed=1),this.index++,1;if(!c&&(u=this.recreateWrapper(l,t,e,i,n,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(n,s+1),u.dirty=0),this.changed=1,this.index++,1;break}}return 0}recreateWrapper(t,e,i,n,r,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Bs(i,t.outerDeco)||!n.eq(t.innerDeco))return null;let o=ks.create(this.top,e,i,n,r,s);if(o.contentDOM){o.children=t.children,t.children=[];for(let t of o.children)t.parent=o}return t.destroy(),o}addNode(t,e,i,n,r){let s=ks.create(this.top,t,e,i,n,r);s.contentDOM&&s.updateChildren(n,r+1),this.top.children.splice(this.index++,0,s),this.changed=1}placeWidget(t,e,i){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(!n||!n.matchesWidget(t)||t!=n.widget&&n.widget.type.toDOM.parentNode){let n=new bs(this.top,t,e,i);this.top.children.splice(this.index++,0,n),this.changed=1}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof vs;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Ms)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((jr||Pr)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let i=document.createElement(t);"IMG"==t&&(i.className="ProseMirror-separator",i.alt=""),"BR"==t&&(i.className="ProseMirror-trailingBreak");let n=new Ss(this.top,[],i,null);e!=this.top?e.children.push(n):e.children.splice(this.index++,0,n),this.changed=1}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Ds(t,e){return t.type.side-e.type.side}function _s(t,e,i,n,r){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],u=l,h=l+=a.size;u>=i||h<=e?s.push(a):(u<e&&s.push(a.slice(0,e-u,n)),r&&(s.push(r),r=void 0),h>i&&s.push(a.slice(i-u,a.size,n)))}return s}function zs(t,e=null){let i=t.domSelectionRange(),n=t.state.doc;if(!i.focusNode)return null;let r=t.docView.nearestDesc(i.focusNode),s=r&&0==r.size,o=t.docView.posFromDOM(i.focusNode,i.focusOffset,1);if(o<0)return null;let l,a,u=n.resolve(o);if(Cr(i)){for(l=o;r&&!r.node;)r=r.parent;let t=r.node;if(r&&t.isAtom&&er.isSelectable(t)&&r.parent&&(!t.isInline||!function(t,e,i){for(let n=0==e,r=e==Tr(t);n||r;){if(t==i)return 1;let e=br(t);if(!(t=t.parentNode))return 0;n=n&&0==e,r=r&&e==Tr(t)}}(i.focusNode,i.focusOffset,r.dom))){let t=r.posBefore;a=new er(o==t?u:n.resolve(t))}}else{if(i instanceof t.dom.ownerDocument.defaultView.Selection&&i.rangeCount>1){let e=o,r=o;for(let n=0;n<i.rangeCount;n++){let s=i.getRangeAt(n);e=Math.min(e,t.docView.posFromDOM(s.startContainer,s.startOffset,1)),r=Math.max(r,t.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(e<0)return null;[l,o]=r==t.state.selection.anchor?[r,e]:[e,r],u=n.resolve(o)}else l=t.docView.posFromDOM(i.anchorNode,i.anchorOffset,1);if(l<0)return null}let h=n.resolve(l);return a||(a=Js(t,h,u,"pointer"==e||t.state.selection.head<u.pos&&!s?1:-1)),a}function Ps(t){return t.editable?t.hasFocus():Gs(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Hs(t,e=0){let i=t.state.selection;if(Fs(t,i),Ps(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Pr){let e=t.domSelectionRange(),i=t.domObserver.currentSelection;if(e.anchorNode&&i.anchorNode&&xr(e.anchorNode,e.anchorOffset,i.anchorNode,i.anchorOffset))return t.input.mouseDown.delayedSelectionSync=1,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection();if(!e)return;let i=t.cursorWrapper.dom,n="IMG"==i.nodeName;n?e.collapse(i.parentNode,br(i)+1):e.collapse(i,0),!n&&!t.state.selection.visible&&Nr&&Dr<=11&&(i.disabled=1,i.disabled=0)}(t);else{let n,r,{anchor:s,head:o}=i;!js||i instanceof Xn||(i.$from.parent.inlineContent||(n=Us(t,i.from)),i.empty||i.$from.parent.inlineContent||(r=Us(t,i.to))),t.docView.setSelection(s,o,t,e),js&&(n&&Vs(n),r&&Vs(r)),i.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let i=t.domSelectionRange(),n=i.anchorNode,r=i.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{i.anchorNode==n&&i.anchorOffset==r||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{Ps(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")},20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const js=jr||Pr&&Hr<63;function Us(t,e){let{node:i,offset:n}=t.docView.domFromPos(e,0),r=n<i.childNodes.length?i.childNodes[n]:null,s=n?i.childNodes[n-1]:null;if(jr&&r&&"false"==r.contentEditable)return qs(r);if(!(r&&"false"!=r.contentEditable||s&&"false"!=s.contentEditable)){if(r)return qs(r);if(s)return qs(s)}}function qs(t){return t.contentEditable="true",jr&&t.draggable&&(t.draggable=0,t.wasDraggable=1),t}function Vs(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=1,t.wasDraggable=null)}function Fs(t,e){if(e instanceof er){let i=t.docView.descAt(e.from);i!=t.lastSelectedViewDesc&&(Ks(t),i&&i.selectNode(),t.lastSelectedViewDesc=i)}else Ks(t)}function Ks(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Js(t,e,i,n){return t.someProp("createSelectionBetween",n=>n(t,e,i))||Xn.between(e,i,n)}function Ws(t){return t.editable&&!t.hasFocus()?0:Gs(t)}function Gs(t){let e=t.domSelectionRange();if(!e.anchorNode)return 0;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(i){return 0}}function Qs(t,e){let{$anchor:i,$head:n}=t.selection,r=e>0?i.max(n):i.min(n),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&Gn.findFrom(s,e)}function Ys(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),1}function Zs(t,e,i){let n=t.state.selection;if(!(n instanceof Xn)){if(n instanceof er&&n.node.isInline)return Ys(t,new Xn(e>0?n.$to:n.$from));{let i=Qs(t.state,e);return i?Ys(t,i):0}}if(i.indexOf("s")>-1){let{$head:i}=n,r=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!r||r.isText||!r.isLeaf)return 0;let s=t.state.doc.resolve(i.pos+r.nodeSize*(e<0?-1:1));return Ys(t,new Xn(n.$anchor,s))}if(!n.empty)return 0;if(t.endOfTextblock(e>0?"forward":"backward")){let i=Qs(t.state,e);return i&&i instanceof er?Ys(t,i):0}if(!(qr&&i.indexOf("m")>-1)){let i,r=n.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText)return 0;let o=e<0?r.pos-s.nodeSize:r.pos;return s.isAtom||(i=t.docView.descAt(o))&&!i.contentDOM?er.isSelectable(s)?Ys(t,new er(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):Kr?Ys(t,new Xn(t.state.doc.resolve(e<0?o:o+s.nodeSize))):0:0}}function Xs(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function to(t,e){let i=t.pmViewDesc;return i&&0==i.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function eo(t,e){return e<0?function(t){let e=t.domSelectionRange(),i=e.focusNode,n=e.focusOffset;if(!i)return;let r,s,o=0;for(_r&&1==i.nodeType&&n<Xs(i)&&to(i.childNodes[n],-1)&&(o=1);;)if(n>0){if(1!=i.nodeType)break;{let t=i.childNodes[n-1];if(to(t,-1))r=i,s=--n;else{if(3!=t.nodeType)break;i=t,n=i.nodeValue.length}}}else{if(io(i))break;{let e=i.previousSibling;for(;e&&to(e,-1);)r=i.parentNode,s=br(e),e=e.previousSibling;if(e)i=e,n=Xs(i);else{if(i=i.parentNode,i==t.dom)break;n=0}}}o?no(t,i,n):r&&no(t,r,s)}(t):function(t){let e=t.domSelectionRange(),i=e.focusNode,n=e.focusOffset;if(!i)return;let r,s,o=Xs(i);for(;;)if(n<o){if(1!=i.nodeType)break;if(!to(i.childNodes[n],1))break;r=i,s=++n}else{if(io(i))break;{let e=i.nextSibling;for(;e&&to(e,1);)r=e.parentNode,s=br(e)+1,e=e.nextSibling;if(e)i=e,n=0,o=Xs(i);else{if(i=i.parentNode,i==t.dom)break;n=o=0}}}r&&no(t,r,s)}(t)}function io(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function no(t,e,i){if(3!=e.nodeType){let t,n;(n=function(t,e){for(;t&&e==t.childNodes.length&&!Er(t);)e=br(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let i=t.childNodes[e];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;t=i,e=0}}(e,i))?(e=n,i=0):(t=function(t,e){for(;t&&!e&&!Er(t);)e=br(t),t=t.parentNode;for(;t&&e;){let i=t.childNodes[e-1];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;e=(t=i).childNodes.length}}(e,i))&&(e=t,i=t.nodeValue.length)}let n=t.domSelection();if(!n)return;if(Cr(n)){let t=document.createRange();t.setEnd(e,i),t.setStart(e,i),n.removeAllRanges(),n.addRange(t)}else n.extend&&n.extend(e,i);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&Hs(t)},50)}function ro(t,e){let i=t.state.doc.resolve(e);if(!Pr&&!Vr&&i.parent.inlineContent){let n=t.coordsAtPos(e);if(e>i.start()){let i=t.coordsAtPos(e-1),r=(i.top+i.bottom)/2;if(r>n.top&&r<n.bottom&&Math.abs(i.left-n.left)>1)return i.left<n.left?"ltr":"rtl"}if(e<i.end()){let i=t.coordsAtPos(e+1),r=(i.top+i.bottom)/2;if(r>n.top&&r<n.bottom&&Math.abs(i.left-n.left)>1)return i.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function so(t,e,i){let n=t.state.selection;if(n instanceof Xn&&!n.empty||i.indexOf("s")>-1)return 0;if(qr&&i.indexOf("m")>-1)return 0;let{$from:r,$to:s}=n;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Qs(t.state,e);if(i&&i instanceof er)return Ys(t,i)}if(!r.parent.inlineContent){let i=e<0?r:s,o=n instanceof nr?Gn.near(i,e):Gn.findFrom(i,e);return o?Ys(t,o):0}return 0}function oo(t,e){if(!(t.state.selection instanceof Xn))return 1;let{$head:i,$anchor:n,empty:r}=t.state.selection;if(!i.sameParent(n))return 1;if(!r)return 0;if(t.endOfTextblock(e>0?"forward":"backward"))return 1;let s=!i.textOffset&&(e<0?i.nodeBefore:i.nodeAfter);if(s&&!s.isText){let n=t.state.tr;return e<0?n.delete(i.pos-s.nodeSize,i.pos):n.delete(i.pos,i.pos+s.nodeSize),t.dispatch(n),1}return 0}function lo(t,e,i){t.domObserver.stop(),e.contentEditable=i,t.domObserver.start()}function ao(t,e){t.someProp("transformCopied",i=>{e=i(e,t)});let i=[],{content:n,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&1==n.childCount&&1==n.firstChild.childCount;){r--,s--;let t=n.firstChild;i.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),n=t.content}let o=t.someProp("clipboardSerializer")||Zi.fromSchema(t.state.schema),l=wo(),a=l.createElement("div");a.appendChild(o.serializeFragment(n,{document:l}));let u,h=a.firstChild,c=0;for(;h&&1==h.nodeType&&(u=yo[h.nodeName.toLowerCase()]);){for(let t=u.length-1;t>=0;t--){let e=l.createElement(u[t]);for(;a.firstChild;)e.appendChild(a.firstChild);a.appendChild(e),c++}h=a.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${r} ${s}${c?` -${c}`:""} ${JSON.stringify(i)}`),{dom:a,text:t.someProp("clipboardTextSerializer",i=>i(e,t))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function uo(t,e,i,n,r){let s,o,l=r.parent.type.spec.code;if(!i&&!e)return null;let a=!!e&&(n||l||!i);if(a){if(t.someProp("transformPastedText",i=>{e=i(e,l||n,t)}),l)return o=new ni(Ye.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",e=>{o=e(o,t,1)}),o;let i=t.someProp("clipboardTextParser",i=>i(e,r,n,t));if(i)o=i;else{let i=r.marks(),{schema:n}=t.state,o=Zi.fromSchema(n);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(t=>{let e=s.appendChild(document.createElement("p"));t&&e.appendChild(o.serializeNode(n.text(t,i)))})}}else t.someProp("transformPastedHTML",e=>{i=e(i,t)}),s=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let i,n=wo().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t);if((i=r&&yo[r[1].toLowerCase()])&&(t=i.map(t=>"<"+t+">").join("")+t+i.map(t=>"</"+t+">").reverse().join("")),n.innerHTML=function(t){let e=window.trustedTypes;return e?(vo||(vo=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),vo.createHTML(t)):t}(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}(i),Kr&&function(t){let e=t.querySelectorAll(Pr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<e.length;i++){let n=e[i];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}(s);let u=s&&s.querySelector("[data-pm-slice]"),h=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let c=+h[3];c>0;c--){let t=s.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;s=t}if(!o){let e=t.someProp("clipboardParser")||t.someProp("domParser")||Ui.fromSchema(t.state.schema);o=e.parseSlice(s,{preserveWhitespace:!(!a&&!h),context:r,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||ho.test(t.parentNode.nodeName)?null:{ignore:1}})}if(h)o=function(t,e){if(!t.size)return t;let i,n=t.content.firstChild.type.schema;try{i=JSON.parse(e)}catch(l){return t}let{content:r,openStart:s,openEnd:o}=t;for(let a=i.length-2;a>=0;a-=2){let t=n.nodes[i[a]];if(!t||t.hasRequiredAttrs())break;r=Ye.from(t.create(i[a+1],r)),s++,o++}return new ni(r,s,o)}(go(o,+h[1],+h[2]),h[4]);else if(o=ni.maxOpen(function(t,e){if(t.childCount<2)return t;for(let i=e.depth;i>=0;i--){let n,r=e.node(i).contentMatchAt(e.index(i)),s=[];if(t.forEach(t=>{if(!s)return;let e,i=r.findWrapping(t.type);if(!i)return s=null;if(e=s.length&&n.length&&fo(i,n,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=po(s[s.length-1],n.length));let e=co(t,i);s.push(e),r=r.matchType(e.type),n=i}}),s)return Ye.from(s)}return t}(o.content,r),1),o.openStart||o.openEnd){let t=0,e=0;for(let i=o.content.firstChild;t<o.openStart&&!i.type.spec.isolating;t++,i=i.firstChild);for(let i=o.content.lastChild;e<o.openEnd&&!i.type.spec.isolating;e++,i=i.lastChild);o=go(o,t,e)}return t.someProp("transformPasted",e=>{o=e(o,t,a)}),o}const ho=/^(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 co(t,e,i=0){for(let n=e.length-1;n>=i;n--)t=e[n].create(null,Ye.from(t));return t}function fo(t,e,i,n,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let s=fo(t,e,i,n.lastChild,r+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(r==t.length-1?i.type:t[r+1]))return n.copy(n.content.append(Ye.from(co(i,t,r+1))))}}function po(t,e){if(0==e)return t;let i=t.content.replaceChild(t.childCount-1,po(t.lastChild,e-1)),n=t.contentMatchAt(t.childCount).fillBefore(Ye.empty,1);return t.copy(i.append(n))}function mo(t,e,i,n,r,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),r<n-1&&(l=mo(l,e,i,n,r+1,s)),r>=i&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=r).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(Ye.empty,1))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function go(t,e,i){return e<t.openStart&&(t=new ni(mo(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),i<t.openEnd&&(t=new ni(mo(t.content,1,i,t.openEnd,0,0),t.openStart,i)),t}const yo={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 bo=null;function wo(){return bo||(bo=document.implementation.createHTMLDocument("title"))}let vo=null;const ko={},xo={},Mo={touchstart:1,touchmove:1};class So{constructor(){this.shiftKey=0,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=0,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 To(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Eo(t){t.someProp("handleDOMEvents",e=>{for(let i in e)t.input.eventHandlers[i]||t.dom.addEventListener(i,t.input.eventHandlers[i]=e=>Co(t,e))})}function Co(t,e){return t.someProp("handleDOMEvents",i=>{let n=i[e.type];return n?n(t,e)||e.defaultPrevented:0})}function Oo(t,e){if(!e.bubbles)return 1;if(e.defaultPrevented)return 0;for(let i=e.target;i!=t.dom;i=i.parentNode)if(!i||11==i.nodeType||i.pmViewDesc&&i.pmViewDesc.stopEvent(e))return 0;return 1}function Ao(t){return{left:t.clientX,top:t.clientY}}function $o(t,e,i,n,r){if(-1==n)return 0;let s=t.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,e=>o>s.depth?e(t,i,s.nodeAfter,s.before(o),r,1):e(t,i,s.node(o),s.before(o),r,0)))return 1;return 0}function Ro(t,e,i){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",1),t.dispatch(n)}function Lo(t,e,i,n){return $o(t,"handleDoubleClickOn",e,i,n)||t.someProp("handleDoubleClick",i=>i(t,e,n))}function Bo(t,e,i,n){return $o(t,"handleTripleClickOn",e,i,n)||t.someProp("handleTripleClick",i=>i(t,e,n))||function(t,e,i){if(0!=i.button)return 0;let n=t.state.doc;if(-1==e)return n.inlineContent?(Ro(t,Xn.create(n,0,n.content.size)),1):0;let r=n.resolve(e);for(let s=r.depth+1;s>0;s--){let e=s>r.depth?r.nodeAfter:r.node(s),i=r.before(s);if(e.inlineContent)Ro(t,Xn.create(n,i+1,i+1+e.content.size));else{if(!er.isSelectable(e))continue;Ro(t,er.create(n,i))}return 1}}(t,i,n)}function Io(t){return jo(t)}xo.keydown=(t,e)=>{let i=e;if(t.input.shiftKey=16==i.keyCode||i.shiftKey,!_o(t,i)&&(t.input.lastKeyCode=i.keyCode,t.input.lastKeyCodeTime=Date.now(),!Fr||!Pr||13!=i.keyCode))if(229!=i.keyCode&&t.domObserver.forceFlush(),!Ur||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)t.someProp("handleKeyDown",e=>e(t,i))||function(t,e){let i=e.keyCode,n=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==i||qr&&72==i&&"c"==n)return oo(t,-1)||eo(t,-1);if(46==i&&!e.shiftKey||qr&&68==i&&"c"==n)return oo(t,1)||eo(t,1);if(13==i||27==i)return 1;if(37==i||qr&&66==i&&"c"==n){let e=37==i?"ltr"==ro(t,t.state.selection.from)?-1:1:-1;return Zs(t,e,n)||eo(t,e)}if(39==i||qr&&70==i&&"c"==n){let e=39==i?"ltr"==ro(t,t.state.selection.from)?1:-1:1;return Zs(t,e,n)||eo(t,e)}return 38==i||qr&&80==i&&"c"==n?so(t,-1,n)||eo(t,-1):40==i||qr&&78==i&&"c"==n?function(t){if(!jr||t.state.selection.$head.parentOffset>0)return 0;let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(e&&1==e.nodeType&&0==i&&e.firstChild&&"false"==e.firstChild.contentEditable){let i=e.firstChild;lo(t,i,"true"),setTimeout(()=>lo(t,i,"false"),20)}return 0}(t)||so(t,1,n)||eo(t,1):n!=(qr?"m":"c")||66!=i&&73!=i&&89!=i&&90!=i?0:1}(t,i)?i.preventDefault():To(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",e=>e(t,Or(13,"Enter"))),t.input.lastIOSEnter=0)},200)}},xo.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=0)},xo.keypress=(t,e)=>{let i=e;if(_o(t,i)||!i.charCode||i.ctrlKey&&!i.altKey||qr&&i.metaKey)return;if(t.someProp("handleKeyPress",e=>e(t,i)))return void i.preventDefault();let n=t.state.selection;if(!(n instanceof Xn&&n.$from.sameParent(n.$to))){let e=String.fromCharCode(i.charCode),r=()=>t.state.tr.insertText(e).scrollIntoView();/[\r\n]/.test(e)||t.someProp("handleTextInput",i=>i(t,n.$from.pos,n.$to.pos,e,r))||t.dispatch(r()),i.preventDefault()}};const No=qr?"metaKey":"ctrlKey";ko.mousedown=(t,e)=>{let i=e;t.input.shiftKey=i.shiftKey;let n=Io(t),r=Date.now(),s="singleClick";r-t.input.lastClick.time<500&&function(t,e){let i=e.x-t.clientX,n=e.y-t.clientY;return i*i+n*n<100}(i,t.input.lastClick)&&!i[No]&&t.input.lastClick.button==i.button&&("singleClick"==t.input.lastClick.type?s="doubleClick":"doubleClick"==t.input.lastClick.type&&(s="tripleClick")),t.input.lastClick={time:r,x:i.clientX,y:i.clientY,type:s,button:i.button};let o=t.posAtCoords(Ao(i));o&&("singleClick"==s?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Do(t,o,i,!!n)):("doubleClick"==s?Lo:Bo)(t,o.pos,o.inside,i)?i.preventDefault():To(t,"pointer"))};class Do{constructor(t,e,i,n){let r,s;if(this.view=t,this.pos=e,this.event=i,this.flushed=n,this.delayedSelectionSync=0,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!i[No],this.allowDefault=i.shiftKey,e.inside>-1)r=t.state.doc.nodeAt(e.inside),s=e.inside;else{let i=t.state.doc.resolve(e.pos);r=i.parent,s=i.depth?i.before():0}const o=n?null:i.target,l=o?t.docView.nearestDesc(o,1):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=t.state;(0==i.button&&r.type.spec.draggable&&0!=r.type.spec.selectable||a instanceof er&&a.from<=s&&a.to>s)&&(this.mightDrag={node:r,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!_r||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=1),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),To(t,"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(()=>Hs(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Ao(t))),this.updateAllowDefault(t),this.allowDefault||!e?To(this.view,"pointer"):function(t,e,i,n,r){return $o(t,"handleClickOn",e,i,n)||t.someProp("handleClick",i=>i(t,e,n))||(r?function(t,e){if(-1==e)return 0;let i,n,r=t.state.selection;r instanceof er&&(i=r.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let t=o>s.depth?s.nodeAfter:s.node(o);if(er.isSelectable(t)){n=i&&r.$from.depth>0&&o>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos?s.before(r.$from.depth):s.before(o);break}}return null!=n?(Ro(t,er.create(t.state.doc,n)),1):0}(t,i):function(t,e){if(-1==e)return 0;let i=t.state.doc.resolve(e),n=i.nodeAfter;return n&&n.isAtom&&er.isSelectable(n)?(Ro(t,new er(i)),1):0}(t,i))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||jr&&this.mightDrag&&!this.mightDrag.node.isAtom||Pr&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Ro(this.view,Gn.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):To(this.view,"pointer")}move(t){this.updateAllowDefault(t),To(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=1)}}function _o(t,e){return t.composing?1:jr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,1):0}ko.touchstart=t=>{t.input.lastTouch=Date.now(),Io(t),To(t,"pointer")},ko.touchmove=t=>{t.input.lastTouch=Date.now(),To(t,"pointer")},ko.contextmenu=t=>Io(t);const zo=Fr?5e3:-1;function Po(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>jo(t),e))}function Ho(t){for(t.composing&&(t.input.composing=0,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",1,1),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function jo(t,e=0){if(!(Fr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ho(t),e||t.docView&&t.docView.dirty){let i=zs(t),n=t.state.selection;return i&&!i.eq(n)?t.dispatch(t.state.tr.setSelection(i)):!t.markCursor&&!e||n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),1}return 0}}xo.compositionstart=xo.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,i=e.selection.$to;if(e.selection instanceof Xn&&(e.storedMarks||!i.textOffset&&i.parentOffset&&i.nodeBefore.marks.some(t=>0==t.type.spec.inclusive)))t.markCursor=t.state.storedMarks||i.marks(),jo(t,1),t.markCursor=null;else if(jo(t,!e.selection.empty),_r&&e.selection.empty&&i.parentOffset&&!i.textOffset&&i.nodeBefore.marks.length){let e=t.domSelectionRange();for(let i=e.focusNode,n=e.focusOffset;i&&1==i.nodeType&&0!=n;){let e=n<0?i.lastChild:i.childNodes[n-1];if(!e)break;if(3==e.nodeType){let i=t.domSelection();i&&i.collapse(e,e.nodeValue.length);break}i=e,n=-1}}t.input.composing=1}Po(t,zo)},xo.compositionend=(t,e)=>{t.composing&&(t.input.composing=0,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++,Po(t,20))};const Uo=Nr&&Dr<15||Ur&&Jr<604;function qo(t,e,i,n,r){let s=uo(t,e,i,n,t.state.selection.$from);if(t.someProp("handlePaste",e=>e(t,r,s||ni.empty)))return 1;if(!s)return 0;let o=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),l=o?t.state.tr.replaceSelectionWith(o,n):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",1).setMeta("uiEvent","paste")),1}function Vo(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let i=t.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):""}ko.copy=xo.cut=(t,e)=>{let i=e,n=t.state.selection,r="cut"==i.type;if(n.empty)return;let s=Uo?null:i.clipboardData,o=n.content(),{dom:l,text:a}=ao(t,o);s?(i.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):function(t,e){if(!t.dom.parentNode)return;let i=t.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(e),i.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),n.removeAllRanges(),n.addRange(r),setTimeout(()=>{i.parentNode&&i.parentNode.removeChild(i),t.focus()},50)}(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},xo.paste=(t,e)=>{let i=e;if(t.composing&&!Fr)return;let n=Uo?null:i.clipboardData,r=t.input.shiftKey&&45!=t.input.lastKeyCode;n&&qo(t,Vo(n),n.getData("text/html"),r,i)?i.preventDefault():function(t,e){if(!t.dom.parentNode)return;let i=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let r=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),i?qo(t,n.value,null,r,e):qo(t,n.textContent,n.innerHTML,r,e)},50)}(t,i)};class Fo{constructor(t,e,i){this.slice=t,this.move=e,this.node=i}}const Ko=qr?"altKey":"ctrlKey";function Jo(t,e){let i=t.someProp("dragCopies",t=>!t(e));return null!=i?i:!e[Ko]}ko.dragstart=(t,e)=>{let i=e,n=t.input.mouseDown;if(n&&n.done(),!i.dataTransfer)return;let r,s=t.state.selection,o=s.empty?null:t.posAtCoords(Ao(i));if(o&&o.pos>=s.from&&o.pos<=(s instanceof er?s.to-1:s.to));else if(n&&n.mightDrag)r=er.create(t.state.doc,n.mightDrag.pos);else if(i.target&&1==i.target.nodeType){let e=t.docView.nearestDesc(i.target,1);e&&e.node.type.spec.draggable&&e!=t.docView&&(r=er.create(t.state.doc,e.posBefore))}let l=(r||t.state.selection).content(),{dom:a,text:u,slice:h}=ao(t,l);(!i.dataTransfer.files.length||!Pr||Hr>120)&&i.dataTransfer.clearData(),i.dataTransfer.setData(Uo?"Text":"text/html",a.innerHTML),i.dataTransfer.effectAllowed="copyMove",Uo||i.dataTransfer.setData("text/plain",u),t.dragging=new Fo(h,Jo(t,i),r)},ko.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},xo.dragover=xo.dragenter=(t,e)=>e.preventDefault(),xo.drop=(t,e)=>{let i=e,n=t.dragging;if(t.dragging=null,!i.dataTransfer)return;let r=t.posAtCoords(Ao(i));if(!r)return;let s=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",e=>{o=e(o,t,0)}):o=uo(t,Vo(i.dataTransfer),Uo?null:i.dataTransfer.getData("text/html"),0,s);let l=!(!n||!Jo(t,i));if(t.someProp("handleDrop",e=>e(t,i,o||ni.empty,l)))return void i.preventDefault();if(!o)return;i.preventDefault();let a=o?Ln(t.state.doc,s.pos,o):s.pos;null==a&&(a=s.pos);let u=t.state.tr;if(l){let{node:t}=n;t?t.replace(u):u.deleteSelection()}let h=u.mapping.map(a),c=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,d=u.doc;if(c?u.replaceRangeWith(h,h,o.content.firstChild):u.replaceRange(h,h,o),u.doc.eq(d))return;let f=u.doc.resolve(h);if(c&&er.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new er(f));else{let e=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((t,i,n,r)=>e=r),u.setSelection(Js(t,f,u.doc.resolve(e)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))},ko.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=1,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Hs(t)},20))},ko.blur=(t,e)=>{let i=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),i.relatedTarget&&t.dom.contains(i.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=0)},ko.beforeinput=(t,e)=>{if(Pr&&Fr&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",e=>e(t,Or(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 os in xo)ko[os]=xo[os];function Wo(t,e){if(t==e)return 1;for(let i in t)if(t[i]!==e[i])return 0;for(let i in e)if(!(i in t))return 0;return 1}class Go{constructor(t,e){this.toDOM=t,this.spec=e||tl,this.side=this.spec.side||0}map(t,e,i,n){let{pos:r,deleted:s}=t.mapResult(e.from+n,this.side<0?-1:1);return s?null:new Zo(r-i,r-i,this)}valid(){return 1}eq(t){return this==t||t instanceof Go&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Wo(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Qo{constructor(t,e){this.attrs=t,this.spec=e||tl}map(t,e,i,n){let r=t.map(e.from+n,this.spec.inclusiveStart?-1:1)-i,s=t.map(e.to+n,this.spec.inclusiveEnd?1:-1)-i;return r>=s?null:new Zo(r,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Qo&&Wo(this.attrs,t.attrs)&&Wo(this.spec,t.spec)}static is(t){return t.type instanceof Qo}destroy(){}}class Yo{constructor(t,e){this.attrs=t,this.spec=e||tl}map(t,e,i,n){let r=t.mapResult(e.from+n,1);if(r.deleted)return null;let s=t.mapResult(e.to+n,-1);return s.deleted||s.pos<=r.pos?null:new Zo(r.pos-i,s.pos-i,this)}valid(t,e){let i,{index:n,offset:r}=t.content.findIndex(e.from);return r==e.from&&!(i=t.child(n)).isText&&r+i.nodeSize==e.to}eq(t){return this==t||t instanceof Yo&&Wo(this.attrs,t.attrs)&&Wo(this.spec,t.spec)}destroy(){}}class Zo{constructor(t,e,i){this.from=t,this.to=e,this.type=i}copy(t,e){return new Zo(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,i){return this.type.map(t,this,e,i)}static widget(t,e,i){return new Zo(t,t,new Go(e,i))}static inline(t,e,i,n){return new Zo(t,e,new Qo(i,n))}static node(t,e,i,n){return new Zo(t,e,new Yo(i,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Qo}get widget(){return this.type instanceof Go}}const Xo=[],tl={};class el{constructor(t,e){this.local=t.length?t:Xo,this.children=e.length?e:Xo}static create(t,e){return e.length?ll(e,t,0,tl):il}find(t,e,i){let n=[];return this.findInner(null==t?0:t,null==e?1e9:e,n,0,i),n}findInner(t,e,i,n,r){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=e&&o.to>=t&&(!r||r(o.spec))&&i.push(o.copy(o.from+n,o.to+n))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let o=this.children[s]+1;this.children[s+2].findInner(t-o,e-o,i,n+o,r)}}map(t,e,i){return this==il||0==t.maps.length?this:this.mapInner(t,e,0,0,i||tl)}mapInner(t,e,i,n,r){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(t,i,n);l&&l.type.valid(e,l)?(s||(s=[])).push(l):r.onRemove&&r.onRemove(this.local[o].spec)}return this.children.length?function(t,e,i,n,r,s,o){let l=t.slice();for(let u=0,h=s;u<i.maps.length;u++){let t=0;i.maps[u].forEach((e,i,n,r)=>{let s=r-n-(i-e);for(let o=0;o<l.length;o+=3){let n=l[o+1];if(n<0||e>n+h-t)continue;let r=l[o]+h-t;i>=r?l[o+1]=e<=r?-2:-1:e>=h&&s&&(l[o]+=s,l[o+1]+=s)}t+=s}),h=i.maps[u].map(h,-1)}let a=0;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(-2==l[u+1]){a=1,l[u+1]=-1;continue}let e=i.map(t[u]+s),h=e-r;if(h<0||h>=n.content.size){a=1;continue}let c=i.map(t[u+1]+s,-1)-r,{index:d,offset:f}=n.content.findIndex(h),p=n.maybeChild(d);if(p&&f==h&&f+p.nodeSize==c){let n=l[u+2].mapInner(i,p,e+1,t[u]+s+1,o);n!=il?(l[u]=h,l[u+1]=c,l[u+2]=n):(l[u+1]=-2,a=1)}else a=1}if(a){let a=function(t,e,i,n,r,s,o){function l(t,e){for(let s=0;s<t.local.length;s++){let l=t.local[s].map(n,r,e);l?i.push(l):o.onRemove&&o.onRemove(t.local[s].spec)}for(let i=0;i<t.children.length;i+=3)l(t.children[i+2],t.children[i]+e+1)}for(let a=0;a<t.length;a+=3)-1==t[a+1]&&l(t[a+2],e[a]+s+1);return i}(l,t,e,i,r,s,o),u=ll(a,n,0,o);e=u.local;for(let t=0;t<l.length;t+=3)l[t+1]<0&&(l.splice(t,3),t-=3);for(let t=0,e=0;t<u.children.length;t+=3){let i=u.children[t];for(;e<l.length&&l[e]<i;)e+=3;l.splice(e,0,u.children[t],u.children[t+1],u.children[t+2])}}return new el(e.sort(al),l)}(this.children,s||[],t,e,i,n,r):s?new el(s.sort(al),Xo):il}add(t,e){return e.length?this==il?el.create(t,e):this.addInner(t,e,0):this}addInner(t,e,i){let n,r=0;t.forEach((t,s)=>{let o,l=s+i;if(o=sl(e,t,l)){for(n||(n=this.children.slice());r<n.length&&n[r]<s;)r+=3;n[r]==s?n[r+2]=n[r+2].addInner(t,o,l+1):n.splice(r,0,s,s+t.nodeSize,ll(o,t,l+1,tl)),r+=3}});let s=rl(r?ol(e):e,-i);for(let o=0;o<s.length;o++)s[o].type.valid(t,s[o])||s.splice(o--,1);return new el(s.length?this.local.concat(s).sort(al):this.local,n||this.children)}remove(t){return 0==t.length||this==il?this:this.removeInner(t,0)}removeInner(t,e){let i=this.children,n=this.local;for(let r=0;r<i.length;r+=3){let n,s=i[r]+e,o=i[r+1]+e;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>s&&e.to<o&&(t[i]=null,(n||(n=[])).push(e));if(!n)continue;i==this.children&&(i=this.children.slice());let l=i[r+2].removeInner(n,s+1);l!=il?i[r+2]=l:(i.splice(r,3),r-=3)}if(n.length)for(let r,s=0;s<t.length;s++)if(r=t[s])for(let t=0;t<n.length;t++)n[t].eq(r,e)&&(n==this.local&&(n=this.local.slice()),n.splice(t--,1));return i==this.children&&n==this.local?this:n.length||i.length?new el(n,i):il}forChild(t,e){if(this==il)return this;if(e.isLeaf)return el.empty;let i,n;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(i=this.children[o+2]);break}let r=t+1,s=r+e.content.size;for(let o=0;o<this.local.length;o++){let t=this.local[o];if(t.from<s&&t.to>r&&t.type instanceof Qo){let e=Math.max(r,t.from)-r,i=Math.min(s,t.to)-r;e<i&&(n||(n=[])).push(t.copy(e,i))}}if(n){let t=new el(n.sort(al),Xo);return i?new nl([t,i]):t}return i||il}eq(t){if(this==t)return 1;if(!(t instanceof el)||this.local.length!=t.local.length||this.children.length!=t.children.length)return 0;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return 0;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return 0;return 1}locals(t){return ul(this.localsInner(t))}localsInner(t){if(this==il)return Xo;if(t.inlineContent||!this.local.some(Qo.is))return this.local;let e=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Qo||e.push(this.local[i]);return e}forEachSet(t){t(this)}}el.empty=new el([],[]),el.removeOverlap=ul;const il=el.empty;class nl{constructor(t){this.members=t}map(t,e){const i=this.members.map(i=>i.map(t,e,tl));return nl.from(i)}forChild(t,e){if(e.isLeaf)return el.empty;let i=[];for(let n=0;n<this.members.length;n++){let r=this.members[n].forChild(t,e);r!=il&&(r instanceof nl?i=i.concat(r.members):i.push(r))}return nl.from(i)}eq(t){if(!(t instanceof nl)||t.members.length!=this.members.length)return 0;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return 0;return 1}locals(t){let e,i=1;for(let n=0;n<this.members.length;n++){let r=this.members[n].localsInner(t);if(r.length)if(e){i&&(e=e.slice(),i=0);for(let t=0;t<r.length;t++)e.push(r[t])}else e=r}return e?ul(i?e:e.sort(al)):Xo}static from(t){switch(t.length){case 0:return il;case 1:return t[0];default:return new nl(t.every(t=>t instanceof el)?t:t.reduce((t,e)=>t.concat(e instanceof el?e:e.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function rl(t,e){if(!e||!t.length)return t;let i=[];for(let n=0;n<t.length;n++){let r=t[n];i.push(new Zo(r.from+e,r.to+e,r.type))}return i}function sl(t,e,i){if(e.isLeaf)return null;let n=i+e.nodeSize,r=null;for(let s,o=0;o<t.length;o++)(s=t[o])&&s.from>i&&s.to<n&&((r||(r=[])).push(s),t[o]=null);return r}function ol(t){let e=[];for(let i=0;i<t.length;i++)null!=t[i]&&e.push(t[i]);return e}function ll(t,e,i,n){let r=[],s=0;e.forEach((e,o)=>{let l=sl(t,e,o+i);if(l){s=1;let t=ll(l,e,i+o+1,n);t!=il&&r.push(o,o+e.nodeSize,t)}});let o=rl(s?ol(t):t,-i).sort(al);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(n.onRemove&&n.onRemove(o[l].spec),o.splice(l--,1));return o.length||r.length?new el(o,r):il}function al(t,e){return t.from-e.from||t.to-e.to}function ul(t){let e=t;for(let i=0;i<e.length-1;i++){let n=e[i];if(n.from!=n.to)for(let r=i+1;r<e.length;r++){let s=e[r];if(s.from!=n.from){s.from<n.to&&(e==t&&(e=t.slice()),e[i]=n.copy(n.from,s.from),hl(e,r,n.copy(s.from,n.to)));break}s.to!=n.to&&(e==t&&(e=t.slice()),e[r]=s.copy(s.from,n.to),hl(e,r+1,s.copy(n.to,s.to)))}}return e}function hl(t,e,i){for(;e<t.length&&al(i,t[e])>0;)e++;t.splice(e,0,i)}function cl(t){let e=[];return t.someProp("decorations",i=>{let n=i(t.state);n&&n!=il&&e.push(n)}),t.cursorWrapper&&e.push(el.create(t.state.doc,[t.cursorWrapper.deco])),nl.from(e)}const dl={childList:1,characterData:1,characterDataOldValue:1,attributes:1,attributeOldValue:1,subtree:1},fl=Nr&&Dr<=11;class pl{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ml{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new pl,this.onCharData=null,this.suppressingSelectionUpdates=0,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Nr&&Dr<=11&&t.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),fl&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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,dl)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);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=1,setTimeout(()=>this.suppressingSelectionUpdates=0,50)}onSelectionChange(){if(Ws(this.view)){if(this.suppressingSelectionUpdates)return Hs(this.view);if(Nr&&Dr<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&xr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return 1;let e,i=new Set;for(let r=t.focusNode;r;r=wr(r))i.add(r);for(let r=t.anchorNode;r;r=wr(r))if(i.has(r)){e=r;break}let n=e&&this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),1):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let i=t.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&Ws(t)&&!this.ignoreSelectionChange(i),r=-1,s=-1,o=0,l=[];if(t.editable)for(let u=0;u<e.length;u++){let t=this.registerMutation(e[u],l);t&&(r=r<0?t.from:Math.min(t.from,r),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(o=1))}if(_r&&l.length){let e=l.filter(t=>"BR"==t.nodeName);if(2==e.length){let[t,i]=e;t.parentNode&&t.parentNode.parentNode==i.parentNode?i.remove():t.remove()}else{let{focusNode:i}=this.currentSelection;for(let n of e){let e=n.parentNode;!e||"LI"!=e.nodeName||i&&wl(t,i)==e||n.remove()}}}let a=null;r<0&&n&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Cr(i)&&(a=zs(t))&&a.eq(Gn.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Hs(t),this.currentSelection.set(i),t.scrollToSelection()):(r>-1||n)&&(r>-1&&(t.docView.markDirty(r,s),function(t){if(!gl.has(t)&&(gl.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=_r,yl)return;yl=1}}(t)),this.handleDOMChange(r,s,o,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(i)||Hs(t),this.currentSelection.set(i))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let i=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(i==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!i||i.ignoreMutation(t))return null;if("childList"==t.type){for(let i=0;i<t.addedNodes.length;i++){let n=t.addedNodes[i];e.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(t.target))return{from:i.posBefore,to:i.posAfter};let n=t.previousSibling,r=t.nextSibling;if(Nr&&Dr<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:i,nextSibling:s}=t.addedNodes[e];(!i||[].indexOf.call(t.addedNodes,i)<0)&&(n=i),(!s||[].indexOf.call(t.addedNodes,s)<0)&&(r=s)}let s=n&&n.parentNode==t.target?br(n)+1:0,o=i.localPosFromDOM(t.target,s,-1),l=r&&r.parentNode==t.target?br(r):t.target.childNodes.length;return{from:o,to:i.localPosFromDOM(t.target,l,1)}}return"attributes"==t.type?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=t.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let gl=new WeakMap,yl=0;function bl(t,e){let i=e.startContainer,n=e.startOffset,r=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return xr(o.node,o.offset,r,s)&&([i,n,r,s]=[r,s,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}}function wl(t,e){for(let i=e.parentNode;i&&i!=t.dom;i=i.parentNode){let e=t.docView.nearestDesc(i,1);if(e&&e.node.isBlock)return i}return null}function vl(t){let e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(jr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||jr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:1}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:1};return null}const kl=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xl(t,e,i){return Math.max(i.anchor,i.head)>e.content.size?null:Js(t,e.resolve(i.anchor),e.resolve(i.head))}function Ml(t,e,i){let n=t.depth,r=e?t.end():t.pos;for(;n>0&&(e||t.indexAfter(n)==t.node(n).childCount);)n--,r++,e=0;if(i){let e=t.node(n).maybeChild(t.indexAfter(n));for(;e&&!e.isLeaf;)e=e.firstChild,r++}return r}function Sl(t){if(2!=t.length)return 0;let e=t.charCodeAt(0),i=t.charCodeAt(1);return e>=56320&&e<=57343&&i>=55296&&i<=56319}class Tl{constructor(t,e){this.S=null,this.focused=0,this.trackWrites=null,this.mounted=0,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new So,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=0,this.dragging=null,this.T=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach($l),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=1)),this.editable=Ol(this),Cl(this),this.nodeViews=Al(this),this.docView=xs(this.state.doc,El(this),cl(this),this.dom,this),this.domObserver=new ml(this,(t,e,i,n)=>function(t,e,i,n,r){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,i=zs(t,e);if(i&&!t.state.selection.eq(i)){if(Pr&&Fr&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",e=>e(t,Or(13,"Enter"))))return;let n=t.state.tr.setSelection(i);"pointer"==e?n.setMeta("pointer",1):"key"==e&&n.scrollIntoView(),s&&n.setMeta("composition",s),t.dispatch(n)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(i);e=o.before(l+1),i=t.state.doc.resolve(i).after(l+1);let a,u,h=t.state.selection,c=function(t,e,i){let n,{node:r,fromOffset:s,toOffset:o,from:l,to:a}=t.docView.parseRange(e,i),u=t.domSelectionRange(),h=u.anchorNode;if(h&&t.dom.contains(1==h.nodeType?h:h.parentNode)&&(n=[{node:h,offset:u.anchorOffset}],Cr(u)||n.push({node:u.focusNode,offset:u.focusOffset})),Pr&&8===t.input.lastKeyCode)for(let g=o;g>s;g--){let t=r.childNodes[g-1],e=t.pmViewDesc;if("BR"==t.nodeName&&!e){o=g;break}if(!e||e.size)break}let c=t.state.doc,d=t.someProp("domParser")||Ui.fromSchema(t.state.schema),f=c.resolve(l),p=null,m=d.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:1,from:s,to:o,preserveWhitespace:"pre"==f.parent.type.whitespace?"full":1,findPositions:n,ruleFromNode:vl,context:f});if(n&&null!=n[0].pos){let t=n[0].pos,e=n[1]&&n[1].pos;null==e&&(e=t),p={anchor:t+l,head:e+l}}return{doc:m,sel:p,from:l,to:a}}(t,e,i),d=t.state.doc,f=d.slice(c.from,c.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(a=t.state.selection.to,u="end"):(a=t.state.selection.from,u="start"),t.input.lastKeyCode=null;let p=function(t,e,i,n,r){let s=t.findDiffStart(e,i);if(null==s)return null;let{a:o,b:l}=t.findDiffEnd(e,i+t.size,i+e.size);if("end"==r&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&t.size<e.size){let t=n<=s&&n>=o?s-n:0;s-=t,s&&s<e.size&&Sl(e.textBetween(s-1,s+1))&&(s+=t?1:-1),l=s+(l-o),o=s}else if(l<s){let e=n<=s&&n>=l?s-n:0;s-=e,s&&s<t.size&&Sl(t.textBetween(s-1,s+1))&&(s+=e?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}(f.content,c.doc.content,c.from,a,u);if(p&&t.input.domChangeCount++,(Ur&&t.input.lastIOSEnter>Date.now()-225||Fr)&&r.some(t=>1==t.nodeType&&!kl.test(t.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",e=>e(t,Or(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(!p){if(!(n&&h instanceof Xn&&!h.empty&&h.$head.sameParent(h.$anchor))||t.composing||c.sel&&c.sel.anchor!=c.sel.head){if(c.sel){let e=xl(t,t.state.doc,c.sel);if(e&&!e.eq(t.state.selection)){let i=t.state.tr.setSelection(e);s&&i.setMeta("composition",s),t.dispatch(i)}}return}p={start:h.from,endA:h.to,endB:h.to}}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof Xn&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),Nr&&Dr<=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,g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),b=d.resolve(p.start),w=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=p.endA;if((Ur&&t.input.lastIOSEnter>Date.now()-225&&(!w||r.some(t=>"DIV"==t.nodeName||"P"==t.nodeName))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"",""))&&(m=Gn.findFrom(c.doc.resolve(g.pos+1),1,1))&&m.head>g.pos)&&t.someProp("handleKeyDown",e=>e(t,Or(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>p.start&&function(t,e,i,n,r){if(i-e<=r.pos-n.pos||Ml(n,1,0)<r.pos)return 0;let s=t.resolve(e);if(!n.parent.isTextblock){let t=s.nodeAfter;return null!=t&&i==e+t.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return 0;let o=t.resolve(Ml(s,1,1));return!o.parent.isTextblock||o.pos>i||Ml(o,1,0)<i?0:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(d,p.start,p.endA,g,y)&&t.someProp("handleKeyDown",e=>e(t,Or(8,"Backspace"))))return void(Fr&&Pr&&t.domObserver.suppressSelectionUpdates());Pr&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Fr&&!w&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(e){return e(t,Or(13,"Enter"))})},20));let v,k=p.start,x=p.endA,M=e=>{let i=e||t.state.tr.replace(k,x,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let e=xl(t,i.doc,c.sel);e&&!(Pr&&t.composing&&e.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==k||e.head==i.mapping.map(x)-1)||Nr&&e.empty&&e.head==k)&&i.setSelection(e)}return s&&i.setMeta("composition",s),i.scrollIntoView()};if(w){if(g.pos==y.pos){Nr&&Dr<=11&&0==g.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Hs(t),20));let e=M(t.state.tr.delete(k,x)),i=d.resolve(p.start).marksAcross(d.resolve(p.endA));i&&e.ensureMarks(i),t.dispatch(e)}else if(p.endA==p.endB&&(v=function(t,e){let i,n,r,s=t.firstChild.marks,o=e.firstChild.marks,l=s,a=o;for(let h=0;h<o.length;h++)l=o[h].removeFromSet(l);for(let h=0;h<s.length;h++)a=s[h].removeFromSet(a);if(1==l.length&&0==a.length)n=l[0],i="add",r=t=>t.mark(n.addToSet(t.marks));else{if(0!=l.length||1!=a.length)return null;n=a[0],i="remove",r=t=>t.mark(n.removeFromSet(t.marks))}let u=[];for(let h=0;h<e.childCount;h++)u.push(r(e.child(h)));if(Ye.from(u).eq(t))return{mark:n,type:i}}(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let e=M(t.state.tr);"add"==v.type?e.addMark(k,x,v.mark):e.removeMark(k,x,v.mark),t.dispatch(e)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let e=g.parent.textBetween(g.parentOffset,y.parentOffset),i=()=>M(t.state.tr.insertText(e,k,x));t.someProp("handleTextInput",n=>n(t,k,x,e,i))||t.dispatch(i())}}else t.dispatch(M())}(this,t,e,i,n)),this.domObserver.start(),function(t){for(let e in ko){let i=ko[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!Oo(t,e)||Co(t,e)||!t.editable&&e.type in xo||i(t,e)},Mo[e]?{passive:1}:void 0)}jr&&t.dom.addEventListener("input",()=>null),Eo(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this.T.state!=this.state){let t=this.T;this.T={};for(let e in t)this.T[e]=t[e];this.T.state=this.state}return this.T}update(t){t.handleDOMEvents!=this.T.handleDOMEvents&&Eo(this);let e=this.T;this.T=t,t.plugins&&(t.plugins.forEach($l),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let i in this.T)e[i]=this.T[i];e.state=this.state;for(let i in t)e[i]=t[i];this.update(e)}updateState(t){this.updateStateInner(t,this.T)}updateStateInner(t,e){var i;let n=this.state,r=0,s=0;t.storedMarks&&this.composing&&(Ho(this),s=1),this.state=t;let o=n.plugins!=t.plugins||this.T.plugins!=e.plugins;if(o||this.T.plugins!=e.plugins||this.T.nodeViews!=e.nodeViews){let t=Al(this);(function(t,e){let i=0,n=0;for(let r in t){if(t[r]!=e[r])return 1;i++}for(let r in e)n++;return i!=n})(t,this.nodeViews)&&(this.nodeViews=t,r=1)}(o||e.handleDOMEvents!=this.T.handleDOMEvents)&&Eo(this),this.editable=Ol(this),Cl(this);let l=cl(this),a=El(this),u=n.plugins==t.plugins||n.doc.eq(t.doc)?t.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",h=r||!this.docView.matchesNode(t.doc,a,l);!h&&t.selection.eq(n.selection)||(s=1);let c="preserve"==u&&s&&null==this.dom.style.overflowAnchor&&function(t){let e,i,n=t.dom.getBoundingClientRect(),r=Math.max(0,n.top);for(let s=(n.left+n.right)/2,o=r+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=t.root.elementFromPoint(s,o);if(!n||n==t.dom||!t.dom.contains(n))continue;let l=n.getBoundingClientRect();if(l.top>=r-20){e=n,i=l.top;break}}return{refDOM:e,refTop:i,stack:Zr(t.dom)}}(this);if(s){this.domObserver.stop();let e=h&&(Nr||Pr)&&!this.composing&&!n.selection.empty&&!t.selection.empty&&function(t,e){let i=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(i)!=e.$anchor.start(i)}(n.selection,t.selection);if(h){let i=Pr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let i=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=Tr(t=t.childNodes[e-1])}else{if(!t.parentNode||Er(t))return null;e=br(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),n=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0}else{if(!t.parentNode||Er(t))return null;e=br(t)+1,t=t.parentNode}}}(e.focusNode,e.focusOffset);if(i&&n&&i!=n){let e=n.pmViewDesc,r=t.domObserver.lastChangedTextNode;if(i==r||n==r)return r;if(!e||!e.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let t=i.pmViewDesc;if(t&&t.isText(i.nodeValue))return n}}return i||n}(this)),!r&&this.docView.update(t.doc,a,l,this)||(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=xs(t.doc,a,l,this.dom,this)),i&&!this.trackWrites&&(e=1)}e||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),i=t.domSelectionRange();return xr(e.node,e.offset,i.anchorNode,i.anchorOffset)}(this))?Hs(this,e):(Fs(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),(null===(i=this.dragging)||void 0===i?void 0:i.node)&&!n.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,n),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():c&&function({refDOM:t,refTop:e,stack:i}){let n=t?t.getBoundingClientRect().top:0;Xr(i,0==n?0:n-e)}(c)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",t=>t(this)));else if(this.state.selection instanceof er){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&Yr(this,e.getBoundingClientRect(),t)}else Yr(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let i=this.pluginViews[e];i.update&&i.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(t,e){let i=t.node,n=-1;if(this.state.doc.nodeAt(i.from)==i.node)n=i.from;else{let t=i.from+(this.state.doc.content.size-e.doc.content.size);(t>0&&this.state.doc.nodeAt(t))==i.node&&(n=t)}this.dragging=new Fo(t.slice,t.move,n<0?void 0:er.create(this.state.doc,n))}someProp(t,e){let i,n=this.T&&this.T[t];if(null!=n&&(i=e?e(n):n))return i;for(let s=0;s<this.directPlugins.length;s++){let n=this.directPlugins[s].props[t];if(null!=n&&(i=e?e(n):n))return i}let r=this.state.plugins;if(r)for(let s=0;s<r.length;s++){let n=r[s].props[t];if(null!=n&&(i=e?e(n):n))return i}}hasFocus(){if(Nr){let t=this.root.activeElement;if(t==this.dom)return 1;if(!t||!this.dom.contains(t))return 0;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return 0;t=t.parentElement}return 1}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(ts)return t.focus(ts);let e=Zr(t);t.focus(null==ts?{get preventScroll(){return ts={preventScroll:1},1}}:void 0),ts||(ts=0,Xr(e,0))}(this.dom),Hs(this),this.domObserver.start()}get root(){let t=this.S;if(null==t)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this.S=e;return t||document}updateRoot(){this.S=null}posAtCoords(t){return rs(this,t)}coordsAtPos(t,e=1){return us(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,i=-1){let n=this.docView.posFromDOM(t,e,i);if(null==n)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(t,e){return function(t,e,i){return ps==e&&ms==i?gs:(ps=e,ms=i,gs="up"==i||"down"==i?function(t,e,i){let n=e.selection,r="up"==i?n.$from:n.$to;return ds(t,e,()=>{let{node:e}=t.docView.domFromPos(r.pos,"up"==i?-1:1);for(;;){let i=t.docView.nearestDesc(e,1);if(!i)break;if(i.node.isBlock){e=i.contentDOM||i.dom;break}e=i.dom.parentNode}let n=us(t,r.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=kr(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let r=e[t];if(r.bottom>r.top+1&&("up"==i?n.top-r.top>2*(r.bottom-n.top):r.bottom-n.bottom>2*(n.bottom-r.top)))return 0}}return 1})}(t,e,i):function(t,e,i){let{$head:n}=e.selection;if(!n.parent.isTextblock)return 0;let r=n.parentOffset,s=!r,o=r==n.parent.content.size,l=t.domSelection();return l?fs.test(n.parent.textContent)&&l.modify?ds(t,e,()=>{let{focusNode:e,focusOffset:r,anchorNode:s,anchorOffset:o}=t.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",i,"character");let u=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:h,focusOffset:c}=t.domSelectionRange(),d=h&&!u.contains(1==h.nodeType?h:h.parentNode)||e==h&&r==c;try{l.collapse(s,o),e&&(e!=s||r!=o)&&l.extend&&l.extend(e,r)}catch(f){}return null!=a&&(l.caretBidiLevel=a),d}):"left"==i||"backward"==i?s:o:n.pos==n.start()||n.pos==n.end()}(t,e,i))}(this,e||this.state,t)}pasteHTML(t,e){return qo(this,"",t,0,e||new ClipboardEvent("paste"))}pasteText(t,e){return qo(this,t,null,1,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return ao(this,t)}destroy(){this.docView&&(function(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)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vr=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){Co(t,e)||!ko[e.type]||!t.editable&&e.type in xo||ko[e.type](t,e)}(this,t)}domSelectionRange(){let t=this.domSelection();return t?jr&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return bl(t,i)}let i;function n(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",n,1),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,1),i?bl(t,i):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function El(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",i=>{if("function"==typeof i&&(i=i(t.state)),i)for(let t in i)"class"==t?e.class+=" "+i[t]:"style"==t?e.style=(e.style?e.style+";":"")+i[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(i[t]))}),e.translate||(e.translate="no"),[Zo.node(0,t.state.doc.content.size,e)]}function Cl(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:Zo.widget(t.state.selection.from,e,{raw:1,marks:t.markCursor})}}else t.cursorWrapper=null}function Ol(t){return!t.someProp("editable",e=>0==e(t.state))}function Al(t){let e=Object.create(null);function i(t){for(let i in t)({}).hasOwnProperty.call(e,i)||(e[i]=t[i])}return t.someProp("nodeViews",i),t.someProp("markViews",i),e}function $l(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")}Tl.prototype.dispatch=function(t){let e=this.T.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};for(var Rl={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:"'"},Ll={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Bl="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Il="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Nl=0;Nl<10;Nl++)Rl[48+Nl]=Rl[96+Nl]=String(Nl);for(Nl=1;Nl<=24;Nl++)Rl[Nl+111]="F"+Nl;for(Nl=65;Nl<=90;Nl++)Rl[Nl]=String.fromCharCode(Nl+32),Ll[Nl]=String.fromCharCode(Nl);for(var Dl in Rl)Ll.hasOwnProperty(Dl)||(Ll[Dl]=Rl[Dl]);const _l="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),zl="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function Pl(t){let e,i,n,r,s=t.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let l=0;l<s.length-1;l++){let t=s[l];if(/^(cmd|meta|m)$/i.test(t))r=1;else if(/^a(lt)?$/i.test(t))e=1;else if(/^(c|ctrl|control)$/i.test(t))i=1;else if(/^s(hift)?$/i.test(t))n=1;else{if(!/^mod$/i.test(t))throw new Error("Unrecognized modifier name: "+t);_l?r=1:i=1}}return e&&(o="Alt-"+o),i&&(o="Ctrl-"+o),r&&(o="Meta-"+o),n&&(o="Shift-"+o),o}function Hl(t,e,i=1){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i&&e.shiftKey&&(t="Shift-"+t),t}function jl(t){let e=function(t){let e=Object.create(null);for(let i in t)e[Pl(i)]=t[i];return e}(t);return function(t,i){let n,r=function(t){var e=!(Bl&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Il&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Ll:Rl)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(i),s=e[Hl(r,i)];if(s&&s(t.state,t.dispatch,t))return 1;if(1==r.length&&" "!=r){if(i.shiftKey){let n=e[Hl(r,i,0)];if(n&&n(t.state,t.dispatch,t))return 1}if((i.altKey||i.metaKey||i.ctrlKey)&&!(zl&&i.ctrlKey&&i.altKey)&&(n=Rl[i.keyCode])&&n!=r){let r=e[Hl(n,i)];if(r&&r(t.state,t.dispatch,t))return 1}}return 0}}function Ul(t,e){let{$cursor:i}=t.selection;return!i||(e?!e.endOfTextblock("backward",t):i.parentOffset>0)?null:i}function ql(t,e,i){let n=e.nodeBefore,r=e.pos-1;for(;!n.isTextblock;r--){if(n.type.spec.isolating)return 0;let t=n.lastChild;if(!t)return 0;n=t}let s=e.nodeAfter,o=e.pos+1;for(;!s.isTextblock;o++){if(s.type.spec.isolating)return 0;let t=s.firstChild;if(!t)return 0;s=t}let l=Bn(t.doc,r,o,ni.empty);if(!l||l.from!=r||l instanceof bn&&l.slice.size>=o-r)return 0;if(i){let e=t.tr.step(l);e.setSelection(Xn.create(e.doc,r)),i(e.scrollIntoView())}return 1}function Vl(t,e,i=0){for(let n=t;n;n="start"==e?n.firstChild:n.lastChild){if(n.isTextblock)return 1;if(i&&1!=n.childCount)return 0}return 0}function Fl(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 Kl(t,e){let{$cursor:i}=t.selection;return!i||(e?!e.endOfTextblock("forward",t):i.parentOffset<i.parent.content.size)?null:i}function Jl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let i=t.node(e);if(t.index(e)+1<i.childCount)return t.doc.resolve(t.after(e+1));if(i.type.spec.isolating)break}return null}function Wl(t){for(let e=0;e<t.edgeCount;e++){let{type:i}=t.edge(e);if(i.isTextblock&&!i.hasRequiredAttrs())return i}return null}function Gl(t,e,i,n){let r,s,o=e.nodeBefore,l=e.nodeAfter,a=o.type.spec.isolating||l.type.spec.isolating;if(!a&&function(t,e,i){let n=e.nodeBefore,r=e.nodeAfter,s=e.index();return n&&r&&n.type.compatibleContent(r.type)?!n.content.size&&e.parent.canReplace(s-1,s)?(i&&i(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),1):e.parent.canReplace(s,s+1)&&(r.isTextblock||An(t.doc,e.pos))?(i&&i(t.tr.join(e.pos).scrollIntoView()),1):0:0}(t,e,i))return 1;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(r=(s=o.contentMatchAt(o.childCount)).findWrapping(l.type))&&s.matchType(r[0]||l.type).validEnd){if(i){let n=e.pos+l.nodeSize,s=Ye.empty;for(let t=r.length-1;t>=0;t--)s=Ye.from(r[t].create(null,s));s=Ye.from(o.copy(s));let a=t.tr.step(new wn(e.pos-1,n,e.pos,n,new ni(s,1,0),r.length,1)),u=a.doc.resolve(n+2*r.length);u.nodeAfter&&u.nodeAfter.type==o.type&&An(a.doc,u.pos)&&a.join(u.pos),i(a.scrollIntoView())}return 1}let h=l.type.spec.isolating||n>0&&a?null:Gn.findFrom(e,1),c=h&&h.$from.blockRange(h.$to),d=c&&Mn(c);if(null!=d&&d>=e.depth)return i&&i(t.tr.lift(c,d).scrollIntoView()),1;if(u&&Vl(l,"start",1)&&Vl(o,"end")){let n=o,r=[];for(;r.push(n),!n.isTextblock;)n=n.lastChild;let s=l,a=1;for(;!s.isTextblock;s=s.firstChild)a++;if(n.canReplace(n.childCount,n.childCount,s.content)){if(i){let n=Ye.empty;for(let t=r.length-1;t>=0;t--)n=Ye.from(r[t].copy(n));i(t.tr.step(new wn(e.pos-r.length,e.pos+l.nodeSize,e.pos+a,e.pos+l.nodeSize-a,new ni(n,r.length,0),0,1)).scrollIntoView())}return 1}}return 0}function Ql(t){return function(e,i){let n=e.selection,r=t<0?n.$from:n.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return 0;s--}return r.node(s).isTextblock?(i&&i(e.tr.setSelection(Xn.create(e.doc,t<0?r.start(s):r.end(s)))),1):0}}const Yl=Ql(-1),Zl=Ql(1);function Xl(t,e=null){return function(i,n){let r=0;for(let s=0;s<i.selection.ranges.length&&!r;s++){let{$from:{pos:n},$to:{pos:o}}=i.selection.ranges[s];i.doc.nodesBetween(n,o,(n,s)=>{if(r)return 0;if(n.isTextblock&&!n.hasMarkup(t,e))if(n.type==t)r=1;else{let e=i.doc.resolve(s),n=e.index();r=e.parent.canReplaceWith(n,n+1,t)}})}if(!r)return 0;if(n){let r=i.tr;for(let n=0;n<i.selection.ranges.length;n++){let{$from:{pos:s},$to:{pos:o}}=i.selection.ranges[n];r.setBlockType(s,o,t,e)}n(r.scrollIntoView())}return 1}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var ta=Object.defineProperty,ea=(t,e)=>{for(var i in e)ta(t,i,{get:e[i],enumerable:1})};function ia(t){const{state:e,transaction:i}=t;let{selection:n}=i,{doc:r}=i,{storedMarks:s}=i;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return r},get tr(){return n=i.selection,r=i.doc,s=i.storedMarks,i}}}var na=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:i}=this,{view:n}=e,{tr:r}=i,s=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,(...t)=>{const i=e(...t)(s);return r.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(r),i}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=1){const{rawCommands:i,editor:n,state:r}=this,{view:s}=n,o=[],l=!!t,a=t||r.tr,u={...Object.fromEntries(Object.entries(i).map(([t,i])=>[t,(...t)=>{const n=this.buildProps(a,e),r=i(...t)(n);return o.push(r),u}])),run:()=>(l||!e||a.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(a),o.every(t=>1==t))};return u}createCan(t){const{rawCommands:e,state:i}=this,n=t||i.tr,r=this.buildProps(n,0);return{...Object.fromEntries(Object.entries(e).map(([t,e])=>[t,(...t)=>e(...t)({...r,dispatch:void 0})])),chain:()=>this.createChain(n,0)}}buildProps(t,e=1){const{rawCommands:i,editor:n,state:r}=this,{view:s}=n,o={tr:t,editor:n,view:s,state:ia({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(i).map(([t,e])=>[t,(...t)=>e(...t)(o)]))}};return o}},ra=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const i=this.callbacks[t];return i&&i.forEach(t=>t.apply(this,e)),this}off(t,e){const i=this.callbacks[t];return i&&(e?this.callbacks[t]=i.filter(t=>t!==e):delete this.callbacks[t]),this}once(t,e){const i=(...n)=>{this.off(t,i),e.apply(this,n)};return this.on(t,i)}removeAllListeners(){this.callbacks={}}};function sa(t,e){const i=new Jn(t);return e.forEach(t=>{t.steps.forEach(t=>{i.step(t)})}),i}var oa=t=>{const e=t.childNodes;for(let i=e.length-1;i>=0;i-=1){const n=e[i];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):1===n.nodeType&&oa(n)}return t};function la(t){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,i=(new window.DOMParser).parseFromString(e,"text/html").body;return oa(i)}function aa(t,e,i){if(t instanceof ki||t instanceof Ye)return t;i={slice:1,parseOptions:{},...i};const n="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return Ye.fromArray(t.map(t=>e.nodeFromJSON(t)));const n=e.nodeFromJSON(t);return i.errorOnInvalidContent&&n.check(),n}catch(r){if(i.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return aa("",e,i)}if(n){if(i.errorOnInvalidContent){let n=0,r="";const s=new Hi({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({C:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:t=>(n=1,r="string"==typeof t?t:t.outerHTML,null)}]}})});if(i.slice?Ui.fromSchema(s).parseSlice(la(t),i.parseOptions):Ui.fromSchema(s).parse(la(t),i.parseOptions),i.errorOnInvalidContent&&n)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${r}`)})}const n=Ui.fromSchema(e);return i.slice?n.parseSlice(la(t),i.parseOptions).content:n.parse(la(t),i.parseOptions)}return aa("",e,i)}function ua(t,e,i={},n={}){return aa(t,e,{slice:0,parseOptions:i,errorOnInvalidContent:n.errorOnInvalidContent})}function ha(t){return e=>function(t,e){for(let i=t.depth;i>0;i-=1){const n=t.node(i);if(e(n))return{pos:i>0?t.before(i):0,start:t.start(i),depth:i,node:n}}}(e.$from,t)}function ca(t,e,i){return void 0===t.config[e]&&t.parent?ca(t.parent,e,i):"function"==typeof t.config[e]?t.config[e].bind({...i,parent:t.parent?ca(t.parent,e,i):null}):t.config[e]}function da(t){return t.map(t=>{const e=ca(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...da(e())]:t}).flat(10)}function fa(t,e){const i=Zi.fromSchema(e).serializeFragment(t),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(i),n.innerHTML}function pa(t){return"function"==typeof t}function ma(t,e=void 0,...i){return pa(t)?e?t.bind(e)(...i):t(...i):t}function ga(t){return{baseExtensions:t.filter(t=>"extension"===t.type),nodeExtensions:t.filter(t=>"node"===t.type),markExtensions:t.filter(t=>"mark"===t.type)}}function ya(t){const e=[],{nodeExtensions:i,markExtensions:n}=ga(t),r=[...i,...n],s={default:null,validate:void 0,rendered:1,renderHTML:null,parseHTML:null,keepOnSplit:1,isRequired:0};return t.forEach(t=>{const i=ca(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:r});i&&i().forEach(t=>{t.types.forEach(i=>{Object.entries(t.attributes).forEach(([t,n])=>{e.push({type:i,name:t,attribute:{...s,...n}})})})})}),r.forEach(t=>{const i={name:t.name,options:t.options,storage:t.storage},n=ca(t,"addAttributes",i);if(!n)return;const r=n();Object.entries(r).forEach(([i,n])=>{const r={...s,...n};"function"==typeof(null==r?void 0:r.default)&&(r.default=r.default()),(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete r.default,e.push({type:t.name,name:i,attribute:r})})}),e}function ba(...t){return t.filter(t=>!!t).reduce((t,e)=>{const i={...t};return Object.entries(e).forEach(([t,e])=>{if(i[t])if("class"===t){const n=e?String(e).split(" "):[],r=i[t]?i[t].split(" "):[],s=n.filter(t=>!r.includes(t));i[t]=[...r,...s].join(" ")}else if("style"===t){const n=e?e.split(";").map(t=>t.trim()).filter(Boolean):[],r=i[t]?i[t].split(";").map(t=>t.trim()).filter(Boolean):[],s=new Map;r.forEach(t=>{const[e,i]=t.split(":").map(t=>t.trim());s.set(e,i)}),n.forEach(t=>{const[e,i]=t.split(":").map(t=>t.trim());s.set(e,i)}),i[t]=Array.from(s.entries()).map(([t,e])=>`${t}: ${e}`).join("; ")}else i[t]=e;else i[t]=e}),i},{})}function wa(t,e){return e.filter(e=>e.type===t.type.name).filter(t=>t.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((t,e)=>ba(t,e),{})}function va(t,e){return"style"in t?t:{...t,getAttrs:i=>{const n=t.getAttrs?t.getAttrs(i):t.attrs;if(0==n)return 0;const r=e.reduce((t,e)=>{const n=e.attribute.parseHTML?e.attribute.parseHTML(i):function(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t?1:"false"===t?0:t}(i.getAttribute(e.name));return null==n?t:{...t,[e.name]:n}},{});return{...n,...r}}}}function ka(t){return Object.fromEntries(Object.entries(t).filter(([t,e])=>"attrs"===t&&function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e)?0:null!=e))}function xa(t){return t.sort((t,e)=>{const i=ca(t,"priority")||100,n=ca(e,"priority")||100;return i>n?-1:i<n?1:0})}function Ma(t){const e=xa(da(t));return function(t){const e=t.filter((e,i)=>t.indexOf(e)!==i);return Array.from(new Set(e))}(e.map(t=>t.name)).length,e}function Sa(t,e,i){const{from:n,to:r}=e,{blockSeparator:s="\n\n",textSerializers:o={}}=i||{};let l="";return t.nodesBetween(n,r,(t,i,a,u)=>{var h;t.isBlock&&i>n&&(l+=s);const c=null==o?void 0:o[t.type.name];if(c)return a&&(l+=c({node:t,pos:i,parent:a,index:u,range:e})),0;t.isText&&(l+=null==(h=null==t?void 0:t.text)?void 0:h.slice(Math.max(n,i)-i,r-i))}),l}function Ta(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function Ea(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function Ca(t,e){const i=Ea(e,t.schema),{from:n,to:r,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,r,t=>{o.push(...t.marks)});const l=o.find(t=>t.type.name===i.name);return l?{...l.attrs}:{}}function Oa(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Aa(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $a(t,e){const i=Aa("string"==typeof e?e:e.name,t.schema);return"node"===i?function(t,e){const i=Oa(e,t.schema),{from:n,to:r}=t.selection,s=[];t.doc.nodesBetween(n,r,t=>{s.push(t)});const o=s.reverse().find(t=>t.type.name===i.name);return o?{...o.attrs}:{}}(t,e):"mark"===i?Ca(t,e):{}}function Ra(t){const{mapping:e,steps:i}=t,n=[];return e.maps.forEach((t,r)=>{const s=[];if(t.ranges.length)t.forEach((t,e)=>{s.push({from:t,to:e})});else{const{from:t,to:e}=i[r];if(void 0===t||void 0===e)return;s.push({from:t,to:e})}s.forEach(({from:t,to:i})=>{const s=e.slice(r).map(t,-1),o=e.slice(r).map(i),l=e.invert().map(s,-1),a=e.invert().map(o);n.push({oldRange:{from:l,to:a},newRange:{from:s,to:o}})})}),function(t){const e=function(t,e=JSON.stringify){const i={};return t.filter(t=>{const n=e(t);return{}.hasOwnProperty.call(i,n)?0:i[n]=1})}(t);return 1===e.length?e:e.filter((t,i)=>{const n=e.filter((t,e)=>e!==i);return!n.some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to)})}(n)}function La(t){return"[object RegExp]"==={}.toString.call(t)}function Ba(t,e,i={strict:1}){const n=Object.keys(e);return n.length?n.every(n=>i.strict?e[n]===t[n]:La(e[n])?e[n].test(t[n]):e[n]===t[n]):1}function Ia(t,e,i={}){return t.find(t=>t.type===e&&Ba(Object.fromEntries(Object.keys(i).map(e=>[e,t.attrs[e]])),i))}function Na(t,e,i={}){return!!Ia(t,e,i)}function Da(t,e,i){var n;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some(t=>t.type===e)||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(t=>t.type===e))return;if(i=i||(null==(n=r.node.marks[0])?void 0:n.attrs),!Ia([...r.node.marks],e,i))return;let s=r.index,o=t.start()+r.offset,l=s+1,a=o+r.node.nodeSize;for(;s>0&&Na([...t.parent.child(s-1).marks],e,i);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&Na([...t.parent.child(l).marks],e,i);)a+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function _a(t,e,i){const n=[];return t===e?i.resolve(t).marks().forEach(e=>{const r=Da(i.resolve(t),e.type);r&&n.push({mark:e,...r})}):i.nodesBetween(t,e,(t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&n.push(...t.marks.map(i=>({from:e,to:e+t.nodeSize,mark:i})))}),n}function za(t,e){return e.nodes[t]||e.marks[t]||null}function Pa(t,e,i){return Object.fromEntries(Object.entries(i).filter(([i])=>{const n=t.find(t=>t.type===e&&t.name===i);return n?n.attribute.keepOnSplit:0}))}function Ha(t,e,i={}){const{empty:n,ranges:r}=t.selection,s=e?Ea(e,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(t=>s?s.name===t.type.name:1).find(t=>Ba(t.attrs,i,{strict:0}));let o=0;const l=[];if(r.forEach(({$from:e,$to:i})=>{const n=e.pos,r=i.pos;t.doc.nodesBetween(n,r,(t,e)=>{if(!t.isText&&!t.marks.length)return;const i=Math.max(n,e),s=Math.min(r,e+t.nodeSize);o+=s-i,l.push(...t.marks.map(t=>({mark:t,from:i,to:s})))})}),0===o)return 0;const a=l.filter(t=>s?s.name===t.mark.type.name:1).filter(t=>Ba(t.mark.attrs,i,{strict:0})).reduce((t,e)=>t+e.to-e.from,0),u=l.filter(t=>s?t.mark.type!==s&&t.mark.type.excludes(s):1).reduce((t,e)=>t+e.to-e.from,0);return(a>0?a+u:a)>=o}function ja(t,e,i={}){const{from:n,to:r,empty:s}=t.selection,o=e?Oa(e,t.schema):null,l=[];t.doc.nodesBetween(n,r,(t,e)=>{if(t.isText)return;const i=Math.max(n,e),s=Math.min(r,e+t.nodeSize);l.push({node:t,from:i,to:s})});const a=r-n,u=l.filter(t=>o?o.name===t.node.type.name:1).filter(t=>Ba(t.node.attrs,i,{strict:0}));return s?!!u.length:u.reduce((t,e)=>t+e.to-e.from,0)>=a}function Ua(t,e){return Array.isArray(e)?e.some(e=>("string"==typeof e?e:e.name)===t.name):e}function qa(t,e){const{nodeExtensions:i}=ga(e),n=i.find(e=>e.name===t);if(!n)return 0;const r=ma(ca(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"!=typeof r?0:r.split(" ").includes("list")}function Va(t,{checkChildren:e=1,ignoreWhitespace:i=0}={}){var n;if(i){if("hardBreak"===t.type.name)return 1;if(t.isText)return/^\s*$/m.test(null!=(n=t.text)?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return 0;if(0===t.content.childCount)return 1;if(e){let n=1;return t.content.forEach(t=>{0!=n&&(Va(t,{ignoreWhitespace:i,checkChildren:e})||(n=0))}),n}return 0}function Fa(t){return t instanceof er}function Ka(t){return t instanceof Xn}function Ja(t=0,e=0,i=0){return Math.min(Math.max(t,e),i)}function Wa(t,e=null){if(!e)return null;const i=Gn.atStart(t),n=Gn.atEnd(t);if("start"===e||1==e)return i;if("end"===e)return n;const r=i.from,s=n.to;return"all"===e?Xn.create(t,Ja(0,r,s),Ja(t.content.size,r,s)):Xn.create(t,Ja(e,r,s),Ja(e,r,s))}var Ga=class{constructor(t){this.find=t.find,this.handler=t.handler}};function Qa(t){var e;const{editor:i,from:n,to:r,text:s,rules:o,plugin:l}=t,{view:a}=i;if(a.composing)return 0;const u=a.state.doc.resolve(n);if(u.parent.type.spec.code||(null==(e=u.nodeBefore||u.nodeAfter)?void 0:e.marks.find(t=>t.type.spec.code)))return 0;let h=0;const c=((t,e=500)=>{let i="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-e),n,(t,e,r,s)=>{var o,l;const a=(null==(l=(o=t.type.spec).toText)?void 0:l.call(o,{node:t,pos:e,parent:r,index:s}))||t.textContent||"%leaf%";i+=t.isAtom&&!t.isText?a:a.slice(0,Math.max(0,n-e))}),i})(u)+s;return o.forEach(t=>{if(h)return;const e=((t,e)=>{if(La(e))return e.exec(t);const i=e(t);if(!i)return null;const n=[i.text];return n.index=i.index,n.input=t,n.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith),n.push(i.replaceWith)),n})(c,t.find);if(!e)return;const o=a.state.tr,u=ia({state:a.state,transaction:o}),d={from:n-(e[0].length-s.length),to:r},{commands:f,chain:p,can:m}=new na({editor:i,state:u});null!==t.handler({state:u,range:d,match:e,commands:f,chain:p,can:m})&&o.steps.length&&(o.setMeta(l,{transform:o,from:n,to:r,text:s}),a.dispatch(o),h=1)}),h}function Ya(t){return"Object"!==function(t){return{}.toString.call(t).slice(8,-1)}(t)?0:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Za(t,e){const i={...t};return Ya(t)&&Ya(e)&&Object.keys(e).forEach(n=>{Ya(e[n])&&Ya(t[n])?i[n]=Za(t[n],e[n]):i[n]=e[n]}),i}var Xa=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...ma(ca(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ma(ca(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Za(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},tu=class t extends Xa{constructor(){super(...arguments),this.type="mark"}static create(e={}){const i="function"==typeof e?e():e;return new t(i)}static handleExit({editor:t,mark:e}){const{tr:i}=t.state,n=t.state.selection.$from;if(n.pos===n.end()){const r=n.marks();if(!r.find(t=>(null==t?void 0:t.type.name)===e.name))return 0;const s=r.find(t=>(null==t?void 0:t.type.name)===e.name);return s&&i.removeStoredMark(s),i.insertText(" ",n.pos),t.view.dispatch(i),1}return 0}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},eu=class{constructor(t){this.find=t.find,this.handler=t.handler}},iu=null;var nu=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=Ma(t),this.schema=function(t,e){var i;const n=ya(t),{nodeExtensions:r,markExtensions:s}=ga(t),o=null==(i=r.find(t=>ca(t,"topNode")))?void 0:i.name,l=Object.fromEntries(r.map(i=>{const r=n.filter(t=>t.type===i.name),s={name:i.name,options:i.options,storage:i.storage,editor:e},o=ka({...t.reduce((t,e)=>{const n=ca(e,"extendNodeSchema",s);return{...t,...n?n(i):{}}},{}),content:ma(ca(i,"content",s)),marks:ma(ca(i,"marks",s)),group:ma(ca(i,"group",s)),inline:ma(ca(i,"inline",s)),atom:ma(ca(i,"atom",s)),selectable:ma(ca(i,"selectable",s)),draggable:ma(ca(i,"draggable",s)),code:ma(ca(i,"code",s)),whitespace:ma(ca(i,"whitespace",s)),linebreakReplacement:ma(ca(i,"linebreakReplacement",s)),defining:ma(ca(i,"defining",s)),isolating:ma(ca(i,"isolating",s)),attrs:Object.fromEntries(r.map(t=>{var e,i;return[t.name,{default:null==(e=null==t?void 0:t.attribute)?void 0:e.default,validate:null==(i=null==t?void 0:t.attribute)?void 0:i.validate}]}))}),l=ma(ca(i,"parseHTML",s));l&&(o.parseDOM=l.map(t=>va(t,r)));const a=ca(i,"renderHTML",s);a&&(o.toDOM=t=>a({node:t,HTMLAttributes:wa(t,r)}));const u=ca(i,"renderText",s);return u&&(o.toText=u),[i.name,o]})),a=Object.fromEntries(s.map(i=>{const r=n.filter(t=>t.type===i.name),s={name:i.name,options:i.options,storage:i.storage,editor:e},o=ka({...t.reduce((t,e)=>{const n=ca(e,"extendMarkSchema",s);return{...t,...n?n(i):{}}},{}),inclusive:ma(ca(i,"inclusive",s)),excludes:ma(ca(i,"excludes",s)),group:ma(ca(i,"group",s)),spanning:ma(ca(i,"spanning",s)),code:ma(ca(i,"code",s)),attrs:Object.fromEntries(r.map(t=>{var e,i;return[t.name,{default:null==(e=null==t?void 0:t.attribute)?void 0:e.default,validate:null==(i=null==t?void 0:t.attribute)?void 0:i.validate}]}))}),l=ma(ca(i,"parseHTML",s));l&&(o.parseDOM=l.map(t=>va(t,r)));const a=ca(i,"renderHTML",s);return a&&(o.toDOM=t=>a({mark:t,HTMLAttributes:wa(t,r)})),[i.name,o]}));return new Hi({topNode:o,nodes:l,marks:a})}(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const i=ca(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:za(e.name,this.schema)});return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this;return xa([...this.extensions].reverse()).map(e=>{const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:za(e.name,this.schema)},n=[],r=ca(e,"addKeyboardShortcuts",i);let s={};if("mark"===e.type&&ca(e,"exitable",i)&&(s.ArrowRight=()=>tu.handleExit({editor:t,mark:e})),r){const e=Object.fromEntries(Object.entries(r()).map(([e,i])=>[e,()=>i({editor:t})]));s={...s,...e}}const o=new pr({props:{handleKeyDown:jl(s)}});n.push(o);const l=ca(e,"addInputRules",i);if(Ua(e,t.options.enableInputRules)&&l){const e=l();if(e&&e.length){const i=function(t){const{editor:e,rules:i}=t,n=new pr({state:{init:()=>null,apply(t,r,s){const o=t.getMeta(n);if(o)return o;const l=t.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:t}=l;"string"==typeof t||(t=fa(Ye.from(t),s.schema));const{from:r}=l,o=r+t.length;Qa({editor:e,from:r,to:o,text:t,rules:i,plugin:n})}),t.selectionSet||t.docChanged?null:r}},props:{handleTextInput:(t,r,s,o)=>Qa({editor:e,from:r,to:s,text:o,rules:i,plugin:n}),handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:r}=t.state.selection;r&&Qa({editor:e,from:r.pos,to:r.pos,text:"",rules:i,plugin:n})}),0)},handleKeyDown(t,r){if("Enter"!==r.key)return 0;const{$cursor:s}=t.state.selection;return s?Qa({editor:e,from:s.pos,to:s.pos,text:"\n",rules:i,plugin:n}):0}},isInputRules:1});return n}({editor:t,rules:e}),r=Array.isArray(i)?i:[i];n.push(...r)}}const a=ca(e,"addPasteRules",i);if(Ua(e,t.options.enablePasteRules)&&a){const e=a();if(e&&e.length){const i=function(t){const{editor:e,rules:i}=t;let n,r=null,s=0,o=0,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}const a=({state:t,from:i,to:r,rule:s,pasteEvt:o})=>{const a=t.tr,u=ia({state:t,transaction:a});if(function(t){const{editor:e,state:i,from:n,to:r,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:u,can:h}=new na({editor:e,state:i}),c=[];return i.doc.nodesBetween(n,r,(t,e)=>{var d,f,p,m,g;if((null==(f=null==(d=t.type)?void 0:d.spec)?void 0:f.code)||!(t.isText||t.isTextblock||t.isInline))return;const y=null!=(g=null!=(m=null==(p=t.content)?void 0:p.size)?m:t.nodeSize)?g:0,b=Math.max(n,e),w=Math.min(r,e+y);b>=w||((t,e,i)=>{if(La(e))return[...t.matchAll(e)];const n=e(t,i);return n?n.map(e=>{const i=[e.text];return i.index=e.index,i.input=t,i.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith),i.push(e.replaceWith)),i}):[]})(t.isText?t.text||"":t.textBetween(b-e,w-e,void 0,""),s.find,o).forEach(t=>{if(void 0===t.index)return;const e=b+t.index+1,n=e+t[0].length,r={from:i.tr.mapping.map(e),to:i.tr.mapping.map(n)},d=s.handler({state:i,range:r,match:t,commands:a,chain:u,can:h,pasteEvent:o,dropEvent:l});c.push(d)})}),c.every(t=>null!==t)}({editor:e,state:u,from:Math.max(i-1,0),to:r.b-1,rule:s,pasteEvent:o,dropEvent:n})&&a.steps.length){try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return i.map(t=>new pr({view(t){const i=i=>{var n;r=(null==(n=t.dom.parentElement)?void 0:n.contains(i.target))?t.dom.parentElement:null,r&&(iu=e)},n=()=>{iu&&(iu=null)};return window.addEventListener("dragstart",i),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",i),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(o=r===t.dom.parentElement,n=e,!o){const t=iu;(null==t?void 0:t.isEditable)&&setTimeout(()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})},10)}return 0},paste:(t,e)=>{var i;const n=null==(i=e.clipboardData)?void 0:i.getData("text/html");return l=e,s=!!(null==n?void 0:n.includes("data-pm-slice")),0}}},appendTransaction:(e,i,n)=>{const r=e[0],u="paste"===r.getMeta("uiEvent")&&!s,h="drop"===r.getMeta("uiEvent")&&!o,c=r.getMeta("applyPasteRules"),d=!!c;if(!u&&!h&&!d)return;if(d){let{text:e}=c;"string"==typeof e||(e=fa(Ye.from(e),n.schema));const{from:i}=c,r=i+e.length,s=(t=>{var e;const i=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(e=i.clipboardData)||e.setData("text/html",t),i})(e);return a({rule:t,state:n,from:i,to:{b:r},pasteEvt:s})}const f=i.doc.content.findDiffStart(n.doc.content),p=i.doc.content.findDiffEnd(n.doc.content);return"number"==typeof f&&p&&f!==p.b?a({rule:t,state:n,from:f,to:p,pasteEvt:l}):void 0}}))}({editor:t,rules:e});n.push(...i)}}const u=ca(e,"addProseMirrorPlugins",i);if(u){const t=u();n.push(...t)}return n}).flat()}get attributes(){return ya(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ga(this.extensions);return Object.fromEntries(e.filter(t=>!!ca(t,"addNodeView")).map(e=>{const i=this.attributes.filter(t=>t.type===e.name),n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Oa(e.name,this.schema)},r=ca(e,"addNodeView",n);return r?[e.name,(n,s,o,l,a)=>{const u=wa(n,i);return r()({node:n,view:s,getPos:o,decorations:l,innerDecorations:a,editor:t,extension:e,HTMLAttributes:u})}]:[]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=ga(this.extensions);return Object.fromEntries(e.filter(t=>!!ca(t,"addMarkView")).map(e=>{const i=this.attributes.filter(t=>t.type===e.name),n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Ea(e.name,this.schema)},r=ca(e,"addMarkView",n);return r?[e.name,(n,s,o)=>{const l=wa(n,i);return r()({mark:n,view:s,inline:o,editor:t,extension:e,HTMLAttributes:l,updateAttributes:e=>{!function(t,e,i={}){const{state:n}=e,{doc:r,tr:s}=n,o=t;r.descendants((e,n)=>{const r=s.mapping.map(n),l=s.mapping.map(n)+e.nodeSize;let a=null;if(e.marks.forEach(t=>{if(t!==o)return 0;a=t}),!a)return;let u=0;if(Object.keys(i).forEach(t=>{i[t]!==a.attrs[t]&&(u=1)}),u){const e=t.type.create({...t.attrs,...i});s.removeMark(r,l,t.type),s.addMark(r,l,e)}}),s.docChanged&&e.view.dispatch(s)}(n,t,e)}})}]:[]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(t=>[t.name,t.storage])),t.forEach(t=>{var e;const i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:za(t.name,this.schema)};"mark"===t.type&&(null==(e=ma(ca(t,"keepOnSplit",i)))||e)&&this.splittableMarks.push(t.name);const n=ca(t,"onBeforeCreate",i),r=ca(t,"onCreate",i),s=ca(t,"onUpdate",i),o=ca(t,"onSelectionUpdate",i),l=ca(t,"onTransaction",i),a=ca(t,"onFocus",i),u=ca(t,"onBlur",i),h=ca(t,"onDestroy",i);n&&this.editor.on("beforeCreate",n),r&&this.editor.on("create",r),s&&this.editor.on("update",s),o&&this.editor.on("selectionUpdate",o),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),u&&this.editor.on("blur",u),h&&this.editor.on("destroy",h)})}};nu.resolve=Ma,nu.sort=xa,nu.flatten=da,ea({},{ClipboardTextSerializer:()=>su,Commands:()=>yh,Delete:()=>bh,Drop:()=>wh,Editable:()=>vh,FocusEvents:()=>xh,Keymap:()=>Mh,Paste:()=>Sh,Tabindex:()=>Th,focusEventsPluginKey:()=>kh});var ru=class t extends Xa{constructor(){super(...arguments),this.type="extension"}static create(e={}){const i="function"==typeof e?e():e;return new t(i)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},su=ru.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new pr({key:new yr("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:i}=t,{doc:n,selection:r}=e,{ranges:s}=r,o=Math.min(...s.map(t=>t.$from.pos)),l=Math.max(...s.map(t=>t.$to.pos)),a=Ta(i);return Sa(n,{from:o,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),ou={};ea(ou,{blur:()=>lu,clearContent:()=>au,clearNodes:()=>uu,command:()=>hu,createParagraphNear:()=>cu,cut:()=>du,deleteCurrentNode:()=>fu,deleteNode:()=>pu,deleteRange:()=>mu,deleteSelection:()=>gu,enter:()=>yu,exitCode:()=>bu,extendMarkRange:()=>wu,first:()=>vu,focus:()=>xu,forEach:()=>Mu,insertContent:()=>Su,insertContentAt:()=>Tu,joinBackward:()=>Ou,joinDown:()=>Cu,joinForward:()=>Au,joinItemBackward:()=>$u,joinItemForward:()=>Ru,joinTextblockBackward:()=>Lu,joinTextblockForward:()=>Bu,joinUp:()=>Eu,keyboardShortcut:()=>Nu,lift:()=>Du,liftEmptyBlock:()=>_u,liftListItem:()=>zu,newlineInCode:()=>Pu,resetAttributes:()=>ju,scrollIntoView:()=>Uu,selectAll:()=>qu,selectNodeBackward:()=>Vu,selectNodeForward:()=>Fu,selectParentNode:()=>Ku,selectTextblockEnd:()=>Ju,selectTextblockStart:()=>Wu,setContent:()=>Gu,setMark:()=>Qu,setMeta:()=>Yu,setNode:()=>Zu,setNodeSelection:()=>Xu,setTextSelection:()=>th,sinkListItem:()=>eh,splitBlock:()=>nh,splitListItem:()=>rh,toggleList:()=>lh,toggleMark:()=>ah,toggleNode:()=>uh,toggleWrap:()=>hh,undoInputRule:()=>ch,unsetAllMarks:()=>dh,unsetMark:()=>fh,updateAttributes:()=>ph,wrapIn:()=>mh,wrapInList:()=>gh});var lu=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var i;t.isDestroyed||(e.dom.blur(),null==(i=null==window?void 0:window.getSelection())||i.removeAllRanges())}),1),au=(t=1)=>({commands:e})=>e.setContent("",{emitUpdate:t}),uu=()=>({state:t,tr:e,dispatch:i})=>{const{selection:n}=e,{ranges:r}=n;return i?(r.forEach(({$from:i,$to:n})=>{t.doc.nodesBetween(i.pos,n.pos,(t,i)=>{if(t.type.isText)return;const{doc:n,mapping:r}=e,s=n.resolve(r.map(i)),o=n.resolve(r.map(i+t.nodeSize)),l=s.blockRange(o);if(!l)return;const a=Mn(l);if(t.type.isTextblock){const{defaultType:t}=s.parent.contentMatchAt(s.index());e.setNodeMarkup(l.start,t)}(a||0===a)&&e.lift(l,a)})}),1):1},hu=t=>e=>t(e),cu=()=>({state:t,dispatch:e})=>((t,e)=>{let i=t.selection,{$from:n,$to:r}=i;if(i instanceof nr||n.parent.inlineContent||r.parent.inlineContent)return 0;let s=Wl(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return 0;if(e){let i=(!n.parentOffset&&r.index()<r.parent.childCount?n:r).pos,o=t.tr.insert(i,s.createAndFill());o.setSelection(Xn.create(o.doc,i+1)),e(o.scrollIntoView())}return 1})(t,e),du=(t,e)=>({editor:i,tr:n})=>{const{state:r}=i,s=r.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new Xn(n.doc.resolve(Math.max(o-1,0)))),1},fu=()=>({tr:t,dispatch:e})=>{const{selection:i}=t,n=i.$anchor.node();if(n.content.size>0)return 0;const r=t.selection.$anchor;for(let s=r.depth;s>0;s-=1)if(r.node(s).type===n.type){if(e){const e=r.before(s),i=r.after(s);t.delete(e,i).scrollIntoView()}return 1}return 0},pu=t=>({tr:e,state:i,dispatch:n})=>{const r=Oa(t,i.schema),s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1)if(s.node(t).type===r){if(n){const i=s.before(t),n=s.after(t);e.delete(i,n).scrollIntoView()}return 1}return 0},mu=t=>({tr:e,dispatch:i})=>{const{from:n,to:r}=t;return i&&e.delete(n,r),1},gu=()=>({state:t,dispatch:e})=>((t,e)=>t.selection.empty?0:(e&&e(t.tr.deleteSelection().scrollIntoView()),1))(t,e),yu=()=>({commands:t})=>t.keyboardShortcut("Enter"),bu=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:i,$anchor:n}=t.selection;if(!i.parent.type.spec.code||!i.sameParent(n))return 0;let r=i.node(-1),s=i.indexAfter(-1),o=Wl(r.contentMatchAt(s));if(!o||!r.canReplaceWith(s,s,o))return 0;if(e){let n=i.after(),r=t.tr.replaceWith(n,n,o.createAndFill());r.setSelection(Gn.near(r.doc.resolve(n),1)),e(r.scrollIntoView())}return 1})(t,e),wu=(t,e={})=>({tr:i,state:n,dispatch:r})=>{const s=Ea(t,n.schema),{doc:o,selection:l}=i,{$from:a,from:u,to:h}=l;if(r){const t=Da(a,s,e);if(t&&t.from<=u&&t.to>=h){const e=Xn.create(o,t.from,t.to);i.setSelection(e)}}return 1},vu=t=>e=>{const i="function"==typeof t?t(e):t;for(let t=0;t<i.length;t+=1)if(i[t](e))return 1;return 0};function ku(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var xu=(t=null,e={})=>({editor:i,view:n,tr:r,dispatch:s})=>{e={scrollIntoView:1,...e};const o=()=>{(ku()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&n.dom.focus(),requestAnimationFrame(()=>{i.isDestroyed||(n.focus(),(null==e?void 0:e.scrollIntoView)&&i.commands.scrollIntoView())})};if(n.hasFocus()&&null===t||0==t)return 1;if(s&&null===t&&!Ka(i.state.selection))return o(),1;const l=Wa(r.doc,t)||i.state.selection,a=i.state.selection.eq(l);return s&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),o()),1},Mu=(t,e)=>i=>t.every((t,n)=>e(t,{...i,index:n})),Su=(t,e)=>({tr:i,commands:n})=>n.insertContentAt({from:i.selection.from,to:i.selection.to},t,e),Tu=(t,e,i)=>({tr:n,dispatch:r,editor:s})=>{var o;if(r){let r;const a=t=>{s.emit("contentError",{editor:s,error:t,disableCollaboration:()=>{"collaboration"in s.storage&&"object"==typeof s.storage.collaboration&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=1)}})},u={preserveWhitespace:"full",...(i={parseOptions:s.options.parseOptions,updateSelection:1,applyInputRules:0,applyPasteRules:0,...i}).parseOptions};if(!i.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{aa(e,s.schema,{parseOptions:u,errorOnInvalidContent:1})}catch(l){a(l)}try{r=aa(e,s.schema,{parseOptions:u,errorOnInvalidContent:null!=(o=i.errorOnInvalidContent)?o:s.options.enableContentCheck})}catch(l){return a(l),0}let h,{from:c,to:d}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},f=1,p=1;if(("type"in r?[r]:r).forEach(t=>{t.check(),f=f?t.isText&&0===t.marks.length:0,p=p?t.isBlock:0}),c===d&&p){const{parent:t}=n.doc.resolve(c);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(c-=1,d+=1)}if(f){if(Array.isArray(e))h=e.map(t=>t.text||"").join("");else if(e instanceof Ye){let t="";e.forEach(e=>{e.text&&(t+=e.text)}),h=t}else h="object"==typeof e&&e&&e.text?e.text:e;n.insertText(h,c,d)}else{h=r;const t=n.doc.resolve(c),e=t.node(),i=0===t.parentOffset,s=e.isText||e.isTextblock,o=e.content.size>0;i&&s&&o&&(c=Math.max(0,c-1)),n.replaceWith(c,d,h)}i.updateSelection&&function(t,e){const i=t.steps.length-1;if(i<e)return;const n=t.steps[i];if(!(n instanceof bn||n instanceof wn))return;const r=t.mapping.maps[i];let s=0;r.forEach((t,e,i,n)=>{0===s&&(s=n)}),t.setSelection(Gn.near(t.doc.resolve(s),-1))}(n,n.steps.length-1),i.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:h}),i.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:h})}return 1},Eu=()=>({state:t,dispatch:e})=>((t,e)=>{let i,n=t.selection,r=n instanceof er;if(r){if(n.node.isTextblock||!An(t.doc,n.from))return 0;i=n.from}else if(i=Rn(t.doc,n.from,-1),null==i)return 0;if(e){let n=t.tr.join(i);r&&n.setSelection(er.create(n.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(n.scrollIntoView())}return 1})(t,e),Cu=()=>({state:t,dispatch:e})=>((t,e)=>{let i,n=t.selection;if(n instanceof er){if(n.node.isTextblock||!An(t.doc,n.to))return 0;i=n.to}else if(i=Rn(t.doc,n.to,1),null==i)return 0;return e&&e(t.tr.join(i).scrollIntoView()),1})(t,e),Ou=()=>({state:t,dispatch:e})=>((t,e)=>{let i=Ul(t,void 0);if(!i)return 0;let n=Fl(i);if(!n){let n=i.blockRange(),r=n&&Mn(n);return null==r?0:(e&&e(t.tr.lift(n,r).scrollIntoView()),1)}let r=n.nodeBefore;if(Gl(t,n,e,-1))return 1;if(0==i.parent.content.size&&(Vl(r,"end")||er.isSelectable(r)))for(let s=i.depth;;s--){let o=Bn(t.doc,i.before(s),i.after(s),ni.empty);if(o&&o.slice.size<o.to-o.from){if(e){let i=t.tr.step(o);i.setSelection(Vl(r,"end")?Gn.findFrom(i.doc.resolve(i.mapping.map(n.pos,-1)),-1):er.create(i.doc,n.pos-r.nodeSize)),e(i.scrollIntoView())}return 1}if(1==s||i.node(s-1).childCount>1)break}return r.isAtom&&n.depth==i.depth-1?(e&&e(t.tr.delete(n.pos-r.nodeSize,n.pos).scrollIntoView()),1):0})(t,e),Au=()=>({state:t,dispatch:e})=>((t,e)=>{let i=Kl(t,void 0);if(!i)return 0;let n=Jl(i);if(!n)return 0;let r=n.nodeAfter;if(Gl(t,n,e,1))return 1;if(0==i.parent.content.size&&(Vl(r,"start")||er.isSelectable(r))){let s=Bn(t.doc,i.before(),i.after(),ni.empty);if(s&&s.slice.size<s.to-s.from){if(e){let i=t.tr.step(s);i.setSelection(Vl(r,"start")?Gn.findFrom(i.doc.resolve(i.mapping.map(n.pos)),1):er.create(i.doc,i.mapping.map(n.pos))),e(i.scrollIntoView())}return 1}}return r.isAtom&&n.depth==i.depth-1?(e&&e(t.tr.delete(n.pos,n.pos+r.nodeSize).scrollIntoView()),1):0})(t,e),$u=()=>({state:t,dispatch:e,tr:i})=>{try{const n=Rn(t.doc,t.selection.$from.pos,-1);return null==n?0:(i.join(n,2),e&&e(i),1)}catch{return 0}},Ru=()=>({state:t,dispatch:e,tr:i})=>{try{const n=Rn(t.doc,t.selection.$from.pos,1);return null==n?0:(i.join(n,2),e&&e(i),1)}catch{return 0}},Lu=()=>({state:t,dispatch:e})=>((t,e)=>{let i=Ul(t,void 0);if(!i)return 0;let n=Fl(i);return n?ql(t,n,e):0})(t,e),Bu=()=>({state:t,dispatch:e})=>((t,e)=>{let i=Kl(t,void 0);if(!i)return 0;let n=Jl(i);return n?ql(t,n,e):0})(t,e);function Iu(){return"undefined"!=typeof navigator?/Mac/.test(navigator.platform):0}var Nu=t=>({editor:e,view:i,tr:n,dispatch:r})=>{const s=function(t){const e=t.split(/-(?!$)/);let i,n,r,s,o=e[e.length-1];"Space"===o&&(o=" ");for(let l=0;l<e.length-1;l+=1){const t=e[l];if(/^(cmd|meta|m)$/i.test(t))s=1;else if(/^a(lt)?$/i.test(t))i=1;else if(/^(c|ctrl|control)$/i.test(t))n=1;else if(/^s(hift)?$/i.test(t))r=1;else{if(!/^mod$/i.test(t))throw new Error(`Unrecognized modifier name: ${t}`);ku()||Iu()?s=1:n=1}}return i&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),s&&(o=`Meta-${o}`),r&&(o=`Shift-${o}`),o}(t).split(/-(?!$)/),o=s.find(t=>!["Alt","Ctrl","Meta","Shift"].includes(t)),l=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:1,cancelable:1}),a=e.captureTransaction(()=>{i.someProp("handleKeyDown",t=>t(i,l))});return null==a||a.steps.forEach(t=>{const e=t.map(n.mapping);e&&r&&n.maybeStep(e)}),1},Du=(t,e={})=>({state:i,dispatch:n})=>ja(i,Oa(t,i.schema),e)?((t,e)=>{let{$from:i,$to:n}=t.selection,r=i.blockRange(n),s=r&&Mn(r);return null==s?0:(e&&e(t.tr.lift(r,s).scrollIntoView()),1)})(i,n):0,_u=()=>({state:t,dispatch:e})=>((t,e)=>{let{$cursor:i}=t.selection;if(!i||i.parent.content.size)return 0;if(i.depth>1&&i.after()!=i.end(-1)){let n=i.before();if(On(t.doc,n))return e&&e(t.tr.split(n).scrollIntoView()),1}let n=i.blockRange(),r=n&&Mn(n);return null==r?0:(e&&e(t.tr.lift(n,r).scrollIntoView()),1)})(t,e),zu=t=>({state:e,dispatch:i})=>{return(n=Oa(t,e.schema),function(t,e){let{$from:i,$to:r}=t.selection,s=i.blockRange(r,t=>t.childCount>0&&t.firstChild.type==n);return s?e?i.node(s.depth-1).type==n?function(t,e,i,n){let r=t.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(r.step(new wn(s-1,o,s,o,new ni(Ye.from(i.create(null,n.parent.copy())),1,0),1,1)),n=new wi(r.doc.resolve(n.$from.pos),r.doc.resolve(o),n.depth));const l=Mn(n);if(null==l)return 0;r.lift(n,l);let a=r.doc.resolve(r.mapping.map(s,-1)-1);return An(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),1}(t,e,n,s):function(t,e,i){let n=t.tr,r=i.parent;for(let f=i.end,p=i.endIndex-1,m=i.startIndex;p>m;p--)f-=r.child(p).nodeSize,n.delete(f-1,f+1);let s=n.doc.resolve(i.start),o=s.nodeAfter;if(n.mapping.map(i.end)!=i.start+s.nodeAfter.nodeSize)return 0;let l=0==i.startIndex,a=i.endIndex==r.childCount,u=s.node(-1),h=s.index(-1);if(!u.canReplace(h+(l?0:1),h+1,o.content.append(a?Ye.empty:Ye.from(r))))return 0;let c=s.pos,d=c+o.nodeSize;return n.step(new wn(c-(l?1:0),d+(a?1:0),c+1,d-1,new ni((l?Ye.empty:Ye.from(r.copy(Ye.empty))).append(a?Ye.empty:Ye.from(r.copy(Ye.empty))),l?0:1,a?0:1),l?0:1)),e(n.scrollIntoView()),1}(t,e,s):1:0})(e,i);var n},Pu=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:i,$anchor:n}=t.selection;return i.parent.type.spec.code&&i.sameParent(n)?(e&&e(t.tr.insertText("\n").scrollIntoView()),1):0})(t,e);function Hu(t,e){const i="string"==typeof e?[e]:e;return Object.keys(t).reduce((e,n)=>(i.includes(n)||(e[n]=t[n]),e),{})}var ju=(t,e)=>({tr:i,state:n,dispatch:r})=>{let s=null,o=null;const l=Aa("string"==typeof t?t:t.name,n.schema);return l?("node"===l&&(s=Oa(t,n.schema)),"mark"===l&&(o=Ea(t,n.schema)),r&&i.selection.ranges.forEach(t=>{n.doc.nodesBetween(t.$from.pos,t.$to.pos,(t,n)=>{s&&s===t.type&&i.setNodeMarkup(n,void 0,Hu(t.attrs,e)),o&&t.marks.length&&t.marks.forEach(r=>{o===r.type&&i.addMark(n,n+t.nodeSize,o.create(Hu(r.attrs,e)))})})}),1):0},Uu=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),1),qu=()=>({tr:t,dispatch:e})=>{if(e){const e=new nr(t.doc);t.setSelection(e)}return 1},Vu=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:i,empty:n}=t.selection,r=i;if(!n)return 0;if(i.parent.isTextblock){if(i.parentOffset>0)return 0;r=Fl(i)}let s=r&&r.nodeBefore;return s&&er.isSelectable(s)?(e&&e(t.tr.setSelection(er.create(t.doc,r.pos-s.nodeSize)).scrollIntoView()),1):0})(t,e),Fu=()=>({state:t,dispatch:e})=>((t,e)=>{let{$head:i,empty:n}=t.selection,r=i;if(!n)return 0;if(i.parent.isTextblock){if(i.parentOffset<i.parent.content.size)return 0;r=Jl(i)}let s=r&&r.nodeAfter;return s&&er.isSelectable(s)?(e&&e(t.tr.setSelection(er.create(t.doc,r.pos)).scrollIntoView()),1):0})(t,e),Ku=()=>({state:t,dispatch:e})=>((t,e)=>{let i,{$from:n,to:r}=t.selection,s=n.sharedDepth(r);return 0==s?0:(i=n.before(s),e&&e(t.tr.setSelection(er.create(t.doc,i))),1)})(t,e),Ju=()=>({state:t,dispatch:e})=>Zl(t,e),Wu=()=>({state:t,dispatch:e})=>Yl(t,e),Gu=(t,{errorOnInvalidContent:e,emitUpdate:i=1,parseOptions:n={}}={})=>({editor:r,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if("full"!==n.preserveWhitespace){const l=ua(t,r.schema,n,{errorOnInvalidContent:null!=e?e:r.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!i),1}return o&&s.setMeta("preventUpdate",!i),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:n,errorOnInvalidContent:null!=e?e:r.options.enableContentCheck})},Qu=(t,e={})=>({tr:i,state:n,dispatch:r})=>{const{selection:s}=i,{empty:o,ranges:l}=s,a=Ea(t,n.schema);if(r)if(o){const t=Ca(n,a);i.addStoredMark(a.create({...t,...e}))}else l.forEach(t=>{const r=t.$from.pos,s=t.$to.pos;n.doc.nodesBetween(r,s,(t,n)=>{const o=Math.max(n,r),l=Math.min(n+t.nodeSize,s);t.marks.find(t=>t.type===a)?t.marks.forEach(t=>{a===t.type&&i.addMark(o,l,a.create({...t.attrs,...e}))}):i.addMark(o,l,a.create(e))})});return function(t,e,i){var n;const{selection:r}=e;let s=null;if(Ka(r)&&(s=r.$cursor),s){const e=null!=(n=t.storedMarks)?n:s.marks();return s.parent.type.allowsMarkType(i)&&(!!i.isInSet(e)||!e.some(t=>t.type.excludes(i)))}const{ranges:o}=r;return o.some(({$from:e,$to:n})=>{let r=0===e.depth?t.doc.inlineContent&&t.doc.type.allowsMarkType(i):0;return t.doc.nodesBetween(e.pos,n.pos,(t,e,n)=>{if(r)return 0;if(t.isInline){const e=!n||n.type.allowsMarkType(i),s=!!i.isInSet(t.marks)||!t.marks.some(t=>t.type.excludes(i));r=e&&s}return!r}),r})}(n,i,a)},Yu=(t,e)=>({tr:i})=>(i.setMeta(t,e),1),Zu=(t,e={})=>({state:i,dispatch:n,chain:r})=>{const s=Oa(t,i.schema);let o;return i.selection.$anchor.sameParent(i.selection.$head)&&(o=i.selection.$anchor.parent.attrs),s.isTextblock?r().command(({commands:t})=>Xl(s,{...o,...e})(i)?1:t.clearNodes()).command(({state:t})=>Xl(s,{...o,...e})(t,n)).run():0},Xu=t=>({tr:e,dispatch:i})=>{if(i){const{doc:i}=e,n=Ja(t,0,i.content.size),r=er.create(i,n);e.setSelection(r)}return 1},th=t=>({tr:e,dispatch:i})=>{if(i){const{doc:i}=e,{from:n,to:r}="number"==typeof t?{from:t,to:t}:t,s=Xn.atStart(i).from,o=Xn.atEnd(i).to,l=Ja(n,s,o),a=Ja(r,s,o),u=Xn.create(i,l,a);e.setSelection(u)}return 1},eh=t=>({state:e,dispatch:i})=>{const n=Oa(t,e.schema);return(r=n,function(t,e){let{$from:i,$to:n}=t.selection,s=i.blockRange(n,t=>t.childCount>0&&t.firstChild.type==r);if(!s)return 0;let o=s.startIndex;if(0==o)return 0;let l=s.parent,a=l.child(o-1);if(a.type!=r)return 0;if(e){let i=a.lastChild&&a.lastChild.type==l.type,n=Ye.from(i?r.create():null),o=new ni(Ye.from(r.create(null,Ye.from(l.type.create(null,n)))),i?3:1,0),u=s.start,h=s.end;e(t.tr.step(new wn(u-(i?3:1),h,u,h,o,1,1)).scrollIntoView())}return 1})(e,i);var r};function ih(t,e){const i=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(i){const n=i.filter(t=>null==e?void 0:e.includes(t.type.name));t.tr.ensureMarks(n)}}var nh=({keepMarks:t=1}={})=>({tr:e,state:i,dispatch:n,editor:r})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,u=Pa(r.extensionManager.attributes,l.node().type.name,l.node().attrs);if(s instanceof er&&s.node.isBlock)return l.parentOffset&&On(o,l.pos)?(n&&(t&&ih(i,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),1):0;if(!l.parent.isBlock)return 0;const h=a.parentOffset===a.parent.content.size,c=0===l.depth?void 0:function(t){for(let e=0;e<t.edgeCount;e+=1){const{type:i}=t.edge(e);if(i.isTextblock&&!i.hasRequiredAttrs())return i}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let d=h&&c?[{type:c,attrs:u}]:void 0,f=On(e.doc,e.mapping.map(l.pos),1,d);if(d||f||!On(e.doc,e.mapping.map(l.pos),1,c?[{type:c}]:void 0)||(f=1,d=c?[{type:c,attrs:u}]:void 0),n){if(f&&(s instanceof Xn&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,d),c&&!h&&!l.parentOffset&&l.parent.type!==c)){const t=e.mapping.map(l.before()),i=e.doc.resolve(t);l.node(-1).canReplaceWith(i.index(),i.index()+1,c)&&e.setNodeMarkup(e.mapping.map(l.before()),c)}t&&ih(i,r.extensionManager.splittableMarks),e.scrollIntoView()}return f},rh=(t,e={})=>({tr:i,state:n,dispatch:r,editor:s})=>{var o;const l=Oa(t,n.schema),{$from:a,$to:u}=n.selection,h=n.selection.node;if(h&&h.isBlock||a.depth<2||!a.sameParent(u))return 0;const c=a.node(-1);if(c.type!==l)return 0;const d=s.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return 0;if(r){let t=Ye.empty;const n=a.index(-1)?1:a.index(-2)?2:3;for(let e=a.depth-n;e>=a.depth-3;e-=1)t=Ye.from(a.node(e).copy(t));const r=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,s={...Pa(d,a.node().type.name,a.node().attrs),...e},u=(null==(o=l.contentMatch.defaultType)?void 0:o.createAndFill(s))||void 0;t=t.append(Ye.from(l.createAndFill(null,u)||void 0));const h=a.before(a.depth-(n-1));i.replace(h,a.after(-r),new ni(t,4-n,0));let c=-1;i.doc.nodesBetween(h,i.doc.content.size,(t,e)=>{if(c>-1)return 0;t.isTextblock&&0===t.content.size&&(c=e+1)}),c>-1&&i.setSelection(Xn.near(i.doc.resolve(c))),i.scrollIntoView()}return 1}const f=u.pos===a.end()?c.contentMatchAt(0).defaultType:null,p={...Pa(d,c.type.name,c.attrs),...e},m={...Pa(d,a.node().type.name,a.node().attrs),...e};i.delete(a.pos,u.pos);const g=f?[{type:l,attrs:p},{type:f,attrs:m}]:[{type:l,attrs:p}];if(!On(i.doc,a.pos,2))return 0;if(r){const{selection:t,storedMarks:e}=n,{splittableMarks:o}=s.extensionManager,l=e||t.$to.parentOffset&&t.$from.marks();if(i.split(a.pos,2,g).scrollIntoView(),!l||!r)return 1;const u=l.filter(t=>o.includes(t.type.name));i.ensureMarks(u)}return 1},sh=(t,e)=>{const i=ha(t=>t.type===e)(t.selection);if(!i)return 1;const n=t.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===n)return 1;const r=t.doc.nodeAt(n);return i.node.type===(null==r?void 0:r.type)&&An(t.doc,i.pos)?(t.join(i.pos),1):1},oh=(t,e)=>{const i=ha(t=>t.type===e)(t.selection);if(!i)return 1;const n=t.doc.resolve(i.start).after(i.depth);if(void 0===n)return 1;const r=t.doc.nodeAt(n);return i.node.type===(null==r?void 0:r.type)&&An(t.doc,n)?(t.join(n),1):1},lh=(t,e,i,n={})=>({editor:r,tr:s,state:o,dispatch:l,chain:a,commands:u,can:h})=>{const{extensions:c,splittableMarks:d}=r.extensionManager,f=Oa(t,o.schema),p=Oa(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:b}=m,w=y.blockRange(b),v=g||m.$to.parentOffset&&m.$from.marks();if(!w)return 0;const k=ha(t=>qa(t.type.name,c))(m);if(w.depth>=1&&k&&w.depth-k.depth<=1){if(k.node.type===f)return u.liftListItem(p);if(qa(k.node.type.name,c)&&f.validContent(k.node.content)&&l)return a().command(()=>(s.setNodeMarkup(k.pos,f),1)).command(()=>sh(s,f)).command(()=>oh(s,f)).run()}return i&&v&&l?a().command(()=>{const t=h().wrapInList(f,n),e=v.filter(t=>d.includes(t.type.name));return s.ensureMarks(e),t?1:u.clearNodes()}).wrapInList(f,n).command(()=>sh(s,f)).command(()=>oh(s,f)).run():a().command(()=>h().wrapInList(f,n)?1:u.clearNodes()).wrapInList(f,n).command(()=>sh(s,f)).command(()=>oh(s,f)).run()},ah=(t,e={},i={})=>({state:n,commands:r})=>{const{extendEmptyMarkRange:s=0}=i,o=Ea(t,n.schema);return Ha(n,o,e)?r.unsetMark(o,{extendEmptyMarkRange:s}):r.setMark(o,e)},uh=(t,e,i={})=>({state:n,commands:r})=>{const s=Oa(t,n.schema),o=Oa(e,n.schema),l=ja(n,s,i);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),l?r.setNode(o,a):r.setNode(s,{...a,...i})},hh=(t,e={})=>({state:i,commands:n})=>{const r=Oa(t,i.schema);return ja(i,r,e)?n.lift(r):n.wrapIn(r,e)},ch=()=>({state:t,dispatch:e})=>{const i=t.plugins;for(let n=0;n<i.length;n+=1){const r=i[n];let s;if(r.spec.isInputRules&&(s=r.getState(t))){if(e){const e=t.tr,i=s.transform;for(let t=i.steps.length-1;t>=0;t-=1)e.step(i.steps[t].invert(i.docs[t]));if(s.text){const i=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,i))}else e.delete(s.from,s.to)}return 1}}return 0},dh=()=>({tr:t,dispatch:e})=>{const{selection:i}=t,{empty:n,ranges:r}=i;return n||e&&r.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),1},fh=(t,e={})=>({tr:i,state:n,dispatch:r})=>{var s;const{extendEmptyMarkRange:o=0}=e,{selection:l}=i,a=Ea(t,n.schema),{$from:u,empty:h,ranges:c}=l;if(!r)return 1;if(h&&o){let{from:t,to:e}=l;const n=null==(s=u.marks().find(t=>t.type===a))?void 0:s.attrs,r=Da(u,a,n);r&&(t=r.from,e=r.to),i.removeMark(t,e,a)}else c.forEach(t=>{i.removeMark(t.$from.pos,t.$to.pos,a)});return i.removeStoredMark(a),1},ph=(t,e={})=>({tr:i,state:n,dispatch:r})=>{let s=null,o=null;const l=Aa("string"==typeof t?t:t.name,n.schema);return l?("node"===l&&(s=Oa(t,n.schema)),"mark"===l&&(o=Ea(t,n.schema)),r&&i.selection.ranges.forEach(t=>{const r=t.$from.pos,l=t.$to.pos;let a,u,h,c;i.selection.empty?n.doc.nodesBetween(r,l,(t,e)=>{s&&s===t.type&&(h=Math.max(e,r),c=Math.min(e+t.nodeSize,l),a=e,u=t)}):n.doc.nodesBetween(r,l,(t,n)=>{n<r&&s&&s===t.type&&(h=Math.max(n,r),c=Math.min(n+t.nodeSize,l),a=n,u=t),n>=r&&n<=l&&(s&&s===t.type&&i.setNodeMarkup(n,void 0,{...t.attrs,...e}),o&&t.marks.length&&t.marks.forEach(s=>{if(o===s.type){const a=Math.max(n,r),u=Math.min(n+t.nodeSize,l);i.addMark(a,u,o.create({...s.attrs,...e}))}}))}),u&&(void 0!==a&&i.setNodeMarkup(a,void 0,{...u.attrs,...e}),o&&u.marks.length&&u.marks.forEach(t=>{o===t.type&&i.addMark(h,c,o.create({...t.attrs,...e}))}))}),1):0},mh=(t,e={})=>({state:i,dispatch:n})=>function(t,e=null){return function(i,n){let{$from:r,$to:s}=i.selection,o=r.blockRange(s),l=o&&Sn(o,t,e);return l?(n&&n(i.tr.wrap(o,l).scrollIntoView()),1):0}}(Oa(t,i.schema),e)(i,n),gh=(t,e={})=>({state:i,dispatch:n})=>function(t,e=null){return function(i,n){let{$from:r,$to:s}=i.selection,o=r.blockRange(s);if(!o)return 0;let l=n?i.tr:null;return function(t,e,i,n=null){let r=0,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(i)&&0==e.startIndex){if(0==e.$from.index(e.depth-1))return 0;let t=o.resolve(e.start-2);s=new wi(t,t,e.depth),e.endIndex<e.parent.childCount&&(e=new wi(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),r=1}let l=Sn(s,i,n,e);return l?(t&&function(t,e,i,n,r){let s=Ye.empty;for(let h=i.length-1;h>=0;h--)s=Ye.from(i[h].type.create(i[h].attrs,s));t.step(new wn(e.start-(n?2:0),e.end,e.start,e.end,new ni(s,0,0),i.length,1));let o=0;for(let h=0;h<i.length;h++)i[h].type==r&&(o=h+1);let l=i.length-o,a=e.start+i.length-(n?2:0),u=e.parent;for(let h=e.startIndex,c=e.endIndex,d=1;h<c;h++,d=0)!d&&On(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=u.child(h).nodeSize}(t,e,l,r,i),1):0}(l,o,t,e)?(n&&n(l.scrollIntoView()),1):0}}(Oa(t,i.schema),e)(i,n),yh=ru.create({name:"commands",addCommands:()=>({...ou})}),bh=ru.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var i,n,r;const s=()=>{var i,n,r,s;if(null!=(s=null==(r=null==(n=null==(i=this.editor.options.coreExtensionOptions)?void 0:i.delete)?void 0:n.filterTransaction)?void 0:r.call(n,t))?s:t.getMeta("y-sync$"))return;const o=sa(t.before,[t,...e]);Ra(o).forEach(e=>{o.mapping.mapResult(e.oldRange.from).deletedAfter&&o.mapping.mapResult(e.oldRange.to).deletedBefore&&o.before.nodesBetween(e.oldRange.from,e.oldRange.to,(i,n)=>{const r=n+i.nodeSize-2,s=e.oldRange.from<=n&&r<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:i,from:n,to:r,newFrom:o.mapping.map(n),newTo:o.mapping.map(r),deletedRange:e.oldRange,newRange:e.newRange,partial:!s,editor:this.editor,transaction:t,combinedTransform:o})})});const l=o.mapping;o.steps.forEach((e,i)=>{var n,r;if(e instanceof mn){const s=l.slice(i).map(e.from,-1),a=l.slice(i).map(e.to),u=l.invert().map(s,-1),h=l.invert().map(a),c=null==(n=o.doc.nodeAt(s-1))?void 0:n.marks.some(t=>t.eq(e.mark)),d=null==(r=o.doc.nodeAt(a))?void 0:r.marks.some(t=>t.eq(e.mark));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:u,to:h},newRange:{from:s,to:a},partial:Boolean(d||c),editor:this.editor,transaction:t,combinedTransform:o})}})};null==(r=null==(n=null==(i=this.editor.options.coreExtensionOptions)?void 0:i.delete)?void 0:n.async)||r?setTimeout(s,0):s()}}),wh=ru.create({name:"drop",addProseMirrorPlugins(){return[new pr({key:new yr("tiptapDrop"),props:{handleDrop:(t,e,i,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:i,moved:n})}}})]}}),vh=ru.create({name:"editable",addProseMirrorPlugins(){return[new pr({key:new yr("editable"),props:{editable:()=>this.editor.options.editable}})]}}),kh=new yr("focusEvents"),xh=ru.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new pr({key:kh,props:{handleDOMEvents:{focus:(e,i)=>{t.isFocused=1;const n=t.state.tr.setMeta("focus",{event:i}).setMeta("addToHistory",0);return e.dispatch(n),0},blur:(e,i)=>{t.isFocused=0;const n=t.state.tr.setMeta("blur",{event:i}).setMeta("addToHistory",0);return e.dispatch(n),0}}}})]}}),Mh=ru.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:t})=>[()=>t.undoInputRule(),()=>t.command(({tr:e})=>{const{selection:i,doc:n}=e,{empty:r,$anchor:s}=i,{pos:o,parent:l}=s,a=s.parent.isTextblock&&o>0?e.doc.resolve(o-1):s,u=a.parent.type.spec.isolating,h=s.pos-s.parentOffset,c=u&&1===a.parent.childCount?h===s.pos:Gn.atStart(n).from===o;return!r||!l.type.isTextblock||l.textContent.length||!c||c&&"paragraph"===s.parent.type.name?0:t.clearNodes()}),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},n={...i},r={...i,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ku()||Iu()?r:n},addProseMirrorPlugins(){return[new pr({key:new yr("clearDocument"),appendTransaction:(t,e,i)=>{if(t.some(t=>t.getMeta("composition")))return;const n=t.some(t=>t.docChanged)&&!e.doc.eq(i.doc),r=t.some(t=>t.getMeta("preventClearDocument"));if(!n||r)return;const{empty:s,from:o,to:l}=e.selection,a=Gn.atStart(e.doc).from,u=Gn.atEnd(e.doc).to;if(s||o!==a||l!==u)return;if(!Va(i.doc))return;const h=i.tr,c=ia({state:i,transaction:h}),{commands:d}=new na({editor:this.editor,state:c});return d.clearNodes(),h.steps.length?h:void 0}})]}}),Sh=ru.create({name:"paste",addProseMirrorPlugins(){return[new pr({key:new yr("tiptapPaste"),props:{handlePaste:(t,e,i)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:i})}}})]}}),Th=ru.create({name:"tabindex",addProseMirrorPlugins(){return[new pr({key:new yr("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Eh=class t{constructor(t,e,i=0,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=t,this.editor=e,this.currentNode=n}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!=(t=this.actualDepth)?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,i=this.to;if(this.isBlock){if(0===this.content.size)return;e=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:e,to:i},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),i=this.resolvedPos.doc.resolve(e);return new t(i,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new t(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new t(e,this.editor)}get children(){const e=[];return this.node.content.forEach((i,n)=>{const r=i.isBlock&&!i.isTextblock,s=i.isAtom&&!i.isText,o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!r&&l.depth<=this.depth)return;const a=new t(l,this.editor,r,r?i:null);r&&(a.actualDepth=this.depth+1),e.push(new t(l,this.editor,r,r?i:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let i=null,n=this.parent;for(;n&&!i;)n.node.type.name===t&&(Object.keys(e).length>0||(i=n)),n=n.parent;return i}querySelector(t,e={}){return this.querySelectorAll(t,e,1)[0]||null}querySelectorAll(t,e={},i=0){let n=[];if(!this.children||0===this.children.length)return n;const r=Object.keys(e);return this.children.forEach(s=>{i&&n.length>0||(s.node.type.name===t&&r.every(t=>e[t]===s.node.attrs[t])&&n.push(s),i&&n.length>0||(n=n.concat(s.querySelectorAll(t,e,i))))}),n}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}},Ch=class extends ra{constructor(t={}){super(),this.css=null,this.editorView=null,this.isFocused=0,this.isInitialized=0,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:1,injectNonce:void 0,extensions:[],autofocus:0,editable:1,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:1,enablePasteRules:1,enableCoreExtensions:1,enableContentCheck:0,emitContentError:0,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=0,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:e,moved:i})=>this.options.onDrop(t,e,i)),this.on("paste",({event:t,slice:e})=>this.options.onPaste(t,e)),this.on("delete",this.options.onDelete);const e=this.createDoc(),i=Wa(e,this.options.autofocus);this.editorState=dr.create({doc:e,schema:this.schema,selection:i||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=1)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;(null==t?void 0:t.editor)&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=0,this.css)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(t,e){const i=document.querySelector("style[data-tiptap-style]");if(null!==i)return i;const n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.setAttribute("data-tiptap-style",""),n.innerHTML='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',document.getElementsByTagName("head")[0].appendChild(n),n}(0,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=1){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.editorState=this.state.apply(t)},composing:0,dragging:null,editable:1,isDestroyed:0},{get:(t,e)=>{if("state"===e)return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const i=pa(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let i=e;if([].concat(t).forEach(t=>{const e="string"==typeof t?`${t}$`:t.key;i=i.filter(t=>!t.key.startsWith(e))}),e.length===i.length)return;const n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}createExtensionManager(){var t,e;const i=[...this.options.enableCoreExtensions?[vh,su.configure({blockSeparator:null==(e=null==(t=this.options.coreExtensionOptions)?void 0:t.clipboardTextSerializer)?void 0:e.blockSeparator}),yh,xh,Mh,Th,wh,Sh,bh].filter(t=>"object"==typeof this.options.enableCoreExtensions?0!=this.options.enableCoreExtensions[t.name]:1):[],...this.options.extensions].filter(t=>["extension","node","mark"].includes(null==t?void 0:t.type));this.extensionManager=new nu(i,this)}createCommandManager(){this.commandManager=new na({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=1),this.options.extensions=this.options.extensions.filter(t=>"collaboration"!==t.name),this.createExtensionManager()}}),t=ua(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:0})}return t}createView(t){var e;this.editorView=new Tl(t,{...this.options.editorProps,attributes:{role:"textbox",...null==(e=this.options.editorProps)?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=1,t(),this.isCapturingTransaction=0;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach(t=>{var e;return null==(e=this.capturedTransaction)?void 0:e.step(t)}):void(this.capturedTransaction=t);const{state:e,transactions:i}=this.state.applyTransaction(t),n=!this.state.selection.eq(e.selection),r=i.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!r)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:i.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=i.findLast(t=>t.getMeta("focus")||t.getMeta("blur")),l=null==o?void 0:o.getMeta("focus"),a=null==o?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),t.getMeta("preventUpdate")||!i.some(t=>t.docChanged)||s.doc.eq(e.doc)||this.emit("update",{editor:this,transaction:t,appendedTransactions:i.slice(1)})}getAttributes(t){return $a(this.state,t)}isActive(t,e){const i="string"==typeof t?t:null,n="string"==typeof t?e:t;return function(t,e,i={}){if(!e)return ja(t,null,i)||Ha(t,null,i);const n=Aa(e,t.schema);return"node"===n?ja(t,e,i):"mark"===n?Ha(t,e,i):0}(this.state,i,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fa(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:i={}}=t||{};return function(t,e){return Sa(t,{from:0,to:t.content.size},e)}(this.state.doc,{blockSeparator:e,textSerializers:{...Ta(this.schema),...i}})}get isEmpty(){return Va(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return null!=(e=null==(t=this.editorView)?void 0:t.isDestroyed)?e:1}$node(t,e){var i;return(null==(i=this.$doc)?void 0:i.querySelector(t,e))||null}$nodes(t,e){var i;return(null==(i=this.$doc)?void 0:i.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Eh(e,this)}get $doc(){return this.$pos(0)}};function Oh(t){return new Ga({find:t.find,handler:({state:e,range:i,match:n})=>{const r=ma(t.getAttributes,void 0,n);if(0==r||null===r)return null;const{tr:s}=e,o=n[n.length-1],l=n[0];if(o){const n=l.search(/\S/),a=i.from+l.indexOf(o),u=a+o.length;if(_a(i.from,i.to,e.doc).filter(e=>e.mark.type.excluded.find(i=>i===t.type&&i!==e.mark.type)).filter(t=>t.to>a).length)return null;u<i.to&&s.delete(u,i.to),a>i.from&&s.delete(i.from+n,a);const h=i.from+n+o.length;s.addMark(i.from+n,h,t.type.create(r||{})),s.removeStoredMark(t.type)}}})}function Ah(t){return new Ga({find:t.find,handler:({state:e,range:i,match:n})=>{const r=e.doc.resolve(i.from),s=ma(t.getAttributes,void 0,n)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(i.from,i.to).setBlockType(i.from,i.from,t.type,s)}})}function $h(t){return new Ga({find:t.find,handler:({state:e,range:i,match:n,chain:r})=>{const s=ma(t.getAttributes,void 0,n)||{},o=e.tr.delete(i.from,i.to),l=o.doc.resolve(i.from).blockRange(),a=l&&Sn(l,t.type,s);if(!a)return null;if(o.wrap(l,a),t.keepMarks&&t.editor){const{selection:i,storedMarks:n}=e,{splittableMarks:r}=t.editor.extensionManager,s=n||i.$to.parentOffset&&i.$from.marks();if(s){const t=s.filter(t=>r.includes(t.type.name));o.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";r().updateAttributes(e,s).run()}const u=o.doc.resolve(i.from-1).nodeBefore;u&&u.type===t.type&&An(o.doc,i.from-1)&&(!t.joinPredicate||t.joinPredicate(n,u))&&o.join(i.from-1)}})}var Rh=class t extends Xa{constructor(){super(...arguments),this.type="node"}static create(e={}){const i="function"==typeof e?e():e;return new t(i)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}};function Lh(t){return new eu({find:t.find,handler:({state:e,range:i,match:n,pasteEvent:r})=>{const s=ma(t.getAttributes,void 0,n,r);if(0==s||null===s)return null;const{tr:o}=e,l=n[n.length-1],a=n[0];let u=i.to;if(l){const n=a.search(/\S/),r=i.from+a.indexOf(l),h=r+l.length;if(_a(i.from,i.to,e.doc).filter(e=>e.mark.type.excluded.find(i=>i===t.type&&i!==e.mark.type)).filter(t=>t.to>r).length)return null;h<i.to&&o.delete(h,i.to),r>i.from&&o.delete(i.from+n,r),u=i.from+n+l.length,o.addMark(i.from+n,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function Bh(e){return t.customRef((t,i)=>({get:()=>(t(),e),set(t){e=t,requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})})}}))}var Ih=class extends Ch{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Bh(this.view.state),this.reactiveExtensionStorage=Bh(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),t.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(t,e){const i=super.registerPlugin(t,e);return this.reactiveState&&(this.reactiveState.value=i),i}unregisterPlugin(t){const e=super.unregisterPlugin(t);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Nh=t.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const i=t.ref(),n=t.getCurrentInstance();return t.watchEffect(()=>{const r=e.editor;r&&r.options.element&&i.value&&t.nextTick(()=>{var e;if(!i.value||!(null==(e=r.options.element)?void 0:e.firstChild))return;const s=t.unref(i.value);i.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx.m,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:s}),r.createNodeViews()})}),t.onBeforeUnmount(()=>{const t=e.editor;t&&(t.contentComponent=null,t.appContext=null)}),{rootEl:i}},render(){return t.h("div",{ref:t=>{this.rootEl=t}})}});t.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return t.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),t.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var e,i;return t.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},null==(i=(e=this.$slots).default)?void 0:i.call(e))}}),t.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return t.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var Dh=(t,e)=>{if("slot"===t)return 0;if(t instanceof Function)return t(e);const{children:i,...n}=null!=e?e:{};if("svg"===t)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,n,i]},_h=/^\s*>\s$/,zh=Rh.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:1,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return Dh("blockquote",{...ba(this.options.HTMLAttributes,t),children:Dh("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[$h({find:_h,type:this.type})]}}),Ph=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Hh=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,jh=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Uh=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,qh=tu.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Dh("strong",{...ba(this.options.HTMLAttributes,t),children:Dh("slot",{})})},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Oh({find:Ph,type:this.type}),Oh({find:jh,type:this.type})]},addPasteRules(){return[Lh({find:Hh,type:this.type}),Lh({find:Uh,type:this.type})]}}),Vh=/(^|[^`])`([^`]+)`(?!`)$/,Fh=/(^|[^`])`([^`]+)`(?!`)/g,Kh=tu.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:1,exitable:1,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Oh({find:Vh,type:this.type})]},addPasteRules(){return[Lh({find:Fh,type:this.type})]}}),Jh=/^```([a-z]+)?[\s\n]$/,Wh=/^~~~([a-z]+)?[\s\n]$/,Gh=Rh.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:1,exitOnArrowDown:1,defaultLanguage:null,enableTabIndentation:0,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:1,defining:1,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:i}=this.options;return[...(null==(e=t.firstElementChild)?void 0:e.classList)||[]].filter(t=>t.startsWith(i)).map(t=>t.replace(i,""))[0]||null},rendered:0}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:t,HTMLAttributes:e}){return["pre",ba(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,i=1===e.pos;return!t||e.parent.type.name!==this.name||!i&&e.parent.textContent.length?0:this.editor.commands.clearNodes()},Tab:({editor:t})=>{if(!this.options.enableTabIndentation)return 0;const{state:e}=t,{selection:i}=e,{$from:n,empty:r}=i;if(n.parent.type!==this.type)return 0;const s=" ".repeat(this.options.tabSize);return r?t.commands.insertContent(s):t.commands.command(({tr:t})=>{const{from:n,to:r}=i,o=e.doc.textBetween(n,r,"\n","\n").split("\n").map(t=>s+t).join("\n");return t.replaceWith(n,r,e.schema.text(o)),1})},"Shift-Tab":({editor:t})=>{if(!this.options.enableTabIndentation)return 0;const{state:e}=t,{selection:i}=e,{$from:n,empty:r}=i;return n.parent.type!==this.type?0:r?t.commands.command(({tr:t})=>{var i;const{pos:r}=n,s=n.start(),o=n.end(),l=e.doc.textBetween(s,o,"\n","\n").split("\n");let a=0,u=0;const h=r-s;for(let e=0;e<l.length;e+=1){if(u+l[e].length>=h){a=e;break}u+=l[e].length+1}const c=(null==(i=l[a].match(/^ */))?void 0:i[0])||"",d=Math.min(c.length,this.options.tabSize);if(0===d)return 1;let f=s;for(let e=0;e<a;e+=1)f+=l[e].length+1;return t.delete(f,f+d),r-f<=d&&t.setSelection(Xn.create(t.doc,f)),1}):t.commands.command(({tr:t})=>{const{from:n,to:r}=i,s=e.doc.textBetween(n,r,"\n","\n").split("\n").map(t=>{var e;const i=(null==(e=t.match(/^ */))?void 0:e[0])||"",n=Math.min(i.length,this.options.tabSize);return t.slice(n)}).join("\n");return t.replaceWith(n,r,e.schema.text(s)),1})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return 0;const{state:e}=t,{selection:i}=e,{$from:n,empty:r}=i;if(!r||n.parent.type!==this.type)return 0;const s=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return s&&o?t.chain().command(({tr:t})=>(t.delete(n.pos-2,n.pos),1)).exitCode().run():0},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return 0;const{state:e}=t,{selection:i,doc:n}=e,{$from:r,empty:s}=i;if(!s||r.parent.type!==this.type)return 0;if(r.parentOffset!==r.parent.nodeSize-2)return 0;const o=r.after();return void 0===o?0:n.nodeAt(o)?t.commands.command(({tr:t})=>(t.setSelection(Gn.near(n.resolve(o))),1)):t.commands.exitCode()}}},addInputRules(){return[Ah({find:Jh,type:this.type,getAttributes:t=>({language:t[1]})}),Ah({find:Wh,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new pr({key:new yr("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData)return 0;if(this.editor.isActive(this.type.name))return 0;const i=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),r=n?JSON.parse(n):void 0,s=null==r?void 0:r.mode;if(!i||!s)return 0;const{tr:o,schema:l}=t.state,a=l.text(i.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(Xn.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",1),t.dispatch(o),1}}})]}}),Qh=Rh.create({name:"doc",topNode:1,content:"block+"}),Yh=Rh.create({name:"hardBreak",addOptions:()=>({keepMarks:1,HTMLAttributes:{}}),inline:1,group:"inline",selectable:0,linebreakReplacement:1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",ba(this.options.HTMLAttributes,t)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:t,storedMarks:r}=i;if(t.$from.parent.type.spec.isolating)return 0;const{keepMarks:s}=this.options,{splittableMarks:o}=n.extensionManager,l=r||t.$to.parentOffset&&t.$from.marks();return e().insertContent({type:this.name}).command(({tr:t,dispatch:e})=>{if(e&&l&&s){const e=l.filter(t=>o.includes(t.type.name));t.ensureMarks(e)}return 1}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Zh=Rh.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:1,addAttributes:()=>({level:{default:1,rendered:0}}),parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ba(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):0,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):0}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ah({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Xh=Zh,tc=Rh.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",ba(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!function(t,e){const{selection:i}=t,{$from:n}=i;if(i instanceof er){const t=n.index();return n.parent.canReplaceWith(t,t+1,e)}let r=n.depth;for(;r>=0;){const t=n.index(r);if(n.node(r).contentMatchAt(t).matchType(e))return 1;r-=1}return 0}(e,e.schema.nodes[this.name]))return 0;const{selection:i}=e,{$to:n}=i,r=t();return Fa(i)?r.insertContentAt(n.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({tr:t,dispatch:e})=>{var i;if(e){const{$to:e}=t.selection,n=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?t.setSelection(Xn.create(t.doc,e.pos+1)):e.nodeAfter.isBlock?t.setSelection(er.create(t.doc,e.pos)):t.setSelection(Xn.create(t.doc,e.pos));else{const r=null==(i=e.parent.type.contentMatch.defaultType)?void 0:i.create();r&&(t.insert(n,r),t.setSelection(Xn.create(t.doc,n+1)))}t.scrollIntoView()}return 1}).run()}}},addInputRules(){return[(t={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Ga({find:t.find,handler:({state:e,range:i,match:n})=>{const r=ma(t.getAttributes,void 0,n)||{},{tr:s}=e,o=i.from;let l=i.to;const a=t.type.create(r);if(n[1]){let t=o+n[0].lastIndexOf(n[1]);t>l?t=l:l=t+n[1].length;const e=n[0][n[0].length-1];s.insertText(e,o+n[0].length-1),s.replaceWith(t,l,a)}else if(n[0]){const e=t.type.isInline?o:o-1;s.insert(e,t.type.create(r)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}}))];var t}}),ec=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ic=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,nc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,rc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sc=tu.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Oh({find:ec,type:this.type}),Oh({find:nc,type:this.type})]},addPasteRules(){return[Lh({find:ic,type:this.type}),Lh({find:rc,type:this.type})]}});const oc="numeric",lc="ascii",ac="alpha",uc="asciinumeric",hc="alphanumeric",cc="domain",dc="emoji",fc="scheme",pc="slashscheme",mc="whitespace";function gc(t,e){return t in e||(e[t]=[]),e[t]}function yc(t,e,i){e[oc]&&(e[uc]=1,e[hc]=1),e[lc]&&(e[uc]=1,e[ac]=1),e[uc]&&(e[hc]=1),e[ac]&&(e[hc]=1),e[hc]&&(e[cc]=1),e[dc]&&(e[cc]=1);for(const n in e){const e=gc(n,i);e.indexOf(t)<0&&e.push(t)}}function bc(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}bc.groups={},bc.prototype={accepts(){return!!this.t},go(t){const e=this,i=e.j[t];if(i)return i;for(let n=0;n<e.jr.length;n++){const i=e.jr[n][0],r=e.jr[n][1];if(r&&i.test(t))return r}return e.jd},has(t,e=0){return e?t in this.j:!!this.go(t)},ta(t,e,i,n){for(let r=0;r<t.length;r++)this.tt(t[r],e,i,n)},tr(t,e,i,n){let r;return n=n||bc.groups,e&&e.j?r=e:(r=new bc(e),i&&n&&yc(e,i,n)),this.jr.push([t,r]),r},ts(t,e,i,n){let r=this;const s=t.length;if(!s)return r;for(let o=0;o<s-1;o++)r=r.tt(t[o]);return r.tt(t[s-1],e,i,n)},tt(t,e,i,n){n=n||bc.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const s=e;let o,l=r.go(t);if(l?(o=new bc,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new bc,s){if(n)if(o.t&&"string"==typeof o.t){const t=Object.assign(function(t,e){const i={};for(const n in e)e[n].indexOf(t)>=0&&(i[n]=1);return i}(o.t,n),i);yc(s,t,n)}else i&&yc(s,i,n);o.t=s}return r.j[t]=o,o}};const wc=(t,e,i,n,r)=>t.ta(e,i,n,r),vc=(t,e,i,n,r)=>t.tr(e,i,n,r),kc=(t,e,i,n,r)=>t.ts(e,i,n,r),xc=(t,e,i,n,r)=>t.tt(e,i,n,r),Mc="WORD",Sc="UWORD",Tc="ASCIINUMERICAL",Ec="ALPHANUMERICAL",Cc="LOCALHOST",Oc="TLD",Ac="UTLD",$c="SCHEME",Rc="SLASH_SCHEME",Lc="NUM",Bc="WS",Ic="NL",Nc="OPENBRACE",Dc="CLOSEBRACE",_c="OPENBRACKET",zc="CLOSEBRACKET",Pc="OPENPAREN",Hc="CLOSEPAREN",jc="OPENANGLEBRACKET",Uc="CLOSEANGLEBRACKET",qc="FULLWIDTHLEFTPAREN",Vc="FULLWIDTHRIGHTPAREN",Fc="LEFTCORNERBRACKET",Kc="RIGHTCORNERBRACKET",Jc="LEFTWHITECORNERBRACKET",Wc="RIGHTWHITECORNERBRACKET",Gc="FULLWIDTHLESSTHAN",Qc="FULLWIDTHGREATERTHAN",Yc="AMPERSAND",Zc="APOSTROPHE",Xc="ASTERISK",td="AT",ed="BACKSLASH",id="BACKTICK",nd="CARET",rd="COLON",sd="COMMA",od="DOLLAR",ld="DOT",ad="EQUALS",ud="EXCLAMATION",hd="HYPHEN",cd="PERCENT",dd="PIPE",fd="PLUS",pd="POUND",md="QUERY",gd="QUOTE",yd="FULLWIDTHMIDDLEDOT",bd="SEMI",wd="SLASH",vd="TILDE",kd="UNDERSCORE",xd="EMOJI",Md="SYM";var Sd=Object.freeze({__proto__:null,ALPHANUMERICAL:Ec,AMPERSAND:Yc,APOSTROPHE:Zc,ASCIINUMERICAL:Tc,ASTERISK:Xc,AT:td,BACKSLASH:ed,BACKTICK:id,CARET:nd,CLOSEANGLEBRACKET:Uc,CLOSEBRACE:Dc,CLOSEBRACKET:zc,CLOSEPAREN:Hc,COLON:rd,COMMA:sd,DOLLAR:od,DOT:ld,EMOJI:xd,EQUALS:ad,EXCLAMATION:ud,FULLWIDTHGREATERTHAN:Qc,FULLWIDTHLEFTPAREN:qc,FULLWIDTHLESSTHAN:Gc,FULLWIDTHMIDDLEDOT:yd,FULLWIDTHRIGHTPAREN:Vc,HYPHEN:hd,LEFTCORNERBRACKET:Fc,LEFTWHITECORNERBRACKET:Jc,LOCALHOST:Cc,NL:Ic,NUM:Lc,OPENANGLEBRACKET:jc,OPENBRACE:Nc,OPENBRACKET:_c,OPENPAREN:Pc,PERCENT:cd,PIPE:dd,PLUS:fd,POUND:pd,QUERY:md,QUOTE:gd,RIGHTCORNERBRACKET:Kc,RIGHTWHITECORNERBRACKET:Wc,SCHEME:$c,SEMI:bd,SLASH:wd,SLASH_SCHEME:Rc,SYM:Md,TILDE:vd,TLD:Oc,UNDERSCORE:kd,UTLD:Ac,UWORD:Sc,WORD:Mc,WS:Bc});const Td=/[a-z]/,Ed=new RegExp("\\p{L}","u"),Cd=new RegExp("\\p{Emoji}","u"),Od=/\d/,Ad=/\s/;let $d=null,Rd=null;function Ld(t,e){const i=function(t){const e=[],i=t.length;let n=0;for(;n<i;){let r,s=t.charCodeAt(n),o=s<55296||s>56319||n+1===i||(r=t.charCodeAt(n+1))<56320||r>57343?t[n]:t.slice(n,n+2);e.push(o),n+=o.length}return e}(e.replace(/[A-Z]/g,t=>t.toLowerCase())),n=i.length,r=[];let s=0,o=0;for(;o<n;){let l=t,a=null,u=0,h=null,c=-1,d=-1;for(;o<n&&(a=l.go(i[o]));)l=a,l.accepts()?(c=0,d=0,h=l):c>=0&&(c+=i[o].length,d++),u+=i[o].length,s+=i[o].length,o++;s-=c,o-=d,u-=c,r.push({t:h.t,v:e.slice(s-u,s),s:s-u,e:s})}return r}function Bd(t,e,i,n,r){let s;const o=e.length;for(let l=0;l<o-1;l++){const i=e[l];t.j[i]?s=t.j[i]:(s=new bc(n),s.jr=r.slice(),t.j[i]=s),t=s}return s=new bc(i),s.jr=r.slice(),t.j[e[o-1]]=s,s}function Id(t){const e=[],i=[];let n=0;for(;n<t.length;){let r=0;for(;"0123456789".indexOf(t[n+r])>=0;)r++;if(r>0){e.push(i.join(""));for(let e=parseInt(t.substring(n,n+r),10);e>0;e--)i.pop();n+=r}else i.push(t[n]),n++}return e}const Nd={defaultProtocol:"http",events:null,format:_d,formatHref:_d,nl2br:0,tagName:"a",target:null,rel:null,validate:1,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Dd(t,e=null){let i=Object.assign({},Nd);t&&(i=Object.assign(i,t instanceof Dd?t.o:t));const n=i.ignoreTags,r=[];for(let s=0;s<n.length;s++)r.push(n[s].toUpperCase());this.o=i,e&&(this.defaultRender=e),this.ignoreTags=r}function _d(t){return t}function zd(t,e){this.t="token",this.v=t,this.tk=e}function Pd(t,e){class i extends zd{constructor(e,i){super(e,i),this.t=t}}for(const n in e)i.prototype[n]=e[n];return i.t=t,i}Dd.prototype={o:Nd,ignoreTags:[],defaultRender:t=>t,check(t){return this.get("validate",t.toString(),t)},get(t,e,i){const n=null!=e;let r=this.o[t];return r?("object"==typeof r?(r=i.t in r?r[i.t]:Nd[t],"function"==typeof r&&n&&(r=r(e,i))):"function"==typeof r&&n&&(r=r(e,i.t,i)),r):r},getObj(t,e,i){let n=this.o[t];return"function"==typeof n&&null!=e&&(n=n(e,i.t,i)),n},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},zd.prototype={isLink:0,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),i=t.get("truncate",e,this),n=t.get("format",e,this);return i&&n.length>i?n.substring(0,i)+"…":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Nd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,i=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",i,this),r=t.get("tagName",i,e),s=this.toFormattedString(t),o={},l=t.get("className",i,e),a=t.get("target",i,e),u=t.get("rel",i,e),h=t.getObj("attributes",i,e),c=t.getObj("events",i,e);return o.href=n,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),h&&Object.assign(o,h),{tagName:r,attributes:o,content:s,eventListeners:c}}};const Hd=Pd("email",{isLink:1,toHref(){return"mailto:"+this.toString()}}),jd=Pd("text"),Ud=Pd("nl"),qd=Pd("url",{isLink:1,toHref(t=Nd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Cc&&t[1].t===rd}}),Vd=t=>new bc(t);function Fd(t,e,i){const n=i[0].s,r=i[i.length-1].e;return new t(e.slice(n,r),i)}const Kd="undefined"!=typeof console&&console&&console.warn||(()=>{}),Jd={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:0};function Wd(t,e=0){if(Jd.initialized&&Kd(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');Jd.customSchemes.push([t,e])}function Gd(t){return Jd.initialized||function(){Jd.scanner=function(t=[]){const e={};bc.groups=e;const i=new bc;null==$d&&($d=Id("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Rd&&(Rd=Id("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),xc(i,"'",Zc),xc(i,"{",Nc),xc(i,"}",Dc),xc(i,"[",_c),xc(i,"]",zc),xc(i,"(",Pc),xc(i,")",Hc),xc(i,"<",jc),xc(i,">",Uc),xc(i,"(",qc),xc(i,")",Vc),xc(i,"「",Fc),xc(i,"」",Kc),xc(i,"『",Jc),xc(i,"』",Wc),xc(i,"<",Gc),xc(i,">",Qc),xc(i,"&",Yc),xc(i,"*",Xc),xc(i,"@",td),xc(i,"`",id),xc(i,"^",nd),xc(i,":",rd),xc(i,",",sd),xc(i,"$",od),xc(i,".",ld),xc(i,"=",ad),xc(i,"!",ud),xc(i,"-",hd),xc(i,"%",cd),xc(i,"|",dd),xc(i,"+",fd),xc(i,"#",pd),xc(i,"?",md),xc(i,'"',gd),xc(i,"/",wd),xc(i,";",bd),xc(i,"~",vd),xc(i,"_",kd),xc(i,"\\",ed),xc(i,"・",yd);const n=vc(i,Od,Lc,{[oc]:1});vc(n,Od,n);const r=vc(n,Td,Tc,{[uc]:1}),s=vc(n,Ed,Ec,{[hc]:1}),o=vc(i,Td,Mc,{[lc]:1});vc(o,Od,r),vc(o,Td,o),vc(r,Od,r),vc(r,Td,r);const l=vc(i,Ed,Sc,{[ac]:1});vc(l,Td),vc(l,Od,s),vc(l,Ed,l),vc(s,Od,s),vc(s,Td),vc(s,Ed,s);const a=xc(i,"\n",Ic,{[mc]:1}),u=xc(i,"\r",Bc,{[mc]:1}),h=vc(i,Ad,Bc,{[mc]:1});xc(i,"",h),xc(u,"\n",a),xc(u,"",h),vc(u,Ad,h),xc(h,"\r"),xc(h,"\n"),vc(h,Ad,h),xc(h,"",h);const c=vc(i,Cd,xd,{[dc]:1});xc(c,"#"),vc(c,Cd,c),xc(c,"️",c);const d=xc(c,"");xc(d,"#"),vc(d,Cd,c);const f=[[Td,o],[Od,r]],p=[[Td,null],[Ed,l],[Od,s]];for(let m=0;m<$d.length;m++)Bd(i,$d[m],Oc,Mc,f);for(let m=0;m<Rd.length;m++)Bd(i,Rd[m],Ac,Sc,p);yc(Oc,{tld:1,ascii:1},e),yc(Ac,{utld:1,alpha:1},e),Bd(i,"file",$c,Mc,f),Bd(i,"mailto",$c,Mc,f),Bd(i,"http",Rc,Mc,f),Bd(i,"https",Rc,Mc,f),Bd(i,"ftp",Rc,Mc,f),Bd(i,"ftps",Rc,Mc,f),yc($c,{scheme:1,ascii:1},e),yc(Rc,{slashscheme:1,ascii:1},e),t=t.sort((t,e)=>t[0]>e[0]?1:-1);for(let m=0;m<t.length;m++){const e=t[m][0],n=t[m][1]?{[fc]:1}:{[pc]:1};e.indexOf("-")>=0?n[cc]=1:Td.test(e)?Od.test(e)?n[uc]=1:n[lc]=1:n[oc]=1,kc(i,e,e,n)}return kc(i,"localhost",Cc,{ascii:1}),i.jd=new bc(Md),{start:i,tokens:Object.assign({groups:e},Sd)}}(Jd.customSchemes);for(let t=0;t<Jd.tokenQueue.length;t++)Jd.tokenQueue[t][1]({scanner:Jd.scanner});Jd.parser=function({groups:t}){const e=t.domain.concat([Yc,Xc,td,ed,id,nd,od,ad,hd,Lc,cd,dd,fd,pd,wd,Md,vd,kd]),i=[Zc,rd,sd,ld,ud,cd,md,gd,bd,jc,Uc,Nc,Dc,zc,_c,Pc,Hc,qc,Vc,Fc,Kc,Jc,Wc,Gc,Qc],n=[Yc,Zc,Xc,ed,id,nd,od,ad,hd,Nc,Dc,cd,dd,fd,pd,md,wd,Md,vd,kd],r=Vd(),s=xc(r,vd);wc(s,n,s),wc(s,t.domain,s);const o=Vd(),l=Vd(),a=Vd();wc(r,t.domain,o),wc(r,t.scheme,l),wc(r,t.slashscheme,a),wc(o,n,s),wc(o,t.domain,o);const u=xc(o,td);xc(s,td,u),xc(l,td,u),xc(a,td,u);const h=xc(s,ld);wc(h,n,s),wc(h,t.domain,s);const c=Vd();wc(u,t.domain,c),wc(c,t.domain,c);const d=xc(c,ld);wc(d,t.domain,c);const f=Vd(Hd);wc(d,t.tld,f),wc(d,t.utld,f),xc(u,Cc,f);const p=xc(c,hd);xc(p,hd,p),wc(p,t.domain,c),wc(f,t.domain,c),xc(f,ld,d),xc(f,hd,p);const m=xc(f,rd);wc(m,t.numeric,Hd);const g=xc(o,hd),y=xc(o,ld);xc(g,hd,g),wc(g,t.domain,o),wc(y,n,s),wc(y,t.domain,o);const b=Vd(qd);wc(y,t.tld,b),wc(y,t.utld,b),wc(b,t.domain,o),wc(b,n,s),xc(b,ld,y),xc(b,hd,g),xc(b,td,u);const w=xc(b,rd),v=Vd(qd);wc(w,t.numeric,v);const k=Vd(qd),x=Vd();wc(k,e,k),wc(k,i,x),wc(x,e,k),wc(x,i,x),xc(b,wd,k),xc(v,wd,k);const M=xc(l,rd),S=xc(a,rd),T=xc(S,wd),E=xc(T,wd);wc(l,t.domain,o),xc(l,ld,y),xc(l,hd,g),wc(a,t.domain,o),xc(a,ld,y),xc(a,hd,g),wc(M,t.domain,k),xc(M,wd,k),xc(M,md,k),wc(E,t.domain,k),wc(E,e,k),xc(E,wd,k);const C=[[Nc,Dc],[_c,zc],[Pc,Hc],[jc,Uc],[qc,Vc],[Fc,Kc],[Jc,Wc],[Gc,Qc]];for(let O=0;O<C.length;O++){const[t,n]=C[O],r=xc(k,t);xc(x,t,r),xc(r,n,k);const s=Vd(qd);wc(r,e,s);const o=Vd();wc(r,i),wc(s,e,s),wc(s,i,o),wc(o,e,s),wc(o,i,o),xc(s,n,k),xc(o,n,k)}return xc(r,Cc,b),xc(r,Ic,Ud),{start:r,tokens:Sd}}(Jd.scanner.tokens);for(let t=0;t<Jd.pluginQueue.length;t++)Jd.pluginQueue[t][1]({scanner:Jd.scanner,parser:Jd.parser});Jd.initialized=1}(),function(t,e,i){let n=i.length,r=0,s=[],o=[];for(;r<n;){let l=t,a=null,u=null,h=0,c=null,d=-1;for(;r<n&&!(a=l.go(i[r].t));)o.push(i[r++]);for(;r<n&&(u=a||l.go(i[r].t));)a=null,l=u,l.accepts()?(d=0,c=l):d>=0&&d++,r++,h++;if(d<0)r-=h,r<n&&(o.push(i[r]),r++);else{o.length>0&&(s.push(Fd(jd,e,o)),o=[]),r-=d,h-=d;const t=c.t,n=i.slice(r-h,r);s.push(Fd(t,e,n))}}return o.length>0&&s.push(Fd(jd,e,o)),s}(Jd.parser.start,t,Ld(Jd.scanner.start,t))}function Qd(t,e=null,i=null){if(e&&"object"==typeof e){if(i)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);i=e,e=null}const n=new Dd(i),r=Gd(t),s=[];for(let o=0;o<r.length;o++){const t=r[o];!t.isLink||e&&t.t!==e||!n.check(t)||s.push(t.toFormattedObject(n))}return s}Gd.scan=Ld;var Yd="[\0- -\u2029 ]",Zd=new RegExp(Yd),Xd=new RegExp(`${Yd}$`),tf=new RegExp(Yd,"g");function ef(t,e){const i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(t=>{const e="string"==typeof t?t:t.scheme;e&&i.push(e)}),!t||t.replace(tf,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var nf=tu.create({name:"link",priority:1e3,keepOnSplit:0,exitable:1,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate),this.options.protocols.forEach(t=>{"string"!=typeof t?Wd(t.scheme,t.optionalSlashes):Wd(t)})},onDestroy(){bc.groups={},Jd.scanner=null,Jd.parser=null,Jd.tokenQueue=[],Jd.pluginQueue=[],Jd.customSchemes=[],Jd.initialized=0},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:1,enableClickSelection:0,linkOnPaste:1,autolink:1,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ef(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}),addAttributes(){return{href:{default:null,parseHTML:t=>t.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return e&&this.options.isAllowedUri(e,{defaultValidate:t=>!!ef(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?null:0}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:t=>!!ef(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ba(this.options.HTMLAttributes,t),0]:["a",ba(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:i}=t;return this.options.isAllowedUri(i,{defaultValidate:t=>!!ef(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",1).run():0},toggleLink:t=>({chain:e})=>{const{href:i}=t||{};return i&&!this.options.isAllowedUri(i,{defaultValidate:t=>!!ef(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?0:e().toggleMark(this.name,t,{extendEmptyMarkRange:1}).setMeta("preventAutolink",1).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:1}).setMeta("preventAutolink",1).run()}},addPasteRules(){return[Lh({find:t=>{const e=[];if(t){const{protocols:i,defaultProtocol:n}=this.options,r=Qd(t).filter(t=>t.isLink&&this.options.isAllowedUri(t.value,{defaultValidate:t=>!!ef(t,i),protocols:i,defaultProtocol:n}));r.length&&r.forEach(t=>e.push({text:t.value,data:{href:t.href},index:t.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:null==(e=t.data)?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:i}=this.options;var n;return this.options.autolink&&t.push((n={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:t=>this.options.isAllowedUri(t,{defaultValidate:t=>!!ef(t,e),protocols:e,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink},new pr({key:new yr("autolink"),appendTransaction:(t,e,i)=>{const r=t.some(t=>t.docChanged)&&!e.doc.eq(i.doc),s=t.some(t=>t.getMeta("preventAutolink"));if(!r||s)return;const{tr:o}=i;return Ra(sa(e.doc,[...t])).forEach(({newRange:t})=>{const e=function(t,e){const i=[];return t.nodesBetween(e.from,e.to,(t,e)=>{(t=>t.isTextblock)(t)&&i.push({node:t,pos:e})}),i}(i.doc,t);let r,s;if(e.length>1)r=e[0],s=i.doc.textBetween(r.pos,r.pos+r.node.nodeSize,void 0," ");else if(e.length){const n=i.doc.textBetween(t.from,t.to," "," ");if(!Xd.test(n))return;r=e[0],s=i.doc.textBetween(r.pos,t.to,void 0," ")}if(r&&s){const t=s.split(Zd).filter(Boolean);if(t.length<=0)return 0;const e=t[t.length-1],a=r.pos+s.lastIndexOf(e);if(!e)return 0;const u=Gd(e).map(t=>t.toObject(n.defaultProtocol));if(!(1===(l=u).length?l[0].isLink:3===l.length&&l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return 0;u.filter(t=>t.isLink).map(t=>({...t,from:a+t.start+1,to:a+t.end+1})).filter(t=>i.schema.marks.code?!i.doc.rangeHasMark(t.from,t.to,i.schema.marks.code):1).filter(t=>n.validate(t.value)).filter(t=>n.shouldAutoLink(t.value)).forEach(t=>{_a(t.from,t.to,i.doc).some(t=>t.mark.type===n.type)||o.addMark(t.from,t.to,n.type.create({href:t.href}))})}var l}),o.steps.length?o:void 0}}))),1==this.options.openOnClick&&t.push(function(t){return new pr({key:new yr("handleClickLink"),props:{handleClick:(e,i,n)=>{var r,s;if(0!==n.button)return 0;if(!e.editable)return 0;let o=null;if(n.target instanceof HTMLAnchorElement)o=n.target;else{let t=n.target;const e=[];for(;"DIV"!==t.nodeName;)e.push(t),t=t.parentNode;o=e.find(t=>"A"===t.nodeName)}if(!o)return 0;const l=$a(e.state,t.type.name),a=null!=(r=null==o?void 0:o.href)?r:l.href,u=null!=(s=null==o?void 0:o.target)?s:l.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),o&&a?(window.open(a,u),1):0}}})}({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(function(t){return new pr({key:new yr("handlePasteLink"),props:{handlePaste:(e,i,n)=>{const{state:r}=e,{selection:s}=r,{empty:o}=s;if(o)return 0;let l="";n.content.forEach(t=>{l+=t.textContent});const a=Qd(l,{defaultProtocol:t.defaultProtocol}).find(t=>t.isLink&&t.value===l);return l&&a?t.editor.commands.setMark(t.type,{href:a.href}):0}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),rf=Object.defineProperty,sf="textStyle",of=/^\s*([-+*])\s$/,lf=Rh.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:0,keepAttributes:0}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(sf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=$h({find:of,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=$h({find:of,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(sf),editor:this.editor})),[t]}}),af=Rh.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:1,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",ba(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((t,e)=>{for(var i in e)rf(t,i,{get:e[i],enumerable:1})})({},{findListItemPos:()=>uf,getNextListDepth:()=>hf,handleBackspace:()=>pf,handleDelete:()=>yf,hasListBefore:()=>cf,hasListItemAfter:()=>bf,hasListItemBefore:()=>df,listItemHasSubList:()=>ff,nextListIsDeeper:()=>mf,nextListIsHigher:()=>gf});var uf=(t,e)=>{const{$from:i}=e.selection,n=Oa(t,e.schema);let r=null,s=i.depth,o=i.pos,l=null;for(;s>0&&null===l;)r=i.node(s),r.type===n?l=s:(s-=1,o-=1);return null===l?null:{$pos:e.doc.resolve(o),depth:l}},hf=(t,e)=>{const i=uf(t,e);if(!i)return 0;const[,n]=((t,e,i,n=20)=>{const r=t.doc.resolve(i);let s=n,o=null;for(;s>0&&null===o;){const t=r.node(s);(null==t?void 0:t.type.name)===e?o=t:s-=1}return[o,s]})(e,t,i.$pos.pos+4);return n},cf=(t,e,i)=>{const{$anchor:n}=t.selection,r=Math.max(0,n.pos-2),s=t.doc.resolve(r).node();return s&&i.includes(s.type.name)?1:0},df=(t,e)=>{var i;const{$anchor:n}=e.selection,r=e.doc.resolve(n.pos-2);return 0===r.index()||(null==(i=r.nodeBefore)?void 0:i.type.name)!==t?0:1},ff=(t,e,i)=>{if(!i)return 0;const n=Oa(t,e.schema);let r=0;return i.descendants(t=>{t.type===n&&(r=1)}),r},pf=(t,e,i)=>{if(t.commands.undoInputRule())return 1;if(t.state.selection.from!==t.state.selection.to)return 0;if(!ja(t.state,e)&&cf(t.state,e,i)){const{$anchor:i}=t.state.selection,n=t.state.doc.resolve(i.before()-1),r=[];n.node().descendants((t,i)=>{t.type.name===e&&r.push({node:t,pos:i})});const s=r.at(-1);if(!s)return 0;const o=t.state.doc.resolve(n.start()+s.pos+1);return t.chain().cut({from:i.start()-1,to:i.end()+1},o.end()).joinForward().run()}if(!ja(t.state,e))return 0;if(!(t=>{const{$from:e,$to:i}=t.selection;return e.parentOffset>0||e.pos!==i.pos?0:1})(t.state))return 0;const n=uf(e,t.state);if(!n)return 0;const r=t.state.doc.resolve(n.$pos.pos-2).node(n.depth),s=ff(e,t.state,r);return df(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},mf=(t,e)=>{const i=hf(t,e),n=uf(t,e);return n&&i&&i>n.depth?1:0},gf=(t,e)=>{const i=hf(t,e),n=uf(t,e);return n&&i&&i<n.depth?1:0},yf=(t,e)=>{if(!ja(t.state,e))return 0;if(!((t,e)=>{const{$from:i,$to:n,$anchor:r}=t.selection;if(e){const i=ha(t=>t.type.name===e)(t.selection);if(!i)return 0;const n=t.doc.resolve(i.pos+1);return r.pos+1===n.end()?1:0}return n.parentOffset<n.parent.nodeSize-2||i.pos!==n.pos?0:1})(t.state,e))return 0;const{selection:i}=t.state,{$from:n,$to:r}=i;return!i.empty&&n.sameParent(r)?0:mf(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():gf(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},bf=(t,e)=>{var i;const{$anchor:n}=e.selection,r=e.doc.resolve(n.pos-n.parentOffset-2);return r.index()===r.parent.childCount-1||(null==(i=r.nodeAfter)?void 0:i.type.name)!==t?0:1},wf=ru.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=0;return this.options.listTypes.forEach(({itemName:i})=>{void 0!==t.state.schema.nodes[i]&&yf(t,i)&&(e=1)}),e},"Mod-Delete":({editor:t})=>{let e=0;return this.options.listTypes.forEach(({itemName:i})=>{void 0!==t.state.schema.nodes[i]&&yf(t,i)&&(e=1)}),e},Backspace:({editor:t})=>{let e=0;return this.options.listTypes.forEach(({itemName:i,wrapperNames:n})=>{void 0!==t.state.schema.nodes[i]&&pf(t,i,n)&&(e=1)}),e},"Mod-Backspace":({editor:t})=>{let e=0;return this.options.listTypes.forEach(({itemName:i,wrapperNames:n})=>{void 0!==t.state.schema.nodes[i]&&pf(t,i,n)&&(e=1)}),e}}}}),vf="textStyle",kf=/^(\d+)\.\s$/,xf=Rh.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:0,keepAttributes:0}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e,...i}=t;return 1===e?["ol",ba(this.options.HTMLAttributes,i),0]:["ol",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(vf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=$h({find:kf,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=$h({find:kf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(vf)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[t]}}),Mf=/^\s*(\[([( |x])?\])\s$/,Sf=Rh.create({name:"taskItem",addOptions:()=>({nested:0,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:1,addAttributes:()=>({checked:{default:0,keepOnSplit:0,parseHTML:t=>{const e=t.getAttribute("data-checked");return""===e||"true"===e},renderHTML:t=>({"data-checked":t.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ba(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:i,editor:n})=>{const r=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=t=>{var e,i;l.ariaLabel=(null==(i=null==(e=this.options.a11y)?void 0:e.checkboxLabel)?void 0:i.call(e,t,l.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",t=>t.preventDefault()),l.addEventListener("change",e=>{if(!n.isEditable&&!this.options.onReadOnlyChecked)return void(l.checked=!l.checked);const{checked:r}=e.target;n.isEditable&&"function"==typeof i&&n.chain().focus(void 0,{scrollIntoView:0}).command(({tr:t})=>{const e=i();if("number"!=typeof e)return 0;const n=t.doc.nodeAt(e);return t.setNodeMarkup(e,void 0,{...null==n?void 0:n.attrs,checked:r}),1}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,r)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([t,e])=>{r.setAttribute(t,e)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),r.append(s,a),Object.entries(e).forEach(([t,e])=>{r.setAttribute(t,e)}),{dom:r,contentDOM:a,update:t=>t.type!==this.type?0:(r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,u(t),1)}}},addInputRules(){return[$h({find:Mf,type:this.type,getAttributes:t=>({checked:"x"===t[t.length-1]})})]}}),Tf=Rh.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ba(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ru.create({name:"listKit",addExtensions(){const t=[];return 0!=this.options.bulletList&&t.push(lf.configure(this.options.bulletList)),0!=this.options.listItem&&t.push(af.configure(this.options.listItem)),0!=this.options.listKeymap&&t.push(wf.configure(this.options.listKeymap)),0!=this.options.orderedList&&t.push(xf.configure(this.options.orderedList)),0!=this.options.taskItem&&t.push(Sf.configure(this.options.taskItem)),0!=this.options.taskList&&t.push(Tf.configure(this.options.taskList)),t}});var Ef=Rh.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Cf=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Of=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Af=tu.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:0,getAttrs:t=>t.includes("line-through")?{}:0}],renderHTML({HTMLAttributes:t}){return["s",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Oh({find:Cf,type:this.type})]},addPasteRules(){return[Lh({find:Of,type:this.type})]}}),$f=Rh.create({name:"text",group:"inline"}),Rf=tu.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:0,getAttrs:t=>t.includes("underline")?{}:0}],renderHTML({HTMLAttributes:t}){return["u",ba(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Lf=Rf;function Bf(t={}){return new pr({view:e=>new If(e,t)})}class If{constructor(t,e){var i;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(i=e.width)&&void 0!==i?i:1,this.color=0==e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map(e=>{let i=t=>{this[e](t)};return t.dom.addEventListener(e,i),{name:e,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e))}update(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,n=this.editorView.dom,r=n.getBoundingClientRect(),s=r.width/n.offsetWidth,o=r.height/n.offsetHeight;if(i){let i=e.nodeBefore,n=e.nodeAfter;if(i||n){let e=this.editorView.nodeDOM(this.cursorPos-(i?i.nodeSize:0));if(e){let r=e.getBoundingClientRect(),s=i?r.bottom:r.top;i&&n&&(s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*o;t={left:r.left,right:r.right,top:s-l,bottom:s+l}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos),i=this.width/2*s;t={left:e.left-i,right:e.left+i,top:e.top,bottom:e.bottom}}let l,a,u=this.editorView.dom.offsetParent;if(this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i),!u||u==document.body&&"static"==getComputedStyle(u).position)l=-pageXOffset,a=-pageYOffset;else{let t=u.getBoundingClientRect(),e=t.width/u.offsetWidth,i=t.height/u.offsetHeight;l=t.left-u.scrollLeft*e,a=t.top-u.scrollTop*i}this.element.style.left=(t.left-l)/s+"px",this.element.style.top=(t.top-a)/o+"px",this.element.style.width=(t.right-t.left)/s+"px",this.element.style.height=(t.bottom-t.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),i=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),n=i&&i.type.spec.disableDropCursor,r="function"==typeof n?n(this.editorView,e,t):n;if(e&&!r){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Ln(this.editorView.state.doc,t,this.editorView.dragging.slice);null!=e&&(t=e)}this.setCursor(t),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Nf extends Gn{constructor(t){super(t,t)}map(t,e){let i=t.resolve(e.map(this.head));return Nf.valid(i)?new Nf(i):Gn.near(i)}content(){return ni.empty}eq(t){return t instanceof Nf&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Nf(t.resolve(e.pos))}getBookmark(){return new Df(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!function(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),n=t.node(e);if(0!=i)for(let t=n.child(i-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return 1;if(t.inlineContent)return 0}else if(n.type.spec.isolating)return 1}return 1}(t)||!function(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),n=t.node(e);if(i!=n.childCount)for(let t=n.child(i);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return 1;if(t.inlineContent)return 0}else if(n.type.spec.isolating)return 1}return 1}(t))return 0;let i=e.type.spec.allowGapCursor;if(null!=i)return i;let n=e.contentMatchAt(t.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(t,e,i=0){t:for(;;){if(!i&&Nf.valid(t))return t;let n=t.pos,r=null;for(let i=t.depth;;i--){let s=t.node(i);if(e>0?t.indexAfter(i)<s.childCount:t.index(i)>0){r=s.child(e>0?t.indexAfter(i):t.index(i)-1);break}if(0==i)return null;n+=e;let o=t.doc.resolve(n);if(Nf.valid(o))return o}for(;;){let s=e>0?r.firstChild:r.lastChild;if(!s){if(r.isAtom&&!r.isText&&!er.isSelectable(r)){t=t.doc.resolve(n+r.nodeSize*e),i=0;continue t}break}r=s,n+=e;let o=t.doc.resolve(n);if(Nf.valid(o))return o}return null}}}Nf.prototype.visible=0,Nf.findFrom=Nf.findGapCursorFrom,Gn.jsonID("gapcursor",Nf);class Df{constructor(t){this.pos=t}map(t){return new Df(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return Nf.valid(e)?new Nf(e):Gn.near(e)}}const _f=jl({ArrowLeft:zf("horiz",-1),ArrowRight:zf("horiz",1),ArrowUp:zf("vert",-1),ArrowDown:zf("vert",1)});function zf(t,e){const i="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,n,r){let s=t.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Xn){if(!r.endOfTextblock(i)||0==o.depth)return 0;l=0,o=t.doc.resolve(e>0?o.after():o.before())}let a=Nf.findGapCursorFrom(o,e,l);return a?(n&&n(t.tr.setSelection(new Nf(a))),1):0}}function Pf(t,e,i){if(!t||!t.editable)return 0;let n=t.state.doc.resolve(e);if(!Nf.valid(n))return 0;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&er.isSelectable(t.state.doc.nodeAt(r.inside))?0:(t.dispatch(t.state.tr.setSelection(new Nf(n))),1)}function Hf(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof Nf))return 0;let{$from:i}=t.state.selection,n=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!n)return 0;let r=Ye.empty;for(let o=n.length-1;o>=0;o--)r=Ye.from(n[o].createAndFill(null,r));let s=t.state.tr.replace(i.pos,i.pos,new ni(r,0,0));return s.setSelection(Xn.near(s.doc.resolve(i.pos+1))),t.dispatch(s),0}function jf(t){if(!(t.selection instanceof Nf))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",el.create(t.doc,[Zo.widget(t.selection.head,e,{key:"gapcursor"})])}var Uf=200,qf=function(){};qf.prototype.append=function(t){return t.length?(t=qf.from(t),!this.length&&t||t.length<Uf&&this.leafAppend(t)||this.length<Uf&&t.leafPrepend(this)||this.appendInner(t)):this},qf.prototype.prepend=function(t){return t.length?qf.from(t).append(this):this},qf.prototype.appendInner=function(t){return new Ff(this,t)},qf.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?qf.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},qf.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},qf.prototype.forEach=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=this.length),e<=i?this.forEachInner(t,e,i,0):this.forEachInvertedInner(t,e,i,0)},qf.prototype.map=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=this.length);var n=[];return this.forEach(function(e,i){return n.push(t(e,i))},e,i),n},qf.from=function(t){return t instanceof qf?t:t&&t.length?new Vf(t):qf.empty};var Vf=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={length:{configurable:1},depth:{configurable:1}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,i){return 0==t&&i==this.length?this:new e(this.values.slice(t,i))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,i,n){for(var r=e;r<i;r++)if(0==t(this.values[r],n+r))return 0},e.prototype.forEachInvertedInner=function(t,e,i,n){for(var r=e-1;r>=i;r--)if(0==t(this.values[r],n+r))return 0},e.prototype.leafAppend=function(t){if(this.length+t.length<=Uf)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Uf)return new e(t.flatten().concat(this.values))},i.length.get=function(){return this.values.length},i.depth.get=function(){return 0},Object.defineProperties(e.prototype,i),e}(qf);qf.empty=new Vf([]);var Ff=function(t){function e(e,i){t.call(this),this.left=e,this.right=i,this.length=e.length+i.length,this.depth=Math.max(e.depth,i.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(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,i,n){var r=this.left.length;return e<r&&0==this.left.forEachInner(t,e,Math.min(i,r),n)||i>r&&0==this.right.forEachInner(t,Math.max(e-r,0),Math.min(this.length,i)-r,n+r)?0:void 0},e.prototype.forEachInvertedInner=function(t,e,i,n){var r=this.left.length;return e>r&&0==this.right.forEachInvertedInner(t,e-r,Math.max(i,r)-r,n+r)||i<r&&0==this.left.forEachInvertedInner(t,Math.min(e,r),i,n)?0:void 0},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var i=this.left.length;return e<=i?this.left.slice(t,e):t>=i?this.right.slice(t-i,e-i):this.left.slice(t,i).append(this.right.slice(0,e-i))},e.prototype.leafAppend=function(t){var i=this.right.leafAppend(t);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(t){var i=this.left.leafPrepend(t);if(i)return new e(i,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(qf);const Kf=qf;class Jf{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let i,n,r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}e&&(i=this.remapping(r,this.items.length),n=i.maps.length);let s,o,l=t.tr,a=[],u=[];return this.items.forEach((t,e)=>{if(!t.step)return i||(i=this.remapping(r,e+1),n=i.maps.length),n--,void u.push(t);if(i){u.push(new Wf(t.map));let e,r=t.step.map(i.slice(n));r&&l.maybeStep(r).doc&&(e=l.mapping.maps[l.mapping.maps.length-1],a.push(new Wf(e,void 0,void 0,a.length+u.length))),n--,e&&i.appendMap(e,n)}else l.maybeStep(t.step);return t.selection?(s=i?t.selection.map(i.slice(n)):t.selection,o=new Jf(this.items.slice(0,r).append(u.reverse().concat(a)),this.eventCount-1),0):void 0},this.items.length,0),{remaining:o,transform:l,selection:s}}addTransform(t,e,i,n){let r=[],s=this.eventCount,o=this.items,l=!n&&o.length?o.get(o.length-1):null;for(let u=0;u<t.steps.length;u++){let i,a=t.steps[u].invert(t.docs[u]),h=new Wf(t.mapping.maps[u],a,e);(i=l&&l.merge(h))&&(h=i,u?r.pop():o=o.slice(0,o.length-1)),r.push(h),e&&(s++,e=void 0),n||(l=h)}let a=s-i.depth;return a>Qf&&(o=function(t,e){let i;return t.forEach((t,n)=>{if(t.selection&&0==e--)return i=n,0}),t.slice(i)}(o,a),s-=a),new Jf(o.append(r),s)}remapping(t,e){let i=new un;return this.items.forEach((e,n)=>{let r=null!=e.mirrorOffset&&n-e.mirrorOffset>=t?i.maps.length-e.mirrorOffset:void 0;i.appendMap(e.map,r)},t,e),i}addMaps(t){return 0==this.eventCount?this:new Jf(this.items.append(t.map(t=>new Wf(t))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let i=[],n=Math.max(0,this.items.length-e),r=t.mapping,s=t.steps.length,o=this.eventCount;this.items.forEach(t=>{t.selection&&o--},n);let l=e;this.items.forEach(e=>{let n=r.getMirror(--l);if(null==n)return;s=Math.min(s,n);let a=r.maps[n];if(e.step){let s=t.steps[n].invert(t.docs[n]),u=e.selection&&e.selection.map(r.slice(l+1,n));u&&o++,i.push(new Wf(a,s,u))}else i.push(new Wf(a))},n);let a=[];for(let c=e;c<s;c++)a.push(new Wf(r.maps[c]));let u=this.items.slice(0,n).append(a).append(i),h=new Jf(u,o);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-i.length)),h}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),i=e.maps.length,n=[],r=0;return this.items.forEach((s,o)=>{if(o>=t)n.push(s),s.selection&&r++;else if(s.step){let t=s.step.map(e.slice(i)),o=t&&t.getMap();if(i--,o&&e.appendMap(o,i),t){let l=s.selection&&s.selection.map(e.slice(i));l&&r++;let a,u=new Wf(o.invert(),t,l),h=n.length-1;(a=n.length&&n[h].merge(u))?n[h]=a:n.push(u)}}else s.map&&i--},this.items.length,0),new Jf(Kf.from(n.reverse()),r)}}Jf.empty=new Jf(Kf.empty,0);class Wf{constructor(t,e,i,n){this.map=t,this.step=e,this.selection=i,this.mirrorOffset=n}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Wf(e.getMap().invert(),e,this.selection)}}}class Gf{constructor(t,e,i,n,r){this.done=t,this.undone=e,this.prevRanges=i,this.prevTime=n,this.prevComposition=r}}const Qf=20;function Yf(t){let e=[];for(let i=t.length-1;i>=0&&0==e.length;i--)t[i].forEach((t,i,n,r)=>e.push(n,r));return e}function Zf(t,e){if(!t)return null;let i=[];for(let n=0;n<t.length;n+=2){let r=e.map(t[n],1),s=e.map(t[n+1],-1);r<=s&&i.push(r,s)}return i}let Xf=0,tp=null;function ep(t){let e=t.plugins;if(tp!=e){Xf=0,tp=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Xf=1;break}}return Xf}const ip=new yr("history"),np=new yr("closeHistory");function rp(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new pr({key:ip,state:{init:()=>new Gf(Jf.empty,Jf.empty,null,0,-1),apply:(e,i,n)=>function(t,e,i,n){let r,s=i.getMeta(ip);if(s)return s.historyState;i.getMeta(np)&&(t=new Gf(t.done,t.undone,null,0,-1));let o=i.getMeta("appendedTransaction");if(0==i.steps.length)return t;if(o&&o.getMeta(ip))return o.getMeta(ip).redo?new Gf(t.done.addTransform(i,void 0,n,ep(e)),t.undone,Yf(i.mapping.maps),t.prevTime,t.prevComposition):new Gf(t.done,t.undone.addTransform(i,void 0,n,ep(e)),null,t.prevTime,t.prevComposition);if(0==i.getMeta("addToHistory")||o&&0==o.getMeta("addToHistory"))return(r=i.getMeta("rebased"))?new Gf(t.done.rebased(i,r),t.undone.rebased(i,r),Zf(t.prevRanges,i.mapping),t.prevTime,t.prevComposition):new Gf(t.done.addMaps(i.mapping.maps),t.undone.addMaps(i.mapping.maps),Zf(t.prevRanges,i.mapping),t.prevTime,t.prevComposition);{let r=i.getMeta("composition"),s=0==t.prevTime||!o&&t.prevComposition!=r&&(t.prevTime<(i.time||0)-n.newGroupDelay||!function(t,e){if(!e)return 0;if(!t.docChanged)return 1;let i=0;return t.mapping.maps[0].forEach((t,n)=>{for(let r=0;r<e.length;r+=2)t<=e[r+1]&&n>=e[r]&&(i=1)}),i}(i,t.prevRanges)),l=o?Zf(t.prevRanges,i.mapping):Yf(i.mapping.maps);return new Gf(t.done.addTransform(i,s?e.selection.getBookmark():void 0,n,ep(e)),Jf.empty,l,i.time,null==r?t.prevComposition:r)}}(i,n,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let i=e.inputType,n="historyUndo"==i?op:"historyRedo"==i?lp:null;return n?(e.preventDefault(),n(t.state,t.dispatch)):0}}}})}function sp(t,e){return(i,n)=>{let r=ip.getState(i);if(!r||0==(t?r.undone:r.done).eventCount)return 0;if(n){let s=function(t,e,i){let n=ep(e),r=ip.get(e).spec.config,s=(i?t.undone:t.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(i?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),r,n),a=new Gf(i?l:s.remaining,i?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(ip,{redo:i,historyState:a})}(r,i,t);s&&n(e?s.scrollIntoView():s)}return 1}}const op=sp(0,1),lp=sp(1,1);ru.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(t=>""!==t).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=t=>{const e=(null==t?void 0:t.node)||this.editor.state.doc;if("textSize"===((null==t?void 0:t.mode)||this.options.mode)){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=t=>{const e=(null==t?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=0;return[new pr({key:new yr("characterCount"),appendTransaction:(e,i,n)=>{if(t)return;const r=this.options.limit;if(null==r||0===r)return void(t=1);const s=this.storage.characters({node:n.doc});if(s>r){const e=0,i=s-r,o=n.tr.deleteRange(e,i);return t=1,o}t=1},filterTransaction:(t,e)=>{const i=this.options.limit;if(!t.docChanged||0===i||null==i)return 1;const n=this.storage.characters({node:e.doc}),r=this.storage.characters({node:t.doc});if(r<=i)return 1;if(n>i&&r>i&&r<=n)return 1;if(n>i&&r>i&&r>n)return 0;if(!t.getMeta("paste"))return 0;const s=t.selection.$head.pos,o=s-(r-i),l=s;return t.deleteRange(o,l),this.storage.characters({node:t.doc})>i?0:1}})]}});var ap=ru.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Bf(this.options)]}});ru.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new pr({key:new yr("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:n}=this.editor,{anchor:r}=e,s=[];if(!i||!n)return el.create(t,[]);let o=0;"deepest"===this.options.mode&&t.descendants((t,e)=>{if(!t.isText)return r>=e&&r<=e+t.nodeSize-1?void(o+=1):0});let l=0;return t.descendants((t,e)=>t.isText?0:r>=e&&r<=e+t.nodeSize-1?(l+=1,"deepest"===this.options.mode&&o-l>0||"shallowest"===this.options.mode&&l>1?"deepest"===this.options.mode:void s.push(Zo.node(e,e+t.nodeSize,{class:this.options.className}))):0),el.create(t,s)}}})]}});var up=ru.create({name:"gapCursor",addProseMirrorPlugins:()=>[new pr({props:{decorations:jf,createSelectionBetween:(t,e,i)=>e.pos==i.pos&&Nf.valid(i)?new Nf(i):null,handleClick:Pf,handleKeyDown:_f,handleDOMEvents:{beforeinput:Hf}}})],extendNodeSchema(t){var e;return{allowGapCursor:null!=(e=ma(ca(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage})))?e:null}}}),hp=ru.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:1,showOnlyCurrent:1,includeChildren:0}),addProseMirrorPlugins(){return[new pr({key:new yr("placeholder"),props:{decorations:({doc:t,selection:e})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,r=[];if(!i)return null;const s=this.editor.isEmpty;return t.descendants((t,e)=>{const i=n>=e&&n<=e+t.nodeSize,o=!t.isLeaf&&Va(t);if((i||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];s&&n.push(this.options.emptyEditorClass);const o=Zo.node(e,e+t.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:e,hasAnchor:i}):this.options.placeholder});r.push(o)}return this.options.includeChildren}),el.create(t,r)}}})]}});function cp({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(null==e?void 0:e.type)===t}ru.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new pr({key:new yr("selection"),props:{decorations:i=>i.selection.empty||t.isFocused||!t.isEditable||Fa(i.selection)||t.view.dragging?null:el.create(i.doc,[Zo.inline(i.selection.from,i.selection.to,{class:e.className})])}})]}});var dp=ru.create({name:"trailingNode",addOptions:()=>({node:"paragraph",notAfter:[]}),addProseMirrorPlugins(){const t=new yr(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new pr({key:t,appendTransaction:(e,i,n)=>{const{doc:r,tr:s,schema:o}=n,l=t.getState(n),a=r.content.size,u=o.nodes[this.options.node];if(l)return s.insert(a,u.create())},state:{init:(t,i)=>!cp({node:i.tr.doc.lastChild,types:e}),apply:(t,i)=>t.docChanged?!cp({node:t.doc.lastChild,types:e}):i}})]}}),fp=ru.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>op(t,e),redo:()=>({state:t,dispatch:e})=>lp(t,e)}),addProseMirrorPlugins(){return[rp(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),pp=ru.create({name:"starterKit",addExtensions(){var t,e,i,n;const r=[];return 0!=this.options.bold&&r.push(qh.configure(this.options.bold)),0!=this.options.blockquote&&r.push(zh.configure(this.options.blockquote)),0!=this.options.bulletList&&r.push(lf.configure(this.options.bulletList)),0!=this.options.code&&r.push(Kh.configure(this.options.code)),0!=this.options.codeBlock&&r.push(Gh.configure(this.options.codeBlock)),0!=this.options.document&&r.push(Qh.configure(this.options.document)),0!=this.options.dropcursor&&r.push(ap.configure(this.options.dropcursor)),0!=this.options.gapcursor&&r.push(up.configure(this.options.gapcursor)),0!=this.options.hardBreak&&r.push(Yh.configure(this.options.hardBreak)),0!=this.options.heading&&r.push(Zh.configure(this.options.heading)),0!=this.options.undoRedo&&r.push(fp.configure(this.options.undoRedo)),0!=this.options.horizontalRule&&r.push(tc.configure(this.options.horizontalRule)),0!=this.options.italic&&r.push(sc.configure(this.options.italic)),0!=this.options.listItem&&r.push(af.configure(this.options.listItem)),0!=this.options.listKeymap&&r.push(wf.configure(null==(t=this.options)?void 0:t.listKeymap)),0!=this.options.link&&r.push(nf.configure(null==(e=this.options)?void 0:e.link)),0!=this.options.orderedList&&r.push(xf.configure(this.options.orderedList)),0!=this.options.paragraph&&r.push(Ef.configure(this.options.paragraph)),0!=this.options.strike&&r.push(Af.configure(this.options.strike)),0!=this.options.text&&r.push($f.configure(this.options.text)),0!=this.options.underline&&r.push(Rf.configure(null==(i=this.options)?void 0:i.underline)),0!=this.options.trailingNode&&r.push(dp.configure(null==(n=this.options)?void 0:n.trailingNode)),r}}),mp=ru.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(i=>e.updateAttributes(i,{textAlign:t})).every(t=>t):0,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(t=>t),toggleTextAlign:t=>({editor:e,commands:i})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?i.unsetTextAlign():i.setTextAlign(t):0}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),gp=hp;const yp={class:"input-richtext-toolbar"},bp={class:"input-richtext-group"},wp={class:"input-richtext-group"},vp={class:"input-richtext-group"},kp={class:"input-richtext-group"},xp={class:"input-richtext-group"},Mp={class:"input-richtext-editor-wrapper"},Sp=e(t.defineComponent({u:"UiInput.RichText",props:{minHeight:{default:"200px"},maxHeight:{default:"400px"},label:{},helpText:{},modelValue:{},placeholder:{default:"Start typing..."},disabled:{type:Boolean,default:0},readonly:{type:Boolean,default:0},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error],default:0},size:{},tabindex:{}},emits:["update:modelValue","blur","focus"],setup(e,{emit:i}){t.useCssVars(t=>({"653355e8":t.minHeight,c14982c4:t.maxHeight}));const n=e,r=i,s=t.ref("string"==typeof n.modelValue?n.modelValue:""),o=((e={})=>{const i=t.shallowRef();return t.onMounted(()=>{i.value=new Ih(e)}),t.onBeforeUnmount(()=>{var t,e,n;const r=null==(t=i.value)?void 0:t.options.element,s=null==r?void 0:r.cloneNode(1);null==(e=null==r?void 0:r.parentNode)||e.replaceChild(s,r),null==(n=i.value)||n.destroy()}),i})({content:s.value,editable:!n.disabled&&!n.readonly,extensions:[pp,Xh.configure({levels:[1,2,3]}),Lf,mp.configure({types:["heading","paragraph"]}),gp.configure({placeholder:n.placeholder})],onUpdate:({editor:t})=>{const e=t.getHTML();s.value=e,r("update:modelValue",e)},onFocus:t=>{r("focus",t.event)},onBlur:t=>{r("blur",t.event)}});return t.watch(()=>n.modelValue,t=>{"string"==typeof t&&o.value&&o.value.getHTML()!==t&&(o.value.commands.setContent(t),s.value=t)}),t.watch(()=>n.disabled,t=>{o.value&&o.value.setEditable(!t&&!n.readonly)}),t.watch(()=>n.readonly,t=>{o.value&&o.value.setEditable(!n.disabled&&!t)}),t.onBeforeUnmount(()=>{o.value&&o.value.destroy()}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-richtext-container",{"input-error":e.error,"input-disabled":e.disabled}])},[t.createElementVNode("div",yp,[t.createElementVNode("div",bp,[t.createVNode(R,{color:t.unref(o)?.isActive("bold")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[0]||(i[0]=e=>t.unref(o)?.chain().focus().toggleBold().run()),disabled:e.disabled,title:"Bold (Ctrl+B)"},{icon:t.withCtx(()=>[t.createVNode(t.unref(G),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("italic")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[1]||(i[1]=e=>t.unref(o)?.chain().focus().toggleItalic().run()),disabled:e.disabled,title:"Italic (Ctrl+I)"},{icon:t.withCtx(()=>[t.createVNode(t.unref(ht),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("underline")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[2]||(i[2]=e=>t.unref(o)?.chain().focus().toggleUnderline().run()),disabled:e.disabled,title:"Underline (Ctrl+U)"},{icon:t.withCtx(()=>[t.createVNode(t.unref(bt),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("strike")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[3]||(i[3]=e=>t.unref(o)?.chain().focus().toggleStrike().run()),disabled:e.disabled,title:"Strikethrough"},{icon:t.withCtx(()=>[t.createVNode(t.unref(yt),{size:16})]),m:1},8,["color","disabled"])]),t.createVNode(ve,{orientation:"vertical",spacing:"28px",margin:"4px"}),t.createElementVNode("div",wp,[t.createVNode(R,{color:t.unref(o)?.isActive("heading",{level:1})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[4]||(i[4]=e=>t.unref(o)?.chain().focus().toggleHeading({level:1}).run()),disabled:e.disabled,title:"Heading 1"},{icon:t.withCtx(()=>[t.createVNode(t.unref(lt),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("heading",{level:2})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[5]||(i[5]=e=>t.unref(o)?.chain().focus().toggleHeading({level:2}).run()),disabled:e.disabled,title:"Heading 2"},{icon:t.withCtx(()=>[t.createVNode(t.unref(at),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("heading",{level:3})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[6]||(i[6]=e=>t.unref(o)?.chain().focus().toggleHeading({level:3}).run()),disabled:e.disabled,title:"Heading 3"},{icon:t.withCtx(()=>[t.createVNode(t.unref(ut),{size:16})]),m:1},8,["color","disabled"])]),t.createVNode(ve,{orientation:"vertical",spacing:"28px",margin:"4px"}),t.createElementVNode("div",vp,[t.createVNode(R,{color:t.unref(o)?.isActive({textAlign:"left"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[7]||(i[7]=e=>t.unref(o)?.chain().focus().setTextAlign("left").run()),disabled:e.disabled,title:"Align Left"},{icon:t.withCtx(()=>[t.createVNode(t.unref(J),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive({textAlign:"center"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[8]||(i[8]=e=>t.unref(o)?.chain().focus().setTextAlign("center").run()),disabled:e.disabled,title:"Align Center"},{icon:t.withCtx(()=>[t.createVNode(t.unref(K),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive({textAlign:"right"})?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[9]||(i[9]=e=>t.unref(o)?.chain().focus().setTextAlign("right").run()),disabled:e.disabled,title:"Align Right"},{icon:t.withCtx(()=>[t.createVNode(t.unref(W),{size:16})]),m:1},8,["color","disabled"])]),t.createVNode(ve,{orientation:"vertical",spacing:"28px",margin:"4px"}),t.createElementVNode("div",kp,[t.createVNode(R,{color:t.unref(o)?.isActive("bulletList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[10]||(i[10]=e=>t.unref(o)?.chain().focus().toggleBulletList().run()),disabled:e.disabled,title:"Bullet List"},{icon:t.withCtx(()=>[t.createVNode(t.unref(dt),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("orderedList")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[11]||(i[11]=e=>t.unref(o)?.chain().focus().toggleOrderedList().run()),disabled:e.disabled,title:"Numbered List"},{icon:t.withCtx(()=>[t.createVNode(t.unref(ct),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("blockquote")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[12]||(i[12]=e=>t.unref(o)?.chain().focus().toggleBlockquote().run()),disabled:e.disabled,title:"Quote"},{icon:t.withCtx(()=>[t.createVNode(t.unref(pt),{size:16})]),m:1},8,["color","disabled"]),t.createVNode(R,{color:t.unref(o)?.isActive("codeBlock")?"primary":"secondary",size:"sm",icon:"",squircle:"",onClick:i[13]||(i[13]=e=>t.unref(o)?.chain().focus().toggleCodeBlock().run()),disabled:e.disabled,title:"Code Block"},{icon:t.withCtx(()=>[t.createVNode(t.unref(nt),{size:16})]),m:1},8,["color","disabled"])]),t.createVNode(ve,{orientation:"vertical",spacing:"28px",margin:"4px"}),t.createElementVNode("div",xp,[t.createVNode(R,{color:"secondary",size:"sm",icon:"",squircle:"",onClick:i[14]||(i[14]=e=>t.unref(o)?.chain().focus().setHorizontalRule().run()),disabled:e.disabled,title:"Horizontal Rule"},{icon:t.withCtx(()=>[t.createVNode(t.unref(ft),{size:16})]),m:1},8,["disabled"]),t.createVNode(R,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!t.unref(o)?.can().undo()||e.disabled,onClick:i[15]||(i[15]=e=>t.unref(o)?.chain().focus().undo().run()),title:"Undo (Ctrl+Z)"},{icon:t.withCtx(()=>[t.createVNode(t.unref(wt),{size:16})]),m:1},8,["disabled"]),t.createVNode(R,{color:"secondary",size:"sm",icon:"",squircle:"",disabled:!t.unref(o)?.can().redo()||e.disabled,onClick:i[16]||(i[16]=e=>t.unref(o)?.chain().focus().redo().run()),title:"Redo (Ctrl+Y)"},{icon:t.withCtx(()=>[t.createVNode(t.unref(mt),{size:16})]),m:1},8,["disabled"])])]),t.createElementVNode("div",Mp,[t.createVNode(t.unref(Nh),{editor:t.unref(o),class:"input-richtext-editor",id:e.inputId},null,8,["editor","id"])])],2))}}),[["__scopeId","data-v-18a35d5d"]]),Tp={class:"pincode-inputs"},Ep={key:0,class:"pincode-icon pincode-icon-leading"},Cp=["value","disabled","readonly","tabindex","data-index","onInput","onKeydown","onFocus"],Op={key:1,class:"pincode-divider"},Ap={key:1,class:"pincode-icon pincode-icon-trailing"},$p=e(t.defineComponent({u:"UiInput.Pincode",props:{maxLength:{default:6},variant:{default:"numeric"},divider:{},hasLeadingIcon:{type:Boolean,default:0},hasTrailingIcon:{type:Boolean,default:0},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{default:"md"},tabindex:{}},emits:["update:modelValue","blur","focus","complete"],setup(e,{emit:i}){const n=e,r=i,s=t.ref([]),o=t.ref(-1),l=t.computed(()=>{const t=(n.modelValue||"").split("");for(;t.length<n.maxLength;)t.push("");return t.slice(0,n.maxLength)}),a=t.computed(()=>n.divider?"number"==typeof n.divider?n.divider:n.divider.count:0),u=t.computed(()=>n.divider?"number"==typeof n.divider?"-":"object"==typeof n.divider&&"character"in n.divider&&n.divider.character||"-":""),h=t.computed(()=>"object"==typeof n.divider&&"component"in n.divider&&"divider"===n.divider.component),c=t.computed(()=>h.value?{orientation:"vertical",variant:"solid",thickness:"1px",margin:"0",spacing:"1.5rem",...n.divider.props}:{}),d=t=>a.value&&t!==n.maxLength?t%a.value===0:0,f=()=>{switch(n.variant){case"numeric":default:return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/}},p=e=>{e.preventDefault();const i=e.clipboardData?.getData("text")||"",o=f(),l=i.split("").filter(t=>o.test(t)).slice(0,n.maxLength).join("");if(l){r("update:modelValue",l);const e=l.length<n.maxLength?l.length:n.maxLength-1;t.nextTick(()=>{const t=s.value[e];t&&t.focus()}),l.length===n.maxLength&&r("complete",l)}},m=t=>{o.value=-1,r("blur",t)};return t.watch(()=>n.modelValue,e=>{e||t.nextTick(()=>{const t=s.value[0];!t||n.disabled||n.readonly||t.focus()})}),(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["pincode-wrapper",[`pincode-size-${e.size}`,{"pincode-error":e.error}]])},[t.createElementVNode("div",Tp,[n.hasLeadingIcon?(t.openBlock(),t.createElementBlock("div",Ep,[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)])):t.createCommentVNode("",1),(t.openBlock(1),t.createElementBlock(t.Fragment,null,t.renderList(e.maxLength,i=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:i},[t.createElementVNode("input",{ref_for:1,ref_key:"pincodeRefs",ref:s,type:"text",class:t.normalizeClass(["pincode-input",{"pincode-input-filled":l.value[i-1],"pincode-input-focused":o.value===i-1}]),value:l.value[i-1],disabled:e.disabled,readonly:e.readonly,tabindex:e.disabled?-1:void 0,"data-index":i-1,maxlength:"1",onInput:e=>((e,i)=>{const o=e.target,a=o.value.slice(-1);if(!f().test(a)&&""!==a)return void(o.value=l.value[i]);const u=[...l.value];u[i]=a;const h=u.join("");r("update:modelValue",h),a&&i<n.maxLength-1&&t.nextTick(()=>{const t=s.value[i+1];t&&(t.focus(),t.select())}),h.length===n.maxLength&&r("complete",h)})(e,i-1),onKeydown:e=>((e,i)=>{const o=e.key;if("Backspace"===o){e.preventDefault();const n=[...l.value];l.value[i]?(n[i]="",r("update:modelValue",n.join(""))):i>0&&(n[i-1]="",r("update:modelValue",n.join("")),t.nextTick(()=>{const t=s.value[i-1];t&&t.focus()}))}else if("ArrowLeft"===o&&i>0){e.preventDefault();const t=s.value[i-1];t&&t.focus()}else if("ArrowRight"===o&&i<n.maxLength-1){e.preventDefault();const t=s.value[i+1];t&&t.focus()}else if("Delete"===o){e.preventDefault();const t=[...l.value];t[i]="",r("update:modelValue",t.join(""))}})(e,i-1),onFocus:t=>(t=>{o.value=t;const e=s.value[t];e&&e.select()})(i-1),onBlur:m,onPaste:p},null,42,Cp),d(i)&&h.value?(t.openBlock(),t.createBlock(ve,t.mergeProps({key:0,ref_for:1},c.value,{class:"pincode-custom-divider"}),null,16)):d(i)?(t.openBlock(),t.createElementBlock("span",Op,t.toDisplayString(u.value),1)):t.createCommentVNode("",1)],64))),128)),n.hasTrailingIcon?(t.openBlock(),t.createElementBlock("div",Ap,[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)])):t.createCommentVNode("",1)])],2))}}),[["__scopeId","data-v-78a9c50b"]]),Rp=["for"],Lp={key:0,class:"input-required"},Bp={key:1,class:"input-hint"},Ip={key:2,class:"input-error-text"},Np={key:3,class:"input-help-text"},Dp=e(t.defineComponent({u:"UiInput",props:{type:{},min:{},max:{},step:{},autocomplete:{},spellcheck:{type:Boolean},hasLeadingIcon:{type:Boolean},hasTrailingIcon:{type:Boolean},label:{},helpText:{},modelValue:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},fullWidth:{type:Boolean},inputId:{},error:{type:[Boolean,String,Error]},size:{},tabindex:{},options:{},multiple:{type:Boolean},searchable:{type:Boolean},allowInsert:{type:Boolean},maxDropdownHeight:{},noOptionsText:{},searchPlaceholder:{},rows:{},cols:{},maxlength:{},resizable:{type:Boolean},accept:{},maxFileSize:{},dragDropText:{},selectedText:{},preview:{},format:{},is24Hour:{type:Boolean},minuteStep:{},minHeight:{},maxHeight:{},maxLength:{},variant:{},divider:{}},emits:["update:modelValue","blur","focus","keydown","file-error","clear-preview","complete"],setup(e,{emit:i}){const n=e,r=i,s=t.useSlots(),o=t.computed(()=>`input-${Math.random().toString(36).substring(2,11)}`),l=t=>function(t,e){const i=t[e];if(!i)return 0;const n=i();return n&&0!==n.length?n.some(t=>t.children&&""!==t.children||t.type&&"object"==typeof t.type||t.props&&Object.keys(t.props).length>0?1:0):0}(s,t),a=t.computed(()=>{const t=n.type||"text";return["text","email","password","number","tel","url","search"].includes(t)}),u=t=>{r("update:modelValue",t)},h=t=>{r("blur",t)},c=t=>{r("focus",t)},d=t=>{r("keydown",t)},f=t=>{r("file-error",t)},p=()=>{r("clear-preview")},m=t=>{r("complete",t)};return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-container",{"input-container--full-width":n.fullWidth,[`input-container--${n.size||"md"}`]:1}])},[n.label?(t.openBlock(),t.createElementBlock("label",{key:0,for:o.value,tabindex:"-1",class:"input-label"},[t.createTextVNode(t.toDisplayString(n.label)+" ",1),n.required?(t.openBlock(),t.createElementBlock("span",Lp,"*")):t.createCommentVNode("",1)],8,Rp)):t.createCommentVNode("",1),t.createElementVNode("div",null,[a.value?(t.openBlock(),t.createBlock(Et,{key:0,"model-value":e.modelValue,type:e.type,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:n.required,min:n.min,max:n.max,step:n.step,autocomplete:n.autocomplete,spellcheck:n.spellcheck,"input-id":o.value,error:Boolean(n.error&&1!=n.error&&""!==n.error),size:n.size,tabindex:e.tabindex,"has-leading-icon":l("leading-icon"),"has-trailing-icon":l("trailing-icon"),"onUpdate:modelValue":u,onBlur:h,onFocus:c,onKeydown:d},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),m:3},8,["model-value","type","placeholder","disabled","readonly","required","min","max","step","autocomplete","spellcheck","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):"textarea"===e.type?(t.openBlock(),t.createBlock($t,{key:1,"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:n.required,rows:n.rows,cols:n.cols,maxlength:n.maxlength,autocomplete:n.autocomplete,spellcheck:n.spellcheck,resizable:n.resizable,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"has-leading-icon":l("leading-icon"),"has-trailing-icon":l("trailing-icon"),"onUpdate:modelValue":u,onBlur:h,onFocus:c,onKeydown:d},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),m:3},8,["model-value","placeholder","disabled","readonly","required","rows","cols","maxlength","autocomplete","spellcheck","resizable","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):"select"===e.type?(t.openBlock(),t.createBlock(Kt,{key:2,"model-value":e.modelValue,options:n.options,placeholder:e.placeholder,disabled:e.disabled,multiple:n.multiple,searchable:n.searchable,"allow-insert":n.allowInsert,"max-dropdown-height":n.maxDropdownHeight,"no-options-text":n.noOptionsText,"search-placeholder":n.searchPlaceholder,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"has-leading-icon":l("leading-icon"),"has-trailing-icon":l("trailing-icon"),"onUpdate:modelValue":u,onBlur:h,onFocus:c},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),m:3},8,["model-value","options","placeholder","disabled","multiple","searchable","allow-insert","max-dropdown-height","no-options-text","search-placeholder","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):"file"===e.type?(t.openBlock(),t.createBlock(de,{key:3,"model-value":e.modelValue,accept:n.accept,multiple:n.multiple,"max-file-size":n.maxFileSize,"drag-drop-text":n.dragDropText,"selected-text":n.selectedText,preview:n.preview,disabled:e.disabled,required:n.required,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"has-leading-icon":l("leading-icon"),"has-trailing-icon":l("trailing-icon"),"onUpdate:modelValue":u,onFileError:f,onClearPreview:p,onBlur:h,onFocus:c},{"leading-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),"trailing-icon":t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),m:3},8,["model-value","accept","multiple","max-file-size","drag-drop-text","selected-text","preview","disabled","required","input-id","error","size","tabindex","has-leading-icon","has-trailing-icon"])):"date"===e.type?(t.openBlock(),t.createBlock(Fe,{key:4,"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:n.required,min:n.min,max:n.max,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"onUpdate:modelValue":u,onBlur:h,onFocus:c},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):"time"===e.type?(t.openBlock(),t.createBlock(Ke,{key:5,"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:n.required,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"onUpdate:modelValue":u,onBlur:h,onFocus:c},null,8,["model-value","placeholder","disabled","readonly","required","input-id","error","size","tabindex"])):"datetime"===e.type?(t.openBlock(),t.createBlock(Je,{key:6,"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:n.required,min:n.min,max:n.max,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"onUpdate:modelValue":u,onBlur:h,onFocus:c},null,8,["model-value","placeholder","disabled","readonly","required","min","max","input-id","error","size","tabindex"])):"richtext"===e.type?(t.openBlock(),t.createBlock(Sp,{key:7,"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,"input-id":o.value,error:n.error,"min-height":n.minHeight,"max-height":n.maxHeight,tabindex:e.tabindex,"onUpdate:modelValue":u,onBlur:h,onFocus:c},null,8,["model-value","placeholder","disabled","readonly","input-id","error","min-height","max-height","tabindex"])):"pincode"===e.type?(t.openBlock(),t.createBlock($p,{key:8,"model-value":e.modelValue,"max-length":n.maxLength||6,variant:n.variant||"numeric",divider:n.divider,disabled:e.disabled,readonly:e.readonly,"input-id":o.value,error:n.error,size:n.size,tabindex:e.tabindex,"onUpdate:modelValue":u,onBlur:h,onFocus:c,onComplete:m},t.createSlots({m:2},[l("leading-icon")?{name:"leading-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"leading-icon",{},void 0,1)]),key:"0"}:void 0,l("trailing-icon")?{name:"trailing-icon",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"trailing-icon",{},void 0,1)]),key:"1"}:void 0]),1032,["model-value","max-length","variant","divider","disabled","readonly","input-id","error","size","tabindex"])):t.createCommentVNode("",1)]),e.$slots.hint?(t.openBlock(),t.createElementBlock("div",Bp,[t.renderSlot(e.$slots,"hint",{},void 0,1)])):t.createCommentVNode("",1),n.error&&1!=n.error?(t.openBlock(),t.createElementBlock("p",Ip,t.toDisplayString("string"==typeof n.error?n.error:n.error?.message||String(n.error)),1)):n.helpText?(t.openBlock(),t.createElementBlock("p",Np,t.toDisplayString(n.helpText),1)):t.createCommentVNode("",1)],2))}}),[["__scopeId","data-v-02897bf2"]]),_p=["disabled","aria-disabled"],zp=["href","target","rel","aria-disabled"],Pp=e(t.defineComponent({u:"UiLink",props:{href:{},to:{},variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:0},external:{type:Boolean,default:0},color:{}},emits:["click"],setup(e,{emit:i}){const n=e,r=i,s=t.computed(()=>{if(n.href)return n.href;if(n.to){if("string"==typeof n.to)return n.to;if("object"==typeof n.to&&n.to)return"#route-object-not-supported"}return"#"});function o(){if("undefined"!=typeof window){const t=getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();if(t)return t}return"#EA00A8"}const l=()=>({primary:o(),success:"#059669",warning:"#d97706",danger:"#dc2626"}),a=t.computed(()=>{if(!n.color)return{};const t=l(),e=t[n.color]||t.primary,i=(t=>{const e=l();return`color-mix(in srgb, ${e[t]||e.primary} 85%, black 15%)`})(n.color),r={"--link-color":e,"--link-hover-color":i,color:e};return"underline"===n.variant?{...r,textDecorationColor:e}:r}),u=t=>{n.disabled||r("click",t)};return(e,i)=>e.to||e.href?(t.openBlock(),t.createElementBlock("a",{key:1,class:t.normalizeClass(["ui-link",[`ui-link-${e.variant}`,`ui-link-${e.size}`,{"ui-link-disabled":e.disabled},{"ui-link-custom-color":e.color}]]),style:t.normalizeStyle(a.value),href:s.value,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,"aria-disabled":e.disabled,onClick:u},[t.renderSlot(e.$slots,"default",{},void 0,1)],14,zp)):(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["ui-link",[`ui-link-${e.variant}`,`ui-link-${e.size}`,{"ui-link-disabled":e.disabled},{"ui-link-custom-color":e.color}]]),style:t.normalizeStyle(a.value),disabled:e.disabled,"aria-disabled":e.disabled,onClick:u},[t.renderSlot(e.$slots,"default",{},void 0,1)],14,_p))}}),[["__scopeId","data-v-3bf99110"]]),Hp={StrandsUiAlert:u,StrandsUiButton:R,StrandsUiCard:z,StrandsUiInput:Dp,StrandsUiLink:Pp,StrandsUiTabs:be,StrandsUiLoader:y},jp={install(t,e={}){const{prefix:i=""}=e;Object.entries(Hp).forEach(([e,n])=>{const r=i?`${i}${e}`:e;t.component(r,n)})}},Up=Object.freeze(Object.defineProperty({__proto__:null,StrandsUiAlert:u,StrandsUiButton:R,StrandsUiCard:z,StrandsUiInput:Dp,StrandsUiLink:Pp,StrandsUiLoader:y,StrandsUiTabs:be,default:jp},Symbol.toStringTag,{value:"Module"}));exports.ChevronDown=X,exports.Minus=ft,exports.StrandsUIPlugin=jp,exports.StrandsUIPlugin$1=Up,exports.StrandsUiAlert=u,exports.StrandsUiButton=R,exports.StrandsUiCard=z,exports.StrandsUiInput=Dp,exports.StrandsUiLink=Pp,exports.StrandsUiLoader=y,exports.StrandsUiTabs=be,exports.UiButtonContent=x,exports.UiDivider=ve,exports.UiTooltip=O,exports._export_sfc=e,exports._sfc_main=S,exports._sfc_main$1=T,exports._sfc_main$2=E,exports.createLucideIcon=F,exports.useFloatingPosition=Rt;
|